SNES SRAM memory map

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
jdratlif
Regular
Posts: 317
Joined: Tue Sep 14, 2004 12:48 am
Location: In a small padded white room
Contact:

SNES SRAM memory map

Post by jdratlif »

How does the SNES handle SRAM? I've been looking for documents related to this, but the only two I've found have conflicting information, and neither seems to be correct.

On the NES, SRAM is mapped to 0x6000-0x7FFF. I'm not sure if this is an absolute, but it has been true for all the games I've seen.

Does the SNES do something similar? Are there any documents detailing the SRAM I should look at?

Thanks.
http://jdrrant.blogspot.com/ - CODEpendent Blog
http://games.technoplaza.net/ - Emulation Goodies
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

The mapper handles it, so each mapper is different.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
jdratlif
Regular
Posts: 317
Joined: Tue Sep 14, 2004 12:48 am
Location: In a small padded white room
Contact:

Post by jdratlif »

Nach wrote:The mapper handles it, so each mapper is different.
I see. Thanks.
http://jdrrant.blogspot.com/ - CODEpendent Blog
http://games.technoplaza.net/ - Emulation Goodies
kammedo
Rookie
Posts: 11
Joined: Mon Oct 18, 2004 5:26 pm

Post by kammedo »

Nach wrote:The mapper handles it, so each mapper is different.
Wait a moment - isnt SRAM fixed mapped in the SNES Address space?
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

No. SRAM is part of the cartridge, so it goes through that mapper.

jdratlif:
romhacking.net might have some docs about it.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
byuu

Post by byuu »

Wait a moment - isnt SRAM fixed mapped in the SNES Address space?
No, cartridge layout isn't fixed.

HiROM usually maps SRAM to $[20-3f|a0-bf]:[6000-7fff], and LoROM usually maps SRAM to $[70-7f|f0-ff]:[0000-7fff], mirrored appropriately. Note that for LoROM, WRAM always overshadows SRAM in banks $7e and $7f, but you can access it at $fe and $ff where it is mirrored.

But really, it's up to the mapper. The SNES only puts the address on the bus, it's up to the cartridge memory mapper to respond. Same for writes. Luckily, most standardized on layouts that were compatible with HiROM and LoROM. But not all games did.

It's best to use $20:6000 for the start of HiROM SRAM, and $70:0000 for the start of LoROM SRAM. That's the most compatible.
Post Reply