# MOS Technology VIC

The VIC (Video Interface Chip), specifically known as the MOS Technology 6560 (NTSC version) / 6561 (PAL version), is the integrated circuit chip responsible for generating video graphics and sound in the VIC-20 home computer from Commodore. It was originally designed for applications such as low-cost CRT terminals, biomedical monitors, control system displays and arcade or home video game consoles.
The chip was designed by Al Charpentier in 1977 but Commodore could not find a market for the chip. In 1979, MOS Technology began work on a video chip named MOS Technology 6564 intended for the TOI computer and had also made some work on another chip, MOS 6562 intended for a color version of the Commodore PET. Both of these chips failed due to memory timing constraints (both required very fast and thus expensive SRAM, making them unsuitable for mass production). Before finally starting to use the VIC in the VIC-20, chip designer Robert Yannes fed features from the 6562 (a better sound generator) and 6564 (more colors) back to the 6560, so before beginning mass production for the VIC-20 it had been thoroughly revised.
Its features include:
* 16 kB address space for screen, character and color memory (only 5 kB points to RAM on the VIC-20 without a hardware modification)
* 16 colors (the upper 8 can only be used in the global background and auxiliary colors)
* two selectable character sizes (8×8 or 8×16 bits; the pixel width is 1 bit for "hires" characters and 2 bits for "multicolor" characters)
* maximum video resolution depends on the television system (176 × 184 is the standard for the VIC-20 firmware, although up to 248 × 232p/464i is possible on the NTSC machine and up to 256 × 280 is possible on the PAL machine)
* 4 channel sound system (3 square wave + "white" noise + global volume setting)
* on-chip DMA
* two 8-bit analog-to-digital converter
* light pen support
Unlike many other video circuits of the era, it does not offer dynamic RAM refresh capabilities. Thus the VIC-20 employed the more expensive static RAM (SRAM) chips. This is likely the reason why the machine was sold with just 5 KB of RAM. Memory expansions for the VIC-20 either used SRAM as well or implemented their own refresh circuit.
The VIC was programmed by manipulating its 16 control registers, memory mapped to the memory address range $9000–$900F in the VIC-20 address space. The on-chip A/D converters were used for dual paddle position readings by the VIC-20, which also used the VIC's light pen facility. The VIC preceded the much more advanced VIC-II, used by the VIC-20's successors, the C64 and C128.
VIC-20s with expansion RAM have their video memory (550 bytes) at $1000 and when it is not present, $1E00. User-defined character sets must be placed within the first 5k of system RAM. The default PETSCII character ROM is at $8000 and each character takes 8 bytes to store. Up to 128 characters may be used at any one time. While the PET had a backslash (\) in its character set, this was replaced on the VIC-20 (and all subsequent Commodore machines) with a British pound sign (£).
Programmable characters are the only way of creating graphics and animation on the VIC as the chip does not have sprites or an all-points-addressable bitmap mode. Of the 16 colors in the palette, eight may be used for the foreground (per the color RAM at $9400) and border while the others are limited to the background and auxiliary multicolors. The MSB of the color RAM is a flag used to indicate if that character is multicolor or high resolution. Due to the extreme blockiness of the former, most VIC-20 games use hires characters.
The VIC does not support scrolling or raster interrupts like on the VIC-II, but the scanline counters could be polled for a specific point on the screen to produce raster effects. This feature was rarely used in games except for a few titles like Imagic's Demon Attack.
Sound programming on the VIC is done by placing a frequency value in one of the four registers at $900A-$900D (they are turned off by writing a zero to them). The first three are square wave generators pitched half an octave from each other and the fourth is for white noise.

## Registers

The VIC has 16 read/write registers listed below:
| Register | Hexadecimal | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
| 0 | 9000 | Interlace | Horizontal origin | Horizontal origin | Horizontal origin | Horizontal origin | Horizontal origin | Horizontal origin | Horizontal origin |
| 1 | 9001 | Vertical origin | Vertical origin | Vertical origin | Vertical origin | Vertical origin | Vertical origin | Vertical origin | Vertical origin |
| 2 | 9002 | VA9 | Number of columns | Number of columns | Number of columns | Number of columns | Number of columns | Number of columns | Number of columns |
| 3 | 9003 | R0 | Number of rows | Number of rows | Number of rows | Number of rows | Number of rows | Number of rows | 8/16 |
| 4 | 9004 | Raster line (bits 8–1) | Raster line (bits 8–1) | Raster line (bits 8–1) | Raster line (bits 8–1) | Raster line (bits 8–1) | Raster line (bits 8–1) | Raster line (bits 8–1) | Raster line (bits 8–1) |
| 5 | 9005 | Video addr (bits 13–10) | Video addr (bits 13–10) | Video addr (bits 13–10) | Video addr (bits 13–10) | Char addr (bits 13–10) | Char addr (bits 13–10) | Char addr (bits 13–10) | Char addr (bits 13–10) |
| 6 | 9006 | Light pen horizontal | Light pen horizontal | Light pen horizontal | Light pen horizontal | Light pen horizontal | Light pen horizontal | Light pen horizontal | 1 |
| 7 | 9007 | Light pen vertical | Light pen vertical | Light pen vertical | Light pen vertical | Light pen vertical | Light pen vertical | Light pen vertical | Light pen vertical |
| 8 | 9008 | Paddle X | Paddle X | Paddle X | Paddle X | Paddle X | Paddle X | Paddle X | Paddle X |
| 9 | 9009 | Paddle Y | Paddle Y | Paddle Y | Paddle Y | Paddle Y | Paddle Y | Paddle Y | Paddle Y |
| 10 | 900A | enable | Oscillator 1 frequency | Oscillator 1 frequency | Oscillator 1 frequency | Oscillator 1 frequency | Oscillator 1 frequency | Oscillator 1 frequency | Oscillator 1 frequency |
| 11 | 900B | enable | Oscillator 2 frequency | Oscillator 2 frequency | Oscillator 2 frequency | Oscillator 2 frequency | Oscillator 2 frequency | Oscillator 2 frequency | Oscillator 2 frequency |
| 12 | 900C | enable | Oscillator 3 frequency | Oscillator 3 frequency | Oscillator 3 frequency | Oscillator 3 frequency | Oscillator 3 frequency | Oscillator 3 frequency | Oscillator 3 frequency |
| 13 | 900D | enable | White noise frequency | White noise frequency | White noise frequency | White noise frequency | White noise frequency | White noise frequency | White noise frequency |
| 14 | 900E | Aux color | Aux color | Aux color | Aux color | Volume | Volume | Volume | Volume |
| 15 | 900F | Background | Background | Background | Background | RV | Border | Border | Border |

## Color palette

The full palette of sixteen colors was generated based on variations of YPbPr signals:
| Number — name | Y | Pb (rel.) | Pr (rel.) |
| 0 — black | 0 | 0 | 0 |
| 1 — white | 1 | 0 | 0 |
| 2 — red | 0.25 | −0.3826834 | 0.9238795 |
| 3 — cyan | 0.75 | 0.3826834 | −0.9238795 |
| 4 — purple | 0.5 | 0.7071068 | 0.7071068 |
| 5 — green | 0.5 | −0.7071068 | −0.7071068 |
| 6 — blue | 0.25 | 1 | 0 |
| 7 — yellow | 0.75 | −1 | 0 |
| 8 — orange | 0.5 | −0.7071068 | 0.7071068 |
| 9 — light orange | 0.75 | −0.7071068 | 0.7071068 |
| 10 — light red | 0.5 | −0.3826834 | 0.9238795 |
| 11 — light cyan | 1 | 0.3826834 | −0.9238795 |
| 12 — light purple | 0.75 | 0.7071068 | 0.7071068 |
| 13 — light green | 0.75 | −0.7071068 | −0.7071068 |
| 14 — light blue | 0.5 | 1 | 0 |
| 15 — light yellow | 1 | −1 | 0 |
Note: Y has 5 possible values (0, 0.25, 0.5, 0.75 and 1); Pb and Pr have 7 possible values (-0.9238795, −0.7071068, −0.3826834, 0, 0.3826834, 0.7071068, 0.9238795)

## VIC IC list

* MOS Technology 6560 NTSC
* MOS Technology 6561E PAL Ceramic version, used in early VIC-20's
* MOS Technology 6561-101 PAL