ArticleslgStudy

computer science

PETSCII

PETSCII is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand PETSCII rather than just read about it. In short: 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. This character set was first used by the PET from 1977, and was subsequently used by the CBM-II, VIC-20, Commodore 64, Commodore 16, Commodore 116, Plus/4, and Commodore 128.

PETSCII — main illustration
PETSCII — illustration

Key takeaways

  • PETSCII belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect PETSCII to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of PETSCII from memory before moving on to harder problems.

Reference excerpt

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. This character set was first used by the PET from 1977, and was subsequently used by the CBM-II, VIC-20, Commodore 64, Commodore 16, Commodore 116, Plus/4, and Commodore 128. However, the Amiga 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) 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. 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 8-bit computers ATASCII 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 (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 0x5E and a left-arrow ⟨←⟩ instead of an underscore ⟨_⟩ 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, 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. 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 {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. 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 standard in various blocks:

Basic Latin (U+0000 - U+007F) Latin-1 Supplement (U+0080 - U+00FF) Greek and Coptic (U+03C0 π GREEK SMALL LETTER PI) General Punctuation (U+2022 • BULLET) Arrows (two arrows, U+2190 and U+2191) Box Drawing (U+2500 - U+257F) Block Elements (U+2580 - U+259F) Geometric Shapes (U+25A0 - U+25FF) Miscellaneous Symbols (U+2600 - U+26FF) Dingbats (U+2713 ✓ CHECK MARK) 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, Commodore 16, Commodore 128 (40 and 80 column modes).

… excerpt ends here. Continue reading the full article.

Illustrations

PETSCII illustration
PETSCII: PETSCII Chart as displayed on the Commodore 64 in shifted and unshifted modes. (Not shown are control codes, as well as characters in the 0xC0–0xFF range, which are the standard uppercase keycodes returned from the keyboard, and which are duplicated to the range 0x60–0x7F.)
PETSCII Chart as displayed on the Commodore 64 in shifted and unshifted modes. (Not shown are control codes, as well as characters in the 0xC0–0xFF range, which are the standard uppercase keycodes returned from the keyboard, and which are duplicated to the range 0x60–0x7F.)
PETSCII: PET 2001 keyboard layout, illustrating PETSCII graphics characters
PET 2001 keyboard layout, illustrating PETSCII graphics characters

Worked examples

Example 1 — a first encounter with PETSCII

Start with the simplest possible case. Write down what PETSCII claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to PETSCII before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about PETSCII ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of PETSCII

In research
PETSCII appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses PETSCII in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
PETSCII is common in secondary-school and first-year university syllabi. It links to neighbouring topics ASCII, Character sets, Commodore 64, so understanding it makes those chapters shorter.
In everyday life
Look for PETSCII outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “PETSCII” →

How to study PETSCII in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what PETSCII means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain PETSCII out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is PETSCII in simple terms?

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. This character set was first used by the PET from 1977, and was subsequently used by the CBM-II, VIC-20, Commodore 64, Commodore 16, Commo…

Why does PETSCII matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study PETSCII?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on PETSCII.

Tags

  • ASCII
  • Character sets
  • Commodore 64
  • Commodore International
  • Computer-related introductions in 1977
  • VIC-20

Keep exploring