I just finished building a genesis cart reader and it seems to be dumping my carts perfectly. I'm not sure how to handle the save data issue in general.
How do you read and eventually write to the save data portion of the cart, specifically Sonic 3?
The sram is at 0x200000 on odd bytes (0x200001, 0x200003, 0x200005, etc). You should be able to just read it normally, but technically, you should "move.b #1,0xA130F1" first, which enables the sram. Sonic 3 does that in the init part of the code when it starts. Setting 0xA130F1 to 0 disables the sram.
From what I've heard on SpritesMind, the save ram in Sonic 3 is always on and setting it to 1 isn't needed, but they put it in there in case the game is attached to a S&K cart, in which case it IS needed.
As long as a game is 2MBytes or less, the save ram doesn't need to be disabled. If a game is larger than 2MBytes, you have to enable and disable the save ram, which then disables and enabled (respectively) reading the rom at 0x200000 instead of the save ram.
The FRAM in Sonic 3 is the same as battery backed up SRAM, but doesn't need the battery.
Thanks for the information.
I tried reading 0x00200001 - 002003ff directly but this was giving me back all 0 (dec). Right now I'm just trying to dump all even/odd sram with no luck.
I'm currently using an Arduino similar chip and I mocked up the reader quickly in their own "language". I've attached a sample of what I'm using and it does work as intended for reading data between 0x0 - 0x001fffff. Maybe I'm missing something simple here?
Ok I did a MD dumper sometime ago, Ill try to help.
First thing you need to do is initialize all critical control bits to inactive state (1)
In case of S3, IIRC it uses /Time, /LWR, /VRes, /CAS0, /CE0 {B31, B28, B27, B17, B16}
After init, you set up the oncart reg to access the Fe-RAM:
Set /VRes to 0,
Set /VRes to 1, (reset on-cart flipflop)
Map pin d0 to output and set it to 1,
Set /Time to 0, (enable Fe-RAM flipflop)
Set /Time to 1,
Map pin d0 to input.
Do a loop running through the addresses of interest, and assert the control signals appropriately:
-:
Set /CAS0 and /CE0 to 0, (cart enabled)
Get data from dBus,
Set /CAS0, /CE0 to 1, (cart disabled)
Increment address,
Loop -
If you want do dump rom afterwards:
Reset address
Map pin d0 to output and set it to 0,
Set /Time to 0, (disable Fe-RAM flipflop)
Set /Time to 1,
Map pin d0 to input.
do the loop as before.
Make sure the wait time between each instruction is 200ns or more (MCU/PLD running at 5MHz maximum clock)
I don't know the specifics for the RAMTRON FERAM chip used on the SONIC3 cartridge but on some FERAM chip designs the act of reading the memory causes destruction of the contained data so it has to be written back after being read... :shrug:
In that case, after reading the dBus Set /LWR to 0, and then to '1'.
Should take care of content destruction
One thing I forgot, you dont need to output the 0xA13000 address, just assert /Time accordingly.
I got the reading of the feram portion seemingly working thanks to the detailed info provided by Jorge Nuno.
My simple dumper was pulling /CAS0, /CEO low using a 10k resistor and pulling /RESET high using another 10k resistor. Pulling /RESET high was only needed for Sonic 3 and was actually left disconnected when I was first building the circuit. Even without /RESET pulled high I was able to correctly read all my carts except for Sonic 3.
I didn't know I needed /LWR when reading the feram. I wasn't aware that I had to manipulate all those extras lines considering my pin count on my board is reaching its limit very fast.
I can also confirm what l_oliveira mentioned about the reading of the feram being a destructive process. Now it makes sense that the data was continually changing on me. Jorge Nuno's second post about setting /LWR low then high fixed that issue.
The whole odd/even sram reading and the 0xA130F1 address doesn't apply in my case. Actually reading only the odd addresses produces only half of the intended data. I needed to read all address between 0x00200001 and 0x002003ff. I figure that information is pertinent if you're actually running code on the physical sega genesis.
The only issue that I noticed is in the comparison of my dumped data vs the srm file produced by gens/kega fusion. I needed to delete the first character of my file and then both emulators would correctly load the sram. I'm not sure what's going on here. Kega Fusion's sram also seems to replace 0x00 with 0xFF for some reason.
Thanks to everybody who chimed in here. There's a ton of great information here.
Just a final comment of mine, reading the FERAM chip is a destructive process on the literal meaning of the word ...:lol:
It also destroys the chip.
So every time you turn on your Mega Drive to play SONIC 3 your backup memory dies a little bit out ... :lol:
I'm just looking over the ssf2 technical docs and it mentions the following as an example:
If 0x08 is written to register 0xA130F9, the first 512KB of the normally invisible upper 1MB of ROM is now visible at 0x200000-0x27FFFF.
So how would I implement this?
Considering that writing $01 to $A130F1 is setting d0 to 1 and flipping /time on/off.
What's the equivalent to writing to the 0xA130F9 address?
When !TIME and !RW are asserted, SSF2 cartridge hardware decodes:
. VA1-VA3 to know which 512k region (out of eight available in 4MB area) is being remapped.
. VD0-VD3 (maybe more, depends of max addressable ROM size) to determine which 512k ROM bank (out of ten for a 5MB game) is being mapped to the given memory region.
So obviously you need to drive those signals as well.