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

GCNT SET 0: Revised PUTC Using SET Variables

This document proposes revising the PUTC macro to use set variables, which would initialize a global counter to 0 and increment it each time the macro is called. This allows the macro to store each character in a unique memory location labeled SAVE followed by the counter value, then loop and output the character to the specified device before incrementing the counter and storing the next character.

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)
57 views1 page

GCNT SET 0: Revised PUTC Using SET Variables

This document proposes revising the PUTC macro to use set variables, which would initialize a global counter to 0 and increment it each time the macro is called. This allows the macro to store each character in a unique memory location labeled SAVE followed by the counter value, then loop and output the character to the specified device before incrementing the counter and storing the next character.

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

Revised PUTC using SET Variables

If we revisit the PUTC macro taking advantage of set variables,


an "improved" construction might be:

&GCNT SET 0 (global SET)


MACRO
&INIT PUTC &CHAR, &DEV
&GCNT SET &GCNT + 1
&INIT STA SAVE&GCNT
LDCH &CHAR
J LOOP&GCNT
SAVE&GCNT RESW 1
LOOP&GCNT TD &DEV
JEQ LOOP&GCNT
WD &DEV
LDA SAVE&GCNT
MEND

The global SET takes place as the macro definitions are read,
initializing the set variable to 0. It is subsequently incremented by
the internal SET statement each time the PUTC macro is
expanded.

You might also like