Chapter 5

TRS-80 Model I:

10 LPRINT CHR$ (27) "K" CHR$ (50) CHR$ (2);

and RUN.

Figure 5-2

Press CTRL-C or BREAK to stop. Very impressive.

Note that we are not printing the slash character (ASCII number 47); but are positioning the dots one at a time. Line 50 of the “welcome program” should now make sense. We see that to fire a single pin, we must send a power of 2 down the line to the printer. Line 50 of the “welcome program” does just that.

5 0 P R I N T C H R $ ( 2 ^ I N T ( 3 . 4 * S I N ( I ) + l ) ) ) ;

The entire expression to the right of the exponent sign chooses an appropriate exponent for 2. The exponents determine which pin is fired, giving us a nice sinusoidal curve. Math types love it.

Who Sez We Ain’t Got No Class?

Let’s put the printer through some “aerobic exercises” with this NEW program:

9 PR #1(Apple)

10 PRINT CHR$ (27) "A" CHR$ (7)

20FOR R=l TO 3

30PRINT TAB (10);

40PRINT CHR$ (27) "K" CHR$ (14) CHR$ (0);

50FOR N=l TO 14

60READ D : PRINT CHR$ (D);

70NEXT N : PRINT : NEXT R

80 PRINT CHR$(27) "2"

99 PR #0

(Apple)

46