Commodore PETSCII escape codes
Every escape that can be typed in Commodore source, and the PETSCII byte it stores. PETSCII is shared byte-for-byte across the whole Commodore 8-bit line, so this table is the escape reference for the Commodore 64, the VIC-20 and the PET alike. Escapes are recognised in string literals, REM and DATA bodies. Filters can be prefilled with ?q= and ?cat= query parameters.
Colour on a monochrome machine
The colour-control escapes ({red}, {cyan}…) drive the colour display on the C64 and VIC-20. On the monochrome PET they store and round-trip identically but have no visible effect.
The lower-case display bank is not yet modelled, so a program that switches to it shows the upper-case/graphics shapes instead.
petcat and VICE aliases
Canonical names follow this app's decode. The petcat/VICE aliases — {wht}, {rvof}, decimal {147}, {CBM-x}/{SHIFT-x} — are accepted on input, so archived petcat listings paste straight in. They are accepted, never produced: a listing exported from here uses the canonical name.
In a {CBM-x}/{SHIFT-x} name, x is whatever the keycap says, so the symbol keys work as well as the letters — {SHIFT-*} is the horizontal line and {CBM-+} the chequerboard.
Where a code is spelled several ways in the wild the alternatives are accepted too, spaces and all: reverse video takes {rvon}, {rvson} or {rvs on}, and {rvoff}, {rvof}, {rvsoff} or {rvs off}.
Shifted-letter keyword abbreviations
pO for POKE and goS for GOSUB tokenize as they do on the machine and list back in full. The {SHIFT-x} escape spells the shifted letter where the plain capital would be ambiguous.
See also the Commodore BASIC reference and file formats.
| Description | ||
|---|---|---|
{stop} | 0x03 | The STOP key code (CHR$ 3). |
{white} also: {wht} | 0x05 | Text colour white (CHR$ 5). |
{dishift} | 0x08 | Disable SHIFT+C= case switching (CHR$ 8). |
{enshift} | 0x09 | Enable SHIFT+C= case switching (CHR$ 9). |
{cr} | 0x0D | Carriage return (CHR$ 13). |
{lower} also: {swlc} | 0x0E | Switch the display to the lower-case / upper-case character set (CHR$ 14). |
{down} | 0x11 | Cursor down one row (CHR$ 17). |
{rvon} also: {rvson}{rvs on} | 0x12 | Reverse video on: characters print with their foreground and background swapped from here to the end of the line, or until reverse video is turned off (CHR$ 18). |
{home} | 0x13 | Cursor home - top-left of the screen (CHR$ 19). |
{del} | 0x14 | Delete the character before the cursor (CHR$ 20). |
{red} | 0x1C | Text colour red (CHR$ 28). |
{right} also: {rght} | 0x1D | Cursor right one column (CHR$ 29). |
{green} also: {grn} | 0x1E | Text colour green (CHR$ 30). |
{blue} also: {blu} | 0x1F | Text colour blue (CHR$ 31). |
{space}parse-only | 0x20 | An ordinary space (CHR$ 32), petcat spelling. |
{$xx} | any | Any raw byte as one or two hex digits - unassigned control codes, the shifted-bank text range $60-$7F, $E0-$FE and the hardware-duplicate glyph codes ($AA, $B4, $C3, $DD, $DE). The lower-case display bank is not yet modelled. |
{orange} also: {orng} | 0x81 | Text colour orange (CHR$ 129). |
{f1} | 0x85 | Function key f1 (CHR$ 133). |
{f3} | 0x86 | Function key f3 (CHR$ 134). |
{f5} | 0x87 | Function key f5 (CHR$ 135). |
{f7} | 0x88 | Function key f7 (CHR$ 136). |
{f2} | 0x89 | Function key f2 (CHR$ 137). |
{f4} | 0x8A | Function key f4 (CHR$ 138). |
{f6} | 0x8B | Function key f6 (CHR$ 139). |
{f8} | 0x8C | Function key f8 (CHR$ 140). |
{shift-cr} also: {sret} | 0x8D | Shifted return (CHR$ 141): moves to the next line without executing it. |
{upper} also: {swuc} | 0x8E | Switch the display to the upper-case / graphics character set (CHR$ 142). |
{black} also: {blk} | 0x90 | Text colour black (CHR$ 144). |
{up} | 0x91 | Cursor up one row (CHR$ 145). |
{rvoff} also: {rvof}{rvsoff}{rvs off} | 0x92 | Reverse video off: characters print normally again (CHR$ 146). |
{clr} | 0x93 | Clear the screen and home the cursor (CHR$ 147). |
{inst} | 0x94 | Insert a space at the cursor (CHR$ 148). |
{brown} also: {brn} | 0x95 | Text colour brown (CHR$ 149). |
{pink} also: {lred} | 0x96 | Text colour pink / light red (CHR$ 150). |
{grey1} also: {gry1} | 0x97 | Text colour dark grey (CHR$ 151). |
{grey2} also: {gry2} | 0x98 | Text colour medium grey (CHR$ 152). |
{lgreen} also: {lgrn} | 0x99 | Text colour light green (CHR$ 153). |
{lblue} also: {lblu} | 0x9A | Text colour light blue (CHR$ 154). |
{grey3} also: {gry3} | 0x9B | Text colour light grey (CHR$ 155). |
{purple} also: {pur} | 0x9C | Text colour purple (CHR$ 156). |
{left} | 0x9D | Cursor left one column (CHR$ 157). |
{yellow} also: {yel} | 0x9E | Text colour yellow (CHR$ 158). |
{cyan} also: {cyn} | 0x9F | Text colour cyan (CHR$ 159). |
{shift-space} | 0xA0 | Shifted space (CHR$ 160): displays as a space but is a distinct code. |
{CBM-k}parse-only | 0xA1 | Block graphic on the C= face of the K key (▌). |
{CBM-i}parse-only | 0xA2 | Block graphic on the C= face of the I key (▄). |
{CBM-t}parse-only | 0xA3 | Block graphic on the C= face of the T key (▔). |
{nnn}parse-only | any | Any raw byte as a decimal code 0-255 (petcat/VICE spelling), e.g. {147} for {clr}. |
{CBM-@}parse-only | 0xA4 | Block graphic on the C= face of the @ key (▁). |
{CBM-g}parse-only | 0xA5 | Block graphic on the C= face of the G key (▎). |
{CBM-+}parse-only | 0xA6 | Block graphic on the C= face of the + key (▒). |
{CBM-m}parse-only | 0xA7 | Block graphic on the C= face of the M key (▕). |
{CBM-£}parse-only | 0xA8 | Block graphic on the C= face of the £ key (🮏). |
{SHIFT-£}parse-only | 0xA9 | Graphic on the SHIFT face of the £ key (◤). |
{CBM-n}parse-only | 0xAA | Block graphic on the C= face of the N key (▕). This code is a hardware duplicate glyph, so it decodes back as a raw {$aa} escape. |
{CBM-q}parse-only | 0xAB | Block graphic on the C= face of the Q key (├). |
{CBM-d}parse-only | 0xAC | Block graphic on the C= face of the D key (▗). |
{CBM-z}parse-only | 0xAD | Block graphic on the C= face of the Z key (└). |
{CBM-s}parse-only | 0xAE | Block graphic on the C= face of the S key (┐). |
{CBM-p}parse-only | 0xAF | Block graphic on the C= face of the P key (▂). |
{CBM-a}parse-only | 0xB0 | Block graphic on the C= face of the A key (┌). |
{CBM-e}parse-only | 0xB1 | Block graphic on the C= face of the E key (┴). |
{CBM-r}parse-only | 0xB2 | Block graphic on the C= face of the R key (┬). |
{CBM-w}parse-only | 0xB3 | Block graphic on the C= face of the W key (┤). |
{CBM-h}parse-only | 0xB4 | Block graphic on the C= face of the H key (▎). This code is a hardware duplicate glyph, so it decodes back as a raw {$b4} escape. |
{CBM-j}parse-only | 0xB5 | Block graphic on the C= face of the J key (▍). |
{CBM-l}parse-only | 0xB6 | Block graphic on the C= face of the L key (🮈). |
{CBM-y}parse-only | 0xB7 | Block graphic on the C= face of the Y key (🮂). |
{CBM-u}parse-only | 0xB8 | Block graphic on the C= face of the U key (🮃). |
{CBM-o}parse-only | 0xB9 | Block graphic on the C= face of the O key (▃). |
{SHIFT-@}parse-only | 0xBA | Graphic on the SHIFT face of the @ key (⌟). |
{CBM-f}parse-only | 0xBB | Block graphic on the C= face of the F key (▖). |
{CBM-c}parse-only | 0xBC | Block graphic on the C= face of the C key (▝). |
{CBM-x}parse-only | 0xBD | Block graphic on the C= face of the X key (┘). |
{CBM-v}parse-only | 0xBE | Block graphic on the C= face of the V key (▘). |
{CBM-b}parse-only | 0xBF | Block graphic on the C= face of the B key (▚). |
{SHIFT-*}parse-only | 0xC0 | Graphic on the SHIFT face of the * key (─). |
{SHIFT-a}parse-only | 0xC1 | Graphic on the SHIFT face of the A key (♠). |
{SHIFT-b}parse-only | 0xC2 | Graphic on the SHIFT face of the B key (│). |
{SHIFT-c}parse-only | 0xC3 | Graphic on the SHIFT face of the C key (─). This code is a hardware duplicate glyph, so it decodes back as a raw {$c3} escape. |
{SHIFT-d}parse-only | 0xC4 | Graphic on the SHIFT face of the D key (🭷). |
{SHIFT-e}parse-only | 0xC5 | Graphic on the SHIFT face of the E key (🭶). |
{SHIFT-f}parse-only | 0xC6 | Graphic on the SHIFT face of the F key (🭹). |
{SHIFT-g}parse-only | 0xC7 | Graphic on the SHIFT face of the G key (🭱). |
{SHIFT-h}parse-only | 0xC8 | Graphic on the SHIFT face of the H key (🭳). |
{SHIFT-i}parse-only | 0xC9 | Graphic on the SHIFT face of the I key (╮). |
{SHIFT-j}parse-only | 0xCA | Graphic on the SHIFT face of the J key (╰). |
{SHIFT-k}parse-only | 0xCB | Graphic on the SHIFT face of the K key (╯). |
{SHIFT-l}parse-only | 0xCC | Graphic on the SHIFT face of the L key (⌞). |
{SHIFT-m}parse-only | 0xCD | Graphic on the SHIFT face of the M key (╲). |
{SHIFT-n}parse-only | 0xCE | Graphic on the SHIFT face of the N key (╱). |
{SHIFT-o}parse-only | 0xCF | Graphic on the SHIFT face of the O key (⌜). |
{SHIFT-p}parse-only | 0xD0 | Graphic on the SHIFT face of the P key (⌝). |
{SHIFT-q}parse-only | 0xD1 | Graphic on the SHIFT face of the Q key (●). |
{SHIFT-r}parse-only | 0xD2 | Graphic on the SHIFT face of the R key (_). |
{SHIFT-s}parse-only | 0xD3 | Graphic on the SHIFT face of the S key (♥). |
{SHIFT-t}parse-only | 0xD4 | Graphic on the SHIFT face of the T key (🭰). |
{SHIFT-u}parse-only | 0xD5 | Graphic on the SHIFT face of the U key (╭). |
{SHIFT-v}parse-only | 0xD6 | Graphic on the SHIFT face of the V key (╳). |
{SHIFT-w}parse-only | 0xD7 | Graphic on the SHIFT face of the W key (○). |
{SHIFT-x}parse-only | 0xD8 | Graphic on the SHIFT face of the X key (♣). |
{SHIFT-y}parse-only | 0xD9 | Graphic on the SHIFT face of the Y key (🭴). |
{SHIFT-z}parse-only | 0xDA | Graphic on the SHIFT face of the Z key (♦). |
{SHIFT-+}parse-only | 0xDB | Graphic on the SHIFT face of the + key (┼). |
{CBM--}parse-only | 0xDC | Block graphic on the C= face of the - key (🮌). |
{SHIFT--}parse-only | 0xDD | Graphic on the SHIFT face of the - key (│). This code is a hardware duplicate glyph, so it decodes back as a raw {$dd} escape. |
{CBM-*}parse-only | 0xDF | Block graphic on the C= face of the * key (◥). |
{SHIFT-↑}parse-only | 0xFF | Pi (CHR$ 255), on the SHIFT face of the ↑ key (π). |
Showing 108 of 108 escape codes