ZX81 character set

Jump to navigation Jump to search
The Sinclair ZX81 character set rendered in the system font.

The ZX81 character set is the character encoding used by the Sinclair Research ZX81 family of microcomputers including the Timex Sinclair 1000 and Timex Sinclair 1500. The encoding uses one byte per character for 256 code points. It has no relationship with previously established ones like ASCII or EBCDIC, but it is related though not identical to the character set of the predecessor ZX80.

Printable characters[edit]

Screenshot of a ZX81 8K BASIC program that demonstrates all code points including BASIC keywords and nonprintable characters, rendered as question marks.

The character set has 64 unique glyphs present at code points 0–63. With the most significant bit set the character is generated in inverse video; corresponding to code points 128–191. These 128 values are the only displayable ones allowed in the video memory (known as the display file). The remaining code points (64–127 and 192–255) are used as control characters such as 118 for newline, or uniquely to Sinclair BASIC for keywords, while some are unused.

The small effective range of only 64 unique glyphs precludes support for Latin lower case letters, and many symbols used widely in computing such as the exclamation point and the at sign. The lack of an apostrophe led some software authors to use a comma instead.

There are 11 block graphics characters, counting code point 0 which also doubles as space. Together with the 11 inverse video versions these 22 code points provide every combination of the character cell divided into 2×2 black-and-white block pixels for low-resolution 64×48 pixel graphics, or into 1×2 black, white or dithered gray wide block pixels for a 32×48 resolution. The 2×2 versions of these are also present in the Block Elements Unicode block.

