Main Wiki More details on the Uzebox Tutorials to help get started Downloads the project files Help forums

When I started the project, I didn't spent a lot of time thinking about the possible video output. A good old classic composite TV output seemed most retro and appropriate than, say, VGA. After all, everybody has a TV. And it's almost always placed in the living room, a much better place (I thought) to show off your games to family and friends! :) The term composite video refers to the fact that both intensity, color and synchronization information are mixed together into a single signal. And one thing I've noticed about it: there's many standards out there. Seemed like each part of the world decided to make their own format, mostly incompatible with each other. Since I live in Canada, the Uzebox produces NTSC composite video, the analog standard mainly used in North America. It worth noting that, if you live in Europe everything is not lost. Although the NTSC standard is not compatible with the PAL or SECAM standards many in Europe told me that most recent TVs sold there supports NTSC.

Up to recently, with the advent of LCD and plasma TVs, we were still using the cathode ray tube (CRT for short) as the basis for picture display. The CRT is a vacuum tube containing an electron gun (a source of electrons) and a fluorescent screen, with internal means to accelerate and deflect the electron beam, used to form images in the form of light emitted from the fluorescent screen.

A video signal is made of 30 frames per second (29.97 to be exact). A frame is the actual picture that fills the screen of your TV. Each video frame is in turn made up of two fields; the 'even' and 'odd' fields. Fields in turn are composed of scanlines, 524 scanlines in total (normally 525, more on that later). Fields are a remnant of the past when technology would not allow the screen to redraw enough times per second to avoid flickering. Engineers decided to draw half a picture at a time, first a field with only the odd lines, then they draw only the even lines. Hence, fields are drawn at a rate of 60 times per seconds. This interlacing of the video lines coupled with the phosphor coating persistence (the time that the phosphor continues to glow after being hit by the electron beam), blends to the human eye, creating smooth motion and imperceptible flickering.



A field begins rendering at the top-left corner of the screen and the electron beam crosses the screen from left to right rendering the video line. When it reaches the right side, the beam is turned off and brought back the left side. That's called the horizontal blanking. When the beam's back to the left side, the next line begins rendering and this continues until the 262nd line is completed rendering. The beam is then turned off and brought back to the top-left corner during what is called the vertical blanking. Then the next fields begin the same process.

Here's what a field rendering looks like:


TVs require some signals to indicate them when to perform horizontal and vertical blanking. That's the synchronization signal mentioned earlier. A full composite video signal fits within one volt. The "normal" or reference voltage is at around 0.3v. The synchronization signals, or sync for short, are "negative going" pulse going to zero volts. The active video on the other hand, "sits" on the reference voltage and swings from .3 to 1 volts.

The typical signal for a scanline look like this:

From that picture we can notice a few things. A scanline is made of two main sections. The blanking interval and the active video period. The blanking itself is composed of the horizontal sync pulse (called HSYNC) and a color burst. Color generation in NTSC is tricky and the explanation of how it precisely works is way out of the scope of this documentation. With that said, I'll risk a simple explanation. When TV came out it was only monochrome, the active video part of the signal represented the luminance or intensity of the picture. When color came, the NTSC engineers wanted to embed color (or chrominance) in the same signal and have it in a way that would be backward compatible with all the B/W TVs out there. There was a short period of time after the HSYNC pulse and beginning of the active video still free, so they put in there a color burst. This burst, made of 9 cycles at 3.57Mhz, is used to syncronize the TV circuitry with the chrominance signal. The chrominance is a 3.57Mhz signal modulating the luminance signal. The way they attained color was by changing the phase of the chrominance modulation. Although this scheme had its issues (some said NTSC meant Never The Same Color), it was clever enough to work on B/W television without major artifacts.

The last part to be covered is the vertical blanking. The TV circuitry needs way to know when the last line was completed and the beam needed to go back to the top. This comes with a series of special sync pulses called the vertical sync or VSYNC. Theses pulses are output at exactly double the line rate. There are 6 pre-equalization pulses, 6 serration pulses and 6 post-equalization pulses. No color burst are issued during VSYNC. After the 18th pulse (or the 9th line) regular HSYNC pulse and color burst resume.

Here's the vertical sync signal. It happens at a rate of 60Hz and signals the beginning of each field. The horizontal drive is just an internal reference corresponding to the line rate.


Here's the standard NTSC timings used by the Uzebox kernel:


To conclude, here's something I wish I had known before and that NO other tutorials ever mentioned. It's worth noting that the official NTSC RS170 standard mandates that each field is made of 262.5 lines (yes, 0.5 line! hence 525 lines in total). This means that the raster beam stops mid-way on the last line and after the vertical retrace is complete, it starts mid-way on the first scanline on the next field. In my very first prototype, this sync stuff was rather confusing to me so I played safe and used a video sync generator chip. To my great deception, the picture was flickering a lot and I could not explain why. I dug out and plugged in by good 'ol NES and SNES and notice their image were not flickering at all! Mesmerized, I turned on my oscilloscope and carefully examined their signals. It turns out that the problem was that 0.5 line! There was no such thing on those consoles, fields would contain exactly 262 lines, no more. Then I wrote the timing in software with those 262 lines per field and...success! No more flickering. According to a real video engineer: "Essentially what you're doing there is by dropping the half line, the TV is *not* scanning in interlaced mode. Basically it's progressive scan." So there you are. Thanks Clay!

External Links




Copyright (c) 2008 Uze, Belogic
The Uzebox (including source code and hardware design) is released under the GNU GPL 3.0 Public Licence.
Pictures and content of this site is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Uzebox is a reserved trademark.