Display Standards Codexery

Mode X

A 320×240 256-color VGA mode with square pixels and planar memory.

Mode X

Mode X is a 320 × 240 256-color display mode for VGA graphics hardware on IBM PC compatibles. Michael Abrash introduced it in his July 1991 "Ramblings in Realtime" column in Dr. Dobb's Journal, and he coined the name "Mode X." It modifies the standard 320 × 200 Mode 13h by raising the resolution to 320 × 240, which produces square pixels instead of the slightly elongated ones in Mode 13h. To activate it, you enter Mode 13h through a BIOS system call and then adjust several VGA registers.

Abrash also enabled the VGA's planar memory mode, sometimes called "unchained mode." Although planar memory was a documented VGA feature used in earlier commercial games, the Mode X articles gave it wide publicity, leading many programmers to treat Mode X and planar memory as the same thing. In planar memory, pixels are split horizontally into groups of four. For any byte in video memory, four screen pixels can be accessed depending on which planes are enabled. This complicates programming, but the payoff is that all 256 KB of VGA memory can be used for one or more display buffers, rather than just 64 KB.

Variants exist. Enabling planar memory in standard 320 × 200 mode became known as Mode Y on the Usenet group rec.games.programmer. Mode Q (short for "cube") refers to a less common 256-color mode with a 256 × 256 resolution. In that mode, the Y coordinate goes in the high byte of the address and the X coordinate in the low byte, forming a pixel address without a multiply, at the cost of lower horizontal resolution.

Resolution
320 × 240
Color depth
256 colors
First publicized by
Michael Abrash
Publication
Dr. Dobb's Journal, July 1991 'Ramblings in Realtime' column
Based on
Mode 13h (320 × 200)
Memory used
256 KB (all VGA memory)
Alternative name for planar 320x200
Mode Y

Lore & Background

Mode X is enabled by first entering Mode 13h via a BIOS system call, then changing the values of several VGA registers. Michael Abrash additionally enabled the VGA's planar memory mode (also called 'unchained mode'). Although planar memory mode was a documented part of the VGA standard and had been used in earlier commercial games, it was first widely publicized in the Mode X articles, leading many programmers to consider Mode X and planar memory synonymous. The planar memory arrangement splits the pixels horizontally into groups of four; for any given byte in video memory, four pixels on screen can be accessed depending on which plane(s) are enabled. This arrangement is more complicated for the programmer, but the advantages—primarily the ability to use all 256 KB of VGA memory for one or more display buffers, instead of only one quarter of that (64 KB)—were considered worthwhile by many.

Reader's Guide

Mode X's significance lies in its demonstration of how to achieve square pixels and full VGA memory utilization on IBM PC compatibles, a technique that was not widely known before Michael Abrash's articles. By enabling planar memory in a tweaked 320 × 240 mode, programmers could use all 256 KB of VGA memory for display buffers, a fourfold increase over the 64 KB available in standard Mode 13h. This allowed for double-buffering, page flipping, and larger off-screen areas, which were valuable for game and graphics development. The mode also inspired variants: enabling planar memory in standard 320 × 200 mode became known as Mode Y, and a 256 × 256 256-color mode called Mode Q (short for 'cube') was sometimes used, where the Y coordinate could be placed in the high byte of the address and the X coordinate in the low byte, forming the address without a multiply at the expense of lower horizontal resolution. The articles were later reprinted in chapters 47–49 of Abrash's Graphics Programming Black Book, cementing Mode X's legacy as a key reference for VGA programming.

Did You Know?

More in Display Standards 1-24

Spotted an error? Know more?

Reader corrections go straight into our review queue. Suggest an edit · How this site is sourced

Comments

Loading…
Open in the interactive codex →