The Uzebox is a homemade game console. A while ago, I found on the net a couple of projects about doing video with microcontrollers.
One of them, Rickard Gunee, made a Pong game with a single PIC and like 3-4 resistors! The microcontroller was generating the (monochrome) video signal, sync and basic sound all at once with cycle-counting precision. Indeed, I found this pretty cool and decided about doing a game system myself, but with my favorite micros, the Atmel AVRs. Additionally, I wanted it to be in color (at least 256 simultaneous colors), have good sound capabilities and some sort of standard input, like those old Atari 2600 joysticks or NES controllers.
After weeks of hacking around with video sync generation and experimenting with software generated color signals, I realized the latter would not work for my project. Generating video color information (bursts, phase changes, etc) in real-time consumes way too much CPU cycles for what I intended to do.
I opted for another approach and used a RGB-to-NTSC converter, the AD725 from Analog Devices. I also decided to invest time
developing some sort of interrupt driven game engine that would mix and ouput music, generate video sync and render frames independently of the main
game program. Althought I knew I couldn't get around insane cycle-counting for the driver, once done, it would makes the actual game development a charm.
The console is based on an Atmel ATmega644, an 8-bit microcontoller based on the AVR architechture. It has 64K of flash for both code and data, 4K of RAM, lots of I/O lines and many peripheral features.
The video is output on one of the ATmega 8-bit I/O port as RGB,
3 bits are allocated for the red component, 3 bits for the green and 2 bits for the blue. Those are fed to a DAC composed of three R-2R resistor ladders.
This gives 256 fixed but simultaneous colors on screen.
Note that the pictures taken from the screen doesn't do justice. The picture is way sharper and the colors more vibrant when looking directly the TV, theres not even a slight flicker. Quite frankly, I'm amazed at the results, specially for a wire-wrap prototype!
The system's 3:3:2 RGB color space
The system runs overclocked at ~28.6Mhz (8 times the NTSC color burst frequency). Even if the part is rated at 20Mhz, it runs without a hiccup. I never experienced any instability or crash so far.
As the chip has only 4K of RAM, the video memory is very limited and the rendering driver is tile and sprite based.
The power available allows to produce a resolution of 180x224 pixels or 30x28 tiles of 8x6 pixels.
The sound is composed of 3 waves channels and 1 LFSR-based noise channel. Each have independant timbre, frequency and volume. Resolution is 8-bit and is mixed at NTSC line rate (~16Khz) and output to an 8-bit DAC (AD557). A hi-level player can play specially formatted MIDI files.
For the
input I opted for standard NES controller interface, which is very simple. Although you can't buy the connectors anywhere, the best source is buying an old NES from eBay.
I must give credit for the idea to use NES controllers to Andre Lamothe and his Hydra console.
Also many thanks to Rickard Gunnee for his excellent video tutorials.
So far
I'me working on a Tetris clone. The game is fully functionnal and implements most of the offical "Super Rotation System" (SRS) system complete with hold block and ghost piece. And it even plays Korobeiniki, the classic Tetris song!
The tile set used for the game
Note that the system (and source code) works only for NTSC. Ajusting it for PAL shouldn't be too hard though.
Once cleaned up, I will add the source code to the driver and game for download.
UZE
Other projects with software generated video