Homebrew

Games I'm making.

After thirty-odd years of playing these things, I started trying to make them. Everything on this page is my own work — written for real NES hardware and emulated here so you can play it without digging a console out of the closet. I'm still learning, so expect rough edges, half-finished levels, and the occasional sprite that doesn't know where it's supposed to be.

Quick primer on the NES hardware

Working inside the NES's limits is the hardest part of making one of these, and it's most of why it's fun — every no pushes you toward an idea you wouldn't have had with room to be lazy. The CPU is a Ricoh 2A03, a 6502 running at 1.79 MHz, programmed in assembly with three registers and no instruction for multiplication or division. If you need to multiply, you write the loop, and you count what it costs before you do.

There are two kilobytes of RAM — not megabytes, kilobytes — for every variable in the game, and a fixed 256 bytes of that is the stack, at an address you cannot move. The ROM is its own puzzle: the CPU can only see 32 KB of program at a time and the video chip 8 KB of tiles, so anything larger needs a mapper, a chip on the cartridge that swaps banks in and out beneath the running program.

The picture is 256×240, built from 8×8 tiles, showing 25 colours at once out of 64 — and background colour is assigned per 16×16 block, which is why NES art has those blocky seams. Sixty-four sprites exist but only eight can share a scanline, which is the flicker you remember from every busy boss fight. And a frame is about 29,780 cycles, with video memory only safe to touch during vertical blank — roughly 2,270 of them. Most of what looks like cleverness in an NES game is someone budgeting that window.

For a sense of scale: the whole of Threshold — every line of code, every tile of art, every note of music, all six nights of it — is 128 kilobytes. A single photo off your phone is twenty-odd times that, and you take those without thinking about it. And the two kilobytes of RAM the game actually runs in would disappear into that one photo a thousand times over. It's a strange figure to carry around while you're deciding whether a variable has earned the right to exist.