Tuesday, July 20, 2010

Lazarus-64 Retro Game build blog

From idea to prototype (continued)

I had no real idea how to carve a microcontroller into a retro game computer, so I started by making a list of what I would like to achieve in this project. Such things as video resolution, color space and memory bandwidth were worked out for the initial prototype, but some of the specifications had to be later changed due to constraints in the video timing and sync generation system. Knowing that a television set would be used as a video screen, a horizontal resolution of 224 pixels across was chosen, and although this was slightly beyond the "accepted" limits of composite video, it would be just fine for a game system. I initially wanted to have 256 horizontal pixels, but due to the way the sync generator worked on multiples of the 3.579 MHz color burst frequency, choices became limited to 160, 224, or 320. 

Having 320 horizontal pixels would have been nice, but then the host microcontroller would have to deal with a 9 bit X address and an 8 bit Y address, resulting in so many wasted cycles to compute the screen coordinates. The Commodore 64 could only push out 160 horizontal pixels in full 16 color mode, so my goal of 224 pixels with 256 colors was not bad as a comparison.

I continued to work out ideas and specifications on the notepad while taking shelter in the shade of a huge coral wall along the beach. The name "Lazarus-64" was penciled on the top of the notebook, and it seemed fitting considering the mythical character that rose from the dead. This project would basically revive the lost days of 8 bit computing using components that were actually available in the early 1980's such as 8 bit static RAM chips, 74 series logic gates, and a lot of tricky timing to carve out an NTSC signal. All of this retro hardware would then be "jacked" into modern 8 bit microcontroller that would basically act like a cartridge and CPU all in one.

A few months later when time allowed, I dug the Lazarus sketches out of my luggage and began to study the scary details of what it would take to actually generate a perfect NTSC signal to drive my video system out to a standard television screen. Some of my goals included not using any parts that were not available in 1980, so taking the easy way out by dropping in an NTSC video generator chip was not going to be an option. I dug deep into the old Atari documentation and NTSC specs, looking at what some of the old Jedi Masters such as Jay Miner (Atari 2600) did back in the days. At first, not much of this ancient data made much sense, but after some late nights the hairy details of the NTSC signal came into focus and I knew what it would take to make a color image on a television set.

To make a stable video image with the number of colors I wanted, it would take about a eight 74HC series logic chips just for the chroma phase generator, but that certainly fit with the project goals of only using true retro components. Now the next step was to decide on how the host microcontroller would talk to the video memory as this would ultimately determine how much "power" the final project would have. 

I decided very early in the prototyping phase that Lazarus-64 would squeeze as much bandwidth as possible out of the 70 nanosecond static RAM used as video memory, allowing the host microcontroller to read and write pixels at a blazing fast 14.318 MHz rate. 

This may seem slow compared to modern video hardware, but compared to the game systems and computers of the 1980s, this is at least 20 times as fast. The Nintendo 8 bit console could not even reach half a megahertz of video bandwidth. So began the creation of what I call "The Lazarus-64 Memory Switcher" - the circuitry that makes this project both easy to program and lighting fast.

After several months of trial and error as well as 200 or more hand drawn circuit diagrams, I had a design that would meet all of my original requirements. Since each small circuit was only partially tested on a small breadboard, the next step would be to breadboard the entire system to see if it would actually work.