A while ago, I found on the net a couple of projects about doing video with microcontrollers. One of them, made by a guy named Rickard Gunee, was a Pong game made with a single PIC microcontroller and a few 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 awesome and it finally motivated me to design my own console, built with some of my favorite microcontrollers, the Atmel AVRs. Additionally, I wanted it to be in color (at least 256 simultaneous colors), have good sound capabilities and some sort of retro input, like those good old NES or SNES controllers. Of all the color generation methods, I opted for a simpler one and used a RGB-to-NTSC converter chip, the AD725 from Analog Devices. I also decided to invest time developing some sort of interrupt driven game engine that would mix music, read joypad status, generate video sync and render frames independently of the main game program. Although I knew I couldn't get around insane cycle-counting for the driver, once done, it would makes the actual game development a piece of cake. Driving my design was the uttermost simplicity, something any hobbyist could build up in no time, ideally built out only of DIP chips. So, apart from the AD725, the console is solely based on an ATmega644, an 8-bit general purpose microcontoller based on Atmel's AVR architecture. It has 4K of RAM(!), 64K of flash for both code, sound and graphics data, lots of I/O lines and many peripheral features. The video is output on one of the ATmega's 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, there's not even a slight flicker. Quite frankly, I'm amazed at the results, specially for a wire-wrap prototype! The system runs overclocked at ~28.6Mhz (8 times the NTSC color burst frequency). Even if the part is rated at 20Mhz, I never experienced any problems to this day! The chip has only 4K of RAM and, since the video memory is very limited, there's no frame buffer. Instead tiles-based video modes are currently supported by the kernel: "Mode 1": Tiles only mode @ 6 clocks per pixels. The resolution is 240x224 pixels or 40x28 tiles of 6x8 (horizontal x vertical) pixels.

"Mode 2": Sprites & Tiles mode @ 10 clocks per pixel. The resolution of 132x208 or 22x26 tiles of 6x8 pixels. Up to 32 simultaneous sprites on screen against a tiled background. This mode also support per-pixel full screen scrolling and multiple "split-screens" for parallax effects.

"Mode 3": Sprites & Tiles mode @ 6 clocks per pixel. The resolution of 240x224 or 30x28 tiles of 8x8 pixels. Due to memory constrainst, sprites count in this mode cannot exceed ~20 simultaneously. This mode supports full screen scrolling and an overlay for high scores, etc.

Many more video modes are currently available. See the WIKI for details. Tiles Only Mode Mode 2: Tiles+Sprites (low-res) Mode 3: Tiles+Sprites (hi-res)

The sound is composed of 3 waves channels and 1 LFSR-based noise or PCM channel. Each have independent timbre, frequency and volume. Resolution is 8-bit and is mixed at NTSC line rate (~15Khz) and is output on a single pin via pulse width modulation (PWM). A hi-level player can play specially formatted MIDI files. With any good music sequencer(Cubase, Cakewalk, etc), a MIDI IN input allows the creation of music and sound fx straight on the console.



For the input I initially opted for standard NES controller but then switched to SNES. Aftermarket SNES controllers are easy to buy these days contrary to NES. Moreover, SNES have more buttons and cool accessories have been made (like a mouse!). Although you can't buy the connectors anywhere, the best source is buying a SNES multitap from eBay (~6$+shipping).



Since it went live, the Uzebox got (or is about to get) a few new features like SNES joysticks, SD Card and Ethernet interfaces. All this development happened due to a cheerful community that brought up a lot of knowledge and ideas in the forums. Be sure to have a look and see the state of the project. Also, check the WIKI for a whole lot of documentation on the project.



I could not give enough thanks to Rickard Gunnee for his projects and excellent video tutorials which made this possible. UZE

Notes

The system (and source code) is designed for NTSC. Adjusting it for PAL shouldn't be too hard since the AD725 also supports this format.

The more recent ATmega644P, seems to have problems with overclocking. The UARTS suffers from severe glitches during operation. So MIDI IN or any serial based extensions does not work correctly.

The AD725 is only available in a surface mount package, so a SOIC-to-DIP socket adapter is required for vector board prototypes. Some soldering skills are required, but the pitch of the pins is not too small, so it is relatively easy to solder (even with no experience). Look in YouTube for hundreds of tutorials.

A set of custom tools developed in Java is provided in the download package. They helps generate content for the game. There is a converter to transform raw images to tiles and maps, a MIDI file converter and a music patch/fx editor.