23
n The escape codes
Back when the ASCII system was set up, computer equip-
ment was relatively simple and thirty-three control codes were
considered sufficient at the time. The American Standards peo-
ple realized that eventually more control codes would be need-
ed, so they included the escape (ESC) code to allow almost any
number of additional codes to be defined when they became
necessary.
ESC allows us to “escape” from the ordinary set of control
codes so we can specify additional functions and other informa-
tion needed for a printer function. In this manual, we’ll write the
ESC code inside broken brackets, like this - (ESC).
(ESC) - decimal 27 - is always followed by at least one
other number; it is never used alone. The whole series of related
numbers is called an escape sequence.
n A note on command syntax
Because the readers of this manual will be running such a
wide variety of applications on so many different computers, we
can’t show the exact way of sending codes to the printer for
each one of them. Instead, as we introduce you to each new com-
mand, we will show the commands as in this example:
(ESC) “W” 1
This command turns on expanded printing. (ESC), as we
mentioned earlier, is the escape code (which is ASCII code 27).
A letter or number in quotes (such as the “W” above) means that
the character should be sent to the printer, but without the
quotes. In our example, you should send a capital W following
the escape code. In BASIC, you could do this in a couple of
ways: by sending the character itself (e.g. LPRINT “W”;), or by
using the CHR$ function to send the ASCII code for the
character (e.g. LPRINT CHR$(87);).
Many of printer commands end with a 1 or 0. When shown as
in the above example (i.e., no quotes and no “CHR$“), you can
use either ASCII code 1 (i.e., CHR$(l)) or the character “1”
(which is ASCII code 49). The same principle applies to com-
mands ending with 0.