Code point 11 is the double-quote (") symbol when used in the display file. The BASIC function CHR$ 192 prints as the same character but is shown as "" in BASIC source listings; it is used for including the literal " character in a string without conflict with the " string delimiter.[1]

Changes from the ZX80[edit]

The character set in the ZX81 was derived from the ZX80 character set. They have mostly the same code points, e.g. for A-Z and 0-9, but the code points are different for the block graphics characters, the symbols ", -, +, *, /, =, >, <, and the BASIC keyword tokens (with many new added). There are also changes to the control characters and code point 1 is no longer an unprintable string terminator. The ZX81 8K BASIC ROM was also available as an upgrade for the ZX80, replacing its integer-only 4K BASIC ROM.[2]

In the later Sinclair ZX Spectrum the entire character encoding was replaced with the ZX Spectrum character set, which is a derivative of ASCII and includes lower case letters and more.

System font[edit]

The ZX81 system font uses an 8×8 pixel-per-character grid where most glyphs fit in 6×6 pixels leaving two pixels horizontal and vertical space between rows and columns. This font was modified from the one in the ZX80's ROM which had slightly wider 7×6 pixel glyphs with only one pixel horizontal space between them. Some glyphs also received a different design in the ZX81 system font, noticeable on the *, the slashed and less rounded 0, and the less rounded $, C, G and J.

The ZX Spectrum uses the same font as the ZX81 but adds many characters including the lowercase Latin alphabet.

Character set[edit]

  Letter   Number   Punctuation   Symbol   Other   undefined

ZX81 character set[1][3]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F
0_ SP
U+0020
0
ZXSpectrum82.svg
U+2598
1
ZXSpectrum81.svg
U+259D
2
ZXSpectrum83.svg
U+2580
3
ZXSpectrum88.svg
U+2596
4
ZXSpectrum8a.svg
U+258C
5
ZXSpectrum89.svg
U+259E
6
ZXSpectrum8b.svg
U+259B
7
ZX80 character 0x09, ZX81 character 0x08.png
U+2592
8[a]
ZX80 character 0x0A, ZX81 character 0x09.png

9[b]
ZX80 character 0x0B, ZX81 character 0x0A.png

10[b]
"
U+0022
11[c]
£
U+00A3
12
$
U+0024
13
:
U+003A
14
?
U+003F
15
1_ (
U+0028
16
)
U+0029
17
>
U+003E
18
<
U+003C
19
=
U+003D
20
+
U+002B
21
-
U+002D
22
*
U+002A
23
/
U+002F
24
;
U+003B
25
,
U+002C
26
.
U+002E
27
0
U+0030
28
1
U+0031
29
2
U+0032
30
3
U+0033
31
2_ 4
U+0034
32
5
U+0035
33
6
U+0036
34
7
U+0037
35
8
U+0038
36
9
U+0039
37
A
U+0041
38
B
U+0042
39
C
U+0043
40
D
U+0044
41
E
U+0045
42
F
U+0046
43
G
U+0047
44
H
U+0048
45
I
U+0049
46
J
U+004A
47
3_ K
U+004B
48
L
U+004C
49
M
U+004D
50
N
U+004E
51
O
U+004F
52
P
U+0050
53
Q
U+0051
54
R
U+0052
55
S
U+0053
56
T
U+0054
57
U
U+0055
58
V
U+0056
59
W
U+0057
60
X
U+0058
61
Y
U+0059
62
Z
U+005A
63
4_ RND

64[d]
INKEY$

65[d]
PI

66[d]
                         
5_                                
6_                                
7_ UP

112
DOWN

113
LEFT

114
RIGHT

115
GRAPH
ICS

116
EDIT

117
NEW
LINE

118
RUB
OUT

119
K/L
mode

120
FUNC
TION

121
        number
126
cursor
127
8_ ZXSpectrum8f.svg
U+2588
128
ZXSpectrum8d.svg
U+259F
129
ZXSpectrum8e.svg
U+2599
130
ZXSpectrum8c.svg
U+2584
131
ZXSpectrum87.svg
U+259C
132
ZXSpectrum85.svg
U+2590
133
ZXSpectrum86.svg
U+259A
134
ZXSpectrum84.svg
U+2597
135
ZX80 character 0x89, ZX81 character 0x88.png
U+2592
136[a]
ZX80 character 0x8A, ZX81 character 0x89.png

137[b]
ZX80 character 0x8B, ZX81 character 0x8A.png

138[b]
"

139
£

140
$

141
:

142
?

143
9_ (

144
)

145
>

146
<

147
=

148
+

149
-

150
*

151
/

152
;

153
,

154
.

155
0

156
1

157
2

158
3

159
A_ 4

160
5

161
6

162
7

163
8

164
9

165
A

166
B

167
C

168
D

169
E

170
F

171
G

172
H

173
I

174
J

175
B_ K

176
L

177
M

178
N

179
O

180
P

181
Q

182
R

183
S

184
T

185
U

186
V

187
W

188
X

189
Y

190
Z

191
C_ ""

192[c]
AT

193[d]
TAB

194[d]
  CODE

196[d]
VAL

197[d]
LEN

198[d]
SIN

199[d]
COS

200[d]
TAN

201[d]
ASN

202[d]
ACS

203[d]
ATN

204[d]
LN

205[d]
EXP

206[d]
INT

207[d]
D_ SQR

208[d]
SGN

209[d]
ABS

210[d]
PEEK

211[d]
USR

212[d]
STR$

213[d]
CHR$

214[d]
NOT

215[d]
**

216[e]
OR

217[d]
AND

218[d]
<=

219[f]
>=

220[g]
<>

221[h]
THEN

222[d]
TO

223[d]
E_ STEP

224[d]
LPRINT

225[d]
LLIST

226[d]
STOP

227[d]
SLOW

228[d]
FAST

229[d]
NEW

230[d]
SCROLL

231[d]
CONT

232[d]
DIM

233[d]
REM

234[d]
FOR

235[d]
GOTO

236[d]
GOSUB

237[d]
INPUT

238[d]
LOAD

239[d]
F_ LIST

240[d]
LET

241[d]
PAUSE

242[d]
NEXT

243[d]
POKE

244[d]
PRINT

245[d]
PLOT

246[d]
RUN

247[d]
SAVE

248[d]
RAND

249[d]
IF

250[d]
CLS

251[d]
UNPLOT

252[d]
CLEAR

253[d]
RETURN

254[d]
COPY

255[d]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F

See also[edit]

Notes[edit]

  1. ^ a b Because they are 50% gray rasters, code points 8 and 136 have the same appearance although every pixel is inverted. Both can be expressed as Unicode character U+2592 ("Medium shade") in the Block Elements Unicode block, but of course if both are converted to the same code point the conversion is non-reversible.
  2. ^ a b c d Not in the Block Elements Unicode block.
  3. ^ a b Code point 11 is the double-quote (") symbol when used in the video memory (called the display file). Code point 192, CHR$ 192, prints as the same character but shows as "" in BASIC listings and is used for including the literal " character in a string without conflict with the " string delimiter.[1]
  4. ^ a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az ba bb bc bd be bf bg bh bi Sinclair BASIC tokenizes keywords into single-byte code points.
  5. ^ The raise to a power multi-character operator tokenized into a single-byte code point.
  6. ^ The greater than or equal to multi-character operator tokenized into a single-byte code point.
  7. ^ The less than or equal to multi-character operator tokenized into a single-byte code point.
  8. ^ The not equal sign multi-character operator tokenized into a single-byte code point.

References[edit]

  1. ^ a b c Vickers, Steven (1981). Sinclair ZX81 BASIC Programming. Sinclair Research Ltd.
  2. ^ "8K BASIC ROM UPGRADE".
  3. ^ Wearmouth, Geoff. "An Assembly Listing of the Operating System of the ZX81 ROM". Archived from the original on August 15, 2015.