A: Appendix
A Complete Guide to the Atari Character Set
Orson Scott Card

Atari characters can be used to do many things besides speak English to the user. Nearly infinite strings can hold fully relocatable machine language programs in character form, the most economical way of storing machine language in BASIC programs. Characters can be POKEd directly into screen memory. Programs can read the keyboard directly, by-passing the Atari's keyboard handling routines, so that you can effectively redefine almost every key and key combination. And editing functions, like CURSOR LEFT, DELETE, CLEAR, TAB, and even TAB SET and TAB CLEAR, can all be executed during a program simply by PRINTing them, either as part of a string or as a CHR$(n) function.

The trouble is, to do all these things requires using several different codes. And the different codes have all been kept in different lists—often in different books—and as often as not you've had to translate hexadecimal to decimal or multiply by 8 in order to get the value you wanted.

Until now. Here is a complete listing of the Atari character set, in ATASCII order, with every bit of information we could think of a use for. For each of 128 characters, you will find:

How to Use the Table

Each entry begins with a printout showing the pattern of on-off bits in the character pattern. Beside each row is the value, in decimal, of the byte that produces that row's on-off pattern. On bits are 1, off bits are 0. The operating system creates inverse characters from the same patterns, except that 0 is interpreted as on and 1 is interpreted as off.

ATASCII VALUE

The first line gives the ATASCII code in decimal and hexadecimal ($) and the value of the inverse character. If the character is also and editing command, the effect of PRINTing the character is given in the third column of the first line.

Machine Language

The second line gives the 6502 machine language instruction represented by the ATASCII value of the character, followed by the instruction represented by the ATASCII value of the inverse character. If the inverse character is also an editing command, the effect of PRINTing the inverse character is given in the third column of the second line.

The following conventions are used with the machine language mnemonics:

# = immediate addressing
z = absolute zero page addressing
abs = absolute 2-byte addressing
(ind) = indirect addressing
,X or ,Y = indexed addressing A = accumulator

Remember that the machine language mnemonic represents the ATASCII value of the character, not the ICODE (internal code) value. This information is provided so you can decode machine language routines contained in strings, like:

C=USR(ADR("string"))

Also, keep in mind that after almost every instruction comes a 1- or 2-byte argument. Any instruction that uses absolute addressing will be followed by a 2-byte argument; instructions that use indirect, zero page, and immediate addressing, as well as branch instructions, will use 1-byte arguments; and instructions with implied addressing (DEY, INX, RTS, NOP, BRK, etc.) will have no argument following them.

ICODE values

The third line gives the ICODE (internal code) value of the character. This is the number that must be POKEd into screen memory to display the character on the screen; the number also represents the order of the character within character set memory. The ICODE value is given in decimal and hexadecimal, followed by the ICODE value of the inverse character in decimal and hexadecimal. Last comes the offset of the character in the character set—the number of bytes to count into character set memory to find the top line of that character's pattern.

(Occasionally the keyboard code is also called an internal code, but for clarity we will use the ICODE only for the number representing the character's order in character set memory, which is also the number POKEd into screen memory.)

KEYCODE Values

The fourth line gives the KEYCODE (keyboard code) value of the character—the number that is stored in location 764 when you press the key combination that produces the character. The number is given in decimal and hexadecimal, followed by the decimal and hexadecimal unshifted KEYCODE—the code for the individual key, regardless of whether SHIFT or CONTROL are pressed. Last comes the key combination required to produce the character. If the character is also an editing command, (ESC) will come first to remind you to PRINT or type the ESC character first or PRINTing the character will execute its editing function.

Indexes

To help you use this table, it is followed by several indexes:

ICODE index. Look up characters by their internal code number.
Machine language index. Look up characters by the machine language mnemonic (in alphabetical order).
KEYCODE index. Look up characters by their keyboard code number.
Screen Editing Characters

The screen editing characters are paired, with the second character in each pair PRINTed as the inverse of the first character. To be PRINTed—PRINT CHR$(nnn)—each character must be prededed by the ESC character—PRINT CHR$(27);CHR$(nnn). The only exception is CHR$(155), the RETURN character. If you could PRINT it, it would be the inverse ESCAPE character, which is what appears when you poke the ICODE equivalent, 219, into screen memory. However, used with PRINT, CHR$(155) will always cause the Operating System to execute a carriage return and line feed. There is no way to defeat this without altering the OS.

Normal   Inverse
27
ESC
155
RETURN
28
CURSOR UP
156
DELETE LINE
29
CURSOR DOWN
157
INSERT LINE
30
CURSOR LEFT
158
TAB CLEAR
31
CURSOR RIGHT
159
TAB SET
125
CLEAR
253
BUZZER [CONTROL-2]
126
DELETE BACK
254
DELETE AHEAD
127
TAB
255
INSERT CHARACTER



Tables:

Return to Table of Contents | Previous Section | Next Section