Translating the ASCII code

You may also find that different manuals and programs use different terms for the same characters or functions. For example, your computer manual may say to send the decimal 10 for a line feed, while your spreadsheet program recommends a <CR> or CTRL-J for the same thing.

Appendix B contains a conversion chart for all the common names of the ASCII codes, and shows the relationship between the different forms of notation. In addition, Appendix A gives a description of all the control codes and ESCape sequences used on the SQ-2000.

How to send control codes to printer

The short program that follows illustrates the concepts of control codes and ESCape sequences. It is written in Microsoft BASIC, but it can be adapted to other forms of BASIC or other programming languages. If you have specific questions about how BASIC works, consult the program’s documentation. How to overcome problems specific to your computer is covered in Chapter 8.

1.Make sure that you’re in BASIC; then type the following line just as it appears here. (Don’t forget to include all semicolons, even the ones at the end of the lines.)

10 LPRINT "NORMAL PRINTING" CHR$(lO) CHR$(13);

2.Now press RETURN, type RUN, and press RETURN again. The SQ-2000 prints:

NORMAL PRINTING

This line begins with a line number, 10, then the command LPRINT. Anything that is enclosed in quotation marks after the LPRINT command is sent to the printer.

If you check the ASCII chart in Appendix B, you’ll find that CHR$(lO) is the control code for a line feed, so when the printer receives this, it moves the paper up one line.

CHR$(13), according to the ASCII chart, is the code for carriage return, so the print head returns to the left margin and awaits the next command.

33