Advanced Graphics

Rowdy Characters

Add the following lines:

1 0 7 0 D A T A 4 4 , - 1 2 , 8 , - 3 2 , 1 2 7

1 0 8 0 D A T A 3 9 , - 1 7 , 0 , 6 4 , 9 6 , 1 1 2 , 1 2 0 , 1 2 4 , - 1 2 , 1 2 7 , 1 2 4 , 1 2 0 , 1 1 2 , 9 6 , 6 4

and RUN.

Figure 6-4

Oops! There’s trouble in River City. Fortunately, we’ve seen these same control code problems before. Hate to keep bringing this subject up, but it does disturb our use of the printer.

We’ve seen codes 9 and 13 cause trouble on the Apple, and codes 0, 10, 11, and

12cause trouble on the TRS-80. If we send them to the printer via CHR$, it interprets them as control codes instead of pin firing instructions. Unfortunate- ly, that makes sense.

Code 8 can also cause trouble since it means “delete the previous character sent to the printer and stored in its print buffer. ” In line 1070 we tried to send a whole sequence of them, and on some computers the program blew up!

For Experts Only

The errors caused by these codes do not always occur, but it is best to avoid them if possible. Short of rewriting the program to circumvent these numbers, one way is to bypass the PRINT statement and POKE our graphic codes directly to the printer driver in the computer’s memory. That memory address is 49296 (CO90 Hex) in the Apple, and 14312 (37E8 Hex) in the TRS-80 Model I (See appendices for examples of use). Other computer users can check their computer’s technical manual for its printer driver memory address.

The advantage of POKE over PRINT CHR$ in this specific situation is that it bypasses some of the nasty tricks we keep encountering with BASIC. The disadvantage is that indiscriminate POKEing can cause unbelievable software crashes. Unless you really understand POKES, best to live with the limitations inherent with your computer/printer combination, and avoid troublesome codes when possible. Model I users will need to use the POKES shown for this particular example.

55