Super FX save: a boot counter that survives the power switch, in Game Pak RAM.
More...
Super FX save: a boot counter that survives the power switch, in Game Pak RAM.
A Super FX cartridge has one RAM, the GSU's Game Pak RAM at $70:0000: the chip draws into it, and when the board has a battery it is also the save memory (header type $15, USE_SRAM := 1; its size is declared at $FFBD, GSU_RAM_KB). The sram module addresses it like any other save memory — this example is memory/save_game's call sequence on a Super FX board, with the GSU stopped the whole time.
It keeps one number: how many times the console has been switched on. At boot it reads the counter and a magic word; a matching magic means a previous run saved here (a fresh cart reads whatever the RAM powered up with, so the magic decides, not a zero). It adds one, saves, and prints both. Power-cycle: the screen shows one more. The block sits at $E000, above the two 16 KB framebuffers a game would use (chips/superfx_game_skeleton) — a game that presents frames must keep its save out of them.
- SNES Concepts
- Game Pak RAM is the GSU's work RAM and the battery-backed save memory
- The save block must not overlap the framebuffers the GSU draws into
- A magic word tells a saved block from power-on garbage
- What to Observe
- "FOUND" is the saved counter (or "NONE" on a fresh cart), "NOW" is FOUND + 1
- Switch the console off and on: NOW increments by one each time
- "GSU PRESENT" confirms the header and the chip agree (gsuIsPresent)
- Modules Used
- console, dma, background, text, sram, superfx
- See also
- sram.h, superfx.h, memory/save_game, chips/sa1_save