Thursday, 4 February 2016

VIC20 IEEE-488 Cartridge

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

I have been working on various VIC20 cartridges recently. One that I was interested in building was an IEEE-488 cartridge. I had previously tried out the PET microSD with a VIC20 IEEE-488 cartridge, and found it worked well.
I was using the Stack Computer Products IEEE-488 Cartridge, a fairly simple design, more straightforward than the official Commodore one, but not as minimal as the MSD one. I haven't been able to find any more info on that, other than a single photo, so I'm sticking with the stack for the moment.
The Stack cartridge has an usual driver arrangement for the IEEE-488 bus, with standard TTL chips rather than dedicated IEEE-488 drivers like the MC3446 or 75160/161.
I reverse engineered this design to see what was going on. There is a 2716 2K ROM and a 6522 VIA. The 6522 is connected to the IO2 address range (9600-9BFF). Port A was wired to the eight data lines on the IEEE-488 bus, via a 74LS642, an inverting octal bus transceiver with open collector outputs (n.b. note that says, 'inverting', may be important later).
Port B of the 6522 was taken up with the control lines, driven via 7438 2 input NAND gates with open collector outputs and read via 74LS125 bus buffers. A 74LS00 was used to limit the ROM address range to A000-AFFF (the bottom of block 5). There was also a diode OR gate feeding CB0 from the DAV & IFC signals.
I've been considering trying to fit a PET microSD, a version of this IEEE-488 cartridge and also a set of ROM and RAM into a single cartridge.  I've been doing that bit by bit, trying different options and the ROM and RAM versions are working well, with the new menu driven no DIP switch version coming on well.
Rather than duplicate the design, I decided to reduce it down and use standard 75160/161 IEEE-488 bus drivers as things like the 74LS642 are difficult to get hold of (and more than double the price of the 75161).
I also added 32K of RAM under the ROM chip to make this more useful, since without it you can only load programs into the internal RAM.
Testing the new cartridge. The RAM was fine. The ROM was fine. Talking to the 6522 was working fine. Talking to the IEEE-488 bus wasn't.
Testing with my IEEE-488 diagnostics board confirmed the problem, comparing the outputs on the LEDs when sending the same commands to the 6522 on the Stack and my new board showed the outputs were inverted. Sending 00 turned all the LEDs on the databus off on the my board. Sending FF turned them all on.
On the Stack board, 00 was all on, FF was all off. I'm allowed one mistake, right? a 'Partial Success' as a colleague of mine used to say. This is something that could be fixed in hardware, add some inverters (or even revert to the original design). It could also be fixed in software by inverting (or removing inversion if already there). I was trying to avoid modifying the original code, although it's only 2K, so I had considered relocating it to live in the 3K gap in block 0 that is generally unused when 8K or more RAM is added. Back to the drawing board.

2022 Update: I gave up with the IEEE-488 cartridge in the end, the requirement for a ROM means it is always going to take up space that might be needed for the programs you want to load, so best just stick with an SD2IEC for the moment.