Skip to content

Sinclair BASIC escape codes ​

Every escape that can be typed in ZX81 or Spectrum source, and the byte it stores. The three machines share a BASIC and not a character set, so each row is badged with the machines it belongs to and no code here is common to all of them. Filters can be prefilled with ?q= and ?cat= query parameters.

On the ZX81 ​

The ZX81 charset applies everywhere in a line — block-graphics escapes, %c inverse video and raw \{NN} bytes work in strings, REM bodies and expressions alike.

On the Spectrums ​

Escapes are recognised inside string literals and REM bodies (48K and 128K — differences are tagged), and the control and UDG forms are also accepted in expressions so imported listings with embedded control bytes re-tokenize byte-exactly. A {...} that is not a recognised directive stays literal text.

See also the Sinclair BASIC reference and file formats.

Description
{=$HHHHHHHHHH}Spectrum only0x0E + 5-byte formRaw form of a numeric override whose 5 stored bytes are not the canonical encoding of any decimal value.
{=n}Spectrum only0x0E + 5-byte formNumeric override after a literal: the hidden 5-byte form stored with the printed digits encodes n instead (protection tricks, e.g. 30 GO TO 20{=9999}). Emitted on import when the stored form disagrees with the digits.
\' parse-onlyZX81 only
also: ▘
0x01Top-left quarter block.
\ 'parse-onlyZX81 only
also: ▝
0x02Top-right quarter block.
\''parse-onlyZX81 only
also: ▀
0x03Top half block.
\. parse-onlyZX81 only
also: ▖
0x04Bottom-left quarter block.
\: parse-onlyZX81 only
also: ▌
0x05Left half block.
\.'parse-onlyZX81 only
also: ▞
0x06Bottom-left and top-right quarters.
\:'parse-onlyZX81 only
also: ▛
0x07All quarters except bottom-right.
\!!parse-onlyZX81 only
also: ▒
0x08Grey (chequerboard) block.
\!.parse-onlyZX81 only
also: 🮏
0x09Grey lower half.
\!'parse-onlyZX81 only
also: 🮎
0x0AGrey upper half.
{INK n}Spectrum only0x10 nEmbedded INK control: sets the text colour (n = 0–9) from this point in the string.
{PAPER n}Spectrum only0x11 nEmbedded PAPER control: sets the background colour (n = 0–9).
{FLASH n}Spectrum only0x12 nEmbedded FLASH control: n = 1 flashing, 0 steady.
{BRIGHT n}Spectrum only0x13 nEmbedded BRIGHT control: n = 1 bright, 0 normal.
{INVERSE n}Spectrum only0x14 nEmbedded INVERSE control: n = 1 inverse video, 0 normal.
{OVER n}Spectrum only0x15 nEmbedded OVER control: n = 1 overprint mode, 0 normal.
{AT r,c}Spectrum only0x16 r cEmbedded AT control: moves the print position to row r, column c.
{TAB n}Spectrum only0x17 n 0x00Embedded TAB control: moves the print position to column n (stored as a 16-bit little-endian operand).
\\Spectrum only0x5CA literal backslash (needed because a lone backslash opens a UDG escape).
\{NN}ZX81 onlyanyAny raw byte as two hex digits - keyword tokens inside strings, control codes (e.g. \{76} NEWLINE), trailing REM spaces (\{00}) and every other byte with no printable form.
{0xNN}Spectrum onlyanyAny raw byte as two hex digits - unassigned control codes, 0x80, keyword-token bytes inside strings and a control directive with its operands truncated. A {...} that is not a recognised directive stays literal text.
\::parse-onlyZX81 only
also: █
0x80Full block (inverse space).
\.:parse-onlyZX81 only
also: ▟
0x81All quarters except top-left.
\:.parse-onlyZX81 only
also: ▙
0x82All quarters except top-right.
\..parse-onlyZX81 only
also: ▄
0x83Bottom half block.
\':parse-onlyZX81 only
also: ▜
0x84All quarters except bottom-left.
\ :parse-onlyZX81 only
also: ▐
0x85Right half block.
\'.parse-onlyZX81 only
also: ▚
0x86Top-left and bottom-right quarters.
\ .parse-onlyZX81 only
also: ▗
0x87Bottom-right quarter block.
\||parse-onlyZX81 only
also: 🮐
0x88Inverse grey block.
\|.parse-onlyZX81 only
also: 🮑
0x89Solid upper half over inverse grey lower half.
\|'parse-onlyZX81 only
also: 🮒
0x8AInverse grey upper half over solid lower half.
\{=$HHHHHHHHHH}ZX81 only0x7E + 5-byte floatRaw form of a numeric override whose 5 stored bytes are not the canonical encoding of any decimal value.
\{=n}ZX81 only0x7E + 5-byte floatNumeric override after a literal: the hidden 5-byte float stored with the printed digits encodes n instead (protection tricks, e.g. 20\{=9999}). Emitted on import when the stored float disagrees with the digits.
\aparse-onlySpectrum only
also: 🄰
0x90User-defined graphic A (CHR$ 144), written 🄰.
\bparse-onlySpectrum only
also: 🄱
0x91User-defined graphic B (CHR$ 145), written 🄱.
\cparse-onlySpectrum only
also: 🄲
0x92User-defined graphic C (CHR$ 146), written 🄲.
\dparse-onlySpectrum only
also: 🄳
0x93User-defined graphic D (CHR$ 147), written 🄳.
\eparse-onlySpectrum only
also: 🄴
0x94User-defined graphic E (CHR$ 148), written 🄴.
\fparse-onlySpectrum only
also: 🄵
0x95User-defined graphic F (CHR$ 149), written 🄵.
\gparse-onlySpectrum only
also: 🄶
0x96User-defined graphic G (CHR$ 150), written 🄶.
\hparse-onlySpectrum only
also: 🄷
0x97User-defined graphic H (CHR$ 151), written 🄷.
\iparse-onlySpectrum only
also: 🄸
0x98User-defined graphic I (CHR$ 152), written 🄸.
\jparse-onlySpectrum only
also: 🄹
0x99User-defined graphic J (CHR$ 153), written 🄹.
\kparse-onlySpectrum only
also: 🄺
0x9AUser-defined graphic K (CHR$ 154), written 🄺.
\lparse-onlySpectrum only
also: 🄻
0x9BUser-defined graphic L (CHR$ 155), written 🄻.
\mparse-onlySpectrum only
also: 🄼
0x9CUser-defined graphic M (CHR$ 156), written 🄼.
\nparse-onlySpectrum only
also: 🄽
0x9DUser-defined graphic N (CHR$ 157), written 🄽.
\oparse-onlySpectrum only
also: 🄾
0x9EUser-defined graphic O (CHR$ 158), written 🄾.
\pparse-onlySpectrum only
also: 🄿
0x9FUser-defined graphic P (CHR$ 159), written 🄿.
\qparse-onlySpectrum only
also: 🅀
0xA0User-defined graphic Q (CHR$ 160), written 🅀.
\rparse-onlySpectrum only
also: 🅁
0xA1User-defined graphic R (CHR$ 161), written 🅁.
\sparse-onlySpectrum only
also: 🅂
0xA2User-defined graphic S (CHR$ 162), written 🅂.
\tparse-only48K only
also: 🅃
0xA3User-defined graphic T (CHR$ 163), written 🅃. On the 128K this byte is the SPECTRUM token, not a UDG - the tokenizer warns (non-fatally).
\uparse-only48K only
also: 🅄
0xA4User-defined graphic U (CHR$ 164), written 🅄. On the 128K this byte is the PLAY token, not a UDG - the tokenizer warns (non-fatally).
%cZX81 only0x8B–0xBFInverse video: % before a letter, digit or punctuation character stores its inverse-video code, e.g. %A is inverse A.

Showing 58 of 58 escape codes

Released under GNU GPL v3.0. Some ROM images are third-party copyrighted works, separate to this project, strictly for personal/educational purposes.