Jump to content
  • Advertisement
  • entries
  • comments
  • views

ATmega168 Tetris

Sign in to follow this  


The tvText library I discussed last entry allows you to display text on a PAL TV in black and white using a 20MHz ATmega168 and a pair of resistors. If this doesn't sound terribly exciting, it's probably because it isn't. However, if you bear some limitations in mind and change the font, you can use this text output as a more general tile-mapping system and use it for games that employ simple graphics.

The new circuit, featuring five sloppily-wired input buttons.
The new circuit, featuring five sloppily-wired input buttons.

I added five buttons to the test circuit -- up, down, left, right and fire -- to act as game input. This circuit is shown in the photograph above. I also added support for 8x8 characters alongside the existing 6x8 characters to the library, set as a compile-time option. This drops the number of characters per line from 32 to 24, but having square tiles makes producing graphics much easier. The reduction in size of the text buffer also frees up more of the precious 1KB of SRAM for the game!

Diagram of the game circuit.

Even though it was always recommended as an excellent game for beginners to write, I don't believe I've ever written a Tetris clone before. Its simple block graphics makes it an ideal candidate for this system, and it always helps to work on a game that's fun to play. Armed with a Game Boy and a stopwatch I attempted to recreate a moderately faithful version of what is probably the most popular rendition of the game.

Click to watch a gameplay video on YouTube.

I think the result plays pretty well, but don't take my word for it -- if you have an ATmega168 lying around, you can download the source and binaries here.
Sign in to follow this  


Recommended Comments

That is fantastic -- the game looks brilliant in motion! Looking forward to seeing you continue progress on this.

Share this comment

Link to comment
great work as usual ben, can't wait to see what you have up your sleeve, never fail to impress

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!