Coding

Show HN: I built a RISC-V emulator that runs DOOM

A lone developer's DIY RISC-V emulator has successfully run the classic game DOOM, leveraging the RV32IM instruction set and a custom syscall interface to execute the game's C code. The emulator's implementation of newlib and ELF loading enabled the porting of DOOM, which now renders to a fixed area in memory. This proof-of-concept achievement highlights the growing accessibility of RISC-V emulation. AI-assisted, human-reviewed.

A RISC-V emulator has been developed that successfully runs the classic game DOOM, utilizing the RV32IM instruction set and a custom syscall interface to execute the game's C code. The emulator's implementation of newlib and ELF loading enabled the porting of DOOM, which now renders to a fixed area in memory.

Overview

The emulator, called rvcore, is a single-core RISC-V emulator that implements the RV32IM ISA, except for the FENCE and EBREAK instructions, which are currently NOP. It was built using CMake and a compiler that supports C++20, with dependencies including libsdl3-dev or sdl3-devel.

What it does

To port DOOM, the developer used doomgeneric, which was quite convenient to get working once the required stubs were in place. The emulator renders DOOM to a fixed area in memory, specifically at address 0x705FDD, also referred to as VRAM_START. The developer achieved several milestones, including running flat binaries written in assembly language, running flat binaries written in C language, running ELF binaries with a single PT_LOAD segment, implementing the newlib stubs needed to run DOOM, getting DOOM to boot, and making DOOM playable.

The build instructions for the emulator involve creating a build directory, running CMake with the Release build type, and then building the project. The build instructions for doomgeneric involve cloning the repository, installing the riscv64-unknown-elf-gcc or the riscv64-gnu-toolchain, and then running make.

In practical terms, this achievement highlights the growing accessibility of RISC-V emulation and demonstrates the potential for running complex applications like DOOM on RISC-V based systems. For developers interested in experimenting with RISC-V emulation, the rvcore emulator and doomgeneric provide a useful starting point.

Similar Articles

More articles like this

Coding 2 min

Ruflo: Multi-agent AI orchestration for Claude Code

A new framework for multi-agent orchestration, Ruflo, has emerged to streamline interactions between Claude Code and external AI agents, leveraging the OpenAPI specification to facilitate seamless integration and data exchange. By abstracting away underlying complexities, Ruflo enables developers to craft more sophisticated workflows and automate tasks with greater ease. This shift in agent management could have far-reaching implications for AI-powered applications. AI-assisted, human-reviewed.

Coding 2 min

Trademark violation: Fake Notepad++ for Mac

A counterfeit version of the popular open-source text editor Notepad++ has been discovered on the Mac App Store, masquerading as the genuine article and potentially compromising user data through unauthorized access to sensitive files. The fake app, which mimics the exact UI and functionality of the original, has been downloaded over 1,000 times, raising concerns about the App Store's vetting process. This incident highlights the need for more robust security measures. AI-assisted, human-reviewed.

Coding 2 min

GameStop makes $55.5B takeover offer for eBay

Retail giant GameStop's $55.5 billion unsolicited bid for eBay marks a seismic shift in e-commerce, as the brick-and-mortar stalwart seeks to leverage its vast customer base and expand its digital footprint through eBay's sprawling online marketplace. The proposed acquisition would integrate eBay's auction and fixed-price platforms with GameStop's loyalty program and omnichannel retail capabilities. The deal's implications for consumer behavior, digital marketplaces, and retail consolidation are far-reaching. AI-assisted, human-reviewed.

Coding 1 min

Over 8M Thermos jars and bottles recalled after 3 people lost vision

Massive consumer goods recall highlights the perils of thermal shock: over 8 million Thermos jars and bottles are being pulled from shelves after three people suffered irreversible vision loss due to sudden temperature changes, prompting a reevaluation of the industry's safety standards for vacuum-insulated containers. The recall affects a wide range of products, including popular travel mugs and food storage containers. A closer look at the affected products' design and manufacturing processes is now underway. AI-assisted, human-reviewed.

Coding 1 min

Stitch Together Lots of Little HTML Pages with Navigations for Interactions

A new approach to web development is emerging, leveraging the concept of "small HTML pages" to stitch together modular, navigable interfaces that facilitate seamless interactions. By breaking down complex web applications into bite-sized, self-contained components, developers can create more agile, responsive, and maintainable user experiences. This modular strategy is poised to revolutionize the way we design and build web interfaces. AI-assisted, human-reviewed.

Coding 1 min

Humanoid Robot Actuators: The Complete Engineering Guide

Advances in high-torque, low-weight actuators are poised to revolutionize humanoid robotics, with the emergence of compact, direct-drive motors and optimized gearboxes enabling more agile and dynamic movement. Key innovations include the integration of high-strength, lightweight materials and the adoption of advanced control algorithms for precise torque control. As a result, humanoid robots are becoming increasingly capable of complex, human-like motion. AI-assisted, human-reviewed.