Skip to content

JCAP Log #6: Video Part 1

cspang1 edited this page Nov 15, 2017 · 1 revision

Arcade Monitor

Video

Easily the most complex aspect of JCAP, video output is the interface between the arcade game and user enjoyment. When working with tens of thousand of pixels, with multi-bit color depths, you can quickly reach gigabytes of video data that needs to be generated, stored, and processed (just take a look at the amount of video RAM (VRAM) modern graphics cards have). There are of course myriad methods and tricks to reducing the video data footprint, but before investigating those, the fundamental behavior of video itself must be understood.

As described in the previous log, JAMMA boards output video to the harness via a component video RGBS (Red, Green, Blue, and Composite Sync). This output has been often mislabeled as "CGA" or even "EGA", however there are very important differences. To understand why the confusion exists, a brief history lesson is necessary.

CGA/EGA


CGA Board

CGA Display Board

CGA (Color Graphics Adapter) is a color graphics adapter introduced by IBM in 1981, and was in fact the first graphics card for the IBM PC. As a result, it became that computer's first color computer display standard. It quickly spread as a widely supported video output format by most of the major computer manufacturers, even through the 1990s. It featured a digital output (each color was either 1 "on" or 0 "off") and several display modes, ranging from 40x25 text modes to 640x200 2-color modes. This is where the shortfall of the adapter becomes apparent. Due to its limited 16K of video memory, it could only support a limited color resolution, with even the 320x200 mode only supporting 4 colors. It attempted to alleviate this constraint by using a switchable color palette, but the limitation still existed. The output of CGA is considered standard resolution.


CGA Prince of Persia Game Screen

CGA Prince of Persia Game Screen

As you can see from this screenshot of Prince of Persia 1 run in CGA graphics mode, only 4 colors are available: cyan, magenta, black, and white. Other 16 bit palettes existed, and some games even switched between them dynamically during play, however none of them are particularly attractive.

EGA (Enhanced Graphics Adapter), released in 1984, succeeded CGA. It is identical to CGA in terms of its functionality, but differs by supporting greater color and pixel resolutions due to better hardware and faster timing, and is considered to output medium resolution video. Relatively few arcade games used medium resolution, so CGA will be the focus of this discussion.


EGA Prince of Persia Game Screen

EGA Prince of Persia Game Screen

Video Signal Characteristics

CGA adapters use a DE-9 connector with red, green, blue, horizontal sync, and vertical sync signals. The only difference between it and RGBS is the fact that the two sync signals are simply combined into a composite sync for RGBS. The horizontal frequency (the rate at which each line is drawn on the screen) is ~15 kHz, and the vertical frequency (the rate at which an entire screen is drawn) is 60 Hz. Incidentally, JAMMA also outputs a 15 kHz x 60 Hz RGBS signal. The similarities between the signals and timings are the sources of confusion between RGBS and CGA, however the similarities end there.


CGA DE-9 Connector

CGA DE-9 Connector

RGBS is an analogue signal, as opposed to CGA's digital. Discrete voltages between 0 V and .7 V are outputted to each of the RGBS color pins via a digital-to-analog circuit (DAC, which converts binary numbers to analog voltage equivalents) to represent different intensities of each color. Combined, these signals represent RGB colors with a color resolution representative of the bits applied to each color's DAC (for example, classic 8-bit graphics were in the form of RRRGGGBB, so 3 bits for red and green and 2 for blue for a total of 8 bits per pixel). Additionally, the color limitations of 2 bits per pixel (bpp) and 16-bit color palettes do not apply to RGBS. These limitations were symptoms of the adapter's hardware. When talking about RGBS vs. CGA, you're talking about a signal protocol vs. a physical adapter respectively. The only limits to the color resolution via RGBS is what your driving hardware is able to produce.

Resolutions

When it comes to standard arcade game resolutions from the 80s, the horizontal and vertical sync rates come into play. Practically, the maximum vertical resolution you can achieve without interlacing (drawing every other line and switching each vertical sync) is 15.75 kHz / 60 Hz = 262 lines. WITH interlacing, this can be increased to 262 lines * 2 = 524 lines. Unfortunately, this doesn't mean that you can visibly see 262 or 524 lines of image on your monitor. When it comes to monitors rendering images, there is a concept called blanking to take into account.


