You will have a better understanding of how the (ESC) codes work when you use them in your programming. Appendix A lists all the ASCII codes and Appendix B summarizes their functions.

A BASIC example

Keep in mind that the ASCII codes and the ESCape sequences are mostly used with programming languages. One example is to use your printer to print listings of your programs.

Different computer systems access the printer in different ways. For example, most computers that use Microsoft BASIC send PRINT or LIST commands to the printer by adding a leading L to a screen com- mand: LPRINT, LLIST. Your computer may not use these commands. If you are not familiar with your computer’s command conventions, check its manual.

We use BASIC in the following programs since it is widely used in portable computers. If necessary, substitute the commands required by your computer.

Once you have discovered how your computer communicates with the printer using BASIC, enter the following program lines into your computer.

10 LPRINT CHR$(27);"-1";20 LPRINT "Underline"

Now list the lines on the printer using your computer’s version of the LLIST command. RUN the program, and you’ll get this:

Underline

With the underline mode, you can underline characters or blank spaces, which is useful when creating forms that have lines for signatures or data. See this for yourself by adding these lines to your pro- gram. Enter 10 blank spaces in line 30 and 15 blank spaces in line 40.

30 LPRINT

"

"

40 LPRINT

"

"

Run your program. The result is:

Underline

30