October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How the Commodore 64 Character Set and PETSCII Graphics Work

PETSCII handles BASIC characters and controls; screen codes select VIC-II glyphs, while separate color values set their color. Here’s how built-in and custom C64 graphics work.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On a Commodore 64, PETSCII is the character and control-code system used by BASIC and the KERNAL; screen codes are the values the VIC-II reads to choose glyphs from character memory. A third value, the color code, controls the character’s color. Keeping those three jobs separate explains why a BASIC character value cannot always be written directly to screen memory—and how built-in and custom PETSCII-style graphics appear on screen.

How does the Commodore 64 character set work?

In standard character mode, each screen position has a screen-memory value identifying a glyph, while color memory stores its color separately. The VIC-II uses the screen code to find the corresponding pattern in character memory and displays that pattern in the selected position.

As an Amazon Associate I earn from qualifying purchases.

A standard glyph is an 8-by-8 grid represented by eight bytes, one for each row. As the Commodore 64 Programmer’s Reference Guide puts it, “Each character is formed in an 8 by 8 grid of dots, where each dot may be either on or off.” Within each byte, the bits indicate which dots in that row are on.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The guide describes the character-pattern address calculation as CHARACTER ADDRESS = SCREEN CODE*8 + (CHARACTER SET*2048) + (BANK*16384). This expresses how the screen code, selected character set, and VIC-II memory bank determine where the pattern is found. The screen code chooses a glyph; it is not itself the bitmap or its color.

#1 Best Overall
The C64 Mini USA Version
  • High definition output at 720p via HDMI
  • Pixel Perfect display, with US/Europe display modes and crt filter options
  • Save game function. Supports software updates via USB flash drive
  • 2 USB ports: plug in a USB keyboard and use as a fully functional home computer, or add a second joystick for 2-player games
  • Included: The C64 Mini computer, Classic USB joystick, HDMI cable, USB cable for power, 64 preinstalled games, instruction manual. *AC USB adaptor not included

What is the difference between PETSCII and screen codes?

PETSCII is the character and control-code scheme used by the C64’s KERNAL. BASIC operations such as PRINT, CHR$(), GET, and INPUT, along with keyboard and file operations, work with PETSCII values. Some values represent printable characters; others are control codes that can change such things as color, cursor position, reverse video, or character-set mode. A PETSCII byte therefore does not always mean “print this glyph.”

Screen codes are different: they are values stored in screen RAM that tell the VIC-II which glyph to display. For example, uppercase A is PETSCII 65, but its screen code is 1 in the uppercase/graphics character set. Spaces, digits, and some punctuation share values across the schemes, which can make them seem interchangeable until code handles letters or graphics.

Rank #2
THEC64 Mini - Black Edition
  • A glorious half-size recreation of the iconic C64 in a striking black finish
  • 25 of the highest rated new games, including; Sam’s Journey, A Pig Quest, Steel Ranger and Knight ‘n’ Grail
  • High Definition output at 720p 50 or 60Hz
  • Play in original 4:3 or pixel perfect aspect ratios, with or without CRT filters
  • Save your progress in one of four save-game slots per game, and return at any time
Value type What it does Where you encounter it
PETSCII Represents characters and control actions. BASIC and KERNAL character input and output, including PRINT and CHR$().
Screen code Selects a glyph for a screen position. Screen RAM read by the VIC-II.
Color code Sets the character’s color independently of glyph selection. Color memory or relevant video registers.

Reverse video illustrates the distinction. With BASIC output, a PETSCII control code changes the editor’s reverse-video state. With a direct screen-memory write, the value must instead be the screen code for the reversed glyph in the relevant character set. The two routes produce related visible results but use different representations.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I get PETSCII graphics on a C64?

For ordinary BASIC output, use PETSCII: a PRINT statement can send a character or control code, and CHR$(n) lets you specify a value numerically. For direct placement in screen RAM, use the screen code for the glyph you want in the active character set. Do not assume a PETSCII value is also the correct screen-memory value; uppercase A is 65 versus screen code 1 in uppercase/graphics mode.

Rank #3
Commodore - C64 - Capital Letter Blue/Red & Commodore T-Shirt
  • Vintage Computer design. Commodore - C64 - Uppercase Letter & Commodore - Lettering Blue/Red
  • Commodore C64 Uppercase Letter & Commodore Blue / Red
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem

Choose the built-in character set that provides the alphabet and symbols your display needs. The C64 has two main sets:

Character set Alphabet Graphics How it affects the display
Uppercase/graphics Uppercase letters Includes graphic and block symbols useful for text-mode pictures, borders, and interfaces. Displays uppercase glyphs and its available graphics.
Lowercase/uppercase Lowercase and uppercase letters Fewer graphic symbols than the uppercase/graphics set. Displays both letter cases, with a different selection of glyphs.

The system or video configuration can select the active set, and BASIC control codes are also commonly used to switch modes. Switching changes which glyphs the VIC-II displays for the relevant screen codes; it does not make PETSCII and screen codes the same encoding.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How do custom character graphics work?

The VIC-II can use character patterns in RAM instead of the standard patterns held in character-generator ROM. A program can define its own 8-by-8 glyphs by supplying the corresponding row bytes, then configure video memory so the VIC-II reads those patterns as its character data.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Custom character data takes the place of the standard character set for that configuration. If a display needs standard letters or other built-in symbols alongside custom shapes, the program must copy the needed standard glyph patterns into the RAM character set as well. The guide’s graphics chapter, “Programming Graphics — Standard Character Mode” and “Character Definitions”, explains the standard mode and programmable character shapes.

Best Value
Sale
8Bitdo Retro Mechanical Keyboard for Windows & Android, C64 Edition
  • Inspired by the classics. Compatible with Windows 10(1903) or above, and Android 9.0 or above.
  • Programmable keys, Dual Super Buttons, and Super Stick, with independent control panel.
  • 87 keys. Top mount style with Kailh Box White Switches.
  • Double-Shot ABS keycaps with SA profile. (C64 Edition only)
  • Hot-swappable PCB. Support n-key rollover.

Further reading

The Commodore 64 Programmer’s Reference Guide graphics chapter is the primary manual reference for character patterns and standard character mode. For explicit PETSCII, screen-code, and color-code mappings, consult Appendix G — PETSCII, Screen Codes & Color Codes; check that any chart you use identifies the character set it depicts, since the same screen codes can show different glyphs in different sets.

Quick Recap

Bestseller No. 1
The C64 Mini USA Version
The C64 Mini USA Version
High definition output at 720p via HDMI; Pixel Perfect display, with US/Europe display modes and crt filter options
Bestseller No. 2
THEC64 Mini - Black Edition
THEC64 Mini - Black Edition
A glorious half-size recreation of the iconic C64 in a striking black finish; High Definition output at 720p 50 or 60Hz
$65.98
Bestseller No. 3
Commodore - C64 - Capital Letter Blue/Red & Commodore T-Shirt
Commodore - C64 - Capital Letter Blue/Red & Commodore T-Shirt
Commodore C64 Uppercase Letter & Commodore Blue / Red; Lightweight, Classic fit, Double-needle sleeve and bottom hem
$19.99
SaleBestseller No. 5
8Bitdo Retro Mechanical Keyboard for Windows & Android, C64 Edition
8Bitdo Retro Mechanical Keyboard for Windows & Android, C64 Edition
Programmable keys, Dual Super Buttons, and Super Stick, with independent control panel.; 87 keys. Top mount style with Kailh Box White Switches.
$101.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.