Chapter 6

All That Work for one Line?

We shouldn’t complain too loudly. It works, and no one said creating graphics was easy.

Our current “universal” program can only handle one line of DATA, and it’s becoming increasingly apparent that HI-RES graphics requires lots of lines of DATA. The following simple changes allow it to handle virtually unlimited amounts of DATA:

15 ONERR GOT0 900 (TRS-80 etc. use on ERROR GOTO)

130 PRINT : GOT0 20

Line 130 creates an infinite loop, sending execution back to the READ statement after printing each line.

Line 15 gives the program a smooth ENDing when the DATA is all READ. When there is no more DATA, an OUT-OF-DATA error message appears, and the program is cleanly ended, even resetting the printer line spacing back to its “power-up” default.

Let’s add 2 more lines of DATA to see how it works:

1 0 0 0

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

1 0 1 0

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

and RUN.

Figure 6-3

It sprouted flowers!

54