PETSCII (PET Standard Code of Information Interchange), also known as CBM ASCII, is the
character set
Character encoding is the process of assigning numbers to graphical characters, especially the written characters of human language, allowing them to be stored, transmitted, and transformed using computers. The numerical values that make up a c ...
used in
Commodore Business Machines' 8-bit
home computer
Home computers were a class of microcomputers that entered the market in 1977 and became common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a s ...
s.
This character set was first used by the
PET from 1977, and was subsequently used by the
CBM-II,
VIC-20,
Commodore 64
The Commodore 64, also known as the C64, is an 8-bit computing, 8-bit home computer introduced in January 1982 by Commodore International (first shown at the Consumer Electronics Show, January 7–10, 1982, in Las Vegas). It has been listed in ...
,
Commodore 16,
Commodore 116,
Plus/4, and
Commodore 128. However, the
Amiga
Amiga is a family of personal computers produced by Commodore International, Commodore from 1985 until the company's bankruptcy in 1994, with production by others afterward. The original model is one of a number of mid-1980s computers with 16-b ...
personal computer family instead uses standard
ISO/IEC 8859-1.
History
The character set was largely designed by
Leonard Tramiel (the son of Commodore CEO
Jack Tramiel
Jack Tramiel (, ); born Idek Trzmiel (; December 13, 1928 – April 8, 2012) was a Polish- American businessman and Holocaust survivor, best known for founding Commodore International. The Commodore PET, VIC-20, and Commodore 64 are som ...
) and PET designer
Chuck Peddle.
The graphic characters of PETSCII were one of the extensions Commodore specified for
Commodore BASIC
Commodore BASIC, also known as PET BASIC or CBM-BASIC, is the Dialect (computing), dialect of the BASIC programming language used in Commodore International's 8-bit home computer line, stretching from the Commodore PET, PET (1977) to the Commodore ...
when laying out desired changes to Microsoft's existing
6502 BASIC
Basic or BASIC may refer to:
Science and technology
* BASIC, a computer programming language
* Basic (chemistry), having the properties of a base
* Basic access authentication, in HTTP
Entertainment
* Basic (film), ''Basic'' (film), a 2003 film
...
to Microsoft's
Ric Weiland in 1977.
mirror
The VIC-20 used the same pixel-for-pixel
font
In metal typesetting, a font is a particular size, weight and style of a ''typeface'', defined as the set of fonts that share an overall design.
For instance, the typeface Bauer Bodoni (shown in the figure) includes fonts " Roman" (or "regul ...
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
Letter case is the distinction between the letters that are in larger uppercase or capitals (more formally ''majuscule'') and smaller lowercase (more formally '' minuscule'') in the written representation of certain languages. The writing system ...
characters are identical to the lowercase characters in the
Atari 8-bit computers font (released 2.75 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

"Unshifted" PETSCII is based on the 1963 version of
ASCII
ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
(rather than the 1967 version, which most if not all other computer character sets based on ASCII use). It has only
uppercase
Letter case is the distinction between the letters that are in larger uppercase or capitals (more formally ''#Majuscule, majuscule'') and smaller lowercase (more formally ''#Minuscule, minuscule'') in the written representation of certain langua ...
letters, an up-arrow instead of
caret
Caret () is the name used familiarly for the character provided on most QWERTY keyboards by typing . The symbol has a variety of uses in programming and mathematics. The name "caret" arose from its visual similarity to the original proofre ...
at
0x5E and a left-arrow instead of an
underscore
An underscore or underline is a line drawn under a segment of text. In proofreading, underscoring is a convention that says "set this text in italic type", traditionally used on manuscript or typescript as an instruction to the printer. Its ...
at 0x5F. In all versions except the original Commodore PET, it also has a
British pound sign instead of the backslash at 0x5C. Other characters added in ASCII-1967 (lowercase letters, the
grave accent
The grave accent () ( or ) is a diacritical mark used to varying degrees in French, Dutch, Portuguese, Italian, Catalan and many other Western European languages as well as for a few unusual uses in English. It is also used in other ...
,
curly braces, vertical bar, and tilde) do not exist in PETSCII. Codes 0xA0–0xDF are allotted to CBM-specific
block graphics characters—horizontal and vertical lines, hatches, shades, triangles, circles and
card suits
In playing cards, a suit is one of the categories into which the cards of a deck are divided. Most often, each card bears one of several Pip (counting), pips (symbols) showing to which suit it belongs; the suit may alternatively or additionall ...
.
PETSCII also has a "shifted" mode (also called "business mode"), which changes the uppercase letters at 0x41–0x5A to lowercase, and changes the graphics at 0xC1–0xDA 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 the Commodore 64, 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.
Included in PETSCII are
cursor and screen control codes, such as
,
,
, and
(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.
Different mappings are used for storing characters (the "interchange" mapping, as used by
CHR$()
) and displaying characters (the "video" mapping). 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.
The keyboard by default provides access to the lower half of the code page. Pressing Shift and a key gives the corresponding upper half code point. Some PETSCII code points cannot be printed and are only used for keyboard input (e.g. F1, RUN/STOP).
Character set
The tables below represent the "interchange" PETSCII encoding, as used by
CHR$()
.
Control characters are defined in the ranges 0x00–0x1F and 0x80–0x9F, although which control characters are defined and what they are defined as varies between systems. The tables below exclude control characters—the encoding of control characters in discussed in
§ Control characters.
The ranges 0x60–0x7F and 0xE0–0xFF are duplicate ranges, although what they duplicate varies between systems. On the Commodore PET, they duplicate 0x20–0x3F and 0xA0–0xBF, respectively; on the Commodore VIC-20, 64, 16, and 128 they duplicate 0xC0–0xDF and 0xA0–0xBF, respectively.
While these characters are visually duplicates, they are semantically different; for example, on the Commodore PET, code points 0x2C and 0x6C both produce a comma character, but only 0x2C functions as a delimiter between input fields.
Graphic characters are mostly identical across systems, with the exceptions of 0x5C (which is
\
on the Commodore PET, and
£
on other systems), 0xDE (which is U+1FB95 CHECKER BOARD FILL on the Commodore PET and VIC-20, and U+1FB96 INVERSE CHECKER BOARD FILL on other systems), and the range 0x60–0x7F (which duplicates a different range on Commodore PET). Additionally, in
Commodore PET 2001's shifted character set, uppercase and lowercase letters are swapped relative to other systems'.
Unicode equivalents
PETSCII characters are represented in the
Unicode
Unicode or ''The Unicode Standard'' or TUS is a character encoding standard maintained by the Unicode Consortium designed to support the use of text in all of the world's writing systems that can be digitized. Version 16.0 defines 154,998 Char ...
standard in various blocks:
*
Basic Latin (U+0000 - U+007F)
*
Latin-1 Supplement (U+0080 - U+00FF)
*
Greek and Coptic ()
*
General Punctuation ()
*
Arrows (two arrows, U+2190 and U+2191)
*
Box Drawing (U+2500 - U+257F)
*
Block Elements (U+2580 - U+259F)
*
Geometric Shapes
A shape is a graphics, graphical representation of an object's form or its external boundary, outline, or external Surface (mathematics), surface. It is distinct from other object properties, such as color, Surface texture, texture, or material ...
(U+25A0 - U+25FF)
*
Miscellaneous Symbols (U+2600 - U+26FF)
*
Dingbats ()
*
Symbols for Legacy Computing (U+1FB00 - U+1FBFF, first added in 2020 as part of Unicode 13.0)
Standard
The following tables represent the PETSCII encoding used on the Commodore VIC-20, 64, 16, and 128.
Unshifted
Shifted
Commodore PET
Unshifted
Shifted
Control characters
While the graphic characters were mostly shared between Commodore systems, the control characters frequently varied. The follow table describes what the control characters represent on the
Commodore PET 2001,
Commodore PET 8032,
VIC-20,
Commodore 64
The Commodore 64, also known as the C64, is an 8-bit computing, 8-bit home computer introduced in January 1982 by Commodore International (first shown at the Consumer Electronics Show, January 7–10, 1982, in Las Vegas). It has been listed in ...
,
Commodore 16,
Commodore 128 (40 and 80 column modes).
The colors of the VIC-20 and C64/128 are listed in the
VIC-II article.
Base 128
Out of PETSCII's first 192 codes, there are 128 graphic characters: 32–127 and 160–192. This permits "base128"-style encodings in DATA statements, or perhaps between PETSCII-speaking machines. This can also include control characters, which are visible when quoted, although which control characters are defined varies between systems.
The primary application for a "Base 128" encoding is in DATA statements in Commodore BASIC. Binary data can be stored with relatively low overhead, allowing one character of data to encode seven bits of data. On a standard 80-character line, typically four characters are used for the line number, and two characters for the abbreviated DATA statement (
dA
). Since the comma and colon are significant to BASIC, a quote character is also needed, leaving 73 characters for data. At seven bits per character, one DATA line could store 511 bits of binary data, for 79% efficiency. If three-digit line numbers are used, efficiency increases to 80%. If two-digit line numbers are used, efficiency is 82%.
[Assume line 0 is a GOTO.]
[Maximum line number is probably off-by-one.]
For storing binary data in Commodore BASIC, it appears that two- or three-digit line numbers are typically the best choice.
Base 164
164 PETSCII characters are representable in quoted strings; theoretically, then, Base 164 is possible. This adds in the color values, the function keys, and cursor controls.
See also
*
ATASCII
*
Atari ST character set
*
ZX Spectrum character set
*
Extended ASCII
Extended ASCII is a repertoire of character encodings that include (most of) the original 96 ASCII character set, plus up to 128 additional characters. There is no formal definition of "extended ASCII", and even use of the term is sometimes critic ...
*
Text semigraphics
References
External links
PETSCII to Unicode mappingand
TrueType fontusing that mapping
Typography in 8 bits: System fontsOnline PETSCII-art editorPETSCII-art
{{character encoding
Character sets
Commodore International
Commodore 64
VIC-20
ASCII
Computer-related introductions in 1977