CSharp and Monogame, Chip-8 emulation
This was an unexpected project. I had started on a basic GameBoy emulator (Zeighty), and once I’d gotten past the processor emulation and the basics of memory and tiles, I ran into problems with how I was going about DMA – this meant I was struggling to get the screen output going. I decided that I might have been a little bit ambitious to begin with, and people suggested I looked at emulating ‘Chip-8’, which seems to be considered as the default entry-level system when learning how to write emulators.
The emulation discord server has a Chip-8 topic and it’s full of very helpful, very knowledgable people. I’d gotten quite a long way with my initial draft, and emulation of a few common ‘ROMS’, and I was directed to go try the ‘standard tests’. In which my emulation did not fare so well!
The process of working through the tests, identifying where I’d made a mistake (or, in a few cases, where I’d been working from a recognised-incorrect set of documents) and correcting was very satisfying. It was amusing to see the Discord group immediate recognised which ‘incorrect’ online documenation I’d been using, based solely on the pattern of ‘fails’ in the standard test suite. Pretty cool.
Once I’d passed all of the standard tests, put a very simple file-load requester and some options into the program, I was told to try the ‘oob’ tests…. which I pretty-much immediately failed! Oob is ‘out of bounds’ – these are tests designed to get the emulators to do things that aren’t really covered in the docs (for instance, accessing a screen address that doesn’t exist) so the behaviour is considered ‘out of bounds’ and, in an ideal world, your emulator would deal with it gracefully.
Well, I decided that this was as good as place as any to declare the alpha version done, pop the repo online, and start thinking about returning to the Gameboy project. At the end of the day, this Chip-8 emulator runs, it plays the games and it gave me a reasonable grounding in how to approach something bigger/more complex…. such as that pesky Gameboy.
Chip-Ate – Github repo


