This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Branch statements,labels in the macro( assembly language) , not working properly

Other Parts Discussed in Thread: CONTROLSUITE

Hello all,

I introduced branch statement in macro, by giving some labels, but it is not working as desired.

Pls refer below code:

ABC  .macro n

...... initial instructions

MOVL ACC,*XAR6

CMPL ACC,*XAR1

B        SKIP_LOOP,LT

/*

Code to implement when ACC>*XAR1

*/

SKIP_LOOP:

/*

Code to implement when ACC<*XAR1

*/

.endm

But, when the condition is like ACC >*XAR1

the corresponding code should get executed and Label mentioned in branch should not be executed in short skipped.

Any help regarding this would be appreciated

Regards,

Tanmayee

  • Hi Tanmayee,

    I'd recommend referring to some of the digital power assembly macros inside controlSUITE.  They should provide you some guidance.
    \controlSUITE\libs\app_libs\digital_power\f2803x_v3.3\asm\
    (the projects that run these macros are here:   \controlSUITE\development_kits\)

    It's been a little bit since I've worked with assembly and this chip, but I do remember a few things which may be useful.  The compiler/IDE is somewhat picky when it comes to tabs/Spacing.  For example, I believe label names must put at the very beginning of a new line.  This may be something worth looking at. 

    Also, if you're not already, you should be single-stepping through the assembly and looking at the CPU registers within CCS to make sure that everything that you expecting to happen, is in fact happening. For example, before the branch you should be able to take a look at the flag register to see if the comparison that was done gave the answer you expect.  Looking at the dis-assembly can also be useful.

    Hopefully this helps.


    Thank you,
    Brett

  • Tanmayee,

    Your assmbly code seems alright.
    When ACC >*XAR1, your code should execute the portion of the code labellled
    Code to implement when ACC>*XAR1
    If you want to skip the code from lable SKIP_LOOP, you need to have another brannch before the SKIP_LOOP lable to jump the execution to the place you desire.
    If not, code will continue to execute linearly...

    -Bharathi.

  • Thanks Brett & Bharathi.. for your replies,

    I am new to assembly codes, that's why I struggled so much :)
    Yeah actually I went through different assembly codes, realized I am not branching unconditionally when my ACC>*XAR1 to skip the other SKIP_LOOP label.

    Regards,
    Tanmayee