Code Repository

To close out my postbacc degree at Oregon State, three other student and I built an 8080 emulator to play the original Midway arcade cabinet ROM of Space Invaders. This was a number of firsts for all of us: our first emulator, our first C++ project, and our first time using SDL (v3 specifically). SDL, or Simple DirectMedia Layer, is “a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL/Direct3D/Metal/Vulkan.” It was a great library to use for input, audio, and video. I recommend Mike Shah’s playlist of tutorials on YouTube.

Initially, I was tasked with setting up keyboard input. That was probably the simplest part, so I moved on to help Joshua with writing up all the opcodes and Patrick with the video memory translation. The latter was a fun exercise made a lot easier by Computer Archeology’s information on the Space Invaders ROM and how it interacts with hardware. I’ve written about this here.

It was also a good opportunity to use some relatively more recent additions to the C++ standard, like arrays (as opposed to vectors) and spans on an array. A span (std::span<T, N>) is a set-sized view of a segment of an array. Since we were representing the ROM’s memory as a std::array<uint8_t, 0x10000, and the display code needed only to read the section assigned to VRAM, we allowed read-only access to that section as a span.