Well, that took longer than I would have liked, but considering this is the first time I've ever looked at FPGA programming, I guess it wasn't too bad. Not having an IO board is brutal, though. 30+minutes for every minor change or even changing what I want to monitor with Signal Tap is quite a time sink.
It looks like it works now, though. Somebody who knows what they're doing should take a look at it though. Back up any files you care about before using.
Sorgelig wrote:I suggest to use the same format as NES memory cards, so you will be able to re-use the same mounted image for several games. Card managing will be do by NES code. You just need to implement the memory card hardware.
The NES doesn't use memory cards. Games that support saves have a RAM chip in the cart with a battery attached. The save is just the contents of the RAM. Either 0x2000 or 0x8000 bytes in size (actually there might be some smaller EPROMs as well, and the Famicom Disk System is different as well, but I don't think that's in the current core). Your notes were very helpful. Thanks.
Usage:
Requires an existing save file (either 0x2000 or 0x8000) in size.
After having loaded a game, select an image file from the OSD. The NES will load the save and reset.
When done playing, Select Save RAM write. The previously selected sav file will be overwritten and the NES will reset.
It looks like sometimes the game gets in a weird state. Reloading the ROM seems to correct it. I never disabled the NES while the saves are being accessed, which is probably causing it to overwrite ROM data.
I noticed that line 626 in apu.sv looks wrong to me. Pretty sure that >= should just be an ==.
Edit: Ignore this comment. I misunderstood the logic. >= is correct.