Chapter 2

There is a lot happening, so we’d better disect the program (like a frog) to learn all about it. Type

L I S T

(TRS-80 etc. use LLIST)

to LIST the program on paper.

Push the FEED button to roll the printout past the lid. Tear it off and keep it handy so we can study the program as we go along.

SAVE the program on tape (or disk) to avoid having to type it in later.

Line by Line

We’re going to type the last program back in, a line at a time, analyzing it as we go.

An alternate strategy is to load the entire program back in from disk or tape, then delete all the lines except the ones being studied. A second alternative is to leave the program in, inserting a REM before each line, removing the REMs as we progress. A third alternative is to leave the program intact and temporarily insert an END at Line 15, shifting it down the program as we progress.

Take your pick!

Line 10 is straightforward. It PRINTed, the “greetings,” starting 14 spaces from the left. Type it in and RUN, watching the head action as it prints.

G R E E T I N G S F R O M T H E G R A P H I C

Figure 2-3

Well, that was rather “pedestrian.”

Line 20 has 3 PRINT statements on the same line. They are separated by semicolons, which are usually optional. The first PRINT statement TABS the print head over 22 spaces, the second sends one of those special CHR$ (character string) codes we mentioned earlier, and the third prints “MX-70.”

CHR$ (14) stands for: print DOUBLE WIDTH.

Appendix B contains all the special codes, often called CONTROL CODES.

18