These codes can be sent directly to the printer by POKEing them to
a special memory location where they are immediately forwarded to
the printer. The format is:
POKE 14312, N
where N is the decimal value of the code you wish to send to the
printer. This works fine as long as the printer is ready to receive the
data when you are ready to send it. On the Model I, the printer’s
readiness is assured if location
14312
contains a decimal
63.
It is best to first test to see if the printer is ready with:
100 IF PEEK(14312)<>63 THEN 100
This puts the program into a continuous loop until the printer is ready
to receive data. If data is sent while the printer is “out to lunch,” it will
be lost.
To show how similar these commands can be from system to sys-
tem, here is the same concept implemented on the Apple II Plus:
100 IF PEEK(49601)>127 THEN 100
200 POKE 49296,N
The printer’s status is stored in location
49601
and the outgoing values
are sent to
49296.
Special printer drivers
An even better (but more difficult) way to overcome these problems
is to modify the printer driver so that the codes are passed correctly to
the printer without any PEEK
S
or POKE
S
. If you do not want to write
such a driver yourself, your computer dealer may be able to help you.
Or you may find aid in the pages of a trade journal.
The following printer driver, for instance, was written for the
TRS-80 Model I by Bob Boothe and reprinted with the kind permis-
sion of
80
Micro (Wayne Green Publishers). The program POKE
S
a
machine-language printer driver program (stored in line
10)
into
memory, then tells the system where its new driver is located. Once
you RUN the program, all codes sent by any BASIC program are sent
directly to the printer-including
0
S
, 10s,
and
12s.
10 DATA 2lE837CB7E20FC211100397E32E837C9
20 READ B$: A=16571
30 FOR P=1 TO LEN (B$) STEP 2
40 B=ASC(MID$(B$,P,l)) - 48
308