More AVR Tetris

[Ben] built an AVR based Tetris game that uses a TV as the display. He linked his project in a comment from the AVR Tetris project featured last week. His work taps the power of his own tvText library to handle the composite video out. Using a TV takes all of the hardware work out of the equation, leaving just the composite jack and a few buttons to connect to the ATmega168 and its 20MHz clock. We’ve embedded the game play video after the break. It’s black and white but also clean and crisp.

@Agent420-I am the biggest fan of Parallax’s Propeller chip, and it is not overrated, but besides that you are completely right :D

From my own experience at trying to get NTSC video output from an even beefier Atmega32 micro, this is a huge accomplishment. The video is crisp and clear and there seems to be no lag. Excellent work. I’m curious to see how enough clock cycles were ecked out to run the video and play the game.

Benny M: Very observant. ;-) I have a VGA box hooked up to my monitor. One thing I haven’t worked out yet is why I get colourful rainbows around every black-white transition when viewed on a TV tuner or VGA box (easily fixed by switching the saturation right down) but no such effect on the handful of “real” TVs I tested on (crisp black and white from the start). Maybe real TVs can detect a black and white signal better than a TV tuner or VGA box?

Agent420: You can get decent colour out of an ATmega168 if you output RGB (see http://avga.prometheus4.com/index.php for an example) but as I only had access to an old TV tuner and VGA box, both of which only support composite or S-Video, I kept it black and white. You can get RGB to composite/S-Video ICs, but they were pretty expensive when I looked. I did also look into Propellers some time ago, but hastily closed the tab when I saw that they were going charge around $50 to ship to the UK!

Nemo: I did a rough test by counting the number of frames it took for a _delay_ms() call to execute, and estimated around 3 MIPS. After enabling TVTEXT_SKIP_ALTERNATE_ROWS I estimated around 9 MIPS. These weren’t very scientific tests so could be completely wrong, but there’s more than enough CPU time left to run a C implementation of Tetris smoothly. (I’m using a 20MHz clock).

I only did PAL modulation with FPGA so I can’t really estimate how much processor time will there be after the signal is colour-modulated. It’s very much possible that there will be enough time for a Tetris.

But srsly, isn’t the best part about Tetris the theme music? I know composite out on an AVR is a pretty nice accomplishment but I need my russian choon fix or the little lines don’t dance right for me.