After a bit of a hiatus for the last month or so, work is continuing on my Chip-8 interpreter for Mac OS X.
The interpreter is being built as a Cocoa application in Objective C. I have previously worked in C and C++, so it’s not a huge leap, but it’s taken me a while to adapt to the idiosyncrasies of the language. The more I work with it though, the more I love it. I’m finding Objective C code is lot more self-documenting than C or C++ and it’s often easier to read.
But back to the interpreter. I’ve implemented a simple messaging system to keep the user informed of the current status:
Currently games and applications can be loaded and run and they work fine on the whole:
Apps can be paused (they will continue execution from the same point when restarted) or stopped (execution will begin from the machine state when the app is first loaded if the app is restarted). Chip-8 uses a timer that fires at 60hz (which was the screen refresh rate of the machine it originally ran on). Any games that use this to control their timing run perfectly. Games that do not use the timer run too fast at the moment. I am currently analysing the original Chip-8 interpreter to arrive at an ideal execution rate for my interpreter.
The Chip-8 app can be resized at any point during execution. It will scale the display appropriately while maintaining the aspect ratio. There is no full screen support currently, but I plan to add that at some point.
Apart from ongoing testing and addressing the speed issue, there are two more things I want to do before I am ready for an initial release of the software.
First is to implement sound. Currently the sound timer is active in the interpreter but there is no tone generation code implemented. I need to spend some time looking into the best way to implement sound support, so I’ll report on my findings in a future post.
Second is to finish implementing the key mapping:
This will allow the player to map each of the hexadecimal keys onto any key on the keyboard, so they can find a set up that works well for them. This is essential to making the games playable. Ultimately I would like to add support for other controls, such as gamepads, but that will be part of a future release.