0% found this document useful (0 votes)
59 views1 page

Putcsave Putcloop: Problems With The First Version of PUTC

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.

Uploaded by

Mohamed Med
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views1 page

Putcsave Putcloop: Problems With The First Version of PUTC

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.

Uploaded by

Mohamed Med
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Problems with the First Version of PUTC

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.

You might also like