8-pin micro plays Pong on your widescreen

[Fernando] sent in a tangential project update that uses an ATtiny45 to play Pong on his television. Last time we looked in on his work he had just finished getting the eight-pin chip to display a big number on the TV via the VGA port. This expands on the idea while he continues to wait for parts.

Right now the chip plays against itself, but he’s got one input pin left and we’d love to see a button added for a simple one-player game. We’re thinking the paddle would always be moving in one direction or the other, with a click of the button to reverse that direction. The part that he’s waiting for is a Bluetooth module, which we’d love to see used for 2-player games via a pair of Wiimotes (we’re just wishing at this point and don’t know if that would even be possible). The end goal for the hardware is a Bluetooth connected scoreboard for Android devices.

The code is written in Assembly, and we found it relatively easy to follow what [Fernando] is doing with the game logic. On the graphics side of things he gets away with a 120×96 resolution because Pong is supposed to look pixelated. We love the result, which you can see for yourself after the break.

12 thoughts on “8-pin micro plays Pong on your widescreen

  1. If you just have one input free, you could still have an unlimited amount of controllers connected. Just use serial data.

    You could even use something like RC5 protocol to pick up the signal from a pair of IR remotes you have kicking around (TV remote versus DVD player remote?).

    Although you may need to slow the ball movement down a little.

  2. Pong, brilliant!

    For inputs you could measure the charge and discharge rate of a single capacitor through several resistors connected to switches.

  3. Amazing! I hope the Bluetooth module won’t come for some time. I’d love to see what else Fernando has got up his sleeve! :-)

    1. The nop is to spend a cycle. At 20Mhz 1 cycle will be exactly 0.05us (micro seconds). In the code is used in a lot of places to spent the time evenly specially when a conditional branch happens. If you imagine a code in C like if (a) { do b, c } else { do d, e, f }, in the pong you will find a brxx mnemonic meaning branch if something (equal, less, etc.) that command will use 1 cycle if the condition is false and 2 cycles if its true, so I have to add nops in on side or the other to make it spend exactly the same time at the end of the “if”. In C the code is optimized (no nops), so at the end of the if you will have spent different quantity of cycles depending on the condition, you have no control on the timing which is essential for a VGA application like this. Unless you have a powerful microcontroller and you use the timer interruptions (but the fun of tiny pong is precisely not using a big micro)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s