Remembering the Commodore VIC-20 - How to do “High” Resolution Color Graphics in 4K
This is the second follow-up article (after Remembering the Commodore PET) in my nostalgia series talking about old Commodore computers - which was triggered by my reading of On The Edge: the Spectacular Rise and Fall of Commodore, and my comments on that book. In this article, I’ve decided to talk about the VIC-20 computer, and principally its video subsystem which I think was quite interesting, and in some ways (well two relatively minor ways really) was even better than the later and more familiar Commodore 64.
First of all, what was the VIC-20?
- It was Commodore’s first home computer, Commodore’s first computer to plug-in to your TV, Commodore’s first computer with color, and it was the first computer by any manufacturer to sell 1 million units.
- The computer was based around the MOS 6502 8-bit CPU, had 5K of RAM memory (that’s 5K as in 5,120 bytes), 20K of ROM (which included the BASIC interpreter and Operating System kernel), and a graphics and sound subsystem powered by the 6561 (or 6560) VIC chip.
- Programs could be stored on cassette tape (using a special cassette unit that Commodore sold), or on floppy disk - using the 1540 disk drive, which was also sold separately. The computer had a cartridge slot, which could be used to plug-in cartridges which contained extra RAM and/or ROM programs - but since there was only 1 slot - you could only plug-in 1 cartridge at a time unless you got a special expansion unit.
- Here’s a picture of a VIC 20 surrounded by various goodies. The keyboard unit in the center is the VIC 20 computer, behind at the rear of the keyboard is the cassette unit, and the two silver things on top of the keyboard are cartridges.
The key thing that made the VIC-20 into what it was, was the VIC chip. The chip was made by MOS Technology, who were also the manufacturers and designers of the 6502 - and who were a Commodore subsiduary for most of their history. According to On The Edge: the Spectacular Rise and Fall of Commodore, the VIC chip was first developed in 1978, and MOS originally intended to sell it to video-game and electronics manufacturers - but it wasn’t very successful in that market. It wasn’t until after Commodore saw the success of the Sinclar ZX80 and a seminal meeting in London, that Commodore decided to build a computer around it.
When you switched on your VIC-20, it booted up the BASIC prompt, with the screen set to 22 X 23 characters. As with the PET, your programs could alter the contents of the screen from BASIC by using the PRINT statement, or by writing (using the POKE statement) to the locations in memory that corresponded to the screen content.
In the VIC-20, there were two chunks of RAM corresponding to the screen content. These began at memory locations 7680 and 38400 on the unexpanded VIC-20 (the locations could vary once you added memory to your VIC-20).
- The first chunk of memory, beginning at 7680, determined what was in each character cell of the screen. Thus location 7680 indicated what character (from a choice of 256) to display at the top left location of the screen, location 7681 indicated the character one cell to the right of the top left, 7682 indicated the character two cells to the right, etc., then, 7802 (which is 7680+22), 7803, 7804, etc., specified the characters on the second row, and so on.
- The second chunk of memory, beginning at 38400, had the same layout, but specified the color of each character. Thus 38400 indicated the foreground color of the character at the top left, 38401 the color of the character one cell to the right of the top left, 38402 was two cells to the right, etc., and 38422 (which is 38400+22), 38423, 38424, etc., specified the foreground colors of the second row of characters and so on. This memory was only 4 bits wide, and 3 of those bits were used for colors (allowing 8 foreground colors - black, white, red, cyan, purple, green, blue and yellow). The remaining bit, turned on multi-color mode for that particular character cell, which I’ll explain in a moment.
To determine how each of the characters looked on screen, the VIC-20 would look at a mini monochrome bitmap which was defined for each character. As the characters were normally 8X8 pixels, the bitmap definition of each character would only takes 64 bits (8 bytes), and an entire set of 256 characters took 2,048 bytes (8 bytes X 256 characters). The VIC-20 contained a 4K ROM which contained 2 character set bitmaps each of 256 characters, and you could switch between the two built-in sets, or tell the computer to get the character definitions from RAM memory (and thus create user-defined characters).
An important point to remember (one that might seem odd to people familiar with modern bitmapped screens), is that if you changed the definition of a character’s bitmap, any occurrences of that character on screen would immediately change. For example, if I changed the definition of letter ‘A’ bitmap to look like a musical note, all the letter ‘A’s on screen would immediately change. I myself used this technique in many of my programs - for example, I could create a user-defined character representing a space-alien enemy, put lots of them on the screen, and make them all wiggle their ears or legs by POKEing a single byte of their character definitions.

