Epson GX-80 Operating Manual page 38

Table of Contents

Advertisement

-
-
_, _
1•
•1 II
•1
1•
8 10 8 8 8 8 8 8 4 2 1
0 0 0 0 0 0 0 0 0 23 4 1
0 0
4100000000000000000082000
Figure 8-5. First line of arrow figure
The numbers for the second and third lines were calculated in the
same manner. Once the numbers for the pin patterns are calculated,
they go in DATA statements, separated by commas.
First we'll give you the whole program and its printout; then we'll
explain two techniques we have not used before:
95 PRINT CHR$(4)"PR#1"
100 PRINT CHR$(27)"1";
110 FOR K=l TO 3
120 PRINT CHR$(27)"Y"CHR$(50)CHR$(0);
130 READ N: IF N=l28 THEN 180
140 IF N=>0 THEN PRINT CHR$(N);:GOTO 130
150 READ P,R: FOR J=l TO -N
160 PRINT CHR$(P)CHR$(R); :NEXT
J
170 GOTO 130
180 PRINT:NEXT K:PRINT CHR${27)"@"
185 PRINT CHR${4)"PR#0"
190 DATA 8,4,10,1,-6,8,0,4,0,2,0,1,-9,0,0,0
200 DATA 23,8,4,2,1,-2,0,0,0,128
210 DATA 0,0,0,0,64,32,17,10,4,0,-6,0,0,-10
220 DATA 64,0,0,0,0,64,32,17,10,4,128
230 DATA 2,4,10,16,34,64,-5,2,0,4,0,8,0,16
240 DATA 0,-9,32,0,61,2,4,8,16,32,64,0,0,0,128
' < \""· · · · · - ··-\
L ....... ---,/
66
In this program we used the number 128 in the DATA statements to
signal the end of a print line. This is the reason for the IF-THEN
statement in line 130 that skips to line 180 and causes a line feed .
The other special technique used in this program is found in lines
140 and 150. Since some of the data numbers are repeated many
times, negative DATA numbers have been used for repetitions, in
order to save typing. Line 140 tests for a negative number and, if it
finds one, reads the next two numbers and prints their pin patterns
the number of times indicated by the negative number.
For example, when the minus 6 in line 190 is read, the program then
reads the next two numbers (8 and 0) and sends them to the printer
six times. This feature is not a necessary part of the program, but it
does allow you to type fewer data numbers.
Otherwise, the program is a straightforward graphics program that
uses 7-dot line spacing and reads numbers from DATA statements
and sends them to the printer. If you want to see the figure in other
densities, change the "Y" in line 120 to "L" or "Z".
Graphics Programming Tips
Now that we've shown you how to design your own graphics, we'll
review and emphasize a few elements of graphics programming.
Semicolons and command placement
After the graphics command is issued, every number sent to the
GX-80 is interpreted as a pin pattern and printed on paper. There-
fore, you must be careful how you write graphics commands in your
program.
For example, suppose you want a 50-column graphics line with a
7-dot line spacing. You might enter the following program:
5 PRINT CHR$(4)"PR#l"
20 PRINT CHR$(27)"K"CHR$(50)CHR$(0)
30 PRINT CHR$(27)"1"
40 FOR G=l TO 50:PRINT CHR$(74):NEXT G
45 PRINT CHR$(4)"PR#0"
67

Advertisement

Table of Contents
loading

Table of Contents