Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2019-03-05 00:34:15

h0tp3ngu1n
New member
Registered: 2018-09-11
Post 3/9

(gameboy) Using FRAM instead of SRAM?

I purchased a bootleg Pokémon Green Version cartridge, and I notice it uses some other sort of chip to store the save data. Not an SRAM chip... I think it's probably an FRAM chip. The game seems to hold its save state even when no battery is connected to the cartridge (though the cartridge does have a space where a battery could go).

I am wondering if anyone knows how they did this (getting the game's save/load functionality to work with FRAM rather than SRAM)? I'm still new to ROM hacking/ASM so I probably won't yet be able to understand the technical details, but I'm just wondering whether it's a relatively simple/straightforward hack or if you'd need to completely rewrite huge sections of code? (I reflashed the cartridge with a non-hacked Pokémon Red Version ROM, just to make sure the cartridge wasn't magical or anything... but, as expected, the non-hacked ROM cannot read/write the save... I'm guessing because the non-hacked version is only intended for SRAM.)

Last edited by h0tp3ngu1n (2019-03-05 00:39:50)

Offline

#2 2019-03-09 21:27:12

Tauwasser
Member
Registered: 2010-10-16
Post 453/457

Re: (gameboy) Using FRAM instead of SRAM?

It's likely not a hack of the game at all. They use a controller inside the cartridge to control the FRAM lines and provide the same interface that Nintendo's mapper did. Some FRAM chips are even direct replacements for SRAM, others need their control lines strobed when SRAM doesn't. But for the most part, that's it.
If your non-hacked ROM doesn't work, the controller might require different initialization at the beginning. If you saved the original flash data of the hacked green, you could binary compare it to the official ROM data and see what they did. Changing the way these games access SRAM isn't really trivial when all you have to go off on are the binary ROM files. Pokémon games use a large chunk of SRAM all the time as scratch pad RAM, so any changes in access or timing would make the game crash if not every location where it's used as such is found and changed.

Offline

#3 2019-03-09 22:49:50

Halfshadow
Member
From: Italy - Lucca
Registered: 2012-04-24
Post 305/331

Re: (gameboy) Using FRAM instead of SRAM?

The FRAM cart seller says this on his page:

"Write Settings:
You need to select this parameters to make a correct writing:

MBC: MBC AUTO
FLASH: Depends of .gb/.gbc file size (Max. 2MB or 4MB)
Remember before writing the cartridge you need to erase it."


The italian Pokémon Green creator.

Offline

#4 2019-03-16 03:19:31

h0tp3ngu1n
New member
Registered: 2018-09-11
Post 6/9

Re: (gameboy) Using FRAM instead of SRAM?

I believe I was mistaken... it's probably not a FRAM chip afterall.

This might sound strange, but I think what's going on is that the hacked game is somehow embedding the save data into the ROM itself. (Because I just dumped the ROM again, and this time when I start the ROM up in an emulator it gives "CONTINUE" as an option (even though there's no accompanying *.sav file), and when I choose continue then it loads the save from where I left off (even though I never dumped the SRAM). I also think maybe the save routine has been rewritten, because I noticed that when I try to save the game in the emulator it displays "Now saving..." and then just freezes.)

edit - Yeah, apparently the ROM which I dumped earlier has a ton of blank bytes at the end, and in the new dump these bytes contain save data. So I guess this game keeps the ROM and save data both on the same chip, and when I dumped the ROM I also dumped whatever save data was appended to it...

Last edited by h0tp3ngu1n (2019-03-16 03:55:31)

Offline

#5 2019-03-16 16:35:01

Halfshadow
Member
From: Italy - Lucca
Registered: 2012-04-24
Post 306/331

Re: (gameboy) Using FRAM instead of SRAM?

Interesting. Then should be safe also for me buy a FRAM cart to flash with my italian Pokémon Green without worry about memory battery and I'll have however the way to dump my save file? I use the N64 with the transfer pak to copy/rewrite the sav file, and can also read the roms, but can't rewrite the roms, then I could not rewrite the sav without the flasher, but isn't a huge problem, if I'll want to reinsert a pokémon I could also transfer it via classic trades.


The italian Pokémon Green creator.

Offline

#6 2019-03-17 00:54:24

h0tp3ngu1n
New member
Registered: 2018-09-11
Post 7/9

Re: (gameboy) Using FRAM instead of SRAM?

Halfshadow wrote:

Interesting. Then should be safe also for me buy a FRAM cart to flash with my italian Pokémon Green without worry about memory battery and I'll have however the way to dump my save file? I use the N64 with the transfer pak to copy/rewrite the sav file, and can also read the roms, but can't rewrite the roms, then I could not rewrite the sav without the flasher, but isn't a huge problem, if I'll want to reinsert a pokémon I could also transfer it via classic trades.

If that was directed at me, I must say that I really don't know anything about the FRAM cart.

The cartridge I mentioned in my earlier post was a Chinese bootleg cartridge (or "reproduction cartridge" as some people call them) which I got off eBay, which I initially thought used FRAM but I was probably wrong. (I had purchased about six Pokémon cartridges from various sellers on eBay. I'm not into much ROM hacking, but I am currently learning ASM and how to make homebrew (I'm pretty much a complete beginner). My intention was to use Benn Venn's Joey device to reflash the bootleg carts with the homebrew ROMs I'm making, so that I can test them/play them on actual hardware. But I was kind of surprised when I found that three of the six cartridges had no battery yet still saved. So my initial thought was that maybe it's using a different kind of memory chip, such as FRAM or something... though I am pretty sure I was mistaken. Seems the cartridge only has a single chip, plus some square-looking thing (I really have no idea what I'm talking about... I know next to nothing about circuitry, lol). When I learn some more ASM I'll need to take a look at the ROM and try to figure out what's going on with the save routine, if anything. But for now I guess I'm not going to worry about it.)

Last edited by h0tp3ngu1n (2019-03-17 01:03:17)

Offline

#7 2019-03-17 10:31:05

Halfshadow
Member
From: Italy - Lucca
Registered: 2012-04-24
Post 307/331

Re: (gameboy) Using FRAM instead of SRAM?

Oh, ok. The I understood wrong. I hope however to be able to backup my FRAM trough the N64 flash card, I hope. XD


The italian Pokémon Green creator.

Offline

Board footer

Powered by FluxBB