TheCard

Title: Programming and Usage of THE!CART :#

Subtitle: The!Cart programming information#

Date: 2013#

Author: Matthias Reichl#

General information#

The!Cart is equipped with 128MB flash (Spansion S29GL01 chip), 512k RAM and a 256-byte SPI EEPROM (Microchip 25AA020A). The memory is addressed using 16384 8k banks (64 8k banks when using RAM instead of flash).

Register definition#

The cartridge configuration registers are located at $D5A0-$D5A8. All registers are read/write unless noted otherwise. Unused bits shall be written as '0' and always read back as '0'.

Powerup configuration is 8k mode ($A000-$BFFF) using flash bank 0, writes to flash are disabled.

Depending on the selected cartridge mode additional registers are enabled at $D5xx.

The primary bank register also serves as a base bank register for the various sub-modes.

The secondary bank register is only used in "flexi mode".

Supported cartridge modes#

Cartridge mode is selected with bits 0-5 of $D5A6, values other qthan the ones listed here are reserved (and result in "cartridge off").

Details on cartridge modes#

In addition to the main "8k" mode The!!!Cart introduces a very flexible "16k" mode, called "flexi mode". The primary bank register controls the 8k bank at $A000-$BFFF, the secondary bank register controls the 8k bank at $8000-$9FFF.

Using the flash/ram select register it's possible to map in either RAM or flash, and the mapped-in RAM can be configured to be read/write or read-only. These settings can be configured independently for the $8000 and $A000 8k banks.

Flexi mode can also be used to emulate "right" cartridges (by disabling the primary $A000 bank and enabling only the secondary $8000) bank or to emulate both a non-switched 8k "left" and "right" cart.

The!!!Cart can also emulate a wide variety of other popular cartridges, like AtariMax, (SW)XEGS and SIC!!! carts. When one of these "emulated" modes is selected, the corresponding configuration registers are enabled in the $D5xx area.

The main configuration registers at $D5Ax are always present, this memory area is not available for controlling "emulated" carts. This can possibly affect the emulation of carts that don't do full memory decoding of the $D5xx area (or no memory decoding at all), like the MEGA or XEGS carts.

In AtariMax 8MBit mode, only $D58x switches off the cart (original cart can also be disabled via $D580-$D5FF).

Tests have shown that this isn't a problem with currently existing software, though.

Using the bank registers#

The primary bank register always addresses the memory in 8k banks. When The!!!Cart is configured to 16k mode, the least significant bit of the bank register is simply ignored.

The emulated bank registers modify the low-order bits of the primary bank register. As a consequence, cartridge data needs to be aligned at memory blocks of the cartridge size (for example: AtariMax 8MBit carts have to start at an 1MB boundary, i.e. 8k bank 128, 256, 384, ...)

Emulated registers of switchable carts also modify the bank enable register.

For example: Accessing $D567 in AtariMax mode sets the 7 low-order bits of the primary bank register to $67 and the primary bank enable register to $01. Accessing $D580 in AtariMax mode sets the primary bank enable register to $00.

Note: in native (8k and flexi) mode, accessing the bank register does not affect the enable register.