Commodore VIC-20#

VIC-20 Specifications#

Lifespan

1980-1985

Media

Cassette tape, cartridge, floppy disk (optional)

CPU

MOS Technology 6502 @ 1.02 MHz (NTSC)

Memory

5K RAM (3.5K usable), 20K ROM (BASIC + KERNAL + character generator)

Display

22x23 text (user-definable characters), 16 colors

Sound

4-channel sound (3 square wave + 1 noise) via the VIC-I chip

Input

Keyboard, joystick, paddles, light pen

Best-selling game

No single pack-in title; popular cartridges included Jupiter Lander and Gorf

Commodore VIC-20 (by Evan-Amos, public domain)

History#

The VIC-20 was introduced by Commodore in 1980 (Japan) and 1981 (US) as a low-cost home computer. It was designed by a team that included Al Charpentier, who designed the MOS 6560/6561 Video Interface Chip (VIC-I), hence the name.

At a retail price of $299, the VIC-20 was the first computer to sell one million units. It was positioned as a “friendly” introductory computer, sold in department stores rather than just computer shops. Its simple plug-and-play nature and game cartridges made it popular with families.

The VIC-20 was succeeded by the Commodore 64 in 1982, which used the same 6502 CPU and the VIC-II chip (a significantly more powerful video chip).

Hardware#

The VIC-20 is based on the MOS 6502 CPU running at 1.02 MHz (NTSC) or 1.108 MHz (PAL). The system is built around the MOS 6560/6561 VIC-I video interface chip:

  • CPU : MOS 6502 @ 1.02 MHz (NTSC) / 1.108 MHz (PAL)

  • Video : MOS 6560/6561 VIC-I

  • Sound : VIC-I provides 4 channels (3 square + 1 noise)

  • RAM : 5 KB (3.5 KB available to BASIC)

  • ROM : 20 KB (BASIC 2.0, KERNAL, character generator)

Video#

The VIC-I chip generates the display, which can operate in several modes:

  • Text mode - 22 columns x 23 rows of 8x8 characters (the KERNAL default)

  • Tall characters - 8x16 characters, selected in $9003

  • Multi-color characters - 4x8 pixels per character, with colors set per cell

The VIC-I has no true bitmap mode. Graphics are made by redefining characters and filling the screen with them (176x184 pixels at the default size). Each character can be one of 8 foreground colors, and the background and border can be any of 16. The VIC-I generates its timing from the 14.318 MHz master clock (NTSC). The default 22-column display is narrower than most home computers of the era, but the size and position are programmable.

The character generator ROM is 4K and holds 512 8x8 characters: two sets (uppercase/graphics and uppercase/lowercase), each with 128 characters plus their reversed versions. The VIC-I can be pointed at RAM to use custom character sets.

Sound#

The VIC-I provides four sound channels:

  • Bass ($900A) - square wave, lowest octave

  • Alto ($900B) - square wave, one octave up

  • Soprano ($900C) - square wave, two octaves up

  • Noise ($900D) - white noise

The channels share a single volume control ($900E, bits 0-3). Bit 7 of each channel register enables the channel; bits 0-6 set the frequency divider.

Memory Map#

The VIC-20 memory map is unusual: the 6502’s 64 KB address space is only partially populated with RAM, and the cartridge ports and I/O regions are mapped in the middle of the address space.

Address Range

Description

$0000-$03FF

RAM (zero page, stack, 1K standard)

$0400-$0FFF

3K RAM expansion slot (unpopulated unless expansion installed)

$1000-$1FFF

RAM (4K, standard on all models)

$2000-$3FFF

BLK1 cartridge ROM

$4000-$5FFF

BLK2 cartridge ROM

$6000-$7FFF

BLK3 cartridge ROM

$8000-$8FFF

Character generator ROM

$9000-$93FF

VIC-I registers ($9000), VIA 1 ($9110, user port/joystick/serial), VIA 2 ($9120, keyboard/joystick)

$9400-$97FF

Color RAM (1K nibbles)

$9800-$9BFF

I/O 2 (expansion)

$9C00-$9FFF

I/O 3 (expansion)

$A000-$BFFF

BLK5 cartridge ROM (autostart)

$C000-$DFFF

BASIC ROM

$E000-$FFFF

KERNAL ROM

VIC-I Registers#

The VIC-I chip is controlled through registers at $9000-$900F:

Address

Function

$9000

Bit 7: interlace; bits 0-6: horizontal screen origin

$9001

Vertical screen origin

$9002

Bit 7: screen address A9; bits 0-6: number of columns

$9003

Bit 7: raster bit 0; bits 1-6: number of rows; bit 0: 8x16 characters

$9004

Raster position, bits 8-1 (read)

$9005

Bits 4-7: screen address A13-A10; bits 0-3: character generator address A13-A10

$9006

Light pen horizontal position

$9007

Light pen vertical position

$9008

Paddle X

$9009

Paddle Y

$900A

Bass (sound channel 1) frequency

$900B

Alto (sound channel 2) frequency

$900C

Soprano (sound channel 3) frequency

$900D

Noise channel frequency

$900E

Bits 4-7: auxiliary color; bits 0-3: volume

$900F

Bits 4-7: background color; bit 3: inverse (clear = inverse); bits 0-2: border color

The screen size and position are programmable: the KERNAL sets up a 22 column by 23 row display, but $9000-$9003 can change the origin and the number of columns and rows. The screen origin values differ between NTSC and PAL machines.

The character generator ROM is mapped at $8000-$8FFF, and $9005 selects where the VIC-I fetches characters from (ROM or RAM). The screen RAM address comes from $9005 and $9002; it defaults to $1E00 on an unexpanded machine and $1000 when the expansion RAM is installed. Color RAM is 506 nibbles; bit 9 of the screen address selects $9600 (screen at $1E00) or $9400 (screen at $1000).

Programming#

The VIC-20 shipped with Commodore BASIC 2.0 in ROM, but the 8bitworkshop IDE focuses on 6502 assembly language and C (via the CC65 compiler).

Binary Formats#

The 8bitworkshop IDE can load VIC-20 programs in two formats:

  • Cartridge format (.bin) - 8K ROM image in the BLK5 ($A000) autostart range, including the A0CBM autostart signature (bytes 41 30 C3 C2 CD at $A004)

  • PRG format (.prg) - Commodore program file with a two-byte load address header

Comments