ZX 81 - BASIC Programming

Sinclair ZX Spectrum
Appendix A - The character set
This is the complete ZX80 character set, with codes in decimal & hex. If one imagines the codes as being Z80 machine code instructions, then the right hand columns give the corresponding assembly language mnemonics. As you are probably aware if you understand these things, certain Z80 instructions are compounds starting with CBh or EDh; the two right hand columns give these.

Code Character Hex Z80 assembler - after CBh - after EDh
0 space 00 nop rlc b  
1 01 ld bc,NN rlc c  
2 02 ld (bc),a rlc d  
3 03 inc bc rlc e  
4 04 inc b rlc h  
5 05 dec b rlc l  
6 06 ld b,N rlc (hl)  
7 07 rlca rlc a  
8 08 ex a,af' rrc b  
9 09 add hl,bc rrc c  
10 0A ld a,(bc) rrc d  
11 " 0B dec bc rrc e  
12 £ 0C inc c rrc h  
13 $ 0D dec c rrc l  
14 : 0E ld c,N rrc (hl)  
15 ? 0F rcca rrc a  
16 ( 10 djnz DIS rl b  
17 ) 11 ld de,NN rl c  
18 > 12 ld (de),a rl d  
19 < 13 inc de rl e  
20 = 14 inc d rl h  
21 + 15 dec d rl l  
22 - 16 ld d,N rl (hl)  
23 * 17 rla rl a  
24 / 18 jr DIS rr b  
25 ; 19 add hl,de rr c  
26 ' 1A la a,(de) rr d  
27 . 1B dec de rr e  
28 0 1C inc e rr h  
29 1 1D dec e rr l  
30 2 1E ld e,N rr (hl)  
31 3 1F rra rr a  
32 4 20 jr nz,DIS sla b  
33 5 21 ld hl,N sla c  
34 6 22 ld (NN),hl sla d  
35 7 23 inc hl sla e  
36 8 24 inc h sla h  
37 9 25 dec h sla l  
38 A 26 ld h,N sla (hl)  
39 B 27 daa la a  
40 C 28 jr z,DIS sra b  
41 D 29 add hl,hl sra c  
42 E 2A ld hl,(NN) sra d  
43 F 2B dec hl sra e  
44 G 2C inc l sra h  
45 H 2D dec l sra l  
46 I 2E ld l,N sra (hl)  
47 J 2F cpl sra a  
48 K 30 jr nc,DIS    
49 L 31 ld sp,NN    
50 M 32 ld (NN),a    
51 N 33 inc sp    
52 O 34 inc (hl)    
53 P 35 dec(hl)    
54 Q 36 ld (hl),N    
55 R 37 scf    
56 S 38 jr c,DIS srl b  
57 T 39 add hl,sp srl c  
58 U 3A ld a,(NN) srl d  
59 V 3B dec sp srl e  
60 W 3C inc a srl h  
61 X 3D dec a srl l  
62 Y 3E ld a,N srl (hl)  
63 Z 3F ccf srl a  
64 RND 40 ld b,b bit 0,b in b,(c)
65 INKEY$ 41 ld b,c bit 0,c out (c),b
66 PI 42 ld b,d bit 0,d sbc hl,bc
67 not used 43 ld b,e bit 0,e ld (NN),bc
68 not used 44 ld b,h bit 0,h neg
69 not used 45 ld b,l bit 0,l retn
70 not used 46 ld b,(hl) bit 0,(hl) im 0
71 not used 47 ld b,a bit 0,a ld i,a
72 not used 48 ld c,b bit 1,b i c,(c)
73 not used 49 ld c,c bit 1,c out (c),c
74 not used 4A ld c,d bit 1,d adc hl,bc
75 not used 4B ld c,e bit 1,e ld bc,(NN)
76 not used 4C ld c,h bit 1,h  
77 not used 4D ld c,l bit 1,l reti
78 not used 4E ld c,(hl) bit 1,(hl)  
79 not used 4F ld c,a bit 1,a ld r,a
80 not used 50 ld d,b bit 2,b ld d,(c)
81 not used 51 ld d,c bit 2,c out (c),d
82 not used 52 ld d,d bit 2,d sbc hl,de
83 not used 53 ld d,e bit 2,e ld (NN),de
84 not used 54 ld d,h bit 2,h  
85 not used 55 ld d,l bit 2,l  
86 not used 56 ld d,(hl) bit 2,(hl) im 1
87 not used 57 ld d,a bit 2,a ld a,i
88 not used 58 ld e,b bit 3,b in e,(c)
89 not used 59 ld e,c bit 3,c out (c),e
90 not used 5A ld e,d bit 3,d adc hl,de
91 not used 5B ld e,e bit 3,e ld de,(NN)
92 not used 5C ld e,h bit 3,h  
93 not used 5D ld e,l bit 3,l  
94 not used 5E ld e,(hl) bit 3,(hl) im 2
95 not used 5F ld e,a bit 3,a ld a,r
96 not used 60 ld h,b bit 4,b in h,(c)
97 not used 61 ld h,c bit 4,c out (c),h
98 not used 62 ld h,d bit 4,d sbc hl,hl
99 not used 63 ld h,e bit 4,e ld (NN),hl
100 not used 64 ld h,h bit 4,h  
101 not used 65 ld h,l bit 4,l  
102 not used 66 ld h,(hl) bit 4,(hl)  
103 not used 67 ld h,a bit 4,a rrd
104 not used 68 ld l,b bit 5,b in l,(c)
105 not used 69 ld l,c bit 5,c out (c),l
106 not used 6A ld l,d bit 5,d adc hl,hl
107 not used 6B ld l,e bit 5,e ld de.(NN)
108 not used 6C ld l,h bit 5,h  
109 not used 6D ld l,l bit 5,l  
110 not used 6E ld l,(hl) bit 5,(hl)  
111 not used 6F ld l,a bit 5,a rld
112 cursor up 70 ld (hl),b bit 6,b  
113 cursor down 71 ld (hl),c bit 6,c  
114 cursor left 72 ld (hl),d bit 6,d sbc hl,sp
115 cursor right 73 ld (hl),e bit 6,e ld (NN),sp
116 GRAPHICS 74 ld (hl),h bit 6,h  
117 EDIT 75 ld (hl),l bit 6,l  
118 NEWLINE 76 halt bit 6,(hl)  
119 RUBOUT 77 ld (hl),a bit 6,a  
120 / mode 78 ld a,b bit 7,b in a,(c)
121 FUNCTION 79 ld a,c bit 7,c out (c),a
122 not used 7A ld a,d bit 7,d adc hl,sp
123 not used 7B ld a,e bit 7,e ld sp,(NN)
124 not used 7C ld a,h bit 7,h  
125 not used 7D ld a,l bit 7,l  
126 number 7E la d,(hl) bit 7,(hl)  
127 cursor 7F ld a,a bit 7,a  
128 80 add a,b res 0,b  
129 81 add a,c res 0,c  
130 82 add a,d res 0,d  
131 83 add a,e res 0,e  
132 84 add a,h res 0,h  
133 85 add a,l res 0,l  
134 86 add a,(hl) res 0,(hl)  
135 87 add a,a res 0,a  
136 88 add a,b res 1,b  
137 89 add a,c res 1,c  
138 8A add a,d res 1,d  
139 inverse " 8B adc a,e res 1,e  
140 inverse £ 8C adc a,h res 1,h  
141 inverse $ 8D adc a,l res 1,l  
142 inverse : 8E adc a,(hl) res 1,(hl)  
143 inverse ? 8F adc a,a res 1,a  
144 inverse ( 90 sub b res 2,b  
145 inverse ) 91 sub c res 2,c  
146 inverse > 92 sub d res 2,d  
147 inverse < 93 sub e res 2,e  
148 inverse = 94 sub h res 2,h  
149 inverse + 95 sub l res 2,l  
150 inverse - 96 sub (hl) res 2,(hl)  
151 inverse * 97 sub a res 2,a  
152 inverse / 98 sbc a,b res 3,b  
153 inverse ; 99 sbc a,c res 3,c  
154 inverse , 9A sbc a,d res 3,d  
155 inverse . 9B abc a,e res 3,e  
156 inverse 0 9C abc a,h res 3,h  
157 inverse 1 9D abc a,l res 3,l  
158 inverse 2 9E abc a,(hl) res 3,(hl)  
159 inverse 3 9F abc a,a res 3,a  
160 inverse 4 A0 and b res 4,b ldi
161 inverse 5 A1 and c res 4,c cpi
162 inverse 6 A2 and d res 4,d ini
163 inverse 7 A3 and e res 4,e outi
164 inverse 8 A4 and h res 4,h  
165 inverse 9 A5 and l res 4,l  
166 inverse A A6 and (hl) res 4,(hl)  
167 inverse B A7 and a res 4,a  
168 inverse C A8 xor b res 5,b ldd
169 inverse D A9 xor c res 5,c cpd
170 inverse E AA xor d res 5,d ind
171 inverse F AB xor e res 5,e outd
172 inverse G AC xor h res 5,h  
173 inverse H AD xor l res 5,l  
174 inverse I AE xor (hl) res 5,(hl)  
175 inverse J AF xor a res 5,a  
176 inverse K B0 or b res 6,b ldir
177 inverse L B1 or c res 6,c cpir
178 inverse M B2 or d res 6,d inir
179 inverse N B3 or e res 6,e otir
180 inverse O B4 or h res 6,h  
181 inverse P B5 or l res 6,l  
182 inverse Q B6 or (hl) res 6,(hl)  
183 inverse R B7 or a res 6,a  
184 inverse S B8 cp b res 7,b lddr
185 inverse T B9 cp c res 7,c cpdr
186 inverse U BA cp d res 7,d indr
187 inverse V BB cp e res 7,e otdr
188 inverse W BC cp h res 7,h  
189 inverse X BD cp l res 7,l  
190 inverse Y BE cp (hl) res 7,(hl)  
191 inverse Z BF cp a res 7,a  
192 "" C0 ret nz set 0,b  
193 AT C1 pop bc set 0,c  
194 TAB C2 jp nz,NN set 0,d  
195 not used C3 jp NN set 0,e  
196 CODE C4 call nz,NN set 0,h  
197 VAL C5 push bc set 0,l  
198 LEN C6 add a,N set 0,(hl)  
199 SIN C7 rst 0 set 0,a  
200 COS C8 ret z set 1,b  
201 TAN C9 ret set 1,c  
202 ASN CA jp z,NN set 1,d  
203 ACS CB   set 1,e  
204 ATN CC call z,NN set 1,h  
205 LN CD call NN set 1,l  
206 EXP CE adc a,N set 1,(hl)  
207 INT CF rst 8 set 1,a  
208 SQR D0 ret nc set 2,b  
209 SGN D1 pop de set 2,c  
210 ABS D2 jp nc,NN set 2,d  
211 PEEK D3 out N,a set 2,e  
212 USR D4 call nc,NN set 2,h  
213 STR$ D5 push de set 2,l  
214 CHR$ D6 sub N set 2,(hl)  
215 NOT D7 rst 16 set 2,a  
216 ** D8 ret c set 3,b  
217 OR D9 exx set 3,c  
218 AND DA jp c,NN set 3,d  
219 <= DB in a,N set 3,e  
220 >= DC call c,NN set 3,h  
221 <> DD prefixes instructions using ix set 3,l  
222 THEN DE sbc a,N set 3,(hl)  
223 TO DF rst 24 set 3,a  
224 STEP E0 ret po set 4,b  
225 LPRINT E1 pop hl set 4,c  
226 LLIST E2 jp po,NN set 4,d  
227 STOP E3 ex (sp),hl set 4,e  
228 SLOW E4 call po,NN set 4,h  
229 FAST E5 push hl set 4,l  
230 NEW E6 and N set 4,(hl)  
231 SCROLL E7 rst 32 set 4,a  
232 CONT E8 ret pe set 5,b  
233 DIM E9 jp (hl) set 5,c  
234 REM EA jp pe,NN set 5,d  
235 FOR EB ex de,hl set 5,e  
236 GOTO EC call pe,NN set 5,h  
237 GOSUB ED   set 5,l  
238 INPUT EE xor N set 5,(hl)  
239 LOAD EF rst 40 set 5,a  
240 LIST F0 ret p set 6,b  
241 LET F1 pop af set 6,c  
242 PAUSE F2 jp p,NN set 6,d  
243 NEXT F3 di set 6,e  
244 POKE F4 call p,NN set 6,h  
245 PRINT F5 push af set 6,l  
246 PLOT F6 or N set 6,(hl)  
247 RUN F7 rst 48 set 6,a  
248 SAVE F8 ret m set 7,b  
249 RAND F9 ld sp,hl set 7,c  
250 IF FA jp m,NN set 7,d  
251 CLS FB ei set 7,e  
252 UNPLOT FC call m,NN set 7,h  
253 CLEAR FD prefixes instructions using iy set 7,l  
254 RETURN FE cp N set 7,(hl)  
255 COPY FF rst 56 set 7,a  

Sinclair ZX Spectrum

  Previous Page Back Next Page