Phil Ashby's EMF 2022 TiDAL Badge Runs a Custom Doom Port Alongside Still-Functional MicroPython

Insisting that the Doom port needed to run alongside MicroPython, instead of replacing it, gave Ashby a real challenge.

Developer Phil Ashby has taken the TiDAL badge from the latest Electromagnetic Field (EMF) conference and given it a new workload: playing Id Software's seminal 1993 first-person shooter Doom.

"It’s becoming the de facto question for any piece of technology with a display on it.. fridges, printers, all sorts of things can run Doom," Ashby explains. "So why not this shiny new ESP32S3 based electronic badge I have just received from Electromagnetic Field 2022? It has a decent dual core 32-bit Xtensa MCU [Microcontroller Unit], 8MB of RAM, 8MB of flash storage, and an ST7789 color pixel display. Oh, and a joystick."

With a small screen and a joystick, it was only a matter of time until Doom hit the TIDAL badge. (📷: Phil Ashby)

While Doom was originally written for the IBM PC and compatibles, requiring an x86 processor, Id Software's decision to release the source code for each of its game engines when it moves onto next-generation versions mean it has been ported to a range of platforms — including Espressif's Xtensa-based ESP32 microcontrollers, on which the TiDAL badge is based.

"There is a port of Doom for an ESP32, proving that it can be done," Ashby notes, "however I have added additional constraints on myself as follows: [Doom must] co-exist with the MicroPython environment that comes pre-installed on the badge; [I must] create an app that can be distributed from the TiDAL Hatchery," referring to the MicroPython app distribution platform created for the badges.

The process turned out to be more challenging than Ashby first anticipated. By requiring that Doom be installed as a MicroPython extension, the Doom source code needed to be modified — and a new scaler, suitable for the badge's 240×135 display, had to be created. The first attempt was beset by problems, including incompatible toolchain issues, MicroPython bugs, and runtime errors.

"Having dismally failed to run anything so far," Ashby admits, "I decide to start at the other end, building up from a 'Hello Mum!' program that relies only on the built-in ESP-ROM (and is compiled without the MicroPython 'special tooling' that is causing me problems), designed to run as the first user-provided code on the device, in ESP-IDF parlance, as the 'secondary boot loader.' Thus is born phlashboot, the shortest program I can write that says 'Hi' without crashing."

With that written and working, Ashby returned to porting Doom — now assisted by the ability to create it as a more traditional application and simply use a wrapper to turn it into a MicroPython extension suitable for distribution in the TiDAL Hatchery. With some fiddling to fix the colors, Doom was ported — using the on-board joystick for control.

"Will it run Doom" is something of a running challenge in the embedded industry, with the game having been ported to a range of platforms from oscilloscopes and in-car entertainment systems to thermostats, GPS receivers, the Raspberry Pi Pico — and, most recently, Doom itself.

Full details on the project are available on Ashby's website, with the source code published to GitHub under an unspecified open-source license. Those who attended EMF 2022 and have a TiDAL badge to hand, meanwhile, can download the compiled "egg" from the TiDAL Hatchery.

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