The DMA Budget
7,790 bytes per frame in NTSC, 18,245 in PAL. The chapter that decides whether your game holds 60 frames a second.
From the toolchain to a cartridge you can sell — C with SGDK and 68000 assembly for the Sega Mega Drive, with every number in the text measured against a ROM that really ran.
// What this book is
Most retro programming books assert. This one measures. Every technical claim was verified against a real build before it went into the text, and every screenshot comes from a ROM that was actually built — because a claim you cannot check is a claim you should not make.
7,790 bytes per frame in NTSC, 18,245 in PAL. The chapter that decides whether your game holds 60 frames a second.
That is one NTSC frame on the 68000, 152,923 in PAL. Everything the game does has to fit between two of them.
80 on screen, 20 per scanline, and the twenty-first simply is not drawn. The book makes the limit visible, then works with it.
C with SGDK for the shape of the game, hand-written assembly in the hot paths. The book shows where the line falls, measured.
Every chapter ends with a ROM that builds and runs — no dead example code. Jump in anywhere and regressions stay visible.
It ends where a hobby project usually stops: SRAM saves, PAL and NTSC correctness, cartridge production and distribution.
// A few things the book measured
None of these are estimates. Each came out of a build, checked with the book's own tooling.
// Read a sample
The printed edition, as printed: the cover, the full table of contents, and then a complete chapter — DMA and the VBlank budget, the one that decides whether your game holds 60 frames a second. Turn the pages with the arrows, your keyboard, or by clicking the outer edge of a page.
Cover, contents and pages 66–71 of the printed edition, shown at reading size. The full book runs to 234 pages.
// The interactive edition
The book also reads in a browser — and there it runs. A Mega Drive compiled to WebAssembly sits beside the text, and the chapter you are reading picks the ROM: scrolling switches the machine along with the words. Every chapter carries the source of its milestone with it.
The sample below is the real thing, not a mock-up: the book's own
contents and chapter 10 — DMA and the VBlank budget
— with milestone 07-dma running beside the text, showing
the budget live and what happens when you blow through it.
// What comes with it
The book is not a set of listings to retype. It comes with the complete source for all twenty-one milestones, the build and test tooling the whole book runs on, and the converters that turn artwork and levels into something the VDP can use. Nothing is held back for a "pro edition"; there is no such thing.
makefile, sources and resources — about 20,000 lines of commented C that builds to a running ROM.md-build, md-run, md-shot, md-test, md-play — headless screenshots, ten acceptance checks, tile and palette validation.Every milestone stands on its own, so you can start at any chapter and still have something that builds and runs — and regressions stay visible because the checks are scriptable:
cd milestones/07-dma
make # -> out/rom.bin
../../tools/md-run.sh out/rom.bin ntsc # play it
python3 ../../tools/md-test.py out/rom.bin # 10 checks, 0 = green
You need SGDK and the free m68k toolchain, both covered in chapter 03. Verified with SGDK 2.12, m68k-elf-gcc 15.2.0 and MAME 0.288.
// What is inside
// Get the book
The manuscript is finished — 234 pages, 38 chapters, and a run-and-gun platformer that grows across all of them. The German edition is complete; the English translation is under way. The printed edition and the interactive edition are being prepared for release.