Referring to table 12-1, if you want to print the word
Navy, you would send the decimal codes 78, 97, 118,
and 121 to the printer.
An 8-bit code can represent decimal values from O
through 255 making it possible to represent 256
different codes with one character set. ASCII only
defines the first 128 codes. The other 128 codes are
used by software developers and printer manufacturers
for additional characters. The additional characters are
called the alternate character set.
Alternate Character Sets
With the development of printers capable of
printing graphics and nonstandard characters, the
second half of the ASCII character set (128 through
255) became available to define additional special
characters and features.
programmers found that having only one character set
severely limited the capabilities of graphic capable
printers, additional character sets were developed.
Today, it is not unusual to find programs with eight or
more complete character sets. These additional
character sets may contain math symbols, foreign
alphabets such as Greek, Russian, or Japanese, and
other special symbols.
To print the characters in an additional character set,
you must have a graphics-capable printer and the
program must specify the character set as well as the
character code. Therefore, the characters printed are a
combination of hardware and software capability. To
make all this work together, software programmers
must write a routine called a printer driver that
performs several functions. A printer driver is written
for each printer the software will support. The driver
tells the software what the capabilities of the printer
being used are and tells the printer how to print each
character in the character set or sets.
To make a printer print, the computer must have a
method to control the printer. Printer control is
accomplished with control codes. The original ASCII
code contains 32 control codes. However, additional
codes are needed to control the special features in
modern printers. Most printers use a combination of the
ASCII control codes and escape codes to enable and
disable printer functions.
Table 12-2.Selected ASCII Control Codes
ASCII Control Codes
Table 12-2 shows examples of the ASCII control
codes. Some of them you will recognize, such as
carriage return and line feed.
When printing, if the printer reaches the end of a
line, the software must send a carriage return and a
line-feed code. Without the line-feed code, the printer
would overstrike the data just printed. The start-of-text
tells the printer that all the codes following are data
codes to be printed. Some printers have a selectable
option that will automatically generate a line feed for
every carriage return.
Escape Control Codes
The technology of printers has grown so that the
original ASCII control codes can no longer support all
the capabilities of most modem printers. Escape
control codes are used to enhance printer operations
beyond the limitations of the ASCII codes. Escape
refers to the ASCII code 027, or the code generated by
the ESCAPE key of the keyboard. Escape control
codes can be used to change the style of print, the size
of the print, whether the print is bold, and various other
features of the printer. Escape codes are not standard
and are defined by the printer manufacturer.