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 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.
- 1 History of development
- 2 Features
- 3 Versions
- 4 Comparison of PAL and NTSC versions
- 5 Memory access limits
- 6 Memory Map
- 6.1 A : Interlace mode
- 6.2 B : Horizontal position
- 6.3 C : Vertical position
- 6.4 D: Number of columns
- 6.5 E: Number of rows
- 6.6 F: Double character size
- 6.7 G: Raster value
- 6.8 H: Screen memory location
- 6.9 I: Character memory location
- 6.10 NOPQRSTU: Sound switches and frequencies
- 6.11 V: Composite sound volume
- 6.12 W: Auxiliary color
- 6.13 X: Screen/background color
- 6.14 Y: Reverse mode
- 6.15 Z: Border color
- 7 Colors
- 8 Advanced sound programming techniques
- 9 Advanced graphics mode programming techniques
- 10 Die shot
- 11 References
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
|Cycles per line||65||71|
|Lines per frame||261||312|
|Lines per frame interlaced||525||not available|
|Crystal||14318181 Hz||4433618 Hz|
Memory access limits
The default register values are stored in ROM at address $EDE4 to $EDF3.
|Location||Bit function||Default value||Function|
||$05||$0C||Interlace mode / Screen origin (horizontal)|
||$19||$26||Screen origin (vertical)|
||$16||Screen memory location / Number of columns|
||$2E||Raster value (lowest bit)/ Number of rows / Double character size|
||$F0||Screen memory location / Character memory location|
||$00||Light pen position (horizontal)|
||$00||Light pen position (vertical)|
||$00||Bass sound switch & frequency|
||$00||Alto sound switch & frequency|
||$00||Soprano sound switch & frequency|
||$00||Noise switch & frequency|
||$00||Auxiliary color / Composite sound volume|
||$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.
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:
|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|
|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)|
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:
|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|
|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)|
I: Character memory location
|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|
|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)|
|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|
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.
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.
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.
|Value||Color||Y||Pb (rel.)||Pr (rel.)|
Colors 8-15 may only be used in the Auxiliary and Background registers.
These are the bit pairs used in multicolor characters (color RAM values with bit 3 set to 1):
|10||character color from color RAM|
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.
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.