User's Manual

Graphics Width Settings
The required graphics width is C, the size of the array. If, however,
C is greater than
255,
the value n
2
, in the graphics entry string must
change from zero to one. With this in mind, add these three lines:
200 N1=C: N2=0
210 IF C>255 THEN N1=C-256: N2=1
220 LPRINT CHR$(27)"*"CHR$(5)CHR$(N1)CHR$(N2);
Introduced in Chapter 11, CHR$(27)” * “CHR$(5) is the one-to-one
graphics density setting. It ensures a printout image that is square.
If your computer system requires a WIDTH statement to prevent
the printer from issuing a carriage return before the graphics line is
complete, add it now:
7 WIDTH LPRINT 255
The format for this statement may be different for your BASIC; see
your software documentation.
Pattern Printout
Now that you’ve completed the groundwork, add the lines that
actually print the pattern.
230 FOR K=1 TO C
240
IF A(K)=1 THEN LPRINT CHR$(P);
250
IF A(K)<>1 THEN LPRINT CHR$(P0);
260 NEXT K
270 LPRINT
280 NEXT PASS
These lines, which are part of the loop for each pass, cause the pro-
gram to check each element of the array and then print either the
pattern P (if the element is a one) or the pattern PO (if the element is not
a one). Line 280 completes the PASS loop. After each pass is printed,
the program recalculates the values of P and PO in lines
170
and
190.
Check your listing against the listing of Figure 14-3 to make sure it’s
all there:
193