The computing world is governed by two architectures: x86 and ARM. Both are closed architectures, but there is a free and open-source alternative in the form of RISC-V, designed by the University of California, Berkeley. The YouTuber CNLohr has spent recent weeks working on a small RISC-V emulator capable of running Linux, but he decided to take an extra step... and inevitably arrived at Doom.
The ExplainingComputers channel did an excellent job presenting the main features of the RISC-V architecture. The idea of a free, open, and flexible solution is very attractive, but its most important applications are in the embedded space, such as Google's Titan M2 security chip, or the famous ESP32 from Espressif Systems.
At the same time, RISC-V is very popular in research environments. In fact, many experts have created RISC-V emulators with various levels of complexity, but CNLohr, whom we remember for his 3D WiFi signal maps, decided to create a version capable of running Linux. That was his first goal:
Doom on a RISC-V Emulator
The original video is 20 minutes full of technical details definitely worth reviewing, but for a week, the web only asked one question: “Can it run Doom?”
CNLohr explains that in its original state, the answer is no. Doom needs to perform write operations on an output graphics device, which the emulator doesn't have. However, with a series of additional adjustments, the marine began blasting demons again. Six years ago, CNLohr prepared a special project called embeddedDoom, a simple and compact build, highly integrated, and with very low memory requirements. His strategy was based on porting embeddedDoom, and presenting the graphics in all its 160x50-pixel glory using ANSI codes.
The rest is a true bug hunt, an initial run, more errors, and finally, Doom on a RISC-V emulator at 25 FPS. Performance improvements will likely come with extra work (and it's not like Doom needs too much at this point)... but that's another story.