Learn › GBC Advanced

Lesson 4 of 5 · About 7 min

Saving to the battery

How a GBC cartridge keeps a save, why it is written in a careful order, and how to remember more than a score.

Memory that stays

A GBC cartridge can carry a small amount of memory with a battery, so it keeps its contents when the console is off. Games use it for saves and high scores. In an emulator, the same memory is a save file next to the game.

Here a game has three save slots, numbered 0 to 2, each with room for up to 8 KB. Fox Run already uses slot 0 for its best score: save_write(0, &best, 2) writes two bytes, and save_read reads them back when the game starts.

GBC Advanced is a course for paid accounts. The rest of this lesson, and its guided session, are in the app.

Start makingDownload on the App StoreGet it on Google Play