It was middle of a week, around noon I think.

I thought to myself “I should write a yet-another NES emulator, that would be awesome!”.

Few minutes later I am reading blogposts, articles, browsing repositories.

And I am like “Damn it looks complicated”.

Me about to write NES emulator (Source: nedroid.com)

So I decided to start with something much, much simpler - Chip-8 that was developed in mid-1970s. Because it’s architecture was pretty straightforward it was a project I was able to finish within few days without a rush - and that included whole day+ of debugging why the hell drawing on screen doesn’t work as expected (reason: Crystal type interference gave me unsigned int8 on one calculation, but it somehow awkwardly handled overflow of int8 - I didn’t had chance to dig into it yet).

I am not going to write any step-by-step guide, because I have found two just fabulous blogposts related to the task - one is about writing Chip-8 emulator in Javascript, and the other one is complete guide with detailed explanations how to do it in C++ - big kudos for the authors. I actually stole a lot of code from the latter after my debugging frustration :P.

Space Invaders welcome screen running on Crystal

You can check out my result here. It is very messy, but should give you basic idea how to do it in Crystal and how to use SDL2 bindings (that I have never had chance to use before in my life).


Note: Direct source of the comic above