User avatar
Posts: 100
Joined: Tue Jul 31, 2012 8:47 am
Location: Aberdeen, Scotland
Contact: Website

Chip-8 in Python on Pi

Sun Dec 30, 2012 5:52 am

A few weeks ago, I uploaded a YouTube video of my Chip-8 emulator sending its output to an OLED display from Adafruit, connected to a Raspberry Pi:

It's really just a curiosity, which I used as an excuse to write my first proper Python program - I've been a C/C# coder for 20+ years now so I doubt I'll ever truly learn to "think in Python" - but I promised the source code so here it is:

Seeing as Chip-8 is a bit of a toy compared to emulating a proper system, there's not much to say about it really, but the "claim to fame" is that it has pluggable drivers for the display and keyboard. So if you use the provided demo, it plugs in pygame drivers and you can have it running on your screen and using your keyboard. But if you substituted the OLED display driver, the output would go to the OLED display, and if you were to write a GPIO-based input driver then you could use a joystick or control pad connected to the GPIO instead of the keyboard. You can have multiple drivers plugged in at once if you wish.

The drivers themselves are very simple, and again little more than toys, but serve to illustrate a possible design pattern for something like this. I hope to provide an additional display driver shortly that will send the output to a certain rather fashionable destination...

Return to “Python”