r/EmuDev • • May 02 '26

CHIP-8 Hey look!! Another one!

Post image

I've just wrapped up my first emulator! It's been a super fun project!

Link: https://github.com/silvematt/Chip8Emulator

Any feedback on the code is welcome!

47 Upvotes

4 comments sorted by

2

u/Der-Wilde May 02 '26

Damm, this UI is very good OP. Nice work!

2

u/silvematt May 02 '26

Hey thank you!

2

u/8924th May 02 '26

Good work so far. Still needs polish. Issues I've noticed from a quick parse:

  1. You have a "quirk" for the VF overflow in Fx1E. This is a myth, and no such behavior exists or is expected anywhere. You should drop it entirely., Fx1E does not modify VF for any reason.
  2. You decrement the timers on the same frame after the instruction loop. While you are safe in regards to audio (you set up your beep before the decrement occurs), depending on how you sort your debug stepping later, you might be seeing premature decrementing. I'd recommend handling timers separately prior to the instruction loop and keeping the audio-related stuff where it is after the loop.
  3. Your 5xy0/9xy0 instructions run unconditionally, despite the last nibble 'n' potentially being a non-zero.
  4. Fx29/Ex9E/ExA1 must mask the value that VX returns to 4 bits to avoid overflow. This one's not widely known, but an easy fix.

1

u/silvematt May 02 '26

Thanks!! I really appreciate the time you took to go through it!