If you have made changes to a program and want to see all of it on the screen, type LIST and then press RETURN to see the program on your screen. When you are completely through with one program and want to start another, type NEW and press RETURN.

How to Send Control Codes to the Printer

The short program. that follows illustrates the concepts of control codes and ESCape sequences. This exercise may help you make better use of the next three chapters. Type and run the program. It should produce the printout you see below it. After the printout is a detailed description of the operation of the program.

10

LPRINT "BASIC programs for the"

20

LPRINT CHR$(70)CHR$(88)CHR$(45)CHR$(50)CHR$(56)CHR$(54)

30 LPRINT

CHR$(&H46)CHR$(&H58)CHR$(&H2D)CHR$(&H32)CHR$(&H38)CHR$(&H36)

40

LPRINT "Wl "CHR$(87)CHR$(49)

50 LPRINT CHR$(27)"Wl";"Double-width print"

60

LPRINT

"Still double-width"

BASIC programs for the

FX-286

F X - 2 8 6

W1 W1

D o u b l e - w i d t h p r i n t S t i l l d o u b l e - w i d t h

In each line LPRINT signals that the rest of the information on the line is to be sent to the printer. In line 10 the letters inside the quotation marks are printed just as they appear in the program.

Line 20 shows an alternate way of printing characters. It uses the CHR$ (character string) function with the decimal code for each letter. Line 30 uses the same method except that it uses hexadecimal numbers instead of decimal numbers. (The symbols &H before each number are required to signal that the numbers are hex, not decimal.)

Line 40 prints the characters W1 using the two different methods (quotation marks and the character string function). Line 50 shows that if the ESCape code, which is CHR$(27) in BASIC, comes before the characters W1, those characters are not printed. Instead, they

4-6