Epson GX-80 Operating Manual page 39

Table of Contents

Advertisement

68
10
74
13
128
64
32
16
8
4
2
1
13
I
27
10
49
10
Figure 8-7. Pin patterns of incorrect program
69
You may also wonder why the program prints not only the different
pin patterns but also the character "J" a number of times. The
reason lies in the number of columns you reserved with the graphics
command. After the GX-80 receives all the numbers reserved by a
graphics command-50 in this case-it leaves the graphics mode
and resumes interpreting numbers as printable characters or print
commands.
Since the incorrect program has sent many extra numbers, mainly
10s and 13s, the 50 columns reserved are filled before the loop in line
40 has been executed 50 times. Therefore, during the last passes of
the loop the GX-80 interprets CHR$(74) as the ASCII code for "J"
and prints that character each of the last 35 passes of the loop.
If you want to make the program work correctly, put the line-
spacing command in line 10, delete line 30 and add two semicolons:
one at the end of line 20 and one between CHR$(74) and the colon
in line 40.
Figure 8-7 is an enlarged representation of the first 14 columns of the
printout. In this figure you can see exactly how the printer reacted to
the first part of the incorrect program.
J
J
J
Actual result
Expected pattern
:::i.::::::::::::::::::::::::::::::::.:::::::;:::
Figure 8-6. Result of incorrect program
This program has all the necessary elements. Line 20 has the com-
mand for single-density graphics and specifies 50 columns. (Remem-
ber that you must use two numbers to reserve columns even if you
only need the first one.) Line 30 has the correct command for the
line spacing, and line 40 calls for the printing of a pin pattern 50
times. (If you wish, refer back to Figure 8-2 to see a representation
of the pin pattern that 74 produces.)
Although this program has all the necessary elements, it will not
give you the single pin pattern that you want, as you can see in the
partial printout in Figure 8-6.
What went wrong? To help you understand the graphics command
and avoid some of the more common errors made with it, let us
examine this program in detail.
First look at line 20. <ESC> K calls for single-density graphics, and
the two CHR$ numbers specify 50 columns of dots. Once that
command is given, the next 50 codes sent to the printer are inter-
preted as numbers corresponding to a pin pattern and printed on the
paper. Since there is no semicolon at the end of the line, the num-
bers 13 and 10-the codes for carriage return and line feed-are
sent to the printer after CHR$(0). Because the graphics command
has been issued, these codes are printed as pin patterns.
Line 30 would normally be the command for 7-dot line spacing, but
since the graphics mode has been put into effect, the command is
interpreted by the printer as two pin patterns: 27 and 49 (the ASCII
codes for <ESC> and 1). Since there is no semicolon at the end of
this line, the numbers 13 and 10 are sent again, and again they are
printed as pin patterns.
In line 40 nothing is sent to the printer until after the PRINT. Then
the desired pin pattern-74-is finally sent, but since no semicolon
is after it, 13 and 10 are sent next each time the loop is executed.

Advertisement

Table of Contents
loading

Table of Contents