LockerGnomeTech news and nostalgia for today's technology professionals
Subscribe

Search

Hacks & Builds

nandfs runs Doom on a CPU made of folders, at minutes per frame

The filesystem experiment makes a processor inspectable with ordinary shell tools, with a disclosed shortcut for large memory.

Chris stands in a maze of manila folders wired together with string, waiting for one dim frame of a game to appear
Illustration: LockerGnome

Doom finally found a computer whose directory tree is more alarming than its monsters. In nandfs, following a symlink can mean following an actual simulated CPU wire.

The project’s README describes two machines running through a FUSE filesystem. A CHIP-8 plays Pong, while a RISC-V machine tackles Doom. Each presents its internal logic as paths a person can inspect. The familiar filesystem interface becomes a way to poke around inside a processor without pretending the processor is a mysterious sealed box.

There is an unusually entertaining failure demonstration: disconnect a wire associated with Pong’s ball position and watch the motion go wrong. That’s an excellent use of a broken game. The visible failure gives a bit-level change a consequence you can recognize without a diagram full of tiny rectangles.

The bigger machine has a catch the RISC-V documentation states explicitly: its larger RAM and ROM use memory folders backed by regular files. Expanding all that memory into individual gates would make the filesystem absurdly large. The CPU stays represented by gates and flip-flops, while memory gets a practical exception.

That matters when you retell the feat. “Every byte of Doom is a folder full of gates” would be a more spectacular headline, and it would describe a machine the author specifically chose not to build. The disclosed boundary makes this version more interesting to examine because you can see where purity becomes an obstacle you would need to store somewhere.

The Doom run notes count 22,677 NAND gates and 2,035 flip-flops in the CPU. Their timing comes from a specific Ubuntu virtual machine on an Apple M-series Mac. A first frame takes much longer than later frames, so multiplying a headline frame time into a prediction for your own machine would be optimistic accounting (with extra directories).

The author calls the additional memory behavior “the whole exception.” Readers can disagree about where the boundary ought to be and still inspect the one that exists. A stunt gains something useful when its compromises are visible enough to argue about.

A more approachable computer simulation could grow out of this sort of visibility: click a wire, change a bit, see the mistake. Performance would still matter, particularly if the student has aged noticeably before the next frame. Here the slower Doom run leaves a much more immediate option sitting beside it: Pong, with a wire waiting to be disconnected.

The ball has a pathname.

More Hacks & Builds

Every Hacks & Builds story →