This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

MMC3 RAM Protect

MMC3 RAM Protect
by on (#174813)
I'm working on implementing some save data using battery-backed PRGRAM. I understand that save data can be corrupted by the console during power off, which is why games like Zelda told you to hold down reset while turning the console off.

I'm using the MMC3, which has RAM protection facilities. The register $A001-$BFFF (odd) will only allow writes to RAM if its highest 2 bits are %10. I keep the RAM read-only by setting it to %11, and only enable writes when necessary. These bits are often ignored by emulators (FCEUX and Nintendulator do, Nestopia doesn't). Has anyone tested if this is enough to prevent the console from overwriting values in RAM? Or do I need to keep 3 copies of the data and checksums?

I'll run some tests with my EverDrive -- I believe that the way it implements battery-backed saves it is possible to corrupt it. I will check that first.
Re: MMC3 RAM Protect
by on (#174814)
PRG RAM corruption comes from the contents of the 2A03's bus going squirrelly when power is removed. It just takes a moment where +5V is slowly sinking, and some of the address lines are received as low just a little earlier, for a random read to become a write.

This is, unfortunately, probably not the sort of situation that you could model with the Everdrive or any other flashcart.

Is the MMC3 powered by the battery in the relevant cartridges? If it is, since PRG RAM /WE goes through the MMC3, then it seems likely that the "read only" state should be good enough to protect the RAM.