ZX80 character set

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Beland (talk | contribs) at 23:10, 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 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.

Character set

ZX80 character set[1][3][a]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F
0_
0
Template:Chset-color-misc|SP
U+0020
Template:Chset-color-punct|"[b]
U+0022
Template:Chset-color-graph|
U+258C
Template:Chset-color-graph|
U+2584
Template:Chset-color-graph|
U+2598
Template:Chset-color-graph|
U+259D
Template:Chset-color-graph|
U+2596
Template:Chset-color-graph|
U+2597
Template:Chset-color-graph|
U+259E
Template:Chset-color-graph|[c]
U+2592
Template:Chset-color-graph|
U+1FB8F
Template:Chset-color-graph|
U+1FB8E
Template:Chset-color-graph|£
U+00A3
Template:Chset-color-graph|$
U+0024
Template:Chset-color-punct|:
U+003A
Template:Chset-color-punct|?
U+003F
1_
16
Template:Chset-color-punct|(
U+0028
Template:Chset-color-punct|)
U+0029
Template:Chset-color-punct|-
U+002D
Template:Chset-color-graph|+
U+002B
Template:Chset-color-punct|*
U+002A
Template:Chset-color-punct|/
U+002F
Template:Chset-color-graph|=
U+003D
Template:Chset-color-graph|>
U+003E
Template:Chset-color-graph|<
U+003C
Template:Chset-color-punct|;
U+003B
Template:Chset-color-punct|,
U+002C
Template:Chset-color-punct|.
U+002E
Template:Chset-color-digit|0
U+0030
Template:Chset-color-digit|1
U+0031
Template:Chset-color-digit|2
U+0032
Template:Chset-color-digit|3
U+0033
2_
32
Template:Chset-color-digit|4
U+0034
Template:Chset-color-digit|5
U+0035
Template:Chset-color-digit|6
U+0036
Template:Chset-color-digit|7
U+0037
Template:Chset-color-digit|8
U+0038
Template:Chset-color-digit|9
U+0039
Template:Chset-color-letter|A
U+0041
Template:Chset-color-letter|B
U+0042
Template:Chset-color-letter|C
U+0043
Template:Chset-color-letter|D
U+0044
Template:Chset-color-letter|E
U+0045
Template:Chset-color-letter|F
U+0046
Template:Chset-color-letter|G
U+0047
Template:Chset-color-letter|H
U+0048
Template:Chset-color-letter|I
U+0049
Template:Chset-color-letter|J
U+004A
3_
48
Template:Chset-color-letter|K
U+004B
Template:Chset-color-letter|L
U+004C
Template:Chset-color-letter|M
U+004D
Template:Chset-color-letter|N
U+004E
Template:Chset-color-letter|O
U+004F
Template:Chset-color-letter|P
U+0050
Template:Chset-color-letter|Q
U+0051
Template:Chset-color-letter|R
U+0052
Template:Chset-color-letter|S
U+0053
Template:Chset-color-letter|T
U+0054
Template:Chset-color-letter|U
U+0055
Template:Chset-color-letter|V
U+0056
Template:Chset-color-letter|W
U+0057
Template:Chset-color-letter|X
U+0058
Template:Chset-color-letter|Y
U+0059
Template:Chset-color-letter|Z
U+005A
4_
64
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_
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|HOME
 
Template:Chset-color-ctrl|EDIT
 
Template:Chset-color-ctrl|newline
 
Template:Chset-color-ctrl|rubout
 
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_
128
Template:Chset-color-graph|
U+2588
Template:Chset-color-punct|"
 
Template:Chset-color-graph|
U+2590
Template:Chset-color-graph|
U+2580
Template:Chset-color-graph|
U+259F
Template:Chset-color-graph|
U+2599
Template:Chset-color-graph|
U+259C
Template:Chset-color-graph|
U+259B
Template:Chset-color-graph|
U+259A
Template:Chset-color-graph|[c]
U+1FB90
Template:Chset-color-graph|
U+1FB91
Template:Chset-color-graph|
U+1FB92
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-punct|-
 
Template:Chset-color-graph|+
 
Template:Chset-color-punct|*
 
Template:Chset-color-punct|/
 
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-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-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_
208
Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-undef Template:Chset-color-punct|"[b]
 
THEN[d]
 
TO[d]
 
Template:Chset-color-punct|;
 
Template:Chset-color-punct|,
 
Template:Chset-color-punct|)
 
Template:Chset-color-punct|(
 
NOT[d]
 
Template:Chset-color-punct|-
 
Template:Chset-color-punct|+
 
Template:Chset-color-punct|*
 
Template:Chset-color-punct|/
 
E_
224
AND[d]
 
OR[d]
 
Template:Chset-color-punct|**[e]
 
Template:Chset-color-punct|=
 
Template:Chset-color-punct|>[a]
 
Template:Chset-color-punct|<[a]
 
LIST[d]
 
return[d]
 
CLS[d]
 
DIM[d]
 
SAVE[d]
 
FOR[d]
 
go to[d]
 
POKE[d]
 
input[d]
 
randomise[d]
 
F_
240
LET[d]
 
Template:Chset-color-undef Template:Chset-color-undef NEXT[d]
 
print[d]
 
Template:Chset-color-undef NEW[d]
 
RUN[d]
 
STOP[d]
 
continue[d]
 
IF[d]
 
go sub[d]
 
LOAD[d]
 
clear[d]
 
REM[d]
 
Template:Chset-color-undef

  Letter  Number  Punctuation  Symbol  Other  Undefined

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

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