So as some people lurking in IRC already know, I started work on a CHIP-8 emulator a little under a year and a half ago. I just picked it back up a couple days ago, and have made some major progress. It was originally written in C++, and I wanted to first write it for the computer using SDL, and then port it to the Nspire, hence the name "nCHIP-8." The C++ to C conversion was surprisingly easy! I'm not sure I did it the
right way, but at least it works. Basically, I put all the data stuff in a struct, and renamed the functions to
chip8_blah()
All the functions take a pointer to a chip8 struct as their first argument, and then just edit that.
I've ported it to the GBA, and it runs great, except for a few bugs in the actual core that I need to fix.
As the CHIP-8 has 16 buttons and the GBA only has 10, I have to make a keymap for each game. If you want to try out Space Invaders here's a ROM you can run on an emulator (or real hardware):
https://sr.ht/MfIH.gbaI personally recommend
mGBANext steps are (in no particular order):
- Make a pretty border
- Port to the CE (it'd be easier if I actually had a CE)
- Port to the Nspire (the repo is called nCHIP-8 after all)
- Fix emulation bugs so it can actually run everything.
- Port to KOS (It might run too slowly for this)
- Port to Arduino
The emulator core is pretty easy to use, and as such makes it a breeze to port to other platforms. The GBA port only took about an hour to go from SDL to GBA.
Source for everything is here:
https://github.com/Ivoah/nCHIP-8