My understanding is that the extra cartridge RAM banks at &A000-&BFFF are battery-backed SRAM that is preserved after powering off the game. If I'm making a simple game that doesn't have a save feature, can this RAM be used as the home for the stack pointer? Putting the stack at the top of high ram seems like a very tight limitation, especially when that ram area has to share space with DMA code. But from what I've read the extra ram should be disabled when not in use. Is there any danger of damaging the Game Boy or the cartridge if I use the additional RAM just as a "scratchpad" for a game with no save feature?

Some sample code from my test rom (the header jumps here, this is in main and not in a subroutine)

ld sp,&FFFF

call GetHardwareVersion ;sets internal variables depending on which game boy model is being used

xor a
call GBCart_RamBank     ;activate extra cartridge RAM at &A000-&BFFF
ld sp,&BFFF             ;relocate the stack pointer to the extra RAM area

1 Answer 1


You should be able to use external RAM for the stack pointer, and I don't believe there's any risk involved in keeping the RAM activated for long periods of time.

I've ran Super Mario Land 2 in a modified GB emulator that shows every cart mapper register access, and from when the game starts on the title screen to a few seconds of gameplay running about on the introductory stage, the external RAM is continuously and always set to be available, just as you want.

Referring to any official Nintendo manuals you have to hand for best practices would be ideal, but matching SML2's behaviour sounds okay to me. :)

There is support in the Game Boy header for cartridges which contain additional RAM that isn't battery backed, so cartridges that use that region just for work is a use case that was foreseen by Nintendo.

As to why SML2 would do this: I'm trying to find more details, but I've found a video showing the memory map of Super Mario Land 2 (5:47) which indicates that it uses the external RAM for storing level and music data during gameplay. The game uses the external cartridge RAM and internal RAM as one big contiguous block (they're adjacent in the memory map), treating the external RAM no differently than internal RAM - storing the game's variables there as well as the level layout. (Pokémon is another game that uses its cartridge RAM for scratch as well as saves.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .