Appendix F
Tricky CodesMost Apple users will encounter difficulty when using codes 9 and 13 in ESCAPE sequences and the graphics mode. To corral these and other rowdy codes, we can POKE the ASCII code numbers directly to the printer driver. Use:
POKE 49296,9
in place of
PRINT CHRS(9)
Unfortunately, using the POKE statement instead of PRINT creates timing problems between the printer and computer. To avoid such complications, the POKE should always be followed by a test of the printer to see if it is ready for more DATA. On the Apple, this is done with a PEEK statement. Example:
10 PR#l
20 POKE 49296,9
30 IF PEEK (49601) <O GOT0 30
40PR#O
If the value stored at location 49601 (ClCl Hex) is negative, the printer has not yet picked up the DATA and stored it in its buffer. If location 49601 is positive, the printer is ready to receive more DATA. By using this test we outflank the funny code numbers like 9 and 13.
Screen Width Versus Printer WidthThe Apple video screen display is limited to 40 characters per row. Unfortu- nately, it restricts the printer line width to the same 40 characters during BASIC program listings unless we take evasive action. Fortunately, the solution is simple.
If we send this code sequence down the line:
(Don’t do it yet - wait for below) <CTRL I> 80 N
the printer line width becomes the full 80 columns used by standard printer paper. The “80” can be any number from 40 to 255 as far as the Apple is concerned. The
92