Mode X

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

Mode X is an alternative video graphics display mode of the IBM VGA graphics hardware that was popularized by Michael Abrash. 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 (now freely available online).[1]

The primary advantage of Mode X is that it has square pixels: a resolution of 320x240 instead of the standard VGA Mode 13h which is 320x200. 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, 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 320x200 mode, which became informally known as "Mode Y" in the Usenet rec.games.programmer group.[2][3]

The term "Mode X" was coined by Michael Abrash, who called it this in his articles. Though this mode had been used earlier by others[4] (i.e. in many commercial games), it became widely known after Abrash's articles.

Planar memory arrangement splits the pixels horizontally into groups of four. For any given byte in the PC video memory aperture, you can access four pixels on screen, by selecting the plane(s) you require. This is more complicated for the programmer, but the advantages gained by this arrangement were considered very worthwhile by many, and Mode X found considerable use in demos and 2D games.

The main uses of the extra memory are:

  • Higher resolutions: up to 360x480 in 256 colours is possible
  • Double buffering and triple buffering for flicker free animation
  • Smooth hardware scrolling of the video display window
  • Graphics stored in 'off-screen' VRAM can quickly be moved around in VRAM using the VGA latches
  • Planar mode allows up to 4 adjoining pixels to be modified in one byte write operation, which is ideal for solid filling of objects such as polygons, rectangles, lines, etc.
  • Screen splitting, where one part of the display is taken from one area of memory and the other from a different area, which is ideal for status displays in games that utilise smooth hardware scrolling

"Mode Q" ('Q' being short for "cube") is often used to refer to Chain-4 256x256 256 colour mode. [5] [6] This mode's advantage is the simplistic and fast method for addressing pixels in memory based on the X and Y coordinates. 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, shift or lookup being needed like other video modes.

References

  1. Abrash, Michael. Michael Abrash's Graphics Programming Black Book Special Edition. The Coriolis Group, Scottsdale Arizona, 1997. ISBN 1-57610-174-6: PDF available online [1]
  2. Lua error in package.lua at line 80: module 'strict' not found.
  3. Roberts, Dave. PC Game Programming Explorer. The Coriolis Group, Scottsdale Arizona, 1994. ISBN 1-883577-07-1. Page 106.
  4. Abrash, Michael. Michael Abrash's Graphics Programming Black Book Special Edition. The Coriolis Group, Scottsdale Arizona, 1997. ISBN 1-57610-174-6: PDF available online [2] pg. 877
  5. Robert Schmidt. Lua error in package.lua at line 80: module 'strict' not found.
  6. Bas van Gaalen. Lua error in package.lua at line 80: module 'strict' not found.

External links