SchematicsVarious schematics for the VIC20 are available on the net. The ones on zimmers.net have the pages split in half, so for reference, these are the joined up versions I put together, with a little bit of tidying up and attempts to correct the misalignment present in the original scans.
Page 1 covers the 6502, VIC, clock and bus buffers.
VIC chipYou could say the heart of the machine is the 6502 processor, but that is relegated off to the side, and the real star of the show is the VIC chip, the 6560 (for NTSC) or 6561 (for PAL). This gives the machine it's name, although it wasn't actually designed for it, having been designed several years earlier but failed to find an application. The VIC generates the video output, which is tied to the dot clock for the different video standards. The original version of the VIC20 (2 pin power connector) had different boards for PAL and NTSC versions, these had different clock crystals (14.31818 MHz for NTSC, 8.867238 MHz for PAL),
converting a PAL VIC20-CR to NTSC and vice versa.
ResetThe VIC20 uses the good old 555 timer to generate a clean reset pulse of 1.6 seconds. This is fed via a 7406 open collector buffer, to allow external reset via the user port, IEC port or cartridge port.
Oric 1 repair.
PowerNone of the VIC20 range used dynamic RAM, so there was no need for -5V or 12V rails required by the usual 4116 chips. The static RAM chips 2114s and 6116s are 5V only, so the VIC20 was a mostly 5V machine. The only part that needed more than 5V was the datasette port that needed 9V. The power circuitry went back to the early Commodore PETs, and had a 9V AC input, rectified to give 9V DC (ish) and then regulated down to 5V. The regulator inside the early model Commodore PET was a 7805 TO3 device which gets rather warm.
Address decodingMost of the address decoding in the VIC20 is handled by splitting the 64K address range of the 6502 microprocessor into eight 8K chunks. These are split as follows:
0000 - 1FFF
Internal 1K RAM
Internal 4K RAM
2000 - 3FFF
4000 - 5FFF
6000 - 7FFF
8000 - 9FFF
Character ROM, I/O 0 and Colour RAM
A000 - BFFF
C000 - DFFF
E000 - FFFF
Four (and a half) of those blocks are not implemented within the VIC20 (shown in blue), and are assigned to the cartridge port. RAM1, RAM2 and RAM3 are 1K allocations within block 0. I/O 2 and I/O 3 are 1K blocks within block 4. BLK1, BLK2, BLK3 and BLK5 are four full 8K blocks.
Block 0Block 0 contains the internal RAM, and important areas of RAM that are always present, and forms the BASIC working area and screen memory as follows:
0000 - 00FF
0100 - 01FF
0200 - 03FF
0400 - 07FF
RAM1 (cartridge slot)
0800 - 0BFF
RAM2 (cartridge slot)
0C00 - 0FFF
RAM3 (cartridge slot)
1000 - 1DFF
BASIC User area
1E00 - 1FFF
The zero page and stack are important to the 6502 so there always needs to be RAM at these locations if you want to make use of the faster zero page op codes, and any subroutine jumps need a stack. There is a 3K gap within this range that can be filled via the cartridge port. This confuses things quite a bit, and you end up with three different arrangements of the memory map, expanded, 3K expansion and 8K (or more) expansion (see later)
Blocks 1,2 and 3Blocks 1, 2 and 3 are mapped to the cartridge port. There you can install RAM and / or ROM. RAM must start in block 1, then blocks 1 and 2, then blocks 1,2 and 3 if it is to be recognised by BASIC. Other combinations can be used by your own assembly language programs, but BASIC will not count memory if there is a gap. These blocks are normally used in combination with block 5, to provide one or more additional 8K blocks of code. As far as we know, Cheese and Onion is the only game which uses all of blocks 1, 2, 3 and 5.
Block 4Block 4 is used for IO and the screen colour RAM as follows:
8000 - 8FFF
9000 - 93FF
I/O 0 (VIC and VIAs)
9400 - 97FF
9800 - 9BFF
I/O 2 (cartridge slot)
9C00 - 9FFF
I/O 3 (cartridge slot)
The 4K character ROM is generally 901460-03, but there may be regional variations for other character sets. The colour RAM is a single 2114 chip, 4 bits by 1K, so only bits 0-3 are implemented. The VIC chip uses either the top or bottom half of that depending on the amount of system RAM installed (see later). I/O 2 and 3 are assigned to the cartridge port to use for external I/O devices. I've never seen those implemented as RAM, but I suppose there is nothing stopping you adding a further 2K of RAM within this I/O range, if you wanted to squeeze the maximum out of the VIC20. BASIC wouldn't see it, but you own assembly language could. The I/O 0 range is split up further for the VIC and the two VIA chips.
9000 - 900F
9110 - 911F
VIA #1 (userport)
9120 - 912F
VIA #2 (keyboard)
VIA#1 is used mainly for the userport, and VIA#2 for the keyboard. The other I/O functions, the joystick port, IEC port and datasette port are split between the remaining pins on both chips.The decoding is not complete here, so the VIAs are mirrored throughout the I/O 0 range. VIA#1 is enabled on all addresses in the I/O 0 range where A4 is high, and VIA#2 where A5 is high, so there are addresses where both chips are enabled. I've not seen this used in practaice, but you could save time if you were writing to both chips at the same time during initialisation using say 9130-913F, although, any read operations would cause bus conflict. Quite a lot of potential range is wasted there, as only 48 bytes of a possible 1024 are used, but it saves a number of logic chips that would have been required for tighter decoding.
Block 5Block 5 is an 8K block assigned to the cartridge port. If a ROM chip is present which starts with the correct predefined header, BASIC execution will jump to the start address defined in the header, this allows autostart cartridges to be used. Most ROM cartridges use a ROM in block 5 to start their code, often with an additional ROM in one of the other 8K banks on the cartridge slot It is also possible to install RAM in this address range, and if a ROM image is copied into the RAM, it will also autostart, but be aware that some cartridges will detect if they are running from RAM, and may refuse to continue.
Block 6Block 6 is the BASIC ROM. This cannot be paged out or replaced from the cartridge port, so any routines in the BASIC ROM are always available. There appears to have only ever been one release, 901486-01.
Block 7Block 7 is the KERNAL ROM (although it also contains various bits of the BASIC code). This is also fixed and cannot be paged or replaced. It is normally socketed, as there are different KERNAL ROMs for each region (901486-06 for NTSC, 901486-07 for PAL). They also seem to be a more common failure than many other chips.
Moving TargetsIf that all seemed to make sense, then let me confuse you a little. In order to make use of the extra 3K or 8K or more RAM, some things are moved around when these are installed, to leave the largest available continuous run of RAM available to BASIC.
BASIC bytes free
Quite a few things to note here:
- The screen and colour RAM move when 8K or more is installed.
- The 3K space in block 0 is not used by BASIC when 8K or more is installed.
- The BASIC start address changes each time.
- RAM in block 5 is not counted by BASIC
- The internal RAM is multiplexed with the VIC chip, so it can't access external RAM
Decoding hardwareThe address decoding is fairly simple, and uses mainly 74LS138 three to eight line decoders.
I have seen quite a few machines where these chips have failed. Possibly because some of their pins are directly connected to the cartridge port, so could have been damaged by inserting or removing a cartridge when the power was on (particularly at an angle), or just static from the carpet.
Avenger, Radar Rat Race, Omega Race
Centipede, Dig Dug
Defender, Robotrol, Pole Position
Adventureland, Pirate's Cove, The Count
Any of those that work prove those blocks are working. Any that fail indicate one or more bad block enable lines. More on this in a previous VIC20 Repair blog post. You will see the Scott Adams' Text Adventure cartridges do not sit in block 5. This is apparently due to a shortage or space, they couldn't fit in the header and bootup code required, so the user had to type a SYS command to start the game.