The first version of the PUTC macro definition could only be used once in an assembly language program as it would generate duplicate labels if used again, causing an assembler error. To fix this, system variables were introduced, including set variables that can be assigned values using SET, and system qualifiers prefixed with $ that automatically increment each macro expansion, avoiding duplicate labels.
The first version of the PUTC macro definition could only be used once in an assembly language program as it would generate duplicate labels if used again, causing an assembler error. To fix this, system variables were introduced, including set variables that can be assigned values using SET, and system qualifiers prefixed with $ that automatically increment each macro expansion, avoiding duplicate labels.
The first version of the PUTC macro definition could only be used once in an assembly language program as it would generate duplicate labels if used again, causing an assembler error. To fix this, system variables were introduced, including set variables that can be assigned values using SET, and system qualifiers prefixed with $ that automatically increment each macro expansion, avoiding duplicate labels.
The first version of the PUTC macro definition could only be used once in an assembly language program as it would generate duplicate labels if used again, causing an assembler error. To fix this, system variables were introduced, including set variables that can be assigned values using SET, and system qualifiers prefixed with $ that automatically increment each macro expansion, avoiding duplicate labels.
The PUTC macro definition given as a first example has a severe
flaw in that it can only be used once in any given assembly language program. If it was used a second time, the labels PUTCSAVE and PUTCLOOP would get generated again in the expansion of PUTC in its second location, which in turn would cause a "duplicate label" error when the expanded code is passed on to the assembler.
System Variables
To correct for this problem, two additional types of macro "system
variables" are provided to go with the & prefixed variable names of the prototype statement:
1. Set Variables - & prefixed variables that can be "set" by
the SET directive (with limited arithmetic capability); e.g. &GCNT.
2. System Qualifiers - $ prefixed symbols with a value that
is automatically adjusted to a new value each time a macro expansion (not necessarily the same macro) occurs; e.g., $LOOP. $ is expanded to $AA for the 1st macro expansion, $AB for the 2nd and so forth.