Table of Contents
|$0000 - $1FFF||General purpose RAM|
|$2000-$2007||System control registers|
|$2008 - $2009||Gamepads|
|$2800 - $280F||Versatile Interface Adapter (GPIOs, Timers)|
|$3000 - $3FFF||Audio RAM|
|$4000 - $7FFF||Framebuffer, Sprite RAM, Blitter registers|
|$8000 - $FFFF||Cartridge slot|
Being a 6502-based system, the GameTank can read at, write to, or execute code from 65,536 different locations during a given cycle. The whole collection of these locations is called the “address space”, where “address” refers to the numeric ID of a given location. These locations are also often referred to as “memory” even though not all of the addresses point to a device you can store data to read back later.
In this context, dollar signs denote that a base-16, or hexadecimal, value is being presented.
General Purpose RAM
The lowest 8,196 addresses provide general-purpose data storage. Data stored in this range will only be read and written by the main processor, without side effects.
Of special note within this section are the ranges $0000-$00FF, and $0100-$01FF, called the Zero Page and the Stack respectively. Addresses in the Zero Page can be accessed more quickly by special opcodes, and addresses in the stack are used by certain operations such as calling and returning from subroutines.
Although the memory map only dedicates 8K to this section, there are actually 32 kilobytes of general purpose RAM that can be used. Four different banks of RAM can be selected using the Banking Register.
System Control Registers
These locations are write-only, meaning that any attempts to read from these locations will essentially return a random value. On the physical hardware the data bus will have no component imparting any particular voltage, so any values returned will come from uncertain forces like radio static or the whims of inscrutable unseen entities.
|$2000||Write 1 to reset audio coprocessor|
|$2001||Write 1 to send NMI to audio coprocessor|
|$2006||Audio enable and sample rate|
|$2008||Gamepad 1 (Left port)|
|$2009||Gamepad 2 (Right port)|
Addresses $2000, $2001, and $2006 are used for controlling the Audio Coprocessor. The first two are used for triggering the RESET and NMI vectors respectively. The high bit of $2006 enables or disables the ACP. The lower seven bits determine the sample rate of the audio system by way of setting the number of clock cycles between the ACP receiving IRQ events.
|00000111||Select the active Sprite RAM page|
|00001000||Select which framebuffer to read/write/blit|
|00010000||Clip blits on the left/right screen edges|
|00100000||Clip blits on the top/bottom screen edges|
|11000000||Select general purpose RAM page|
When a flag for clipping in a direction is set, blits to coordinates 128-255 will have no effect. When the flag is not set, blits to those coordinates will wrap to the 0-127 range.
Video/Blitter Flags AKA DMA Flags
These flags at $2007 configure the blitter and the behavior of video memory.
|00000001||DMA_ENABLE||Enable/disable the Blitter|
|00000010||DMA_PAGE_OUT||Select framebuffer page sent to TV|
|00000100||DMA_NMI||Enable NMI signal generated by VBlank|
|00001000||DMA_COLORFILL_ENABLE||Use solid colors for blits instead of sprites|
|00010000||DMA_GCARRY||Set 0 to repeat 16×16 tiles on blit draws|
|00100000||DMA_CPU_TO_VRAM||0 means CPU accesses Sprite RAM1 means the CPU access the framebuffer|
|01000000||DMA_IRQ||Enable IRQ signal when blits finish|
|10000000||DMA_OPAQUE||Set 1 to disable transparency|
The front gamepad ports can be read at $2008 and $2009. Writing to these addresses will not do anything. A byte read from one of these locations will return 6 binary button states from the respective controller. Consecutive reads to the same port will toggle the “select” line on the controller port, causing the controller to change which six button states are being returned. More on reading gamepads can be found in its own article.
Versatile Interface Adapter
Addresses $2800-$280F map to the sixteen registers of the Versatile Interface Adapter or “VIA” for short.
Addresses $2810-$2FFF will also map to the same sixteen registers.
The VIA is used to control the “SPI” pins on the cartridge port as well as the general-purpose IO pins on the rear of the console. More detail is available on the specific VIA article.
Audio RAM is shared between the main system bus and the Audio Coprocessor. From the main processor's perspective this memory sits at $3000-$3FFF. See the dedicated page for more audio specific info.
Video RAM is accessible from $4000-$7FFF and maps to either the Framebuffer, Sprite RAM, or the Blitter Parameters.
The upper half of the GameTank's address space is given to whatever hardware sits in the cartridge slot. The highest address bit on the main bus is presented to the cartridge inverted as an active-low cartridge enable signal. When any address at $8000 or higher is accessed, the cartridge is responsible for further address decoding and activation of memory chips it has on board.
Some of the simplest devices to go in the cartridge slot carry a single parallel EEPROM and a bypass capacitor. Any parallel EEPROM up to 32Kx8 can be used without additional banking hardware. Early cartridges for the GameTank used 8K EEPROMs.
2MB Flash Cartridges
The typical cartridge used at time of writing has 2 megabytes of NOR flash and some extra chips to help access this data through a 32 kilobyte cartridge address space. See Flash Cartridges for more info.