Main Page | See live article | Alphabetical index

Mode 13h

In computing, Mode 13h is a standard 256 colour mode on IBM's VGA graphics hardware. It features a resolution of 320x200 pixels and was used extensively in computer games of its time. Mode 13 provides a straight forward manner of access (called chunky graphics) to video at the expense of several very useful features. Due to its aspect ratio Mode 13h does not have completely square pixels.

Mode 13 is something of a curiosity, because the VGA is from a hardware perspective a planar device, and so completely unsuited to chunky graphics. It was made possible by a hardware trick. In order to understand how Mode 13 was possible, you must understand a little about the VGA's memory layout:

The VGA's 256K of video memory is not directly available to the programmer and is accessed via a 'window' in the PC's memory of 64KB in size. The Video RAM is actually a bank of 4 planes, 64KB each. By manipulating the VGA the programmer can decide how some or all of these 4 planes will be affected by each write or read operation. In 256 colour mode each plane represents a pixel. For example, on the first line of the screen pixels 0, 4, 8, 12 etc are all contained in memory plane 0, while pixels 1, 5, 9, 13 etc. are contained in memory plane 1 and so on. A single byte written to the 64K window therefore can address up to 4 pixels at once.

Mode 13h though allows the programmer to access the VGA in the chunky fashion where every byte represents a single pixel. This is made possible because in Mode 13h the hardware uses the last two bits of the address to select the plane to write to. The upshot is that the programmer has a simple access model, the downside is that three quarters of the video memory is now inaccessible.

Although never documented by IBM, an alternative planar 256 colour mode is available called Mode X