I
1. : :
89
n Download character definition command
You’ve read through a long explanation of download
characters and we haven’t even told you the command syntax
yet! Now the wait is over. This is the most complex command in
your printer repertoire and now you’ve got the necessary
knowledge to implement it. Here it is:
(ESC)“&“CHR$(O) nl n2 m0 ml m.2 m3 m4 m5 m6 m7 m8 m9
ml0 ml1
Like the other printer’s commands, it starts with an (ESC)
(CHR$(27)). The next character is an ampersand (&) (CHR$(38))
followed by a CHR$(O).
nl and n2 are used to specify the ASCII values of the
characters you are defining. The reason that there are two bytes
reserved for this is that your printer allows you to define many
characters with just a single command. nl is used to specify the
beginning of a range of characters to be defined; n2 specifies the
end of the range. For instance, if you wanted to change the ap-
pearance of the numerals from 0 to 9 (which have ASCII codes
48 through 57), the command would begin with (ESC) “&”
CHR$(O) CHR$(48) CHR$(57) . . . Of course, you can also define
individual characters by making nl and nZ equal.
m0 is called the attribute byte, for it describes two attributes
of the character we have designed: descender data and propor-
tional width information. A byte consists of eight bits. In the at-
tribute byte, the first (high order) bit is used for the descender
data, and the last seven bits are used for proportional widths.
We’ll be discussing proportional character widths in detail later
in this chapter; for now, we’ll leave it at 11. The descender data
was descussed earlier: to use the top eight pins, this bit should
be 1; to use the bottom eight pins this bit should be 0. Figure 6-
10 shows the bits of the attribute byte as we’ll use them for our
flask character. By now you’ve probably seen an easier way to
determine the value of the attribute byte. Instead of translating
everything to binary, merely assign the descender data a value
of 128 (the value of the first bit) if you don’t want descenders, or
0 if you want descenders. Then just add the descender data to
the proportional width. This way, it’s simply a matter of adding
two decimal numbers. (In our case, it’s 128 + 11 = 139.)