HiROM SRAM dumping

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
HiROM SRAM dumping
by on (#141842)
I've been trying to use my homemade cart dumper to copy the SRAM off of my Secret of Mana cart, but apparently I'm making a really stupid mistake somewhere. According to the higan manifest, the SRAM is mapped to 20-3f,a0-bf:6000-7fff, which matches up to HiROM mapping. It's also only 8KB, or 0x2000 bytes long. So, shouldn't that mean that the save file should be located within a contiguous block at 206000-2067fff? I tried dumping that block and loading it into an emulator, but it's not being recognized. I've tested it against some of my LoROM games, and they all work fine using this address translation function that byuu gave me:

Code:
uint32_t SRAMAddress(uint32_t address)
{
  return 0x700000 + ((address & ~0x7FFF) << 1) + (address & 0x7FFF);
}


So I know my dumper is still working, I'm just apparently failing at understanding the HiROM mapping scheme. So... any ideas what I'm doing wrong? Bonus points for an answer in the form of that function re-written for HiROM ^^
Re: HiROM SRAM dumping
by on (#141843)
Try $306000-$307FFF, $316000-$317FFF, $326000-$327FFF, and $336000-$337FFF.
Code:
uint32_t SRAMAddress(uint32_t address)
{
  return 0x300000 + ((address & ~0x1FFF) << 3) + (address & 0x1FFF);
}

Anyone know if there's a Super NES counterpart to NesCartDB, a web site that lists the ROM size, SRAM size, and mapper for each game?
Re: HiROM SRAM dumping
by on (#141844)
Thanks, I'll give it a try.

tepples wrote:
Anyone know if there's a Super NES counterpart to NesCartDB, a web site that lists the ROM size, SRAM size, and mapper for each game?


Super Famicom (NTSC).bml


Edit: No luck. I tried the translation function as well as all 4 of the sections you mentioned, none seem to work. Why 30:xxxx? The mapped section starts at 20:xxxx, doesn't it?
Re: HiROM SRAM dumping
by on (#141847)
SoM uses a SHVC-2J3M-01 board (according to this site); attached is the relevant memory map and should answer your "why $30:xxxx?" question. "RAM" in this context refers to SRAM.

I couldn't care less what higan's "manifest" contains -- i.e. don't ask me why banks $20-2f and $a0-af are listed there, but I'm sure there's some justification somewhere for it (some cart somewhere needing it, and the manifest file that someone chose for SoM just happened to "mostly" be the same thing), but I'm not going to get hung up on that (and neither should you). Refer to official documentation as a source of truth, not so much "manifest files". :-)
Re: HiROM SRAM dumping
by on (#141848)
Well, higan/bsnes actually uses its manifests to determine the mapping used for emulation, so it's not like it's extraneous and unused metadata like the cartridge headers... and it wasn't chosen at random, byuu actually mapped out the full NTSC set, so there's got to be SOME reason for that. In any case, that image pretty clearly shows that for a 64K SRAM, it should be located in the contiguous block at $30:6000-7FFF, which isn't working, so I guess my problems are elsewhere.
Re: HiROM SRAM dumping
by on (#141866)
Ok, there's definitely something wrong with the dumper, my full 16MB dump is just the first 2MB mirrored 8 times, which would explain why bank $30:6000-7FFF doesn't have the save, because it's actually $10:6000-7FFF. Looks like I have some debugging to do...