Table of Contents Previous topic Next topic
CROSS ASSEMBLER->Assembler Macros->Dummy Labels
If you include an ordinary label in the macro definition then, except where it is being defined using the SET directive, it will only be possible to call that macro once. A second call will generate a duplicate label error. Dummy labels overcome this problem. Dummy labels are \.0 to \.9 and \.A to \.Z (or \.a to \.z since the dummy labels are case insensitive). These symbols are used within the macro definition in place of ordinary labels, and when the macro is expanded the assembler replaces them with labels .00000, .00001, .00002 etc. Unique labels are therefore generated each time the macro is called.
The following example illustrates the use of dummy labels.
Firstly the source code listing: NAM MACXAMPL TTL *** Dummy Labels *** LIST SYM MEX ORG 6000H
* This is the macro definition:macxampl MACR LDA\0 $60 LDA\1 $52\.0 A\1\0 BNE \.0 ENDM* This is the macro call: macxampl A,B
And now the listing generated during assembly: 1 NAM MACXAMPL 2 TTL *** Dummy Labels *** 3 LIST 4 SYM 5 MEX 6 6000 ORG 6000H 7 8 * This is the macro definition: 9 10 macxampl MACR 11 LDA\0 $60 12 LDA\1 $52 13 \.0 A\1\0 14 BNE \.0 15 ENDM 16 17 * This is the macro call: 18 19 macxampl A,B 6000 96 60 LDAA $60 6002 D6 52 LDAB $52 6004 1B .00000 ABA 6005 26 FD BNE .00000 20 21Assembly completeBytes filed: 70 errors0 warnings