Graham Sanderson's Chocolate Doom Port Brings the Classic 1993 Shooter to the Raspberry Pi Pico

Packed into just 264kB of RAM, well below the 4MB minimum of its 1993 release, this Doom port is fully playable — and deathmatch-ready.

Gareth Halfacree
2 years agoGaming / Retro Tech / HW101

Raspberry Pi engineer Graham Sanderson has achieved what at first glance would seem impossible: running Id Software's classic Doom on the Raspberry Pi Pico, a microcontroller with no native video output and just 264kB of RAM.

"Will it run Doom" is considered a challenge to hardware hackers across the land, who have made the 1993 first-person shooter playable on GPS receivers, thermostats, oscilloscopes, and potato-powered graphing calculators — sort of, anyway.

Getting it running on a Raspberry Pi Pico's RP2040 microcontroller, though seemed a step too far: While its dual-core Arm Cortex-M0+ CPU packs a punch well above its weight, particularly in comparison with the desktop processors of the era, having just 264kB of RAM puts it well below the 4MB usually required.

Doom, but not as you know it: This port's running on an RP2040. (📹: Graham Sanderson)

"The RP2040 is certainly not the tightest platform Doom has ever been ported to — although at <$1 it is probably one of the cheapest — so I wanted to set my self a more aggressive set of goals," Sanderson explains of the project. "Everything should match the original game experience. It should feel like the original game. It should run on a Raspberry Pi Pico. The RP2040 should output directly to VGA (16 color pins for RGB565 along with HSync/VSync) along with stereo sound."

All told, that's quite a set of challenges: The WAD file — "Where's All the Data" — bundled with the shareware release of Doom is 4MB, already too big to fit on the Raspberry Pi Pico's 2MB flash chip — even before the game code was included. There's no video output or audio output on the Raspberry Pi Pico, either, solvable through the use of programmable input/output (PIO) state machines.

Moving to an RP2040 board with larger flash unlocks support for Doom II. (📹: Graham Sanderson)

"Wanting to support the original demos means everything has to match exactly with the original game," Sanderson adds, "as the demos are simply a sequence of input events, and the slightest calculation or behavior difference can cause 'desync' ending up, for example, with the player running into, and shooting at, walls."

Despite these challenges, Sanderson's project was a success: The RP2040 Doom port, which is based on the open source Chocolate Doom engine, is capable of running the original Doom WAD on a Raspberry Pi Pico; moving to an RP2040-based board with 8MB of flash unlocks support for the Ultimate Doom level pack and the sequel Doom II.

That's not all, though: Sanderson's port also includes nine-channel OPL2 music and eight-channel stereo sound, support for a USB keyboard as an input device, a playable framerate of 30 frames per second or higher, and — in an inspired addition — support for four-player networked deathmatches played over an I2C network.

"Doom might seem like a frivolous application, but it demonstrates just how powerful RP2040 can be in the hands of an experienced user," Raspberry Pi's Eben Upton says of the project on the company blog.

"It offers plenty of memory and integer compute performance; flexible I/O, used here to drive a VGA monitor and interface to a USB keyboard; and, critically, the ability to simultaneously drive every element of the chip hard without tripping over yourself."

With a Pico costing $4 and an RP2040 available for as little as $0.75, this could be the cheapest Doom machine yet. (📹: Raspberry Pi)

A detailed technical write-up is available on Sanderson's website, while the source code and compilation instructions can be found on GitHub under the reciprocal GNU General Public License.

Those eager to give it a go, however, may need to pick their Raspberry Pi Pico from a winner in the silicon lottery: The project runs the RP2040 at 270MHz, an out-of-spec overclock, which requires a flash chip capable of operating at 135MHz — something not every board can manage.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles