Scalecrown · the code

Every step of the game

The sources and the programs, in folders named exactly as the book names them. Free to use in your own work, commercial or not, under the MIT licence.

Build and play

You need DASM (assembler), Stella (emulator and debugger) and Python 3 (build, tests and verifier). Open a terminal in the folder and type:

python tools/build.py
stella game/build/scalecrown_ntsc.bin

Check everything

From the top folder of the full download, this assembles every source again and compares the result with the reference bytes:

python verify.py
  • Work on a copy of a step: copy chain/01-first-room beside it, for example as chain/01-my-room, open a command prompt in the copy and type the two commands. The build makes the NTSC and the PAL cartridge in game/build. On Windows, if python is not found, try py; on Linux and macOS it may be python3.
  • To play without building, open releases/scalecrown-1.0-ntsc.bin (or -pal.bin) in Stella, which recognises the F4SC cartridge by itself. In Stella 7.0 the arrow keys are the joystick, the space bar its button, F1 the SELECT switch and F2 RESET.
  • Each step folder in chain/ has its own copy of every source and tool it needs, and builds on its own. variants/ holds the 27 experiments of the book, 18 guided variants and 9 “Where it breaks” versions, each with a README, and CHAPTERS.md says which step and experiments go with each chapter.
  • Built with dasm 2.20.14.1 (another version may give other bytes) and tested in Stella 7.0 and in the book's test bench, never on a real console.

Chapter by chapter

Ch.TitleFolderDownload
1Your workshopchain/01-first-room/
2The 6507, the memory and the cartridgechain/01-first-room/
3Racing the beam: the framechain/01-first-room/
4The playfield and the first roomchain/01-first-room/
5The knightchain/02-knight/
6The dungeon and the HUDchain/03-dungeon/
7Keys, doors and treasurechain/04-keys-doors/
8The serpentschain/05-serpents/
9The sword and the damagechain/05-serpents/
10The throne roomchain/06-serpent-king/
11The Serpent Kingchain/06-serpent-king/
12The TIA and the musicchain/07-sound/
13Effects and sound modeschain/07-sound/
14States, title and end screenschain/08-title-and-ends/
15The hunt: how hard the game ischain/09-the-hunt/
16Reading and checking the gamechain/09-the-hunt/
17Glossary and index—