Aeon Emulator Blog

October 30, 2009

Planar Video Memory

Filed under: Aeon, Graphics — Greg Divis @ 3:19 pm

In a previous post, I gave a brief overview of the components of a VGA card, but I didn’t talk about the two components that most affect how data flows from the CPU to video RAM. Let’s start with some background information.

In the early days of computing, monochrome displays were pretty common. Video memory for such a simple system could require as little as 1 bit per pixel if only one color intensity is needed. This means that to fit a 1-bit color 320×200 pixel resolution image in video memory, you only needed about 8 KB of dedicated video memory. When the time came to introduce color displays and what would be called the Color Graphics Adapter (CGA), the design would grow from this.

CGA extended the monochrome video model by adding a second “plane” of bits to represent the same pixels as the first, monochrome plane. Now, there are two bits used for each pixel on the screen, and they are used as an index into a 4-color palette. Although two bits are used to form one index, the bits are not contiguous in memory because they are in separate planes.

Eventually, the Enhanced Graphics Adapter (EGA) came along, and another two planes were added. Now, one pixel consists of a 4-bit index with one bit taken from each of the four planes, so 16 simultaneous colors could be displayed.

The Video Graphics Array (VGA) is compatible with EGA and CGA, but adds higher resolution 4-bit video modes and a low-resolution 8-bit video mode, finally making more realistic graphics possible with the ability to show 256 colors at once. On a CGA, EGA, and VGA card the video memory is still planar, and accessing video RAM in 2 or 4-bit color modes is quite a headache as a result. For 8-bit, though, IBM decided to give developers a break and not add another 4 planes; in fact, the default 256-color display mode on VGA hardware sets up some control registers to make video memory for this mode appear linear. For the first time, instead of complex masking and shifting, all you had to do to write an 8-bit pixel to the screen was to calculate its address and write to it:

pixelAddress = 0xA0000 + (y * ScreenWidth) + x

There was a drawback to this 256-color mode, and that’s that it locked you into a low-resolution 320×200 (which has a weird-looking aspect ratio), and did not leave any off-screen video memory available for page-flipping or hardware scrolling. A number of games disabled this linear addressing, placing the card into “unchained 256-color mode.” It added the complexity of dealing with multiple planes again, but allowed a measure of hardware acceleration that was otherwise impossible, and with further tweaking could allow better resolutions.

Aeon currently handles most of the 16 and 256 color standard EGA/VGA resolutions.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: