MOS Technology VIC

From DenialWIKI
Jump to: navigation, search
The die

The 6560 Video Interface Chip (VIC) is the namesake of the VIC-20. This chip handles the graphics and sound, interacts with light gun/pen, and converts analog paddle signals to a digital value.

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 Commodore VIC-20 home computer. It was originally designed for applications such as low cost CRT terminals, biomedical monitors, control system displays and arcade or home video game consoles.

History of development

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)
  • 4 channel sound system (3 square wave + "white" noise + global volume setting)
  • two 8-bit A/D converters
  • light pen support
  • on-chip DMA and address generation

The maximum video resolution depends on the television system (176 × 184 is the standard for the VIC-20 firmware, although at least 224 × 256 is possible on the PAL machine)

The VIC was programmed by manipulating its 16 control registers, memory mapped to the 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 lightpen facility. The VIC preceded the much more advanced VIC-II, used by the VIC-20's successors, the C64 and C128.


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

Comparison of PAL and NTSC versions

Chip 6560-101 6561-101
Cycles per line 65 71
Lines per frame 261 312
Lines per frame interlaced 525 not available
Crystal 14318181 Hz 4433618 Hz
Bus clock crystal/14 crystal/4
Screen width 210 233
Screen height 233 284

Memory access limits

The VIC cannot access memory connected using the Cartridge port, only RAM in the ranges $0000-03FF and $1000-$1FFF, as well as the character ROM at $8000-8FFF, can be read.[1]

Memory Map

The default register values are stored in ROM at address $EDE4 to $EDF3.

Location Bit function Default value Function
hex dec NTSC PAL
$9000 36864 ABBBBBBB $05 $0C Interlace mode / Screen origin (horizontal)
$9001 36865 CCCCCCCC $19 $26 Screen origin (vertical)
$9002 36866 HDDDDDDD $16 Screen memory location / Number of columns
$9003 36867 GEEEEEEF $2E Raster value (lowest bit)/ Number of rows / Double character size
$9004 36868 GGGGGGGG variable Raster value
$9005 36869 HHHHIIII $F0 Screen memory location / Character memory location
$9006 36870 JJJJJJJJ $00 Light pen position (horizontal)
$9007 36871 KKKKKKKK $00 Light pen position (vertical)
$9008 36872 LLLLLLLL $FF Paddle 1
$9009 36873 MMMMMMMM $FF Paddle 2
$900A 36874 NRRRRRRR $00 Bass sound switch & frequency
$900B 36875 OSSSSSSS $00 Alto sound switch & frequency
$900C 36876 PTTTTTTT $00 Soprano sound switch & frequency
$900D 36877 QUUUUUUU $00 Noise switch & frequency
$900E 36878 WWWWVVVV $00 Auxiliary color / Composite sound volume
$900F 36879 XXXXYZZZ $1B Screen color / Reverse mode / Border color

A : Interlace mode

In this mode, the videochip will draw 525 interlaced lines instead of the 261 non-interlaced lines in the normal mode. This bit has no effect on the PAL version.[2]

To turn off in BASIC:

   POKE 36864, PEEK(36864) AND 127

To turn off in ML:

   lda $9000
   and #%01111111
   sta $9000

To turn on in BASIC:

   POKE 36864, PEEK(36864) OR 128

To turn on in ML:

   lda $9000
   ora #%10000000
   sta $9000

B : Horizontal position

Moves the screen along the X axis half characters (4 hires pixels).

C : Vertical position

Moves the screen along the Y axis two dots per increment. The VIC can be tricked into single-line offsets by setting the horizontal position to 0 in the first raster line.

D: Number of columns

The number of character columns, normally set to 22. Values greater than 31 will be trimmed. 27 columns fill a NTSC screen, 30 columns fill a PAL screen. However, to keep all columns visible on any CRT you shouldn't use more than 24 columns on NTSC systems and no more than 26 columns on PAL systems. The total number of characters displayed may exceed 512 if enough internal RAM is available.

E: Number of rows

On NTSC systems the maximum number of rows is 28, on PAL it is 32. Greater values probably won't work on every CRT. The total number of characters displayed may exceed 512 if enough internal RAM is available.

F: Double character size

When set this will double the character size to 16 lines. This can be used to display bitmapped screens where every pixel can be modified.

G: Raster value

This holds the number of the line that is currently drawn to the screen. It's also used to synchronize the light pen. The single bit in register $9003/36867 is the lowest bit of the raster value.

H: Screen memory location

Determines where the character index values are stored in memory. The single bit in $9002/36869 is bit 9 of the screen address. The other bits are bits 10-13 of the screen address. Keep in mind that bit 9 is also bit 9 of the color memory location. If it's set to 0 color memory starts at $9400/37888, otherwise it starts at $9600/38400.

To the CPU, bit 13 is bit 15 but inverted.

Values for bit 9 set to 1

These are the possible screen locations for unexpanded VICs or VICs with a 3K memory expansion (and color memory at $9600/38400), default in bold:


(bits 10-13)

Location Contents
hex dec
0 $8200 33280 character ROM
1 $8600 34304 character ROM
2 $8A00 35328 character ROM
3 $8E00 36352 character ROM
4 $9200 37376 I/O block 1 (VIC and VIAs) / alternative color RAM location
5 $9600 38400 normal color RAM
6 $9A00 39424 I/O block 2
7 $9E00 40448 I/O block 3
8 $0200 512 RAM
9 $0600 1536 RAM (3K memory expansion, not accessible)
10 $0A00 2560 RAM (3K memory expansion, not accessible)
11 $0E00 3584 RAM (3K memory expansion, not accessible)
12 $1200 4608 RAM
13 $1600 5632 RAM
14 $1A00 6656 RAM
15 $1E00 7680 RAM

