Sunday 9 February 2020

Marina64 1MB Banked ROM Cartridge for C64


This is the Marina 64, a new 1MB banked ROM cartridge for the Commodore 64 (and Commodore 128 and SX-64).
This is based on the Magic Desk cartridge. This was a Commodore product back in the 1980s which was an early attempt at a desktop operating system. With a literal desktop (possibly the origin of that?).
There was a file manager, calculator, and a very strange word processor that was like a virtual typewrite simulator where as you typed, the page of text moved to the left, creating a document 80 characters wide on a 40 column screen.
This didn't catch on, and was superseded by GEOS and things like that. However, it lives on in the hardware that was used. I haven't been able to find any pictures of the original Magic Desk 1 cartridge, but it consisted of four 8K ROMs, and two TTL chips. These formed a simple bank switching mechanism to allow the four ROMs to be accessed through a single 8K window. On boot, the first ROM would be selected, and the C64 would boot as if it were a normal 8K cartridge. When the program needed to access one of the other blocks of code, it would write to an IO address which would select a different ROM from the four available.
At some time in the past, a thought must have occurred to someone that it would be a good starting point for their own cartridge. The C64 was limited to 16K ROM in a cartridge, so this was a way to get a 32K game in cartridge form. Another thought would have occurred that this could be achieved with similar logic and a single ROM chip, selecting one block or bank of 8K from a single 32K ROM chip (not sure if Commodore ever did this or it was later clones). Further thoughts could have been along the lines that the bank is selected by writing a byte to the IO port, and only the first two bits were used to select the bank, so a larger ROM chip could be used by latching more bits of the byte written to the IO port to use to select the bank. (There will be a more detailed look at this in a later blog post). There are now many variations of the design of 'Magic Desk compatible' cartridges, and when looking for a cartridge for larger games for The Future Was 8 bit '999' range of cartridges, this seemed a well established and well supported way to go.
My first attempt was a 'developers edition' cartridge, really just an in house testing tool. This had the ROM socket, and two TTL chips. One of these is simple decoding logic, the other latches the number of the bank selected. Here I am using a 74HCT273, so it latches the whole byte written to the port. The original design used a 74LS174 which can only latch 6 bits. Most of the versions of the design I have seen online had lots of jumpers. TFW8b doesn't like jumpers (he asked me to add here he also hates cardigans), so I looked into which ones we actually needed.
This is the result of my analysis of the various options for common EPROM types. The first jumper I got rid of was the one on the /EXROM pin. This was there to disable the cartridge so it could be programmed in system. I didn't see this as a requirement of this implementation of Magic Desk, at 300 bytes per second out of an IEC drive, it would take just under an hour to program a 1MB ROM chip, so I would recommend just using a standard EPROM programmer where it takes a couple of minutes.
The remainder of the jumpers were selecting a bank address or 5V for the upper address lines on smaller chips. The 27C64 and 27C128 aren't really relevant here as they can use plain cartridge PCBs for 8K and 16K titles. By discounting those, and the writable chips version the 28C64, and the 28C256 with it's address lines in a different place, and the largest writable 39F series chips, you get down to a single jumper, one to select if the ROM is 28 pin or 32 pin.

EPROM
Jumper
Banks
Capacity
27C256
28 pin
4
32K
27C512
28 pin
8
64K
27C010
32 pin
16
128K
27C020
32 pin
32
256K
27C040
32 pin
64
512K
27C080
32 pin
128
1M

This is a common differentiator with TFW8b products. This will work for most people, most of the time. For the few who want to use different chips, or write in system etc. other products are available, but we try not to over complicate the main product for the average user. I was asked about the need to stack two 512K chips to get 1MB. I have seen a cartridge which requires this, but I don't see why that is necessary when you can use a single 27C080 1MB chip.
This is the prototype of the cartridge, dubbed the Marina 64 (for obvious reasons). These boards are available now as a bare PCB from TFW8b.com. A production version will be available soon, with surface mount ICs pre-assembled, and an activity LED, which shows when the cartridge is active.
Naturally, the cartridge PCB is designed to fit into the TFW8b.com C64 Stumpy Cartridge Cases. Available in a range of tasteful colours (and pink), and also available blank labels for your own titles.
One of the benefits of going down the Magic Desk route, is there are a number of programs around to generate compilation cartridges and self extracting programs to work with a Magic Desk cartridge, and these can be previewed and tested in the Vice C64 emulator.
A good example of this is the Magic Desk Cartridge Generator v3.0 by Žarko Živanov. This is a python script which can be used to compile a cartridge from normal PRG files. The script generates a menu program which allows you to select a program, which is then decompressed into RAM. The programs can span multiple banks, and with 1MB capacitor you can fit dozens of programs on a single cartridge.
Another option is if you have a single large prg file, you can use a program such as the C64 Cartridge Creator tool 1.0.0 by Solo761. There is no menu in this case, it just copies the prg file from the ROM cartridge into RAM and starts it running. None of these options are suitable for programs which require multiple files (for example disk games), only single prg files.
Update - The production versions are available now Marina64 PCBs from TFW8b.com.

Update - see the following blog post for more details on How banked ROM cartridges work.