Pages 282–287 · Markdown

Appendix A – Character Set, Z80N Mnemonics and Control Codes

This is the complete ZX Spectrum Next / NextZXOS character set, with codes in decimal and hexadecimal, the character each code represents, as well as the control codes (shaded) together with their corresponding NextBASIC tokens, if any. Tokens that are shaded are specific to the ZX Spectrum Next and cannot be found in earlier ZX Spectrum models. As the codes are also Z80N machine code instructions, the right hand columns give the corresponding assembly language mnemonics. As you are probably aware if you understand these things, certain Z80N instructions are compounds starting with CBh or EDh; the two rightmost columns give you these. Note that ED instructions that are shaded, cannot be found in regular Z80 CPUs and are only native to Z80N, the variant of the Z80 CPU, found on the ZX Spectrum Next. Control codes are marked with UW if they refer to User Windows and SW if they refer to System Windows.

DecCharacter / Control Code / TokenHexZ80N Assembler- after CB- after ED
0colour: pale yellow Justify off (UW) Increase font (SW)00noprlc b
1colour: pale yellow Justify on (UW) Decrease font (SW)01ld bc,NNrlc c
2colour: pale yellow Save Window (UW) Change font (SW)02ld (bc),arlc d
3colour: pale yellow Restore Window (UW)
Regenerate Small Fonts (SW)
03inc bcrlc e
4colour: pale yellow Cursor to top left (UW)(SW)04inc brlc h
5colour: pale yellow Cursor to bottom left (UW)(SW)05dec brlc l
6colour: pale yellow PRINT comma06ld b,Nrlc (hl)
7colour: pale yellow EDIT, Scroll (SW)(UW)07rlcarlc a
8colour: pale yellow ⇦08ex af,af'rrc b
9colour: pale yellow ⇨09add hl,bcrrc c
10colour: pale yellow ⇩0Ald a,(bc)rrc d
11colour: pale yellow ⇧0Bdec bcrrc e
12colour: pale yellow DELETE / Backspace0Cinc crrc h
13colour: pale yellow ENTER / Carriage Return
PRINT apostrophe
0Ddec crrc l
14colour: pale yellow Clear Window (UW)(SW)0Eld c,Nrrc (hl)
15colour: pale yellow Wash Window (UW)(SW)0Frrcarrc a
16colour: pale yellow INK10djnz DISrl b
17colour: pale yellow PAPER11ld de,NNrl c
18colour: pale yellow FLASH12ld (de),arl d
19colour: pale yellow BRIGHT13inc derl e
20colour: pale yellow INVERSE14inc drl h
21colour: pale yellow OVER15dec drl l
22colour: pale yellow AT16ld d,Nrl (hl)
23colour: pale yellow TAB17rlarl a
24colour: pale yellow ATTR (UW)(SW)18jr DISrr b
25colour: pale yellow POINT (UW)(SW)19add hl,derr c
26colour: pale yellow AUTO PAUSE (UW)(SW)1Ald a,(de)rr d
27colour: pale yellow Fill window with character(UW)(SW)1Bdec derr e
28colour: pale yellow Set Double Width (UW)(SW)1Cinc err h
29colour: pale yellow Set Font Height (UW)1Ddec err l
30colour: pale yellow Justification mode (UW)
Set Font Width (SW)
1Eld e,Nrr (hl)
31colour: pale yellow Permit embed. codes in justif. mode
(UW)
Redefine Character Set (SW)
1Frrarr a
32Space20jr nz, DISsla b
33!21ld hl,NNsla c
DecCharacter / Control Code / TokenHexZ80N Assembler- after CB- after ED
34"22ld (NN),hlsla d
35#23inc hlsla ecolour: yellow-green swapnib
36$24inc hsla hcolour: yellow-green mirror a
37%25dec hsla l
38&26ld h,Nsla (hl)
39‘27daasla acolour: yellow-green test N
40(28jr z,DISsra bcolour: yellow-green bsla de,b
41)29add hl,hlsra ccolour: yellow-green bsra de,b
42*2Ald hl,(NN)sra dcolour: yellow-green bsrl de,b
43+2Bdec hlsra ecolour: yellow-green bsrf de,b
44,2Cinc lsra hcolour: yellow-green brlc de,b
45-2Ddec lsra l
46.2Eld l,Nsra (hl)
47/2Fcplsra a
48030jr nc,DIScolour: yellow-green mul d,e
49131ld sp,NNcolour: yellow-green add hl,a
50232ld (NN),acolour: yellow-green add de,a
51333inc spcolour: yellow-green add bc,a
52434inc (hl)colour: yellow-green add hl,NN
53535dec (hl)colour: yellow-green add de,NN
54636ld (hl),Ncolour: yellow-green add bc,NN
55737scf
56838jr c,DISsrl b
57939add hl,spsrl c
58:3Ald a,(NN)srl d
59;3Bdec spsrl e
60<3Cinc asrl h
61=3Ddec asrl l
62>3Eld a,Nsrl (hl)
63?3Fccfsrl a
64@40ld b,bbit 0,bin b,(c)
65A41ld b,cbit 0,cout (c),b
66B42ld b,dbit 0,dsbc hl,bc
67C43ld b,ebit 0,eld (NN),bc
68D44ld b,hbit 0,hneg
69E45ld b,lbit 0,lretn
70F46ld b,(hl)bit 0,(hl)im 0
71G47ld b,abit 0,ald i,a
72H48ld c,bbit 1,bin c,(c)
73I49ld c,cbit 1,cout (c),c
74J4Ald c,dbit 1,dadc hl,bc
75K4Bld c,ebit 1,eld bc,(NN)
76L4Cld c,hbit 1,h
77M4Dld c,lbit 1,lreti
78N4Eld c,(hl)bit 1,(hl)
79O4Fld c,abit 1,ald r,a
80P50ld d,bbit 2,bin d,(c)
81Q51ld d,cbit 2,cout (c),d
82R52ld d,dbit 2,dsbc hl,de
83S53ld d,ebit 2,eld (NN),de
84T54ld d,hbit 2,h
85U55ld d,lbit 2,l
DecCharacter / Control Code / TokenHexZ80N Assembler- after CB- after ED
86V56ld d,(hl)bit 2,(hl)im 1
87W57ld d,abit 2,ald a,i
88X58ld e,bbit 3,bin e,(c)
89Y59ld e,cbit 3,cout (c),e
90Z5Ald e,dbit 3,dadc hl,de
91[5Bld e,ebit 3,eld de,(NN)
92\5Cld e,hbit 3,h
93]5Dld e,lbit 3,l
94↑5Eld e,(hl)bit 3,(hl)im 2
95_5Fld e,abit 3,ald a,r
96£60ld h,bbit 4,bin h,(c)
97a61ld h,cbit 4,cout (c),h
98b62ld h,dbit 4,dsbc hl,hl
99c63ld h,ebit 4,eld (NN),hl
100d64ld h,hbit 4,h
101e65ld h,lbit 4,l
102f66ld h,(hl)bit 4,(hl)
103g67ld h,abit 4,arrd
104h68ld l,bbit 5,bin l,(c)
105i69ld l,cbit 5,cout (c),l
106j6Ald l,dbit 5,dadc hl,hl
107k6Bld l,ebit 5,eld hl,(NN)
108l6Cld l,hbit 5,h
109m6Dld l,lbit 5,l
110n6Eld l,(hl)bit 5,(hl)
111o6Fld l,abit 5,arld
112p70ld (hl),bbit 6,bin f,(c)
113q71ld (hl),cbit 6,c
114r72ld (hl),dbit 6,dsbc hl,sp
115s73ld (hl),ebit 6,eld (NN),sp
116t74ld (hl),hbit 6,h
117u75ld (hl),lbit 6,l
118v76haltbit 6,(hl)
119w77ld (hl),abit 6,a
120x78ld a,bbit 7,bin a,(c)
121y79ld a,cbit 7,cout (c),a
122z7Ald a,dbit 7,dadc hl,sp
123{7Bld a,ebit 7,eld sp,(NN)
124|7Cld a,hbit 7,h
125}7Dld a,lbit 7,l
126~7Eld a,(hl)bit 7,(hl)
127©7Fld a,abit 7,a
12880add a,bres 0,b
129▝colour: pink TIME81add a,cres 0,c
130▘colour: pink PRIVATE82add a,dres 0,d
131▀colour: pink IFELSE183add a,eres 0,e
132▗colour: pink ENDIF84add a,hres 0,h
133▐colour: pink EXIT85add a,lres 0,l
134▚colour: pink REF86add a,(hl)res 0,(hl)
135▜colour: pink PEEK$87add a,ares 0,a

