8/30/2013

N64 SRAM/FlashRAM results

Just wanted to post my results with implementing SRAM/FlashRAM support into my savegame dumper.

Forum love

The most active retro forums seem to be Benheck and Assemblergames. The first one is closed for new members and on the second it took one week until my thread got unlocked by a moderator. No comments after one week and today the thread got deleted.... Kind of disappointing, because I would have appreciated some external input. 

PIN mirroring

My first idea was to mirror AD0-AD15, ALE_L, ALE_H, VCC, GND and switch \READ, \WRITE.
The problem with this idea is that the 64drive will not start with the flashram connected to the mentioned PINs and if you connect them while the 64drive is already running you will just read crap. I also realized that the XPloder64 was interfering with the reading/writing commands. So I had to desolder the cartridge slot.

Full PIN switching

Because the PIN mirroring was not working I modified the gameshark cartridge so I can switch AD0-AD15, ALE_L, ALE_H, \READ and \WRITE during runtime. VCC and GND can of course be mirrored. This is the hardware setup:
Ugly PIN switch setup
Kind of messy, but works in general.


Writing the dumper

I thought this would be an easy task, because the N64 port of ScummVM already has FlashRAM support. It is based on hkz-libn64. Sadly neither the SRAM nor the FlashRAM routines were working for me at all. So I wrote my own routines based on the code from hkz-libn64 and LaC's n64 hardware dox. Against MESS and the 64drive SRAM/FlashRAM emulation these routines work perfectly. I used the following test to verify the functionality of the routines. I filled a buffer (sie of SRAM/FlashRAM) with values from a pseudo random generator and wrote the buffer to the SRAM/FlashRAM. Then I set the same SEED again for the pseudo random generator and filled the buffer with zeros. Now I read the SRAM/FlashRAM into the buffer and compared it to the results from the pseudo random generator. If this works it is very likely that my routines work.

The results

As mentioned above the routines work great against MESS and the 64drive, but not so much against an actual SRAM, FlashRAM chip. There are some strange read/write errors.
Strange SRAM/FlashRAM read errors
I am still not sure if this a problem of my software routines or because of bad wiring. I rewired several times and resoldered some parts, but I was still getting very strange results. I was able to back up F-Zero X (SRAM), 1080 (SRAM) and Pokemon Stadium (FlashRAM) which tells me that it is working in general. But it is not working perfect so I declared the code routines as experimental and I can not ensure that it will work properly for your games. Games I had no luck with are Zelda OOT (SRAM), Zelda MM (FlashRAM), Jet Force Gemini (FlashRAM) and Paper Mario (FlashRAM). It could just be a bad connection problem, but simply neither have the time nor the urge to create a custom board with full soldering for all 20 important connections with switches. These are all games anyway which I would start from the beginning if I ever wanted to play them again. So I backed up the three games which were most important to me.

The final dumper

Here you can see some screenshots of the dumper with experimental SRAM/FlashRAM support and can download it here.
The main menu
SRAM quick Hexview
FlashRAM copy feature with CRC


Future work

I am only partially happy, because it is no definitive solution, but neither a full soldering setup nor switching to the official N64 setup are solutions I think would justify the effort. The only think I might try is to check if the XPloder64 is compatible with GSuploader. But most likely it wont be compatible, because the Gameshark was from Datel and the Xploder64 from Blaze. The only Xploder64 software seems to be X-Killer 0.6, which would involve setting up a Windows 98 PC again. Maybe I am bored on Christmas...

7 comments:

  1. Could you please re-upload the source code? Thank you very much :)

    ReplyDelete
    Replies
    1. Hi, not sure which version I uploaded then, but I reuploaded the libdragon and lib-hkz version in the following archive:

      https://drive.google.com/file/d/0B7Jlv1BqChMRNkxUOU1CaUpZN3c/edit?usp=sharing

      Have fun ;-)

      Delete
    2. This comment has been removed by the author.

      Delete
  2. Thank you,

    I had to change line 117 in N64FlashRAM.c from "PI_DMAFromSRAM(dst, (offset / 2), size)" to "PI_DMAFromSRAM(dst, offset, size)" and increase the slot size from 960 to 1024 to flash a 100% complete save game to a real JFG cartridge.

    ReplyDelete
  3. Nice work! I'm not sure if you're aware, but a new version of GSUploader has been made which supports the Moschip 7705 based USB->parallel port adapters. As such, I've also devised a method for allowing one to use the USB adapter with the "official" GameShark/AR tools so that one could work on these things without having a parallel port. If you're interested, stop by #n64dev on efnet as we're always doing fun stuff in there. :p

    ReplyDelete
  4. Hi, I am currently not active anymore in N64 hacking, but my problem back then was that all the Gameshark tools as well as the GSUploader are only working with Datel devices(AR,Gamesshark, Gamebuster, Equalizer...) and not with the Blaze devices (Xploder64). I have no more working Datel device but an Xploder64 which is not supported by all the common tools. Still thank you for the hint with the Moschip support. Still waiting for the N64 HDMI mod from retroactive ;-)

    ReplyDelete
  5. Hi again :)
    I wrote a N64 savegame reader/writer for Arduino, I posted the source here if you're interested: http://forum.arduino.cc/index.php?topic=158974.msg2450235#msg2450235

    ReplyDelete