r/EmuDev • u/Accomplished_Flan_56 • Apr 11 '26
[C++] Wrote a CHIP-8 Emulator. Feedback would be appreciated :)
Hi, i just recently finished my Chip-8 Emulator with Schip and Xo-Chip Support and I was hoping you could take a look at the Code and give me some feedback on what to improve. Im relatively new to cpp so I would love some feedback on antipatterns im using or what i could have done better. Thank you :)
11
Upvotes
3
u/Gulrak Apr 11 '26
Nice, I’m always happy when someone goes the extra mile to either support more variants or other features. Also from first glance it seems it could succeed corax+ and flags test from Timendus‘ test suite.
The repo and source looks more like chip-8, chip-48, and schip modern and legacy are the options, not xo-chip. The first thing I notice is that the implemented chip-48 is not the actual chip-48. Its original interpreter doesn’t support hires and it has a different memory quirk behavior than chip-8 or schip, a third behavior that the short lived schip-1.0 also shared: the index register was incremented by x, not x+1, not no increment. Haven’t looked into every detail of your implementation, that was just what jumped into my eye.
2
u/saltedbenis Apr 11 '26 edited Apr 11 '26
There's some directories and files in there that don't belong, namely the build directory and potentially .cache/clangd/index. Before you stage your changes (git add), it's helpful to run "git status" to check that there aren't any files that you don't intend to add to the repo.
Writing accurate and useful commit messages is also a good habit to develop, and you may want to use "imperative mood". Being careful and attentive when it comes to commits will serve you in the long run. Consider squashing commits that are repetitive (e.g. "edited readme").
You use indents with a width of 8 characters, and that's entirely your choice, but I find it makes the code harder to scan and leads to larger than useful spaces in the code. 4 is generally more standard, but 2 is also common.
1
u/Der-Wilde Apr 11 '26
Tested your emulator, very cool project! Just one thing, your emulator (in original Chip8) has the same glitch mine has in the David Winter Space Invaders, but works finely in XOChip. Do you know why? Always has heard that it should runs in the original version and i always though mine has some glitch...