1 Displays as IF but indicates ELSE

DecCharacter / Control Code / TokenHexZ80N Assembler- after CB- after ED
136▖colour: pink REG88adc a,bres 1,b
137▞colour: pink DPOKE89adc a,cres 1,c
138▌colour: pink DPEEK8Aadc a,dres 1,dcolour: yellow-green push NN
139▛colour: pink MOD8Badc a,eres 1,e
140▄colour: pink <<8Cadc a,hres 1,h
141▟colour: pink >>8Dadc a,lres 1,l
142▙colour: pink UNTIL8Eadc a,(hl)res 1,(hl)
143█colour: pink ERROR8Fadc a,ares 1,a
144(a)colour: pink ON90sub bres 2,bcolour: yellow-green outinb
145(b)colour: pink DEFPROC91sub cres 2,ccolour: yellow-green nextreg r,N
146(c)colour: pink ENDPROC92sub dres 2,dcolour: yellow-green nextreg r,a
147(d)colour: pink PROC93sub eres 2,ecolour: yellow-green pixeldn
148(e)colour: pink LOCAL94sub hres 2,hcolour: yellow-green pixelad
149(f)colour: pink DRIVER95sub lres 2,lcolour: yellow-green setae
150(g)colour: pink WHILE96sub (hl)res 2,(hl)
151(h)colour: pink REPEAT97sub ares 2,a
152(i)colour: pink ELSE98sbc a,bres 3,bcolour: yellow-green jp (c)
153(j)colour: pink REMOUNT99sbc a,cres 3,c
154(k)colour: pink BANK9Asbc a,dres 3,d
155(l)colour: pink TILE9Bsbc a,eres 3,e
156(m)colour: pink LAYER9Csbc a,hres 3,h
157(n)colour: pink PALETTE9Dsbc a,lres 3,l
158(o)colour: pink SPRITE9Esbc a,(hl)res 3,(hl)
159(p)colour: pink PWD9Fsbc a,ares 3,a
160(q)colour: pink CDA0and bres 4,bldi
161(r)colour: pink MKDIRA1and cres 4,ccpi
162(s)colour: pink RMDIRA2and dres 4,dini
163(t)SPECTRUMA3and eres 4,eouti
164(u)PLAYA4and hres 4,hcolour: yellow-green ldix
165RNDA5and lres 4,lcolour: yellow-green ldws
166INKEY$A6and (hl)res 4,(hl)
167PIA7and ares 4,a
168FNA8xor bres 5,bldd
169POINTA9xor cres 5,ccpd
170SCREEN$AAxor dres 5,dind
171ATTRABxor eres 5,eoutd
172ATACxor hres 5,hcolour: yellow-green lddx
173TABADxor lres 5,l
174VAL$AExor (hl)res 5,(hl)
175CODEAFxor ares 5,a
176VALB0or bres 6,bldir
177LENB1or cres 6,ccpir
178SINB2or dres 6,dinir
179COSB3or eres 6,eotir
180TANB4or hres 6,hcolour: yellow-green ldirx
181ASNB5or lres 6,l
182ACSB6or (hl)res 6,(hl)
183ATNB7or ares 6,acolour: yellow-green ldpirx
184LNB8cp bres 7,blddr
185EXPB9cp cres 7,ccpdr
186INTBAcp dres 7,dindr
DecCharacter / Control Code / TokenHexZ80N Assembler- after CB- after ED
187SQRBBcp eres 7,eotdr
188SGNBCcp hres 7,hcolour: yellow-green lddrx
189ABSBDcp lres 7,l
190PEEKBEcp (hl)res 7,(hl)
191INBFcp ares 7,a
192USRC0ret nzset 0,b
193STR$C1pop bcset 0,c
194CHR$C2jp nz,NNset 0,d
195NOTC3jp NNset 0,e
196BINC4call nz,NNset 0,h
197ORC5push bcset 0,l
198ANDC6add a,Nset 0,(hl)
199<=C7rst 0set 0,a
200>=C8ret zset 1,b
201<>C9retset 1,c
202LINECAjp z,NNset 1,d
203THENCBmodifying prefixset 1,e
204TOCCcall z,NNset 1,h
205STEPCDcall NNset 1,l
206DEF FNCEadc a,Nset 1,(hl)
207CATCFrst 8set 1,a
208FORMATD0ret ncset 2,b
209MOVED1pop deset 2,c
210ERASED2jp nc,NNset 2,d
211OPEN #D3out (N),aset 2,e
212CLOSE #D4call nc,NNset 2,h
213MERGED5push deset 2,l
214VERIFYD6sub Nset 2,(hl)
215BEEPD7rst 16set 2,a
216CIRCLED8ret cset 3,b
217INKD9exxset 3,c
218PAPERDAjp c,NNset 3,d
219FLASHDBin a,(N)set 3,e
220BRIGHTDCcall c,NNset 3,h
221INVERSEDDIX prefix*set 3,l
222OVERDEsbc a,Nset 3,(hl)
223OUTDFrst 24set 3,a
224LPRINTE0ret poset 4,b
225LLISTE1pop hlset 4,c
226STOPE2jp po,NNset 4,d
227READE3ex (sp),hlset 4,e
228DATAE4call po,NNset 4,h
229RESTOREE5push hlset 4,l
230NEWE6and Nset 4,(hl)
231BORDERE7rst 32set 4,a
232CONTINUEE8ret peset 5,b
233DIME9jp (hl)set 5,c
234REM / ;EAjp pe,NNset 5,d
235FOREBex de,hlset 5,e
236GO TOECcall pe,NNset 5,h
237GO SUBEDmodifying prefixset 5,l
238INPUTEExor Nset 5,(hl)
DecCharacter / Control Code / TokenHexZ80N Assembler- after CB- after ED
239LOADEFrst 40set 5,a
240LISTF0ret pset 6,b
241LETF1pop afset 6,c
242PAUSEF2jp p,NNset 6,d
243NEXTF3diset 6,e
244POKEF4call p,NNset 6,h
245PRINTF5push afset 6,l
246PLOTF6or Nset 6,(hl)
247RUNF7rst 48set 6,a
248SAVEF8ret mset 7,b
249RANDOMIZEF9ld sp,hlset 7,c
250IFFAjp m,NNset 7,d
251CLSFBeiset 7,e
252DRAWFCcall m,NNset 7,h
253CLEARFDIY prefix*set 7,l
254RETURNFEcp Nset 7,(hl)
255COPYFFrst 56set 7,a

ZX Spectrum Next User Manual, 3rd Edition (ISBN 978-1-5272-5496-1), written and illustrated by Phoebus R. Dokos. Copyright © 2020-2024 Phoebus Dokos / SpecNext Ltd. Licensed under CC BY-NC-SA 4.0. This is a transcription and can contain errors; check any doubt against the printed page.