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.

[youtube=http://www.youtube.com/watch?v=8KlHqu1tnMg&w=470]

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.

    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

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.