99
for the macro: one to define it, and one to use it. They are
given in the Table 6-9.
Table 6-9
Macro instruction commands
Function Control code
Define macro <EfjCi “+” . . . (codes you include)
. . .
CHR$(30)
Use macro < ESC > “ + CHR$(l)
To see how this works we can build a macro that will reset
the printing style to normal, no matter what style it may be
to start with. The following program will define a macro to
do this.
10 LPRINT CHR$ (27) ; ‘It”; ‘Start macro
20 LPRINT CHR$(27);“h”;CHR$(O); ‘Big character off
30 LPRINT CHRs(27) ;“!“;CHR$(
40 LPRINT CHR$ ( 27) ; “T” ;
off
50 LPRINT CHR$(27) ;“a”;CHR$(
printing
60 LPRINT CHR$(30)
definition
0) ; ‘Select normal pica
‘Super & subscripts
0) ; ‘Left-aligned
‘End macro
As the comments in the program show, we started to define
the macro in line 10. Line 20 cancels big character printing.
Line 30 sets normal pica, and this command also cancels
proportional pitch, condensed print, expanded print, boldface,
emphasized, italics, and underlining. Line 40 cancels super-
scripts and subscripts. Line 50 sets left-aligned printing. Then,
line 60 ends the macro definition. This printer will remember
this macro until the power is turned off or until a new macro
is defined. A macro can hold up to 16 bytes (characters) of
information. The one that we defined contains eleven.
Now that you have defined a macro, let’s see how to use it.
This program will print one line using several printing features.
Then it “calls” the macro in line 60. When line 70 prints the
style is “plain vanilla” because the macro has reset it.