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 only | 0x0E + 5-byte form | Raw form of a numeric override whose 5 stored bytes are not the canonical encoding of any decimal value. |
{=n}Spectrum only | 0x0E + 5-byte form | Numeric 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: ▘ | 0x01 | Top-left quarter block. |
\ 'parse-onlyZX81 only also: ▝ | 0x02 | Top-right quarter block. |
\''parse-onlyZX81 only also: ▀ | 0x03 | Top half block. |
\. parse-onlyZX81 only also: ▖ | 0x04 | Bottom-left quarter block. |
\: parse-onlyZX81 only also: ▌ | 0x05 | Left half block. |
\.'parse-onlyZX81 only also: ▞ | 0x06 | Bottom-left and top-right quarters. |
\:'parse-onlyZX81 only also: ▛ | 0x07 | All quarters except bottom-right. |
\!!parse-onlyZX81 only also: ▒ | 0x08 | Grey (chequerboard) block. |
\!.parse-onlyZX81 only also: 🮏 | 0x09 | Grey lower half. |
\!'parse-onlyZX81 only also: 🮎 | 0x0A | Grey upper half. |
{INK n}Spectrum only | 0x10 n | Embedded INK control: sets the text colour (n = 0–9) from this point in the string. |
{PAPER n}Spectrum only | 0x11 n | Embedded PAPER control: sets the background colour (n = 0–9). |
{FLASH n}Spectrum only | 0x12 n | Embedded FLASH control: n = 1 flashing, 0 steady. |
{BRIGHT n}Spectrum only | 0x13 n | Embedded BRIGHT control: n = 1 bright, 0 normal. |
{INVERSE n}Spectrum only | 0x14 n | Embedded INVERSE control: n = 1 inverse video, 0 normal. |
{OVER n}Spectrum only | 0x15 n | Embedded OVER control: n = 1 overprint mode, 0 normal. |
{AT r,c}Spectrum only | 0x16 r c | Embedded AT control: moves the print position to row r, column c. |
{TAB n}Spectrum only | 0x17 n 0x00 | Embedded TAB control: moves the print position to column n (stored as a 16-bit little-endian operand). |
\\Spectrum only | 0x5C | A literal backslash (needed because a lone backslash opens a UDG escape). |
\{NN}ZX81 only | any | Any 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 only | any | Any 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: █ | 0x80 | Full block (inverse space). |
\.:parse-onlyZX81 only also: ▟ | 0x81 | All quarters except top-left. |
\:.parse-onlyZX81 only also: ▙ | 0x82 | All quarters except top-right. |
\..parse-onlyZX81 only also: ▄ | 0x83 | Bottom half block. |
\':parse-onlyZX81 only also: ▜ | 0x84 | All quarters except bottom-left. |
\ :parse-onlyZX81 only also: ▐ | 0x85 | Right half block. |
\'.parse-onlyZX81 only also: ▚ | 0x86 | Top-left and bottom-right quarters. |
\ .parse-onlyZX81 only also: ▗ | 0x87 | Bottom-right quarter block. |
\||parse-onlyZX81 only also: 🮐 | 0x88 | Inverse grey block. |
\|.parse-onlyZX81 only also: 🮑 | 0x89 | Solid upper half over inverse grey lower half. |
\|'parse-onlyZX81 only also: 🮒 | 0x8A | Inverse grey upper half over solid lower half. |
\{=$HHHHHHHHHH}ZX81 only | 0x7E + 5-byte float | Raw form of a numeric override whose 5 stored bytes are not the canonical encoding of any decimal value. |
\{=n}ZX81 only | 0x7E + 5-byte float | Numeric 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: 🄰 | 0x90 | User-defined graphic A (CHR$ 144), written 🄰. |
\bparse-onlySpectrum only also: 🄱 | 0x91 | User-defined graphic B (CHR$ 145), written 🄱. |
\cparse-onlySpectrum only also: 🄲 | 0x92 | User-defined graphic C (CHR$ 146), written 🄲. |
\dparse-onlySpectrum only also: 🄳 | 0x93 | User-defined graphic D (CHR$ 147), written 🄳. |
\eparse-onlySpectrum only also: 🄴 | 0x94 | User-defined graphic E (CHR$ 148), written 🄴. |
\fparse-onlySpectrum only also: 🄵 | 0x95 | User-defined graphic F (CHR$ 149), written 🄵. |
\gparse-onlySpectrum only also: 🄶 | 0x96 | User-defined graphic G (CHR$ 150), written 🄶. |
\hparse-onlySpectrum only also: 🄷 | 0x97 | User-defined graphic H (CHR$ 151), written 🄷. |
\iparse-onlySpectrum only also: 🄸 | 0x98 | User-defined graphic I (CHR$ 152), written 🄸. |
\jparse-onlySpectrum only also: 🄹 | 0x99 | User-defined graphic J (CHR$ 153), written 🄹. |
\kparse-onlySpectrum only also: 🄺 | 0x9A | User-defined graphic K (CHR$ 154), written 🄺. |
\lparse-onlySpectrum only also: 🄻 | 0x9B | User-defined graphic L (CHR$ 155), written 🄻. |
\mparse-onlySpectrum only also: 🄼 | 0x9C | User-defined graphic M (CHR$ 156), written 🄼. |
\nparse-onlySpectrum only also: 🄽 | 0x9D | User-defined graphic N (CHR$ 157), written 🄽. |
\oparse-onlySpectrum only also: 🄾 | 0x9E | User-defined graphic O (CHR$ 158), written 🄾. |
\pparse-onlySpectrum only also: 🄿 | 0x9F | User-defined graphic P (CHR$ 159), written 🄿. |
\qparse-onlySpectrum only also: 🅀 | 0xA0 | User-defined graphic Q (CHR$ 160), written 🅀. |
\rparse-onlySpectrum only also: 🅁 | 0xA1 | User-defined graphic R (CHR$ 161), written 🅁. |
\sparse-onlySpectrum only also: 🅂 | 0xA2 | User-defined graphic S (CHR$ 162), written 🅂. |
\tparse-only48K only also: 🅃 | 0xA3 | User-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: 🅄 | 0xA4 | User-defined graphic U (CHR$ 164), written 🅄. On the 128K this byte is the PLAY token, not a UDG - the tokenizer warns (non-fatally). |
%cZX81 only | 0x8B–0xBF | Inverse 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