Mode X

Mode X is an alternative 256-color graphics display mode of the IBM VGA graphics hardware that was popularized by Michael Abrash. The primary advantage of Mode X is that it has square pixels: a resolution of instead of the standard VGA Mode 13h which is. It is enabled by entering Mode 13h via an MS-DOS system call, then adjusting the resolution through VGA registers. It was first published in July 1991 in Dr. Dobb's Journal, and republished in chapters 47-49 of Abrash's Graphics Programming Black Book. The term "Mode X" was coined by Abrash.

Additionally, Abrash enabled the VGA's planar memory mode (also called "unchained mode"). Even though planar memory mode is a documented part of the VGA standard and was 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. It is possible to enable planar memory in standard mode, which became known as Mode Y in the Usenet rec.games.programmer group.

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 is more complicated for the programmer, but the advantages gained by this arrangement&mdash;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)&mdash;were considered worthwhile by many.

Another advantage of the mode is that 3D objects don't need ratio adjustment when they rotate, because each pixel is perfectly square. And circles don't look squeezed at on a monitor with 4:3 aspect ratio in this resolution because mathematically the divisions 320:240 and 4:3 give the same result, which is the reason why the pixels are perfectly square in this mode on such monitors.

Variants
In addition to unchained being called Mode Y, Mode Q (short for "cube") is sometimes used to refer to a  256-color mode. The Y coordinate can simply be put in the high byte of the address, and the X coordinate in the low byte, forming the address of the pixel without a multiply.