DOOM's E1M1 rendered in chunky low-resolution graphics on Sega Genesis hardware

Running DOOM on the Sega Genesis

I got DOOM running within the real hardware constraints of the Sega Genesis (Mega Drive). It's a port built with an AI agent on top of Doom64KB, the Neo Geo port — title screen, 3D rendering of E1M1, music and sound effects all working.

I got DOOM running within the real hardware constraints of the Sega Genesis (known as the Mega Drive in Japan). It's a port built with an AI agent, based on Doom64KB, a DOOM port for the Neo Geo. Everything works, from the title screen through 3D rendering of E1M1, background music, and sound effects. Here's the demo video first.

It started with a tweet from Renpou

The trigger was this post by Yoshino of Renpou (@yoshinokentarou).

Tweet by Yoshino of Renpou about Doom64KB running on the Neo Geo

Before that, I was struggling with a GBADoom port

Actually, before this I had been working on a Genesis port based on GBADoom, also using an AI agent.

The problem is that GBADoom draws pixel by pixel, which is a bad fit for the Genesis VDP — a chip that can only arrange tiles. I could squeeze out 0.8 to 3 fps and no more.

GBADoom also needed over 200KB for the heap alone, which was painful to fit into the Genesis's 64KB. I got badly stuck by using gcc-68k-linux instead of gcc-68k-elf (I never suspected the real cause and ended up reading gcc's own source). Sorting out endianness problems inherited from ARM CPUs meant an endless build-and-test loop. I never even reached a 3D screen. I haven't published that attempt — someday I'd like to give it a proper burial.

With Doom64KB as the base, it worked in about a day

That's when I learned about Doom64KB, the engine used for the Neo Geo version.

Doom64KB is a DOOM port built for machines that only have 64KB of RAM but can use plenty of ROM. The Neo Geo and the Genesis share the same Motorola 68000 CPU and are both big-endian, so the platform-independent code should run almost unmodified and only the I/O layer would need rewriting. That was the outlook — and after all that struggle with GBADoom it felt almost absurd: in about a day it went from the title screen to 3D rendering. Thanks to a design that commits fully to a low-resolution chunky display, the frame rate is far more realistic than the GBADoom-based version, too.

The AI agent did the porting work itself

Honestly, the porting engineering here was almost entirely the AI agent's work.

  • Rendering the screen as a 38×28 chunky framebuffer pushed into VDP tiles
  • Reducing DOOM's 256 colours down to the Genesis's 64 (4 palettes × 16 colours)
  • Rearranging WAD lumps to satisfy the even-address alignment the 68000 requires
  • Text rendering for the HUD and menus, music and sound effects, FPS display

I left all of this — fitting it into 64KB of main RAM — to the AI (builds via SGDK + marsdev). I was really just stating the goal and reporting bugs.

Subtle questions about behaviour and sound needed human judgement, but for hang-type bugs the AI iterated against a headless emulator, so mostly I just waited for the fix. That said, when the emulator failed to launch because of the build environment, or when video/audio capture failed, the AI would wander off indefinitely — I did step in and stop it when things started to look like that.

What I did with my own hands: fan MIDI to VGM conversion

The part I clearly worked on myself was the music. A fan-made MIDI of "At Doom's Gate", the E1M1 theme, converted to VGM for the Genesis's YM2612 FM sound chip.

...although midi2vgm itself was also built with AI, so how much credit is really mine is questionable. The FM instrument patches took a lot of back and forth, and I'm still not happy with them. I know far too little about the YM2612. I want to do better there.

The ROM image and source are public

The repository is here, published as a fork of Doom64KB.

I've also published a built ROM image (without music and sound effects), so you can run it yourself.

I wouldn't have built any of this if Renpou hadn't shown me the Neo Geo version — so, thanks again.