Saturday, 23 January 2016

VIC20 - The Penultimate Cartridge - Part 2 Multi ROM and RAM

Here is the next step in the evolution of my VIC20 Penultimate Cartridge.
This version expands on the previous version by adding 4 pins to each of the chips. The RAM is upgraded from a 62256 (32Kx8) to a 621024 (128Kx8), and the ROM from 27C512 (64Kx8) to 27C040 (512Kx8). To control this, the GAL has been upgraded from a 16V8 to a 22V10.
I've upgraded the PCB to have gold plated edge connectors, for better contact and I've added some large holes to the board (can you add a hole? OK, I've removed some hole shaped sections). This makes the routing the tracks more a challenge, but fits around the pillars in some cartridge cases. This allows the board to fit into an original cartridge case with no modification.
Here it's installed in a nicely yellowed spare Pirates Cove. The lack of the apostrophe is annoying, I guess they couldn't decided if it should that be Pirate's Cove (the Cove of a Pirate) or Pirates' Cove (the Cove of the Pirates). The game itself says 'Pirate Adventure', I guess that was too many letters to fit on. (Update: the box says Pirate Cove). Note the 'Don't forget' label on the top of the original label, you'll need that later.
The DIP switches to control the mode and the reset switch poke out the top of the cartridge. You can change mode and press reset without removing the cartridge or powering off the VIC20.
There's 9 DIP switches there, quite a lot of modes. This is due to the very odd way the VIC20 addresses the cartridge slot. It's quite clever in many ways, as little or no address decoding is required for most cartridges. Decoded select lines are available for the various blocks of memory and I/O:

  • RAM1 0400-07FF (1K)
  • RAM2 0800-0BFF (1K)
  • RAM3 0C00-0FFF (1K)
  • BLK1 2000-3FFF (8K)
  • BLK2 4000-5FFF (8K)
  • BLK3 6000-7FFF (8K)
  • BLK5 A000-BFFF (8K)
  • IO2  9800-9BFF
  • IO3  9C00-9FFF

That was designed so you could use up to 3 pairs of 2114 chips controlled by RAM1,2 and 3 to give a 3K expansion. This fits into a gap in the internal memory in what would be block 0 (0000-1FFF). If you add RAM here, the VIC20 shows 6655 bytes available. If you add any more RAM, this 3K isn't counted any more. If you add RAM to blocks 1, 2 and 3, you can add up 24K of RAM, and the VIC will show it's maximum of 28159 bytes available. You can add RAM in block 5, but the VIC won't count this, but it can be used to load in cartridge ROM images from disk. Here is a memory test program I think I got from an ebay listing (?) which tests which blocks are present.
The first version of this board had a 32K RAM chip, with this I could add 3K + 8K +8K + 8K, or 8K + 8K + 8K + 8K, but I couldn't have all the blocks filled, 3K + 8K +8K + 8K + 8K. I didn't think anything would need this, but it turns out the VIC20 port of Doom does, so I have upgraded the RAM chip to be able to do this. The extra 3K means I had to switch to a 128K chip, even through almost 3/4 of it won't be used. I could have achieved this with a 32K chip and an 8K chip (or even 6 2114's), but aesthetically, it balances the larger 32 pin ROM chip, and it turns out the 128K chips is not only cheaper than the 32K chip + the 8K chip, it is actually cheaper than either of them individually. Now you can play Doom if you like.
The RAM is complicated then, but the ROM side must be easier? Well, sort of. If there is a ROM in block 5, the VIC will run it. On the first revision of the board, I had a choice of 16 8K ROM images that would appear in block 5 and run. This was great, but limited the choice of cartridges. Many games needed more than 8K of ROM, so installed a ROM chip in one of the other blocks. With many of the Commodore cartridges, such as Defender and Robotron, this was 8K on block 5 and 8K in block 3. Now you can play Ms. Pac Man if you like.
The great thing about standard is there are so many to choose from. Atari decided they would do things differently, and when they released Centipede and Dig Dug etc. they had ROMs in block 5 and block 1. I support that as well, so you can play Donkey Kong if you like.
That's three different ROM configurations, 5, 3+5, 1+5. Any more? Well, yes, for the five Scott Adams text adventure cartridges, they went for ROMs in blocks 2 and 3. Why? - who knows. (Update: apparently this was due to lack of space, no autostart saved 128 bytes - see an interview with Scott Adams). With no ROM in block 5, these do not automatically start, hence the 'Remember to type SYS 32592' label on the cartridge. I've supported those as well. Adventureland anyone?
I'm not sure if I've shot myself in the foot adding all these modes. it does make for a lot of DIP switches. The first 4 control the ROM and RAM mapping modes,

   SW1 SW2 SW3 SW4 BLK0 BLK1 BLK2 BLK3 BLK5 Total RAM TOTAL ROM
    0   0   0   0   -    -    -    -    -      0K        0K
    0   0   0   1   -   RAM   -    -    -      8K        0K
    0   0   1   0   -   RAM  RAM  RAM   -      24K       0K
    0   0   1   1   -   RAM  RAM  RAM  RAM     32K       0K

    0   1   0   0  RAM   -    -    -    -      3K        0K
    0   1   0   1  RAM  RAM   -    -    -      11K       0K
    0   1   1   0  RAM  RAM  RAM  RAM   -      27K       0K
    0   1   1   1  RAM  RAM  RAM  RAM  RAM     35K       0K

    1   0   0   0   -    -    -    -   ROM     0K        8K
    1   0   0   1   -    -    -   ROM  ROM     0K       16K
    1   0   1   0   -   ROM   -    -   ROM     0K       16K
    1   0   1   1   -    -   ROM  ROM   -      0K       16K

    1   1   0   0  RAM  RAM  RAM  RAM  ROM     27K       8K
    1   1   0   1  RAM  RAM  RAM  ROM  ROM     19K      16K
    1   1   1   0  RAM  ROM  RAM  RAM  ROM     19K      16K
    1   1   1   1  RAM  RAM  ROM  ROM  RAM     19K      16K

