Main Content

Recreating classic games with a bare MCU

Some time ago, I hatched a plan to introduce my kids to a handful of classic computer games. This wasn’t a matter of misplaced nostalgia: I’m not overly sentimental and I’d rather play Horizon Zero Dawn than Pong. Instead, I wanted to show how simple the design of a computer game can be — perhaps to encourage them to tinker on their own.

With their assistance, I ended up building three handheld games. It proved to be an enjoyable pursuit and a source of more joy than I anticipated — so I wanted to share some practical notes, technical details, and gameplay videos for posterity.

Game #1: TurboSnake 2000 and 25000
In this classic genre, the player controls a constantly-moving snake. The only possible input is to turn the snake 90 degrees to the left or to the right. The objective is to eat “apples” appearing on the screen, and to do so without colliding with any obstacles or hitting your own tail. Because the snake grows with every consumed apple, survival requires careful planning and a good amount of dexterity.

The history of this sort of games is muddied, but their core mechanics trace back at least to Nibbler, a 1982 arcade game developed by Rock-Ola. Much later, the reintroduction of the game by Nokia turned it into a staple of mobile gaming in the pre-smartphone years.

I picked “snake” as the initial project because of the simplicity of the gameplay and its compatibility with low-resolution displays. At first, I thought of using a 16x16 LED array as the gameplay arena; but after some experimentation with an 8x8 LED dot matrix module (LD788BS-S22 from Jameco), I was surprised to find this low-res variant still quite playable. The added benefit was the ease of driving this display directly from an MCU without any additional registers or line decoders.

So, I built the first prototype with an 8x8 LED display controlled directly by an ATmega328P in a “scanline” mode. The display has a grid of internal connections that allow the MCU to select a specific row to activate by applying a voltage to one of eight vertically-running lines, and then to turn on chosen LEDs in the selected row by via eight horizontal pins. Although this only illuminates one row at a time, persistence of vision does the rest.

The game employed four momentary switches for controlling snake direction. LED matrix aside, the only other output peripheral is a small speaker, wired through a transistor to an MCU output pin.”

Link to article