Values for bit 9 set to 0

This are the possible screen locations for more 8K+ expanded VICs (with color RAM at $9400/37888), default in bold:


(bits 10-13)

Location Contents
hex dec
0 $8000 32768 character ROM
1 $8400 33792 character ROM
2 $8800 34816 character ROM
3 $8C00 35840 character ROM
4 $9000 36864 I/O block 1 (VIC and VIAs) / alternative color RAM location
5 $9400 37888 normal color RAM
6 $9800 38912 I/O block 2
7 $9C00 39936 I/O block 3
8 $0000 0 RAM
9 $0400 1024 RAM (3K memory expansion, not accessible)
10 $0800 2048 RAM (3K memory expansion, not accessible)
11 $0C00 3072 RAM (3K memory expansion, not accessible)
12 $1000 4096 RAM
13 $1400 5120 RAM
14 $1800 6144 RAM
15 $1C00 7168 RAM

I: Character memory location

Value Location Contents
hex dec
0 $8000 32768 character ROM upper case normal characters
1 $8400 33792 character ROM upper case reversed characters
2 $8800 34816 character ROM lower case normal characters
3 $8C00 35840 character ROM lower case reversed characters
4 $9000 36864 I/O block 1 - VIC and VIAs
5 $9400 37888 color RAM with memory expansion in block 1 / normal color RAM
6 $9800 38912 I/O block 2
7 $9C00 39936 I/O block 3
8 $0000 0 RAM
9 $0400 1024 RAM (+3K memory expansion, not accessible)
10 $0800 2048 RAM (+3K memory expansion, not accessible)
11 $0C00 3072 RAM (+3K memory expansion, not accessible)
12 $1000 4096 RAM
13 $1400 5120 RAM
14 $1800 6144 RAM
15 $1C00 7168 half RAM, half ROM of upper case normal characters since the 14-bit address space of the VIC wraps around

NOPQRSTU: Sound switches and frequencies

When the sound switches are set to 1 the sound channel associated with it is turned on. The frequencies for the channels are calculated like this:

frequency = clock / (127 - value)

To get the register value for a particular frequency do:

value = 127 - (clock / frequency)

The 'clock' varies depending on the channel and on the version of the VIC you are using:

Channel NTSC clock PAL clock
bass 3995 4329
alto 7990 8659
soprano 15980 17320
noise 31960 34640

Internally, the square wave sound generators are realized as 8-bit linear feedback shift registers (LSFR). When they're active, one bit is shifted out, inverted, output and inserted at the other end, at the rate programmed with the low 7 bits of the frequency register. The noise generator seems to be a 13-bit LSFR.[3]

V: Composite sound volume

This determines the loudness of all channels combined, ranging from 0 (off) to 15 (full volume). With high volume settings and more than one channel running clipping might occur. See DC offsets and clipping. For the smallest amount of clipping the volume should be set to a value of 8.[4]

W: Auxiliary color

This color is used with multicolor characters only, but all 16 possible colors can be used.

X: Screen/background color

Here as well, all 16 colors can be chosen from.

Y: Reverse mode

When set to 0 character and screen color are swapped.

Z: Border color

Only colors 0-7 can be used here.



The VIC produces a 16-color YPbPr composite video palette. The palette lacks any intermediate shade of gray, and it has only four levels of luminance above the zero (black).[5]

Color codes

Value Color Y Pb (rel.) Pr (rel.)
0 black 0  0  0
1 white 1  0  0
2 red 0.25 -0.383  0.924
3 cyan 0.75  0.383 -0.924
4 purple 0.5  0.707  0.707
5 green 0.5 -0.707 -0.707
6 blue 0.25  1  0
7 yellow 0.75 -1  0
8 orange 0.5 -0.707  0.707
9 light orange 0.75 -0.707  0.707
10 pink 0.5 -0.383  0.924
11 light cyan* 1  0.383 -0.924
12 light purple 0.75  0.707  0.707
13 light green 0.75 -0.707 -0.707
14 light blue 0.5  1  0
15 light yellow* 1 -1  0

The colors marked with an asterisk (*) are out of the RGB gamut.[6]

Colors 8-15 may only be used in the Auxiliary and Background registers.

Multicolor codes

These are the bit pairs used in multicolor characters (color RAM values with bit 3 set to 1):

Value Color
00 screen/background color
01 border color
10 character color from color RAM
11 auxiliary color

Advanced sound programming techniques

Digitized sound output

4-bit resolution digitized sounds can be played by writing samples to the volume register. See One hour of digitized music on the VIC.

The rather quiet output can be amplified with a HF carrier.

Manipulating waveforms

The waveforms of the three square wave oscillators can be modified by rapidly turning an oscillator on and off after letting it rest for a while. See 15 new waveforms for the VIC-20.

Advanced graphics mode programming techniques

With help of just-in-time graphics data manipulation (and great loss of CPU performance), resolutions far beyond the original VIC design can be established. See the New Frontiers in VIC-Hires-Graphics Series.

Die shot

The Visual 6502 project offers a 6561 die shot for reverse engineering purposes.