Those are split into 4, the first is 8K blocks, the second is 8K blocks plus the initial 3K. Thirst comes just ROMs and finally ROMs with RAM in the gaps. Yes, another configuration, the Super Expander and Diagnostics cartridges have ROM in block 5 and 3K RAM.
The last 5 DIP switches select which ROM images to load, the high bits of the ROM. The ROM socket can take 28 or 32 pin ROMs, anything from a single ROM image in a 27C64 through to 32 ROM images in a 27C040. When testing this, I was using an EEPROM, a 29C040, unfortunately as will all these 'standards', the pinout is slightly different to the 27C040, so I've had to make a small modification to my test board. I will fit a jumper in future revisions. I've also bolted this to a base without a lid, useful for testing as it still holds in place.
This is how I've loaded my test ROM image, I've split the cartridges up by type, although there is no need to do this. The settings show the mode selection and then the ROM address.

 Switches
1234 56789
0100 xxxxx - 3K RAM only
0001 xxxxx - 8K RAM only
0010 xxxxx - 24K RAM only
0011 xxxxx - 32K RAM only
0111 xxxxx - 35K RAM only

1000 00000 - Avenger
1000 10000 - Choplifter
1000 01000 - Frogger
1000 11000 - Gorf
1000 00100 - Jelly Monsters
1000 10100 - Omega Rat Race
1000 01100 - Radar Rat Race

1100 11100 - Diagnostics (PAL) with 27K RAM 

1100 11101 - Diagnostics (NTSC) with 27K RAM 

1001 00010 - Defender
1001 10010 - Ms Pac Man
1001 01010 - Pole Position
1001 11010 - Robotron
1001 00110 - Submarine Commander
     10110 - 
     01110 - 
     11110 - 

1010 00001 - Centipede
1010 10001 - Dig Dug
1010 01001 - Donkey Kong
     11001 - 
     00101 - 
     10101 - 
     01101 - 
     11101 - 

1011 00011 - Adventure Land
1011 10011 - Pirate's Pirates' Pirates Cove Pirate Adventure
1011 01011 - Mission Impossible
1011 11011 - Voodoo Castle
1011 00111 - The Count
     10111 - 
     01111 - 
     11111 - 

This leads me to think it would be easier to come up with some sort of menu driven system which writes out to an I/O latch to set these options then reset the system. I suspect that will be the next stage of evolution.
I have some of this revision available if anyone would like one of these multi RAM / multi ROM cartridge boards. This will come with programmed GAL, RAM and ROM chips fitted, just add an old cartridge case:
VIC20 Penultimate Cartridge V2.2

In parallel with this, I am also working on the IEEE-488 interface side of what may become 'the penultimate cartridge'. So far I have reverse engineered the Stack IEEE-488 board and built a simplified replacement. 
Currently I have a strange totem pole arrangement out of the back of the VIC20.
More on that once I get it working.

Update: Spot the deliberate mistake in the VIC20 IEEE-488 cartridge

Update 2: New version of the Penultimate Cart with no DIP switches in development.

Update 3: You can now buy one of these complete with a VIC20 diagnostics test harness.

Update 4: Penultimate Cartridge V4.3 available now, all menu driven, no DIP switches.