Bank Switching Cartridges

Cartridges for the C64 provide either 8K or 16K of ROM that will replace parts of the memory visible to the CPU when plugged into the expansion port. Either 8K or 16K, that is all the Commodore can see directly on a cartridge. Then there is an auto-start mechanism implemented in the Kernal that can be triggered to execute code contained in that ROM when the machine is powered on or reset. Jani features an excellent article about how to create such simple cartridges on his site which I have linked to before.

A simple ROM cartridge: the OpenC64Cart.

Now, a maximum of 16K is not very much. Any cartridge that provides more data needs to implement some form of bank switching, i.e. some mechanism to switch between different sections (banks) of ROM. The simplest way to do so would be by using hardware jumpers like the OpenC64Cart shown above. Often, the visible bank is selected by writing to the I/O area in memory. But there are other, more esoteric methods like the one used by the Super Zaxxon cartridges.

The “64k-Karte”

Lately, I’ve been studying a couple of generic bank switching cartridges for the Commodore 64/128. The first one I came across was a board created by Hucky called the “64k-Karte”. It caught my interest when Hucky presented Super Mario Bros. 64 starting from such a cartridge.

The 64kCart, my rendition of Hucky’s bank switching cartridge.

I found a mirror of Hucky’s original page describing the cartridge and I created my own version of the board using KiCAD. As the name implies, this cartridge supports up to 64K of ROM divided into banks of 8K each, numbered 7 down to 0. On reset, bank 7 is selected by default and EXROM is pulled low so that those 8K are visible at $8000.

64kCart schematics

There is a 74LS173 4-bit register on the board that latches D0-D3 when triggered by the IO1 line. The first 3 bits are used to switch between the banks in reversed order and the 4th bit allows the cartridge to be disabled, pulling EXROM high and thus enabling RAM access at $8000. In his post on the Lemon64 forum, e5frog gives a short code snippet showing how to use this: Writing values between #$00 and #$07 to $DE00 will switch between the ROM banks with #$00 selecting the highest bank and #$07 the lowest one. Writing the value #$08 to $DE00 will disable the cartridge until a reset is triggered.

So, the SMB64 cartridge presented by Hucky works by auto-starting a bootloader in the default bank. This loader first copies itself into RAM. Then it switches through the other banks, copying the code of the game to where it would otherwise be loaded to from disk. When this is done, the loader disables the cartridge and starts the actual game.

The Magic Desk Cart

Only after I had built the 64kCart, I learned about the “Magic Desk” cartridge created by Msolajic and Zzarko. And it was even later that I discovered that KiCAD files were available for this cartridge. Oh well. By then, I had alread created my own Magic Desk compatible layout.

The MagicDeskCart Rev.1 with wrong labels on the jumper.

Just like the 64kCart, the Magic Desk is using banks of 8K each mapped to $8000. But it uses a 74LS174 6-bit register, so with one bit again used to disable the module it can address up to 32 banks, i.e. a total of 256K of ROM. Also, the order of the banks is not inverted, so that bank 0 is located at the beginning of the EPROM. Another advantage of the Magic Desk is that its format is supported by the Vice emulator, which greatly helps when testing software.

Magic Desk Cart schematics.

Aside from those differences, working with the Magic Desk is quite similar. Writing values between #$00 and #$1f to $DE00 will switch between the ROM banks, with #$00 selecting the lowest bank and #$1f the highest one. Writing the value #$80 to $DE00 will disable the cartridge until a reset is triggered.

For both the 64kCart and the Magic Desk there are utility programs available that will create ROM images from a single or even multiple program files. But I haven’t looked into these, yet.

The Magic Desk Dual

Inspired by the “Double-Ender” cartridges that were made for the Atari 2600 back in the day and following the suggestion of a user on Forum64 I then went on to create another Magic Desk compatible cartridge.

First sketch of the MDD circuit.

With no additional logic except for a diode and a pull-up resistor it should be possible to create such a “Double-Ender” cartridge with both games contained in the same ROM chip. Depending on which way the cartridge is inserted into the expansion port, a different set of memory banks is selected. I dubbed the board the “Magic Desk Dual” and the project files are also available on Github.

The first Magic Desk Dual cartridge assembled and tested.

Wouldn’t it be great to have a cartridge running Super Mario Bros. one way, and The Great Giana Sisters the other way around? 😉

Of course, the MDD must be used with care because the entire bus is connected to both ends of the cartridge. Accidentally shortened pins or ESDs could potentially damage the computer.

The MDD in its case.

I also created a case for the MDD cartridge that is suitable for 3D printing. The STL files for the case will be available on Thingiverse, soon.


3 thoughts on “Bank Switching Cartridges

  1. Hello
    I was wondering if you have managed to get Giana sisters to work with the intro as it seems hard to find this ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.