Okay, I promised I’d talk about multi-color mode. Remember each character cell’s color memory (38400 onward) had a bit determining whether it was in multi-color mode. If the multi-color bit was turned on for that character cell, the 8 byte character definition, would instead of being used as an 8X8 monochrome bitmap, would be treated as a 4X8 bitmap in 4 colors (2 bits per pixel). The four colors used for the cell, were the foreground color of the cell, the background color of the screen, and 2 auxilary colors (which were determined for the whole screen). Multi-color mode was pretty useless if you used the ROM based character definitions, because they weren’t designed to look like anything useful in this mode - but it was handy if you created your own character definitions. The fact that you could mix multi-color and the 2-color characters on the screen was also useful - for example - you could have create a chunky 4 color alien mothership, and have writing in higher-resolution 2 color text, elsewhere on the screen. (By the way, this ability to easily mix the higher resolution and multi-color modes on the same screen was one of the very few things that the VIC-20 did that the Commodore 64 couldn’t). The principle oddity of the multi-color mode, was that when in multi-color mode, each pixel was very much wider than tall.
I’ve mentioned, but so far glossed over, the background color for the screen and the auxilary colors. Where did they came from? They were stored on registers on the actual VIC chip itself. The VIC chip contained 16 registers which were mapped into memory at locations 36864 to 36879, and by PEEKing and POKEing these addresses, you could manipulate their values. Among these registers were the screen background color (from a choice of 16 colors), the auxilary color (also from a choice of 16), and the border color - which was also used as the second auxilary color (from a choice of 8 colors). There was also a bit you could set to invert the screen colors (because doing it in software would be too slow on a 1 MHz CPU), so as to make the explosion effects in your games really annoying.
As well as the color registers, the VIC chip also included quite a few other registers. These included:-
- Registers to control the pitch of four tone generators (three vaguely musical square wave generators, plus a white noise generator) as well as the volume for the whole set.
- Registers to monitor the position of a lightpen and game paddles.
- Registers to vary the screen origin and size (in characters) - to a fairly limited extent - which was the other main capability that the VIC-20 had which the latter Commodore 64 didn’t (note to 8-bit pedants: I know that the Commodore 64 had some capability to vary the screen size in hardware, and clever progamming tricks could be used to do it in software). I remember using these to make a wierd spacewarp effect in one of my games, that was supposed to make you feel like you or the screen (or something) was falling into a tunnel and then out again, in between levels.
- There was also a register to monitor the screen’s scanline (how far down the display, the refresh had got), so you could monitor this and change colors part way down the screen - but since you had to poll it rather than simply wait for an interrupt - and since polling would use most of the CPU’s power - I don’t think that this was vastly useful.
- And most interestingly, there was a register bit you could set to double the height of each character cell (giving you 8X16 characters - or 4X16 if multi-color - instead of 8X8 or 4X8).
So how could you do high resolution graphics on the VIC-20? Well, “high” might be a bit of an overstatement - but pixel addressable?
I’ve already given you more than enough clues in this article, can you figure out?
Okay, here’s how:-
- Set the VIC chip to display double height characters
- Set each location in screen memory to display a different double height character. For example, the top left cell displays character 0, the next cell displays character 1, the third cell, character 2, and so on. If you stick with 22 columns, you can fit 11 full rows of double height characters (that’s 242 characters), without having to duplicate any characters - this gives you a resolution of 176X176 pixels (or 88X176 if multi-color)
- Now, when you want to plot a pixel at a given location on screen, you calculate which character is in that cell, then calculate which bit and byte of the character’s bitmap corresponds to that pixel, and change that.
- And once you can set individual pixels, you can then using more math, draw lines, circles, etc.,
Of course, two were slight obstacles in the way:-
- There are no BASIC commands for any of this plotting - you had to do all the math and then PEEK and POKE the right memory locations yourself.
- There wasn’t quite enough memory in the unexpanded VIC to do this: The character definitions took 4K, the screen characters took about 0.5K, and the operating system used 1K = 5.5K, but the computer only had 5K in total! Work-rounds:
- Get a memory cartridge
- Reduce the screen size - remember those screen size/origin VIC registers - and do “high” resolution on an even smaller canvas
I myself took the memory cartridge route, getting a 8K RAM (yes 8 whole kilobytes!), and I remember the thrill of sitting in my bedroom, when all my PEEKs, POKEs and math, finally got a diagonal line and a circle to plot across the screen - very slowly - pixel by pixel.
Later, I got an “Super Expander” cartridge which included 3K of RAM and added extra BASIC commands for plotting. I didn’t use that much, because I couldn’t use it at the same time as the 8K RAM (remember only 1 cartridge slot), and lines and circles didn’t turn out to be very useful for making games (which was my primary interest at the time).
I would say is given the tightness of the memory at the time, Commodore/MOS did miss one rather obvious trick: They could have had added a mode where the VIC chip, using double height characters, dispensed with the screen character memory (allowing you to save a whole 0.5K!), and when in this mode simply assumed screen location 0 contained double height character 0, screen location 1 contained double height character 1, etc. I suspect, they either ran out of silicon, or decided adding a mode like this simply wasn’t worth the effort on the VIC.
I’m going to stop now, but before I do, here are two black rectangles. They are 176X176 and 88X176 pixels respectively. I’ve included them to give modern readers an idea of just how tiny, compared to today’s screens, the VIC-20’s maximum resolution was*. And don’t forget the VIC-20 also had far less colors - 8/16 with significant limitations about how they could be combined in different parts of the screen - as compared to modern computers which typically have around 16,777,216 and allow any color to be used in any part of the screen.

*Modern screens have more or less square pixels, however as mentioned previously, the VIC-20’s multi-color mode featured pixels that were much wider than tall - so although the overall screen was more or less square, the individual pixels weren’t - so the smaller rectangle represents the resolution, but not the shape, of the VIC-20’s multi-color mode. Phew… sorry!