Super NES Programming/SNES memory map

From Wikibooks, open books for an open world
Jump to: navigation, search

Memory Mapping[edit]

There are two types of SNES cartridges, the SNES community refers to them as LoROM and HiROM cartridges. Both have different memory mapping.

Bank Offset Defintion Shadowing
$00-$2F $0000-$1FFF LowRAM, shadowed from bank $7E $7E
$2000-$2FFF PPU1, APU, hardware registers
$3000-$3FFF DSP, SuperFX, hardware registers
$4000-$41FF controller
$4200-$4FFF DMA, PPU2, hardware registers
$6000-$7FFF RESERVED (enhancement chips memory)
$8000-$FFFF MODE 20 ROM (program memory)
$30-$3F $0000-$1FFF LowRAM, shadowed from bank $7E $7E
$2000-$2FFF PPU1, APU (hardware registers)
$3000-$3FFF DSP, SuperFX (hardware registers)
$4000-$41FF controller
$4200-$4FFF DMA, PPU2 (hardware registers)
$6000-$7FFF RESERVED (enhancement chips memory)
$8000-$FFFF MODE 20 ROM (program memory) $80-$BF
$40-$6F $0000-$7FFF RESERVED
$0000-$FFFF MODE 20 ROM (program memory) $C0-$EF
$70-$77 $0000-$7FFF (Mode 20 SRAM - save RAM) 256KBytes
$78-$7D $0000-$7FFF RESERVED
$7E $0000-$1FFF LowRAM
$2000-$7FFF HighRAM
$8000-$FFFF Extended RAM
$7F $0000-$FFFF Extended RAM
$80-$EF $0000-$FFFF Mirror of $00-$6F $00-$6F
$F0-$FF $0000-$7FFF RESERVED
$8000-$FFFF (Mode 20 ROM)

The HiRom memory map is as follows:

Bank Offset Definition Shadowing
$00-$2F $0000-$1FFF LowRAM, shadowed From $7E $7E
$2000-$2FFF PPU1, APU $00-$3F
$3000-$3FFF SFX, DSP, etc. $00-$3F
$4000-$41FF Controller $00-$3F
$4200-$5FFF PPU2, DMA, etc. $00-$3F
$6000-$7FFF RESERVED $00-$3F
$8000-$FFFF (Mode 21 ROM) From $C0-$EF $C0-$EF
$30-$3F $0000-$1FFF LowRAM, shadowed From $7E $7E
$2000-$2FFF PPU1, APU $00-$3F
$3000-$3FFF SFX, DSP, etc. $00-$3F
$4000-$41FF Controller $00-$3F
$4200-$5FFF PPU2, DMA, etc. $00-$3F
$6000-$7FFF (Mode 21 SRAM) 256KBytes -------
$8000-$FFFF (Mode 21 ROM) From $C0-$EF $C0-$EF
$40-$6F $0000-$7FFF (Mode 21 ROM) From $C0-$EF $C0-$EF
$70-$77 $0000-$FFFF (Mode 20 SRAM) 256KBytes -------
$78-$7D $0000-$FFFF RESERVED -------
$7E $0000-$1FFF LowRAM $00-$3F
$2000-$7FFF HighRAM -------
$8000-$FFFF Expanded RAM -------
$7F $0000-$FFFF Expanded RAM -------
$80-$BF $0000-$FFFF Mirror oF $00-$3F $00-$3F
$c0-$FF $0000-$FFFF (Mode 21 ROM) -------

Banks $80 to $FF are mostly a mirror of the above. ROM mapped to banks $80 to $FF may be accessed at 3.58 Mhz rather than 2.68 Mhz depending on how register $420D is set.

There are two main models for memory that are used: LoROM and HiROM. LoROM means that the address line A15 is ignored by the cartridge, so the cartridge doesn't distinguish between $0000-$7FFF and $8000-$FFFF in any bank. Smaller ROMs use this model to prevent wasted space in banks $00-$3F.

Misc locations[edit]

At the end of bank 0, 64 bytes of cartridge information are stored. This section includes info such as interrupt vectors, title, version, etc.

location name description
$FFC0 Game title. 21 bytes, usually uppercase.
$FFD5 ROM makeup byte. xxAAxxxB; AA==11 means FastROM, B is HiROM
$FFD6 ROM type. ROM/RAM/SRAM/DSP1/FX
$FFD7 ROM size.
$FFD8 SRAM size.
$FFD9 Creator license ID code.
$FFDB Version #.
$FFDC Checksum complement.
$FFDE Checksum.

Interrupt vectors[edit]

Vectors are all 2 bytes. Program execution begins in emulation mode at the reset vector ($FFFC-D).

native mode vectors[edit]

name location description
COP $FFE4, 5 Co-processor enable. Not used for the Super NES.
BRK $FFE6, 7
ABORT $FFE8, 9
NMI $FFEA, B Non-maskable interrupt. Called when vertical refresh (vblank) begins.
RESET $FFEC, D unused
IRQ $FFEE, F Interrupt request. Can be set to be called at a certain spot in the horizontal refresh cycle.

emulation mode vectors[edit]

name location description
COP $FFF4,5 Co-processor enable. Not normally used for the Super NES.
ABORT $FFF8,9
NMI $FFFA,B Non-maskable interrupt. Called when vertical refresh (vblank) begins.
RES $FFFC,D Reset vector, execution begins via this vector.
BRK $FFFE,F
IRQ $FFFE,F Interrupt request. Can be set to be called at a certain spot in the horizontal refresh cycle.

External Links[edit]

Snes mem map
SNES Memory Mapping

See Also[edit]