66
SETTING LEFT AND RIGHT MARGINS
The left and right margins of this printer work just like a typewriter – once they are set all printing is done between them. You can set margins either by using the keys on the con- trol panel, as described in Chapter 3, or by escape commands. The commands to set the margins are given in the following table:
Table
Left and right margin commands
Function | IControl code | I |
| J |
Setleftmarginatcolumnn (ESC)“l”CHR$(n) Setrightmarginatcolumnn (ESC)“Q”CHR$(n) Setleftmarginatcolumnnl and ~Esc)‘<x,,cHR$(nl)cHR$(n2) rightmarginatcolumnn2
Try setting the margins with this program:
10‘ Demo of margins
20 GOSUB 70
30 LPRINT CHR$(27);“1“;CHR$(1O)
40 LPRINT CHR$(27);“Q”;CHR$(70);
50 GOSUB 70
60 END
70FOR 1=1 TO 80
80 LPRINT “X”;
90 NEXT I
100LPRINT
110RETURN
The first thing that this program does is to branch to the subroutine that starts in line 70. This subroutine prints 80 X’s in a row. The first time that the subroutine is used, all the X’s fit in one line. Then line 30 sets the left margin to 10, and line 40 sets the right margin to 70. Once again the subroutine is used, but this time the X’s won’t all fit on one line since there is now only room for 60 characters between the margins.
Run the program. The results will look like this:
xxxx xx x Xxxxx xx xx Xxxxx x xx xxx x Xxxxxxxxxx Xxxxxxxxx xx Xxxxxxx Kxx x Xxxxx x xx Xx.xxxxxxxx xx
Xxxxxxxxx xxxxxxxx xxxxxxxxxxxxxx Xxxxxxxxxx xxxxxxx xxxxxxxxxxxx Xxxxxxxx xxxxxxxxxxxx