Progressive vs. Interlaced

Progressive vs. Interlaced Scanning

Blanking (also referred to as blanking interval or retrace) is an almost anachronistic feature that is rooted in the old cathode ray tube monitors. Within these monitors a beam of electrons was deflected back and forth across a phosphor coating on the inside of the screen, causing them to light up with the colors we see. This beam is driven by magnetic coils, and due to the effects of inductive inertia the coils are unable to instantaneously deflect the beam from the end of a line to the beginning of the next, or from the bottom of the screen to the top. During these periods of movement, we have blanking. In modern monitors, this blanking time isn't electrically necessary, however it has remained due to the timing standards it has defined for various video signals as well as the time it provides to generate further video data.


Blanking

Screen Blanking

Within these blanking periods, there are two (again, somewhat anachronistic) events called the front porch and back porch. These are short periods of time before (front porch) and after (back porch) the horizontal and vertical sync pulses where the RGB signals are driven low (i.e. no video). These events were necessary in CRTs because the act of whipping the electron beam from one side of the screen to the other is rather violent, and causes the beam to "wobble". By adding extra blanking lines on the porch, this wobble can be allowed to subside before beginning to draw the actual images. The need for porches has been somewhat removed with the advent of LCDs, which don't have electron guns, however they have remained once again for the standard's sake and are used for positioning the image on the screen instead in many cases.


Anatomy of Screen

Anatomy of Screen with Syncs and Porches

So what is the significance of all this? Well, it turns out a lot of different JAMMA games ran at different vertical resolutions based on the number of blanking lines:

262 lines (192 active + 70 blanking) x 60 Hz = 15.7 kHz (a few games)
262 lines (224 active + 38 blanking) x 60 Hz = 15.7 kHz (most games)
262 lines (240 active + 22 blanking) x 60 Hz = 15.7 kHz (many games)

Based on this information it would appear that the vast majority of 15 kHz arcade monitors in the days of JAMMA required at least between 22 and 38 lines worth of blanking to be able to re-position the electron gun at the top of the screen, and most JAMMA games therefore were designed to be compatible with these monitors.

VGA


JAMMA Board with VGA Output Ports (right)

JAMMA Board with VGA Output Ports (right)

VGA (VideoGraphics Array), proceeded EGA and up until quite recently was the defacto standard for high resolution video (now replaced for the most part by standards such as DVI, HDMI, DisplayPort, and others). It features a ~31 kHz horizontal sync rate, meaning it can display double the vertical resolution of CGA. A typical VGA system can produce displays with any combination of:

512 to 800 pixels wide, in 16 colors (including 640, 704, 720, 736, 768...), or
256 to 400 pixels wide, in 256 colors (including 320, 360, 384...)

with
200, or 350 to 410 vertical lines (including 400-line) at 70 Hz refresh rate, or
224 to 256, or 448 to 512 lines (including 240 or 480-line) at 60 Hz refresh rate
512 to 600 lines at reduced vertical refresh rates (down to 50 Hz, and including e.g. 528, 544, 552, 560, 576-line)

And that's about all that's applicably unique to VGA. It provides a nice range of resolutions at different refresh rates, and more importantly, is extremely easy these days to find supported in a monitor.

Etc.

A couple final notes:

1. Many early games only displayed monochrome graphics, meaning a pixel was only either on or off, one color or the other (usually black and white). This was again a symptom of memory limitations. Today this mode can be taken advantage of to display at larger resolutions than with color graphics, when detail is more important than aesthetics.

2. There is a graphics standard between CGA's (15.75 kHz) "standard" and EGA's (25 kHz) "medium" resolutions: the 16.5 kHz extended resolution. It was virtually never used by arcade games, but now you know.

Conclusion


Various Video Formats

Various Video Formats

For the purposes of JCAP, a 15 kHz RGBS video output via the JAMMA connector is a given. Many classic arcade games such as Pac-Man and Galaga output a 15 kHz 224x288 pixel (in vertical orientation) video signal, so that will likely be the project baseline. Additionally, some flavor of VGA output will also be supported for use when a 15 kHz monitor isn't available. Thankfully, all of these formats and myriad resolutions can be easily generated by the Propeller and its video generators.