PETSCII
PETSCII (PET Standard Code of Information Interchange), also known as CBM ASCII, is the character set used in Commodore Business Machines' 8-bit home computers, starting with the PET from 1977 and including the CBM-II, VIC-20, Commodore 64, Commodore 16, Commodore 116, Plus/4, and Commodore 128.
![]() PETSCII (shifted and unshifted) | |
Language(s) | English with pseudographics |
---|---|
Classification | 8-bit extended early ASCII |
Based on | US-ASCII (1963 version) |
History
The character set was largely designed by Leonard Tramiel (the son of Commodore CEO Jack Tramiel) and PET designer Chuck Peddle. The graphic characters of PETSCII were one of the extensions Commodore specified for Commodore BASIC when laying out desired changes to Microsoft's existing 6502 BASIC to Microsoft's Ric Weiland in 1977.[1] The VIC-20 used the same pixel-for-pixel font as the PET, although the characters appeared wider due to the VIC's 22-column screen. The Commodore 64, however, used a slightly re-designed, heavy upper-case font, essentially a thicker version of the PET's, in order to avoid color artifacts created by the machine's higher resolution screen. The C64's lowercase characters are identical to the lowercase characters in the Atari 800's system font (released several years earlier).
Peddle claims the inclusion of card suit symbols was spurred by the demand that it should be easy to write card games on the PET (as part of the specification list he received).
Specifications
![](../I/Cbmcharset-modes.png.webp)
![](../I/C64_Petscii_Charts.png.webp)
"Unshifted" PETSCII is based on the 1963[2] version of ASCII (rather than the 1967 version, which most if not all other computer character sets based on ASCII use). It has only uppercase letters, an up-arrow ⟨↑⟩ instead of caret ⟨^⟩ at $5E and a left-arrow ⟨←⟩ instead of an underscore ⟨_⟩ at $5F, and in the VIC-20 and C64 version, a British pound sign ⟨£⟩ instead of the backslash ⟨\⟩ at $5C. Other characters added in ASCII-1967: lowercase letters, the grave accent, curly braces, vertical bar, and tilde – do not exist in PETSCII. Codes $60–$7F and $A0–$BF are allotted to CBM-specific block graphics characters (horizontal and vertical lines, hatches, shades, triangles, circles and card suits).
PETSCII also has a "shifted" or "text mode", which changes the uppercase letters at $41–$5A to lowercase, and changes the graphics at $61–$7A to uppercase letters. Upper- and lower-case are swapped from where ASCII has them. The mode is toggled by holding one of the SHIFT keys and then pressing and releasing the Commodore key. The shift can be done by POKEing location 59468 with the value 14 to select the alternative set or 12 to revert to standard. On C64 the sets are alternated by flipping bit 2 of the byte 53272. On some models of PET this can also be achieved via special control code PRINT CHR$(14)
which adjust the line spacing as well as changing the character set; the POKE method is still available and does not alter the line spacing.[3]
Included in PETSCII are cursor and screen control codes, such as {HOME}
, {CLR}
, {RVS ON}
, and {RVS OFF}
(the latter two activating/deactivating reverse-video character display). The control codes appeared in program listings as reverse-video graphic characters, although some computer magazines, in their efforts to provide more clearly readable listings, pretty-printed the codes using their actual names in curly braces, like the above examples. This is unambiguous as PETSCII has no curly brace characters. The colors of the VIC-20 and C64/128 are listed in the VIC-II article.
Character set
If shifted and unshifted modes are different, the unshifted character is shown first, then the shifted character. Characters that don't match ASCII have their Unicode code point below them in hex.
The table below is for the Commodore 64, Commodore 16, and Commodore 128 (control characters are for the Commodore 128 in 80 column mode). Other Commodore machines used slightly different versions of PETSCII, with different control characters and in some cases different graphic characters. For example, on CBM machines prior to the VIC-20, characters $2C and $6C both produced a comma character, albeit with slightly different semantics.[4]
The actual character generator ROM used a different set of assignments. For example, to display the characters "@ABC" on screen by directly writing into the screen memory, one would POKE the decimal values 0, 1, 2, and 3 rather than 64, 65, 66, and 67.[5]
PETSCII (Commodore 64, 16, and 128)[6][7][8][9][10][11] | ||||||||||||||||
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
0_ | UNDL ON |
STOP | WHITE | BELL | TAB | LF | SHIFT ON |
SHIFT OFF |
CR | TEXT MODE |
BLINK ON | |||||
1_ | DOWN | RVS ON |
HOME | DEL | TAB SET/ CLEAR |
ESC | RED | RIGHT | GREEN | BLUE | ||||||
2_ | SP | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | / |
3_ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? |
4_ | @ | Aa | Bb | Cc | Dd | Ee | Ff | Gg | Hh | Ii | Jj | Kk | Ll | Mm | Nn | Oo |
5_ | Pp | Rr | Ss | Tt | Uu | Vv | Ww | Xx | Yy | Zz | [ | £ 00A3 |
] | ↑ 2191 |
← 2190 | |
6_ | ─ 2500 |
♠A 2660 |
🭲B 1FB72 |
🭸C 1FB78 |
🭷D 1FB77 |
🭶E 1FB76 |
🭺F 1FB7A |
🭱G 1FB71 |
🭴H 1FB74 |
╮I 256E |
╰J 2570 |
╯K 256F |
🭼L 1FB7C |
╲M 2572 |
╱N 2571 |
🭽O 1FB7D |
7_ | 🭾P 1FB7E |
●Q 25CF |
🭻R 1FB7B |
♥S 2665 |
🭰T 1FB70 |
╭U 256D |
╳V 2573 |
○W 25CB |
♣X 2663 |
🭵Y 1FB75 |
♦Z 2666 |
┼ 253C |
🮌 1FB8C |
│ 2502 |
π 03C0 |
◥🮘 25E5 |
8_ | DARK PUR- PLE |
UNDL OFF |
RUN | F1 | F3 | F5 | F7 | F2 | F4 | F6 | F8 | CR | GRAPH MODE |
BLINK OFF | ||
9_ | BLACK | UP | RVS OFF |
CLR | INST | BROWN | PINK | DARK CYAN |
GRAY | LIGHT GREEN |
LIGHT BLUE |
LIGHT GRAY |
PUR PLE |
LEFT | YELLOW | CYAN |
A_ | NBSP | ▌ 258C |
▄ 2584 |
▔ 2594 |
▁ 2581 |
▏ 258F |
▒ 2592 |
▕ 2595 |
🮏 1FB8F |
◤🮙 25E4 |
🮇 1FB87 |
├ 251C |
▗ 2597 |
└ 2514 |
┐ 2510 |
▂ 2582 |
B_ | ┌ 250C |
┴ 2534 |
┬ 252C |
┤ 2524 |
▎ 258E |
▍ 258D |
🮈 1FB88 |
🮂 1FB82 |
🮃 1FB83 |
▃ 2583 |
🭿✓ 1FB7F |
▖ 2596 |
▝ 259D |
┘ 2518 |
▘ 2598 |
▚ 259A |
C_ | ─ 2500 |
♠A 2660 |
🭲B 1FB72 |
🭸C 1FB78 |
🭷D 1FB77 |
🭶E 1FB76 |
🭺F 1FB7A |
🭱G 1FB71 |
🭴H 1FB74 |
╮I 256E |
╰J 2570 |
╯K 256F |
🭼L 1FB7C |
╲M 2572 |
╱N 2571 |
🭽O 1FB7D |
D_ | 🭾P 1FB7E |
●Q 25CF |
🭻R 1FB7B |
♥S 2665 |
🭰T 1FB70 |
╭U 256D |
╳V 2573 |
○W 25CB |
♣X 2663 |
🭵Y 1FB75 |
♦Z 2666 |
┼ 253C |
🮌 1FB8C |
│ 2502 |
π 03C0 |
◥🮘 25E5 |
E_ | NBSP | ▌ 258C |
▄ 2584 |
▔ 2594 |
▁ 2581 |
▏ 258F |
▒ 2592 |
▕ 2595 |
🮏 1FB8F |
◤🮙 25E4 |
🮇 1FB87 |
├ 251C |
▗ 2597 |
└ 2514 |
┐ 2510 |
▂ 2582 |
F_ | ┌ 250C |
┴ 2534 |
┬ 252C |
┤ 2524 |
▎ 258E |
▍ 258D |
🮈 1FB88 |
🮂 1FB82 |
🮃 1FB83 |
▃ 2583 |
🭿✓ 1FB7F |
▖ 2596 |
▝ 259D |
┘ 2518 |
▘ 2598 |
▚ 259A |
The keyboard by default provides access to the lower half of the code page. Pressing shift+key gives the corresponding upper half code point. Some PETSCII codes cannot be printed and are only used for keyboard input (e.g. F1, RUN/STOP).
![](../I/PET_Keyboard.svg.png.webp)
Base 128
Out of PETSCII's first 192 codes, 164 have visible representations (for the control codes, these are visible when quoted): 5 (white), 17–20 and 28–31 (colors and cursor controls), 32–90 (ASCII equivalent), 91–127 (graphics), 129 (orange), 133–140 (function keys), 144–159 (colors and cursor controls), and 160–192 (graphics). This permits "base128"-style encodings in DATA statements, or perhaps between PETSCII-speaking machines; for example, 33–127, 160–192.
Notes
References
- A Conversation with Chuck Peddle, Bil Herd, Jeri Ellsworth - part 3 (2009 videoconference, 06:30) Archived 9 January 2011 at the Wayback Machine
- Jennings, Thomas Daniel (5 February 2020) [1999]. "An annotated history of some character codes or ASCII: American Standard Code for Information Infiltration". sensitive research (SR-IX).
- THE COMMODORE PET COMPUTER / FREQUENTLY ASKED QUESTIONS FILE - VERSION 1.7 ( Updated 25 November 2000) BY LARRY ANDERSSON, COMMODORE COLLECTOR AND PET ENTHUSIAST
- "Commodore Trivia Edition #26 Answers for February 1996".
- Commodor PETSCII character sets (PDF)
- Oy, Aivosto (2014), Commodore PETSCII character sets (PDF)
- "ReadMe.txt" (PDF), L2/19-025: Proposal to add characters from legacy computers and teletext to the UCS, 4 January 2019
- "C64IPRI.TXT" (PDF), L2/19-025: Proposal to add characters from legacy computers and teletext to the UCS, 4 January 2019
- "C64IALT.TXT" (PDF), L2/19-025: Proposal to add characters from legacy computers and teletext to the UCS, 4 January 2019
- "PETSCII to Unicode Mapping". www.kreativekorp.com.
- C64DX System Specification
External links
- PETSCII character map, part 1, part 2, part 3 (JPEG)
- An attempt at PETSCII to Unicode mapping, unshifted, shifted
- Another PETSCII to Unicode mapping and a TrueType font using that mapping
- Commodore 128 PETSCII control characters
- Typography in 8 bits: System fonts
- Online PETSCII-art editor
- PETSCII-art