miuradio
How It SpawnsThe tricks inside famous games, shown running.›

How It Spawns

Why can't Mario walk back? Turn around in Super Mario Bros.

Story

and the edge of the screen stops you like a wall.

Super Mario Bros., Nintendo, 1985, on the NES. The screen follows you right and never moves one pixel left, so a prize you run past is gone for good. The game's code shows why there's nowhere to go back to.

A level isn't stored as a picture. It's a list of things, two bytes each: where it goes, what it is (a row of blocks, a gap, a step) and how long it is. World 1-1's whole layout, from the start to the castle, is 101 bytes: 49 things on the list, about 13 screens long (its enemies are a separate list of 30 bytes). The game reads that list front to back as you run, and never back, except in the maze castles. It draws the level a column at a time, half a screen ahead of the screen, into video memory only two screens wide. Every time the screen moves two blocks, two new columns go in, right over the two oldest. So half a screen past that left edge, the level is already gone.

Toshihiko Nakago, whose company SRD programmed the game, remembers hunting for free bytes: "1 block was 3 bytes, maybe 2". Near the end, the team told Shigeru Miyamoto there were eight bytes left. His answer: "I really wanted to put some blocks here!"

The world, the square and our level are our own simplified version, drawn in code in the game's own two-byte format and timing. The middle is shown slowed down. The first test of the game moved "only a square shape", as Takashi Tezuka recalls, so our hero is one too. The code was read through doppelganger's commented disassembly. Not affiliated with or endorsed by Nintendo.

Which old game should we open up next?

Sources: Super Mario Bros. (NES, 1985), the game's code and level data, read in doppelganger's commented disassembly SMBDIS.ASM (the area parser, the column renderer, the scroll handler and World 1-1's object list). Iwata Asks, Super Mario Bros. 25th Anniversary, vol. 5, Nintendo, 2010 (Toshihiko Nakago, Shigeru Miyamoto, Takashi Tezuka).
Sounds and music: our own, made in code.

Follow

TikTok@howitspawns›Instagram@howitspawns›YouTube@howitspawns›X@howitspawns›
Link copied