Post
by Eke » Wed Feb 02, 2011 4:47 pm
I am not sure to follow, are you talking about problem running this program on emulators or real hardware ?
- On most emulators, you must have a proper ROM header to tell the emulator you are using SRAM ("RA"). which address, which size, etc... Others will handle SRAM access by default when you write the cartridge area ($000000-$3fffff) or above the ROM size area since theorically SRAM can be mapped anywhere. On most emulators, you can write to odd or even address then read back without problems, you can also use word access. Afaik, the ROM header format have additional bits to indicate the type of SRAM used, not sure if any emulators use that but probably not .
On real hardware, it obviously depends how SRAM is mapped in the cartridge. I don't see why you could not have SRAM using the even address and high bits of the data bus, you could even use 16-bit SRAM chip if you want to.
- $A130F1 banking stuff is implemented by cartridge hardware, not the console itself. On emulators, it is only necessary if your ROM program size overlaps SRAM area. Most official games using SRAM never write this address as they have SRAM mapped outside ROM area ($200000-$3fffff, $300000-$3fffff, ...). I don't even think any of the few games that use banking for SRAM implement the SRAM write-protection bit anyway
So basically, the "How to work with SRAM" guide above does not make much sense, it entirely depends on the way SRAM is build in cartridge hardware or handled by the emulator you are using.