#16179 - DarkPhantom - Tue Feb 10, 2004 5:21 am
I'm trying to write a program that will clear the saved data for RPG's with 512kbit flash ram save packs. Just writting values to 0x0E000000 doesn't seem to work. Anybody know how to write to the flash ram? (The program is in RAM and then I insert the cart that I want to clear).
_________________
"head straight for your goal by any means
there is a door that you've never opened
there is a window with a view you've never seen
get there no matter how long it takes"
-Theme of Shadow, Sonic Adventure 2
#16181 - tepples - Tue Feb 10, 2004 6:50 am
GBA games with flash save use Sanyo flash or Atmel flash. Reading flash appears to be identical to reading SRAM. This PDF describes Atmel's writing protocol. Can anybody dig up information about Sanyo's write handshake?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#16189 - torne - Tue Feb 10, 2004 2:36 pm
I wrote this for flash/eeprom/sram a while ago but unfortunately I then destroyed my root filesystem while doing stupid things (repartitioning a live HD while i'm both running an OS off it, and accessing it using raw emulation in VMware). Writing to flash is done in blocks, which must first be erased (there's also an eraseall call) and ideally verified afterward. I don't have the documentation on how to do it because that was on the same filesystem; I was clean-room reverse engineering (legal in pretty much any jurisdiction) the official N backup library and will hopefully find time to restart this work soon.
In the meantime, you could try disassembling a commercial ROM (legal in most places for educational purposes) and having a look at how they do it. The save code is in the general vicinity of the save type identifier string.
#16492 - loading - Tue Feb 17, 2004 10:34 pm
in case you're still interested:
Write Byte to Flash:
Write 0xAA to 0x0A005555
Write 0x55 to 0x0A002AAA
Write 0xA0 to 0x0A005555
Write your byte to the address you want. Wait a short time and write an other byte.
Delete Block (0x1000 bytes, note you'll need to delete before writing):
Write 0xAA to 0x0A005555
Write 0x55 to 0x0A002AAA
Write 0x80 to 0x0A005555
Write 0xAA to 0x0A005555
Write 0x55 to 0x0A002AAA
Write 0x30 to 0x0A00X000 (where X = your Block)
Write your byte to the address you want. Wait a little longer.
Select Upper/Lower 64k
Write 0xAA to 0x0A005555
Write 0x55 to 0x0A002AAA
Write 0xB0 to 0x0A005555
Write 0x0X to 0x0A000000 (where X = 0 or 1)
wait some time.
Note waiting is not neccesarry on most emulators but you'll need to do it if you're writing to a real flash chip. I was unable to figure out the exact times (not enough reversing skills :( ) but it does the job.
#16501 - ampz - Wed Feb 18, 2004 1:01 am
loading: Nintendo use at least six different types of flash memories. The command sequences are different for each type. Games are required to support all types of the correct size. (The N library takes care of this)
You do not just wait for the flash memory to complete it's task. You poll it until ready.