Doom has been ported to all sorts of platforms, including ESP32 platforms with 4MB PSRAM but “RP2040 doom” port of Doom to the Raspberry Pi RP2040 is more challenging, since RAM is limited to the measly 264KB built-in into the microcontroller, and for boards with only 2MB flash like the Raspberry Pi Pico, storage capacity becomes an issue.
But Graham Sanderson solved all those issues by compressing the data, changing the code to use less RAM, making full use of the two Arm Cortex-M0+ cores, both overclocked at 270 MHz, in order to run Doom (DOOM1.WAD) on Raspberry Pi Pico at 320×240 resolution @ 60 fps, and the full Ultimate Doom and DOOM II WADs expected to fit into Raspberry Pi RP2040 boards with 8MB SPI flash.
The port was based on Chocolate Doom, OPL2 emulation for audio support was derived from the emu8950 project, and sound effects were compressed using ADPCM-XQ IMA-ADPCM encoder. Here’s what was achieved after six months of (spare time) work:
- RP2040 overclocked to 270MHz (note: requires a flash chip that will run at 135Mhz)
- Full DOOM1.WAD playable on Raspberry Pi Pico with 2MB flash.
- Ultimate Doom and Doom II are playable on devices 8MB flash like StackyPi or UDOO Key
- 320×200 @ 60 fps VGA output (upscaled to 1280×1024 @ 60Hz).
- Frame rate of about 30-35+ FPS.
- Audio – 9 Channel OPL2 Sound at 49716Hz, 8 Channel Stereo Sound Effects.
- I2C networking for up to 4 players.
- USB Keyboard Input support.
- Save/Load of games, all cheats supported.
- All end scenes, intermissions, help screens supported.
You can watch the results by yourself in the video below.
The source code, build instructions, and UFS firmware can be found on Github. But if you want to understand how this was implemented, the compression techniques used, optimizations of the doom port, for instance, replacing 32-bit variables with 16-bit ones to lower memory used, and overall challenges of the project, you should definitely read the long writeup on Github.io.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
One Reply to “Doom ported to Raspberry Pi RP2040”
As someone that posts too many videos of doom running to twitter I approve of this.