Graphics Printer Trick

Author(s): Dick Wagner
Publication: Update Magazine
Pub Details: Update October 1988
Date: October 1988
Pages: 26

Readers who have tried any extensive printer graphics programming (not a screen dump) probably got discouraged with the amount of data required to key in. Consider that a printed figure covering 1″x1″ requires 60 head pin definitions per line and 9 lines are required, making 540 definitions. Remember that a space also must be defined.

Often there are repetative groups of code numbers of the same values. The following procedure will print those duplicate codes–in the DATA statement use negative numbers that denote the number of repeats and the next number is the code to be repeated. Then program the READ command to send negative numbers to a loop that prints the required number of duplicate codes, then returns to the next DATA number.

An example will illustrate this. Let’s make a 1 pin line with up-turned ends 8 pins high, total length of 60 dots.

10 LPRINT
20 LET A$=CHR$ 27+"K"+CHR$ 60+CHR$ 0
30 LPRINT A$;
40 FOR X=1 TO 60
50 READ N: IF N<0 THEN GO TO 100
60 LPRINT CHR$ N;
70 NEXT X
90 DATA 255,-58,1,255
100 READ R: FOR J=1 TO -N
110 LPRINT CHR$ R;: NEXT J
120 LET X=X-N-1: GO TO 70

The reader must adapt this to the printer driver program being used and the printer code for standard density 60 dots per inch or similar. For Oliger systems do not use A$ as OUT 127,n must be used for LPRINT CHR$ n (delete line 30).

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.