Chip-8 Emulator in Makecode Arcade! (Fantasy Console)

CHIP-8 in Makecode Arcade! :alien_monster:

Hello everyone! It’s been a minute, and I’m finally ready to present to you my CHIP-8 Emulator for Makecode Arcade.

Features:

  1. 4 KB RAM
  2. Full CPU implementation.
  3. 16 general-purpose registers
  4. Stack and timers
  5. Sprite drawing with collision detection
  6. Configurable display palette
  7. Native Arcade controller support
  8. Runs at decent speed on most real Arcade hardwares
  9. JSBin ROM converter for converting .ch8 files into MakeCode arrays

I tested it with a couple roms and they all worked fine, I included David Winter’s Space Invaders rom because it’s pretty fancy for a CHIP-8 game though.

Convert CH8 roms to a code that you can paste into the main.ts file in the project to run your own roms! You can grab some from the Github link included on the jsbin site.

Press Menu to change the color mode!

https://output.jsbin.com/dagiram

7 Likes

Holy lag? I think it’s the conversion but it randomly makes the enemies teleport

I’m curious, Abstract: What was your design process for this implementation? It’s gorgeous … and I’d love to know how you went about developing it.

Premise: One of my long-term projects is a course on computer organization and computer architecture. Simulators and emulators are great projects for that kind of a course, and I’m planning on at least one of the projects being a software emulator written for MakeCode Arcade. I love “simple” architectures like the CHIP-8 for this kind of a project.

Really cool project and really nice work, Abstract!

1 Like

Some opcodes might be off or not implemented yet, I’m working on that part.

1 Like

Hello AlexK!

I treated the emulator as if I were implementing a tiny computer. I separated memory, registers, timers, input, display, and the fetch-decode-execute loop into distinct parts. Once the framework was in place, implementing new opcodes became much easier because I could compare the ROM’s expected behavior against what my emulator was actually doing.

You don’t need to read the rest of this reply but it’s some useful notes in case you need them.

For Chip-8 I embedded the ROM directly as a constant because the programs are so small. For larger systems like a Game Boy (which somebody has made a GB emulator for Arcade), it makes more sense to load ROM data from image or hex rather than hard-coding it.

I’d also recommend using debug logs a lot too, even for tiny things like when the project starts, because in a bigger project where you emulate an actual CPU, you want to know the status of the PC and such.

Hoping to see that emulator for whatever it might be someday, just remember that Arcade is a fantasy console limited by constraints after-all.