ZX80 character set

Jump to navigation Jump to search
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[edit]

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[edit]

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[edit]

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.

Character set[edit]

ZX80 character set[1][3][a]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F
0_
0
SP
U+0020
"[b]
U+0022
ZXSpectrum8a.svg
U+258C
ZXSpectrum8c.svg
U+2584
ZXSpectrum82.svg
U+2598
ZXSpectrum81.svg
U+259D
ZXSpectrum88.svg
U+2596
ZXSpectrum84.svg
U+2597
ZXSpectrum89.svg
U+259E
ZX80 character 0x09, ZX81 character 0x08.png[c]
U+2592
ZX80 character 0x0A, ZX81 character 0x09.png[d]
 
ZX80 character 0x0B, ZX81 character 0x0A.png[d]
 
£
U+00A3
$
U+0024
:
U+003A
?
U+003F
1_
16
(
U+0028
)
U+0029
-
U+002D
+
U+002B
*
U+002A
/
U+002F
=
U+003D
>
U+003E
<
U+003C
;
U+003B
,
U+002C
.
U+002E
0
U+0030
1
U+0031
2
U+0032
3
U+0033
2_
32
4
U+0034
5
U+0035
6
U+0036
7
U+0037
8
U+0038
9
U+0039
A
U+0041
B
U+0042
C
U+0043
D
U+0044
E
U+0045
F
U+0046
G
U+0047
H
U+0048
I
U+0049
J
U+004A
3_
48
K
U+004B
L
U+004C
M
U+004D
N
U+004E
O
U+004F
P
U+0050
Q
U+0051
R
U+0052
S
U+0053
T
U+0054
U
U+0055
V
U+0056
W
U+0057
X
U+0058
Y
U+0059
Z
U+005A
4_
64
                               
5_
80
                               
6_
96
                               
7_
112
UP
 
DOWN
 
LEFT
 
RIGHT
 
HOME
 
EDIT
 
newline
 
rubout
 
               
8_
128
ZXSpectrum8f.svg
U+2588
"
 
ZXSpectrum85.svg
U+2590
ZXSpectrum83.svg
U+2580
ZXSpectrum8d.svg
U+259F
ZXSpectrum8e.svg
U+2599
ZXSpectrum87.svg
U+259C
ZXSpectrum8b.svg
U+259B
ZXSpectrum86.svg
U+259A
ZX80 character 0x89, ZX81 character 0x88.png[c]
U+2592
ZX80 character 0x8A, ZX81 character 0x89.png[d]
 
ZX80 character 0x8B, ZX81 character 0x8A.png[d]
 
£
 
$
 
:
 
?
 
9_
144
(
 
)
 
-
 
+
 
*
 
/
 
=
 
>
 
<
 
;
 
,
 
.
 
0
 
1
 
2
 
3
 
A_
160
4
 
5
 
6
 
7
 
8
 
9
 
A
 
B
 
C
 
D
 
E
 
F
 
G
 
H
 
I
 
J
 
B_
176
K
 
L
 
M
 
N
 
O
 
P
 
Q
 
R
 
S
 
T
 
U
 
V
 
W
 
X
 
Y
 
Z
 
C_
192
                               
D_
208
        "[b]
 
THEN[e]
 
TO[e]
 
;
 
,
 
)
 
(
 
NOT[e]
 
-
 
+
 
*
 
/
 
E_
224
AND[e]
 
OR[e]
 
**[f]
 
=
 
>[a]
 
<[a]
 
LIST[e]
 
return[e]
 
CLS[e]
 
DIM[e]
 
SAVE[e]
 
FOR[e]
 
go to[e]
 
POKE[e]
 
input[e]
 
randomise[e]
 
F_
240
LET[e]
 
    NEXT[e]
 
print[e]
 
  NEW[e]
 
RUN[e]
 
STOP[e]
 
continue[e]
 
IF[e]
 
go sub[e]
 
LOAD[e]
 
clear[e]
 
REM[e]
 
 

Notes[edit]

  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[edit]

  1. ^ a b c Wearmouth, Geoff. "An Assembly Listing of the ROM of the Sinclair ZX80". Archived from the original on August 15, 2015.
  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[edit]