ARM While directive - repeating labels

229 views Asked by At

If using the WHILE asm directive, intialised like:

    GBLA    w
    WHILE   w < 10
w   SETA    w+1
    ; code
    WEND

How can we have ;code be a repeated segment involving a label (say, we conditionally branch back to it in the segment)?

I have tried doing:

w.label    ;code
           ;code
           B{cond}    w.label

And also label.w.

I also tried forming a macro, with w passed in as a parameter, but it didn't want to join label to a numeric value in that way.

Does . only work for strings, and if so can I concatenate a string and a literal in some other way?

Or what other way can I include a label in a segment to be repeated w times?

1

There are 1 answers

0
Notlikethat On BEST ANSWER

This is one of the reasons local labels exist:

1:    ;code
      ;code
      B{cond}    1b    @ look (b)ackwards for the nearest "1:"

Since these always resolve to the last/next match seen, and don't generate symbols, they can be unambiguously duplicated as much as you like.