FOR <label>=<num> TO <num>
ENDFOR
None
The FOR directive is an inline macro because it can generate multiple lines of assembly code from only one line of input code.
FOR takes an absolute expression and assembles the portion of code following it, the number of times represented by the expression. The FOR expression may be either a constant or a label previously defined using EQU or SET.
The following listing is an example of using FOR to create a 5-repetition loop.
FOR label=2 TO 6 DC.B label*7 ENDFOR
Abs. Rel. Loc Obj. code Source line ---- ---- ------ --------- ----------- 1 1 FOR label=2 TO 6 2 2 DC.B label*7 3 3 ENDFOR 4 2 000000 0E DC.B label*7 5 3 ENDFOR 6 2 000001 15 DC.B label*7 7 3 ENDFOR 8 2 000002 1C DC.B label*7 9 3 ENDFOR 10 2 000003 23 DC.B label*7 11 3 ENDFOR 12 2 000004 2A DC.B label*7 13 3 ENDFOR
-Compat: Compatibility modes assembler option