Jump to content

ZX81 character set

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Beland (talk | contribs) at 23:11, 22 June 2020 (convert special characters (via WP:JWB)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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

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

Template:Chset-color-ctrl|function
 
Template:Chset-color-undef| Template:Chset-color-undef| Template:Chset-color-undef| Template:Chset-color-undef| Template:Chset-color-ctrl|number
 
Template:Chset-color-ctrl|cursor
 
8_
128
Template:Chset-color-graph|
2588
Template:Chset-color-graph|
259F
Template:Chset-color-graph|
2599
Template:Chset-color-graph|
2584
Template:Chset-color-graph|
259C
Template:Chset-color-graph|
2590
Template:Chset-color-graph|
259A
Template:Chset-color-graph|
2597
Template:Chset-color-graph|[a]
1FB90
Template:Chset-color-graph|
1FB91
Template:Chset-color-graph|
1FB92
Template:Chset-color-punct|"
 
Template:Chset-color-graph|£
 
Template:Chset-color-graph|$
 
Template:Chset-color-punct|:
 
Template:Chset-color-punct|?
 
9_
144
Template:Chset-color-punct|(
 
Template:Chset-color-punct|)
 
Template:Chset-color-graph|>
 
Template:Chset-color-graph|<
 
Template:Chset-color-graph|=
 
Template:Chset-color-graph|+
 
Template:Chset-color-punct|-
 
Template:Chset-color-punct|*
 
Template:Chset-color-punct|/
 
Template:Chset-color-punct|;
 
Template:Chset-color-punct|,
 
Template:Chset-color-punct|.
 
Template:Chset-color-digit|0
 
Template:Chset-color-digit|1
 
Template:Chset-color-digit|2
 
Template:Chset-color-digit|3
 
A_
160
Template:Chset-color-digit|4
 
Template:Chset-color-digit|5
 
Template:Chset-color-digit|6
 
Template:Chset-color-digit|7
 
Template:Chset-color-digit|8
 
Template:Chset-color-digit|9
 
Template:Chset-color-letter|A
 
Template:Chset-color-letter|B
 
Template:Chset-color-letter|C
 
Template:Chset-color-letter|D
 
Template:Chset-color-letter|E
 
Template:Chset-color-letter|F
 
Template:Chset-color-letter|G
 
Template:Chset-color-letter|H
 
Template:Chset-color-letter|I
 
Template:Chset-color-letter|J
 
B_
176
Template:Chset-color-letter|K
 
Template:Chset-color-letter|L
 
Template:Chset-color-letter|M
 
Template:Chset-color-letter|N
 
Template:Chset-color-letter|O
 
Template:Chset-color-letter|P
 
Template:Chset-color-letter|Q
 
Template:Chset-color-letter|R
 
Template:Chset-color-letter|S
 
Template:Chset-color-letter|T
 
Template:Chset-color-letter|U
 
Template:Chset-color-letter|V
 
Template:Chset-color-letter|W
 
Template:Chset-color-letter|X
 
Template:Chset-color-letter|Y
 
Template:Chset-color-letter|Z
 
C_
192
Template:Chset-color-punct|""[b]
 
AT[c]
 
TAB[c]
 
Template:Chset-color-undef| CODE[c]
 
VAL[c]
 
LEN[c]
 
SIN[c]
 
COS[c]
 
TAN[c]
 
ASN[c]
 
ACS[c]
 
ATN[c]
 
LN[c]
 
EXP[c]
 
INT[c]
 
D_
208
SQR[c]
 
SGN[c]
 
ABS[c]
 
PEEK[c]
 
USR[c]
 
STR$[c]
 
CHR$[c]
 
NOT[c]
 
Template:Chset-color-punct|**[d]
 
OR[c]
 
AND[c]
 
Template:Chset-color-punct|<=[e]
 
Template:Chset-color-punct|>=[f]
 
Template:Chset-color-punct|<>[g]
 
THEN[c]
 
TO[c]
 
E_
224
STEP[c]
 
lprint[c]
 
llist[c]
 
STOP[c]
 
SLOW[c]
 
FAST[c]
 
NEW[c]
 
scroll[c]
 
CONT[c]
 
DIM[c]
 
REM[c]
 
FOR[c]
 
GOTO[c]
 
gosub[c]
 
input[c]
 
LOAD[c]
 
F_
240
LIST[c]
 
LET[c]
 
pause[c]
 
NEXT[c]
 
POKE[c]
 
print[c]
 
PLOT[c]
 
RUN[c]
 
SAVE[c]
 
RAND[c]
 
IF[c]
 
CLS[c]
 
unplot[c]
 
clear[c]
 
return[c]
 
COPY[c]
 

  Letter  Number  Punctuation  Symbol  Other  Undefined

See also

Notes

  1. ^ a b Because they are 50% gray rasters, code points 8 and 136 have the same appearance although every pixel is inverted.
  2. ^ 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]
  3. ^ 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.
  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. ^ 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.