would enter LPRINT CHR$(65). To make the printer’s bell
sound, we would LPRINT CHR$(7). In general, we print a
character by entering LPRINT CHR$(ASCII code) to the
printer.
We can also use hex ASCII codes. Although we use only
decimal ASCII codes in this manual, you should understand at
least what a hex code is. “Hex” is short for hexadecimal and
refers to a base-16 number (the numbers we use in everyday life
are base 10). Since the hex system needs 16 digits, it uses the
numerals 0 through 9 and also the letters A through F. You can
always tell that a number is in hexadecimal by the “&H” im-
mediately preceding it. The ASCII code for the letter “A” (65 in
decimal) is &H41 in hex.
n Control codes
ASCII codes with values of 32 or less do not have their own
keys. These codes control many of the printer’s functions, so we
call them control codes. To enter a control code from the
keyboard, we have to press two keys at the same time - the
“control” key and one other. The other key determines what
code is sent - pressing the control (CTRL) key and A sends
ASCII code 1, CTRL B sends ASCII code 2, and so on.
Your printer has a lot of control codes to let you do some real-
ly nifty things. Let’s try one that we’ve mentioned several times
already:
10 1 Demo of ASCII code
20 LPRINT CHR$(7)
30 END
RUN
That’s the printer’s bell (we call it that even though it sounds
like a buzzer). We’ll learn more about it in later (we just wanted
to show you a control code that would get your attention right
away).
There are four common ways of referring to a control code:
the name of the code or its abbreviation, the decimal ASCII
value, the hexadecimal ASCII value, and the “CTRL-” value.
For example, the ASCII code that causes the printer to advance
the paper one line is decimal 10. This code may be referred to
by any of the following.