Jump to content

ZX80 character set

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Gioto (talk | contribs) at 07:25, 16 May 2016 (→‎Layout). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The Sinclair ZX80 character set rendered in the system font.

The ZX80 character set is the character encoding used by the Sinclair Research ZX80 microcomputer with its original 4K BASIC ROM. 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 successor ZX81.

Printable characters

Screenshot of a ZX80 4K BASIC program that demonstrates all code points including BASIC keywords and nonprintable characters, the latter rendered as question marks except CHR$(1) rendered as a null string. Therefore the top line covers the 33 code points 0–32, the following 5 lines cover 32 each, and the last lines with keywords cover yet fewer.

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 or the at sign.

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 1 is the double-quote (") character when used in the display file, but uniquely to the ZX80 it is used internally as the string terminator character[1] so the BASIC function CHR$(1) returns a null string;[2] CHR$(212) translates to the printable " character.[3]

Changes in the ZX81

The 8K BASIC ROM of the follow-up ZX81 model was also available as an upgrade for the ZX80, replacing its integer-only 4K BASIC ROM.[4] It introduced the modified ZX81 character set which has 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.

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

The ZX80 system font uses an 8×8 pixel-per-character grid where most glyphs fit in 7×6 pixels leaving one pixel horizontal space between them. This font was modified in the ZX81's ROM to slightly narrower 6×6 pixel glyphs with two pixels horizontal space between them, which improved the look of single inverted characters by showing inverted pixels on both sides. 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.

Layout

  Letter  Number  Punctuation  Symbol  Other  Undefined

ZX80 character set[1][3][a]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F
0_ Template:Chset-color-punct|SP
U+0020
0
Template:Chset-color-punct|"
U+0022
1[b]
Template:Chset-color-graph|
U+258C
2
Template:Chset-color-graph|
U+2584
3
Template:Chset-color-graph|
U+2598
4
Template:Chset-color-graph|
U+259D
5
Template:Chset-color-graph|
U+2596
6
Template:Chset-color-graph|
U+2597
7
Template:Chset-color-graph|
U+259E
8
Template:Chset-color-graph|
U+2592
9[c]
Template:Chset-color-graph|
 
10[d]
Template:Chset-color-graph|
 
11[d]
Template:Chset-color-punct|£
U+00A3
12
Template:Chset-color-punct|$
U+0024
13
Template:Chset-color-punct|:
U+003A
14
Template:Chset-color-punct|?
U+003F
15
1_ Template:Chset-color-punct|(
U+0028
16
Template:Chset-color-punct|)
U+0029
17
Template:Chset-color-punct|-
U+002D
18
Template:Chset-color-punct|+
U+002B
19
Template:Chset-color-punct|*
U+002A
20
Template:Chset-color-punct|/
U+002F
21
Template:Chset-color-punct|=
U+003D
22
Template:Chset-color-punct|>
U+003E
23
Template:Chset-color-punct|<
U+003C
24
Template:Chset-color-punct|;
U+003B
25
Template:Chset-color-punct|,
U+002C
26
Template:Chset-color-punct|.
U+002E
27
Template:Chset-color-digit|0
U+0030
28
Template:Chset-color-digit|1
U+0031
29
Template:Chset-color-digit|2
U+0032
30
Template:Chset-color-digit|3
U+0033
31
2_ Template:Chset-color-digit|4
U+0034
32
Template:Chset-color-digit|5
U+0035
33
Template:Chset-color-digit|6
U+0036
34
Template:Chset-color-digit|7
U+0037
35
Template:Chset-color-digit|8
U+0038
36
Template:Chset-color-digit|9
U+0039
37
Template:Chset-color-alpha|A
U+0041
38
Template:Chset-color-alpha|B
U+0042
39
Template:Chset-color-alpha|C
U+0043
40
Template:Chset-color-alpha|D
U+0044
41
Template:Chset-color-alpha|E
U+0045
42
Template:Chset-color-alpha|F
U+0046
43
Template:Chset-color-alpha|G
U+0047
44
Template:Chset-color-alpha|H
U+0048
45
Template:Chset-color-alpha|I
U+0049
46
Template:Chset-color-alpha|J
U+004A
47
3_ Template:Chset-color-alpha|K
U+004B
48
Template:Chset-color-alpha|L
U+004C
49
Template:Chset-color-alpha|M
U+004D
50
Template:Chset-color-alpha|N
U+004E
51
Template:Chset-color-alpha|O
U+004F
52
Template:Chset-color-alpha|P
U+0050
53
Template:Chset-color-alpha|Q
U+0051
54
Template:Chset-color-alpha|R
U+0052
55
Template:Chset-color-alpha|S
U+0053
56
Template:Chset-color-alpha|T
U+0054
57
Template:Chset-color-alpha|U
U+0055
58
Template:Chset-color-alpha|V
U+0056
59
Template:Chset-color-alpha|W
U+0057
60
Template:Chset-color-alpha|X
U+0058
61
Template:Chset-color-alpha|Y
U+0059
62
Template:Chset-color-alpha|Z
U+005A
63
4_ Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef
5_ Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef
6_ Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef
7_ Template:Chset-color-ctrl|UP
 
112
Template:Chset-color-ctrl|DOWN
 
113
Template:Chset-color-ctrl|LEFT
 
114
Template:Chset-color-ctrl|RIGHT
 
115
Template:Chset-color-ctrl|HOME
 
116
Template:Chset-color-ctrl|EDIT
 
117
Template:Chset-color-ctrl|NEW
LINE

118
Template:Chset-color-ctrl|RUB
OUT

119
Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef
8_ Template:Chset-color-graph|
U+2588
128
Template:Chset-color-punct|"
 
129
Template:Chset-color-graph|
U+2590
130
Template:Chset-color-graph|
U+2580
131
Template:Chset-color-graph|
U+259F
132
Template:Chset-color-graph|
U+2599
133
Template:Chset-color-graph|
U+259C
134
Template:Chset-color-graph|
U+259B
135
Template:Chset-color-graph|
U+259A
136
Template:Chset-color-graph|
U+2592
137[c]
Template:Chset-color-graph|
 
138[d]
Template:Chset-color-graph|
 
139[d]
Template:Chset-color-punct|£
 
140
Template:Chset-color-punct|$
 
141
Template:Chset-color-punct|:
 
142
Template:Chset-color-punct|?
 
143
9_ Template:Chset-color-punct|(
 
144
Template:Chset-color-punct|)
 
145
Template:Chset-color-punct|-
 
146
Template:Chset-color-punct|+
 
147
Template:Chset-color-punct|*
 
148
Template:Chset-color-punct|/
 
149
Template:Chset-color-punct|=
 
150
Template:Chset-color-punct|>
 
151
Template:Chset-color-punct|<
 
152
Template:Chset-color-punct|;
 
153
Template:Chset-color-punct|,
 
154
Template:Chset-color-punct|.
 
155
Template:Chset-color-digit|0
 
156
Template:Chset-color-digit|1
 
157
Template:Chset-color-digit|2
 
158
Template:Chset-color-digit|3
 
159
A_ Template:Chset-color-digit|4
 
160
Template:Chset-color-digit|5
 
161
Template:Chset-color-digit|6
 
162
Template:Chset-color-digit|7
 
163
Template:Chset-color-digit|8
 
164
Template:Chset-color-digit|9
 
165
Template:Chset-color-alpha|A
 
166
Template:Chset-color-alpha|B
 
167
Template:Chset-color-alpha|C
 
168
Template:Chset-color-alpha|D
 
169
Template:Chset-color-alpha|E
 
170
Template:Chset-color-alpha|F
 
171
Template:Chset-color-alpha|G
 
172
Template:Chset-color-alpha|H
 
173
Template:Chset-color-alpha|I
 
174
Template:Chset-color-alpha|J
 
175
B_ Template:Chset-color-alpha|K
 
176
Template:Chset-color-alpha|L
 
177
Template:Chset-color-alpha|M
 
178
Template:Chset-color-alpha|N
 
179
Template:Chset-color-alpha|O
 
180
Template:Chset-color-alpha|P
 
181
Template:Chset-color-alpha|Q
 
182
Template:Chset-color-alpha|R
 
183
Template:Chset-color-alpha|S
 
184
Template:Chset-color-alpha|T
 
185
Template:Chset-color-alpha|U
 
186
Template:Chset-color-alpha|V
 
187
Template:Chset-color-alpha|W
 
188
Template:Chset-color-alpha|X
 
189
Template:Chset-color-alpha|Y
 
190
Template:Chset-color-alpha|Z
 
191
C_ Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef
D_ Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef "
 
212[b]
THEN
 
213[e]
TO
 
214[e]
;
 
215
,
 
216
(
 
217
)
 
218
NOT
 
219[e]
-
 
220
+
 
221
*
 
222
/
 
223
E_ AND
 
224[e]
OR
 
225[e]
**
 
226[f]
=
 
227
>
 
228[a]
<
 
229[a]
LIST
 
230[e]
RETURN
 
231[e]
CLS
 
232[e]
DIM
 
233[e]
SAVE
 
234[e]
FOR
 
235[e]
GO TO
 
236[e]
POKE
 
237[e]
INPUT
 
238[e]
RAND
OMISE

239[e]
F_ LET
 
240[e]
Template:Chset-color-undef Template:Chset-color-undef NEXT
 
243[e]
PRINT
 
244[e]
Template:Chset-color-undef NEW
 
246[e]
RUN
 
247[e]
STOP
 
248[e]
CONT
INUE

249[e]
IF
 
250[e]
GO SUB
 
251[e]
LOAD
 
252[e]
CLEAR
 
253[e]
REM
 
254[e]
Template:Chset-color-undef
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F

Notes

  1. ^ a b c The ZX80 Operating Manual has an error and shows the > and < symbols in the wrong order.[5]
  2. ^ a b Code point 1 is the double-quote (") symbol when used in the video memory (called the display file), but it is used internally as the string terminator character[1] so CHR$(1) returns a null string. Code point 212, CHR$(212), translates to the printable " character.
  3. ^ a b Because they are 50% gray rasters, code points 9 and 137 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.
  4. ^ a b c d Not in the Block Elements Unicode block.
  5. ^ 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 Sinclair BASIC tokenizes keywords into single-byte code points.
  6. ^ The raise to a power multi-character operator tokenized into a single-byte code point.

References

  1. ^ a b c Wearmouth, Geoff. "An Assembly Listing of the ROM of the Sinclair ZX80". Archived from the original on August 15, 2015. {{cite web}}: Unknown parameter |deadurl= ignored (|url-status= suggested) (help)
  2. ^ Davenport, Hugo (1980). A Course in BASIC Programming - Sinclair ZX80 Operating Manual. Science of Cambridge Ltd. pp. 75–77.
  3. ^ a b Davenport, Hugo (1980). A Course in BASIC Programming - Sinclair ZX80 Operating Manual. Science of Cambridge Ltd. pp. 116–117.
  4. ^ "8K BASIC ROM UPGRADE".
  5. ^ Sinclair ZX80 Character Set

See also