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.

asm: XBANZ within .loop

Hi

I am developing a high-performance assembly routine on the F28027 microcontroller and was wondering how to use branch statements within the .loop directive


.loop 5
<code>
 XBANZ skip, *--
<code>
skip:
<code> 
.endloop

Of course, this produces the assembly error "Symbol skip has already been defined". What is the correct way to achieve this behaviour? 

  • Hi og,

    You might try using assembly macro labels (append "?" after the label), though I don't know if they work outside of assembly macros. I can confirm that they work within macros.

     

    Regards, Mitja

  • Hi Mitja

    Thanks for your suggestion. Unfortunately the ? trick doesn't work outside of a macro. I've worked around the problem by moving the affected part of code into a macro. Although it fixes the problem it makes the code even more difficult to follow. Sounds like the ability to use ? inside a .loop construct would be a useful addition to the asm spec.

    Og

  • The C28x Assembly Language Tools book http://www-s.ti.com/sc/techlit/spru513 , in section 5.3.4, has an example of auto-generating a label within .loop.  It happens to all occur within a macro.  But I think that is incidental to this example, and not required.

    Thanks and regards,

    -George

     

  • Thanks for this George - this did indeed solve the problem, despite the section in question clearly stating that the forced substitution operator only works within macros.

    To summarise: To achieve the objective described by

    	.loop 5
    <code>
    BANZ skip, AR1--
    <code>
    skip:
    <code>
    .endloop

    I used the following:
    	.eval 5, N
    .loop
    <code>
    BANZ skip:N:, AR1--
    <code>
    skip:N:
    <code>
    .eval N+1, N
    .break N = 5
    .endloop