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.
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:
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.
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!
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.