Golden Sun: The Broken Seal
This page is a guide to the games/tbs/ folder of the Alchemy project, where
every scene, battle, sprite, song, and line of Golden Sun: The Broken Seal is
kept as source to read and study.

This is the 2001 original, which runs from the stormy night in Vale to the top
of Venus Lighthouse. All six retail editions (tbs-ja, tbs-en, tbs-de,
tbs-es, tbs-fr, and tbs-it) compile byte-for-byte from this tree, covering
201 scenes, every battle formation, and every line of localised dialogue.
Camelot built the game in a style now rarely seen, favouring plain blocking C and cold starts over large state machines. The guides below explain how each part of the game works, and may be read before any source file is opened.
Two ideas to meet first
Two of Camelot's design choices underlie the rest of the codebase:
- Cold-start engines: Walking around a town, fighting a battle, and playing Lucky Dice never occupy RAM at the same time. The main routine clears the heap before every engine and starts the next one from a cold state.
- One blocking tick function (
sySynch): Rather than splitting cutscenes and menus into large state machines, foreground C callssySynch(1)in a loop. Meanwhile, a short list of per-tick callbacks moves actors, scrolls maps, and types dialogue one frame at a time.
The system library shows both ideas at work, and Debug Mode covers Camelot's built-in developer toolkit.
Guide by division
- The system library: Power-on, cold-start engines, blocking ticks, per-tick events versus actor scripts, scene overlays, and safe flash saving.
- RPG Data & Rules: Index-based item, ability, enemy, class, and Djinn tables, unified fighter units, from-scratch stat recalculation, and 4,096 game flags.
- World, Scenes & Maps: Walking and collision, prioritised field requests, scenes, cues, exits, actors, field Psynergy, and the tilted perspective World Map.
- Battle & Effects: Formations, turn order, two-phase enemy AI, decoupled hit playback, zoomed backdrops, and brightness canvas effects and summons.
- Dialogue, Menus & Shops: Animated windows, Huffman-compressed dialogue and European grammar, call-stack field menus, shops, sanctums, and inns.
- Graphics & Sound: GBA indexed palettes, 5-direction sprites, palette-swapped monsters, shared tilesets, area music rules, jingle ducking, and the custom audio mixer.
- Debug Mode: Camelot's built-in retail debug menus, shortcuts, and test rooms.
Looking something up
- Codebase Map: How to find the code behind any line of
dialogue, a folder-by-folder map of
games/tbs/src/, build layout, and naming conventions. - Places: Every town, room, and dungeon in story order with rendered maps and recorded events.
- Glossary: Plain definitions of Golden Sun, SGL, studio, and GBA terms.
Build and cartridge at a glance
make tbs-en # or tbs-ja, tbs-de, tbs-es, tbs-fr, tbs-it
make compare-tbs-en # build and verify against rom.sha1An 8 MB ROM split into 14 resident modules, with 201 scenes across 96 overlays and 71 areas, 380 formations, 28 Djinn, 16 summons, and about 2,100 PNGs.