Monday, 8 February 2016

VIC20 Penultimate Cartridge Part 3 - No more DIP switches

The last version of the VIC20 Penultimate Cartridge I'm currently working on expanded the ROM and RAM capabilities, but at the cost of increasing complexity. There were now 9 DIP switches (soon to be 10), 4 to select the ROM and RAM mode, and the rest to select a ROM image set. This came with a long table of the ROM and RAM setting required for each ROM set. For example, you would need to set mode 1 and ROM image 0 for Avenger, and mode 9 and ROM image 8 for the diagnostics cart etc. This worked fine, but would be a bit annoying to use, keep having to refer back to the settings list, which was too large to print on the cartridge case.
To make this easier I wanted to automate the switching, using a menu program on the VIC20 to the set the mode and ROM image, and then reset itself to start the selected ROM. I started looking at the options for this and designed a new version of the board. It started to get complicated quickly with multiple latches to hold the mode, and the ROM address, and also something to generate a delayed reset pulse. There was also the issue of getting it into a start mode.
To simplify things, I went for a microcontroller, this would do all the latching, and generate the reset pulse. It could have a set starting state, and also would allow the mode and address to be preset, but not changed until the reset pulse, so as not to mess up the menu code which was currently running. This was fitted dead bug style on one of the previous boards, to test this out properly. The LEDs show the ROM/RAM mode being set. The cable at the top is connected to a programming header, from a bit of another board glued onto this one.
The VIC20 has some helpfully address decoded signals on the cartridge connection, for IO chips. I found when testing this that just triggering on the IO2 signal was a problem. It seems the normal operation of the OS reads from addresses in the IO2 range at about 60Hz, so I used some spare gates in the GAL chip to generate an IO2 and write signal to trigger the latches.
I've added an LED bargraph for testing, I don't think the final version needs that, as much as I like flashing LEDs, it's not really necessary. With the additional write gated logic, and the microcontroller code written, the LEDs were all being set correctly. The idea of operation would be as follows, when the VIC20 is powered on, a default mode is selected which runs a menu program from ROM. The menu will have a choice of options, all of which will lead to setting the mode and ROM address and resetting the VIC20. When the VIC20 resets, the selected game or whatever will run. There is a button on the cartridge which when pressed will bring the menu back up. It does this by resetting the VIC20 and setting the mode back to the initial state - the mode changes happen whilst reset is held down so it is never in an inconsistent state.
I've setup 4 commands:

  • POKE 38928,X - change to mode X imediately
  • POKE 38929,X - change to ROM address X imediately
  • POKE 38930,X - change to mode X, apply pending ROM change and reset
  • POKE 38931,X - preset ROM address for above

This should cover most of the options required. The menu should be able to offer things like

  • Run a game cartridge from ROM (8K/16K/Atari 16K/Scott Adams 16K)
  • Run the VIC20 diagnostics software (which needs ROM and RAM)
  • Run Super Expander or other BASIC with up to 27K RAM
  • Exit to BASIC with 3K-35K RAM

But also I think I should be able to get it to run some commands on reset,

  • Exit to BASIC with 3K-35K of RAM and execute LOAD "*",8
  • Exit to BASIC with 11K-35K of RAM and execute LOAD "FB20-8K",8 
  • Select a Scott Adams adventure and execute SYS 32592

Being able to autostart a diskimage or the file browser on an SD2IEC (or a 1541 if you like), would be a nice feature to have, and avoiding typing SYS 32592 makes the Scott Adams adventures easier to use.
The new board is now designed and ordered, and will still fit in an original cartridge case. Whilst I'm waiting for those to arrive, I need to write the menu program.
There has been a lot of interest so far, I think this has the potential to be a very useful product. I'm thinking in future I could remove the large (and expensive) EPROM and use a larger micrcontroller to load the ROM images into RAM from a small serial EEPROM. The whole thing could then go surface mount and once the board is smaller, maybe even a custom cartridge case....

Update:
The new boards are here, the software is taking a bit longer to write.
My VIC-20 coding is a bit rusty. I have a very basic BASIC version, but I am looking to write a better version in C.

Update 2:
I have some simple single ROM cartridge PCBs, if you only want to replace a single game.

If you like DIP switches, I still have some of the current version of the PCB available, built and tested with up to 35K RAM and 32 ROM images:

VIC20 Penultimate Cartridge V2.2

Update 3:
The menu software has been rewritten in C.
Initial testing is underway, so far, so good.

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