.png)
Every character the Einstein prints has a number, and LD A,<number> followed
by a print call puts it on screen. This is the full list of the codes you can
display.
You can write either form in your source. LD A,'H' and LD A,72 produce
exactly the same program, so use whichever reads better - the letter when you
are naming a character, the number when you are calculating one.
Capitals:
| Char | Dec | Hex | Char | Dec | Hex |
|---|---|---|---|---|---|
A |
65 | 41h | N |
78 | 4Eh |
B |
66 | 42h | O |
79 | 4Fh |
C |
67 | 43h | P |
80 | 50h |
D |
68 | 44h | Q |
81 | 51h |
E |
69 | 45h | R |
82 | 52h |
F |
70 | 46h | S |
83 | 53h |
G |
71 | 47h | T |
84 | 54h |
H |
72 | 48h | U |
85 | 55h |
I |
73 | 49h | V |
86 | 56h |
J |
74 | 4Ah | W |
87 | 57h |
K |
75 | 4Bh | X |
88 | 58h |
L |
76 | 4Ch | Y |
89 | 59h |
M |
77 | 4Dh | Z |
90 | 5Ah |
Lower case:
| Char | Dec | Hex | Char | Dec | Hex |
|---|---|---|---|---|---|
a |
97 | 61h | n |
110 | 6Eh |
b |
98 | 62h | o |
111 | 6Fh |
c |
99 | 63h | p |
112 | 70h |
d |
100 | 64h | q |
113 | 71h |
e |
101 | 65h | r |
114 | 72h |
f |
102 | 66h | s |
115 | 73h |
g |
103 | 67h | t |
116 | 74h |
h |
104 | 68h | u |
117 | 75h |
i |
105 | 69h | v |
118 | 76h |
j |
106 | 6Ah | w |
119 | 77h |
k |
107 | 6Bh | x |
120 | 78h |
l |
108 | 6Ch | y |
121 | 79h |
m |
109 | 6Dh | z |
122 | 7Ah |
| Char | Dec | Hex | Char | Dec | Hex |
|---|---|---|---|---|---|
0 |
48 | 30h | 5 |
53 | 35h |
1 |
49 | 31h | 6 |
54 | 36h |
2 |
50 | 32h | 7 |
55 | 37h |
3 |
51 | 33h | 8 |
56 | 38h |
4 |
52 | 34h | 9 |
57 | 39h |
The digits start at 48, which is why adding 48 to a number from 0 to 9 turns it into the character for that digit.
| Char | Dec | Hex |
|---|---|---|
| space | 32 | 20h |
| Char | Dec | Hex | Char | Dec | Hex |
|---|---|---|---|---|---|
! |
33 | 21h | ) |
41 | 29h |
" |
34 | 22h | * |
42 | 2Ah |
# |
35 | 23h | + |
43 | 2Bh |
$ |
36 | 24h | , |
44 | 2Ch |
% |
37 | 25h | - |
45 | 2Dh |
& |
38 | 26h | . |
46 | 2Eh |
' |
39 | 27h | / |
47 | 2Fh |
( |
40 | 28h |
| Char | Dec | Hex | Char | Dec | Hex |
|---|---|---|---|---|---|
: |
58 | 3Ah | > |
62 | 3Eh |
; |
59 | 3Bh | ? |
63 | 3Fh |
< |
60 | 3Ch | @ |
64 | 40h |
= |
61 | 3Dh |
Ten codes do not hold what a standard ASCII table would tell you. If you have worked from an ASCII chart before, these are the ones to watch:
| Code | Hex | The Einstein prints | An ASCII chart would say |
|---|---|---|---|
| 91 | 5Bh | left arrow | [ |
| 92 | 5Ch | one half | \ |
| 93 | 5Dh | right arrow | ] |
| 94 | 5Eh | up arrow | ^ |
| 95 | 5Fh | underscore | underscore - the same |
| 96 | 60h | pound sign | backtick |
| 123 | 7Bh | one quarter | { |
| 124 | 7Ch | double vertical bar | | |
| 125 | 7Dh | three quarters | } |
| 126 | 7Eh | division sign | ~ |
Two consequences worth knowing before you go hunting a bug that is not there.
The arrows are free. Codes 91, 93 and 94 give you left, right and up as single characters, and 92, 123 and 125 give you the common fractions. For a game that is a gift: a cursor, a direction indicator or a menu marker with no graphics work at all.
Some characters cannot be printed. There is no [, ], {, }, \,
backtick or ~ on this machine. Ask for one and you get the glyph above
instead. If you are printing a message containing any of them, choose
different punctuation.
Codes 128 to 255 are not text at all. They hold a set of graphic characters - arrows, solid and outlined boxes, and an assortment of short line and corner segments, with some blanks among them.
That is more useful than it sounds. A game built out of characters can draw borders, frames, mazes and simple scenery from this range without touching the graphics hardware at all, and printing a character is something you already know how to do.
No table is given here yet. The quickest way to see what is up there is to print a handful at a time and look:
LD A,200
RST 8
DEFB 158
Change the number, run it again, and keep a note of the ones you like.
These do not print anything. They move the cursor.
| Code | Hex | Effect |
|---|---|---|
| 8 | 08h | Move back one position. The next character printed lands on top of the previous one. |
| 10 | 0Ah | Move down one line, staying in the same column. |
| 13 | 0Dh | Return to the start of the current line. |
A new line needs 13 and then 10. Neither is enough on its own: 13 without 10 leaves you on the same line, and 10 without 13 steps your output diagonally down the screen.
Codes below 32 other than these three are not covered here. If you are calculating a character code rather than naming one, keep the result at 32 or above.