In the programs that follow (except the first), we shorten the process of specifying pins by using the fact that their labels represent powers of two. (Refer back to Figure 10-3 to refresh your memory about the relationship of ordinal numbers to powers of two and the exponential labels for the pins.) We use the caret (^) to represent exponentiation; for example, 2^6 means raise two to the sixth power. Some computer systems use, instead of a caret, an up-arrow (t ), which prints as a left bracket ([) on the FX.

Straight line

Your first testing of the FX’s graphics potential will consist of firing the bottom graphics pin. Enter and RUN this program (be careful to include the semicolons):

NEW

10 LPRINT CHR$(27)"K"CHR$(100)CHR$(0);

20 FOR X=1 TO 100

30 LPRINT CHR$(l); 40, NEXT X

50 LPRINT

If your system won’t send CHR$(0), use CHR$(8).This program deserves a full discussion:Line 10 prepares the printer to accept 100 columns of graphics data.

Line 20 starts a loop for the LPRINT statement. Note that the loop must match the number of columns specified in line 10. The printer is expecting 100 bytes of data; it interprets everything it receives as graphics data until this quota is filled.

Line 30 sends a one to fire the bottom graphics pin. The semicolon at the end of the line is necessary to suppress the carriage return and line feed (ASCII 13 and 10), because otherwise they are sent automatically at the end of each LPRINT line. Without that semicolon, the printer would receive the sequence 1,13,10,1,13,10 . . . instead of l,l,l,l.

138