ZX81 character set

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.

The Sinclair ZX81 character set rendered in the system font.

Printable characters

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

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]

On a graphical representation the characters are printed with 8 pixels width (and height), but letters and numbers for the ZX81 are a bit narrower, spanning usually on 6 horizontal pixels instead of the 7 used in the ZX80, leaving 2 white vertical pixels stripes between one character and the other.

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 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

ZX81 character set[1][3]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F
0_
0
SP
0020

2598

259D

2580

2596

258C

259E

259B
[lower-alpha 1]
2592

1FB8F

1FB8E
"[lower-alpha 2]
0022
£
00A3
$
0024
:
003A
?
003F
1_
16
(
0028
)
0029
>
003E
<
003C
=
003D
+
002B
-
002D
*
002A
/
002F
;
003B
,
002C
.
002E
0
0030
1
0031
2
0032
3
0033
2_
32
4
0034
5
0035
6
0036
7
0037
8
0038
9
0039
A
0041
B
0042
C
0043
D
0044
E
0045
F
0046
G
0047
H
0048
I
0049
J
004A
3_
48
K
004B
L
004C
M
004D
N
004E
O
004F
P
0050
Q
0051
R
0052
S
0053
T
0054
U
0055
V
0056
W
0057
X
0058
Y
0059
Z
005A
4_
64
RND[lower-alpha 3]
 
inkey$[lower-alpha 3]
 
PI[lower-alpha 3]
 
5_
80
6_
96
7_
112
UP
 
DOWN
 
LEFT
 
RIGHT
 
graphics
 
EDIT
 
newline
 
rubout
 
K/L
mode

function
 
number
 
cursor
 
8_
128

2588

259F

2599

2584

259C

2590

259A

2597
[lower-alpha 1]
1FB90

1FB91

1FB92
"
 
£
 
$
 
:
 
?
 
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
""[lower-alpha 2]
 
AT[lower-alpha 3]
 
TAB[lower-alpha 3]
 
CODE[lower-alpha 3]
 
VAL[lower-alpha 3]
 
LEN[lower-alpha 3]
 
SIN[lower-alpha 3]
 
COS[lower-alpha 3]
 
TAN[lower-alpha 3]
 
ASN[lower-alpha 3]
 
ACS[lower-alpha 3]
 
ATN[lower-alpha 3]
 
LN[lower-alpha 3]
 
EXP[lower-alpha 3]
 
INT[lower-alpha 3]
 
D_
208
SQR[lower-alpha 3]
 
SGN[lower-alpha 3]
 
ABS[lower-alpha 3]
 
PEEK[lower-alpha 3]
 
USR[lower-alpha 3]
 
STR$[lower-alpha 3]
 
CHR$[lower-alpha 3]
 
NOT[lower-alpha 3]
 
**[lower-alpha 4]
 
OR[lower-alpha 3]
 
AND[lower-alpha 3]
 
<=[lower-alpha 5]
 
>=[lower-alpha 6]
 
<>[lower-alpha 7]
 
THEN[lower-alpha 3]
 
TO[lower-alpha 3]
 
E_
224
STEP[lower-alpha 3]
 
lprint[lower-alpha 3]
 
llist[lower-alpha 3]
 
STOP[lower-alpha 3]
 
SLOW[lower-alpha 3]
 
FAST[lower-alpha 3]
 
NEW[lower-alpha 3]
 
scroll[lower-alpha 3]
 
CONT[lower-alpha 3]
 
DIM[lower-alpha 3]
 
REM[lower-alpha 3]
 
FOR[lower-alpha 3]
 
GOTO[lower-alpha 3]
 
gosub[lower-alpha 3]
 
input[lower-alpha 3]
 
LOAD[lower-alpha 3]
 
F_
240
LIST[lower-alpha 3]
 
LET[lower-alpha 3]
 
pause[lower-alpha 3]
 
NEXT[lower-alpha 3]
 
POKE[lower-alpha 3]
 
print[lower-alpha 3]
 
PLOT[lower-alpha 3]
 
RUN[lower-alpha 3]
 
SAVE[lower-alpha 3]
 
RAND[lower-alpha 3]
 
IF[lower-alpha 3]
 
CLS[lower-alpha 3]
 
unplot[lower-alpha 3]
 
clear[lower-alpha 3]
 
return[lower-alpha 3]
 
COPY[lower-alpha 3]
 

  Letter  Number  Punctuation  Symbol  Other  Undefined

See also

Notes

  1. Because they are 50% gray rasters, code points 8 and 136 have the same appearance although every pixel is inverted.
  2. 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]
  3. Sinclair BASIC tokenizes keywords into single-byte code points.
  4. The raise to a power multi-character operator tokenized into a single-byte code point.
  5. The greater than or equal to multi-character operator tokenized into a single-byte code point.
  6. The less than or equal to multi-character operator tokenized into a single-byte code point.
  7. The not equal sign multi-character operator tokenized into a single-byte code point.

References

  1. 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.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.