Overview
The 6502 could only address 64KB. The Z80 reached the same limit. But games needed more—more graphics, more levels, more music. Memory banking solved this by swapping different memory “banks” into the same address range. The CPU saw the same addresses, but different data appeared depending on which bank was active.
The problem
| CPU | Address bus | Maximum memory |
|---|
| 6502 | 16-bit | 64KB |
| Z80 | 16-bit | 64KB |
Games needed more than 64KB.
The solution
| Concept | Implementation |
|---|
| Banks | Multiple memory blocks |
| Switching | Control register selects bank |
| Window | Address range that changes |
| Fixed | Addresses that don’t change |
C64 banking
Memory map
| Address | Contents |
|---|
| $0000-$9FFF | RAM |
| $A000-$BFFF | BASIC ROM or RAM |
| $C000-$CFFF | RAM |
| $D000-$DFFF | I/O, char ROM, or RAM |
| $E000-$FFFF | KERNAL ROM or RAM |
Bank switching register
lda #$35 ; All RAM, I/O visible
sta $01 ; Processor port
NES cartridge banking
Mappers
| Mapper | Capability |
|---|
| NROM | No banking (32KB max) |
| MMC1 | 256KB PRG, 128KB CHR |
| MMC3 | 512KB PRG, 256KB CHR |
| MMC5 | 1MB PRG, 1MB CHR |
Mapper registers
Write to specific addresses to control banks:
lda #$05 ; Bank number
sta $8000 ; Bank select register
ZX Spectrum 128
128KB model
| Bank | Address |
|---|
| 0-7 | 8 × 16KB banks |
| Paged at | $C000-$FFFF |
| Fixed | $0000-$BFFF |
Bank select
ld a,$05 ; Bank 5
ld bc,$7ffd ; Port
out (c),a ; Select bank
Game Boy
| Feature | Design |
|---|
| ROM banks | Switchable at $4000-$7FFF |
| RAM banks | Switchable at $A000-$BFFF |
| MBC chips | Memory Bank Controllers |
Uses
| Application | Benefit |
|---|
| More levels | Larger games |
| Graphics banks | More sprites/tiles |
| Music data | Longer soundtracks |
| Code | Larger programs |
Programming considerations
| Challenge | Solution |
|---|
| Code in paged area | Keep critical code fixed |
| Data access | Know which bank is active |
| Interrupts | Ensure correct bank for handlers |
| Debugging | Track bank state |
See also