Video Graphics Array - Programming Tricks

Programming Tricks

An undocumented but popular technique nicknamed Mode X (first coined by Michael Abrash) or "tweaked VGA" was used to make programming techniques and graphics resolutions available that were not otherwise possible in the standard Mode 13h. This was done by "unchaining" the 256 KB VGA memory into four separate "planes", which would make all of VGA's 256 KB of RAM available in 256-color modes. There was a trade-off for extra complexity and performance loss in some types of graphics operations, but this was mitigated by other operations becoming faster in certain situations:

  • Single-color polygon filling could be accelerated due to the ability to set four pixels with a single write to the hardware.
  • The video adapter could assist in copying video RAM regions, which was sometimes faster than doing this with the relatively slow CPU-to-VGA interface.
  • Several higher-resolution display modes were possible: at 16 colors, 704×528, 736×552, 768×576, and even 800×600. Software such as Xlib (a VGA graphics library for C in the early 1990s) and ColoRIX (a 256-color graphics program), also supported tweaked 256-color modes on standard adaptors using many combinations of widths of 256, 320, and 360 pixels, and heights of 200, 240, 256, 400, and 480 lines. However, 320×240 was the best known and most-frequently used, so much so that "Mode X" itself became synonymous with "320x240x8", since it was a typical 4:3 aspect ratio resolution with square pixels.
  • The use of multiple video pages in hardware allowed the programmer to perform double buffering, triple buffering or split screens, which, while available in VGA's 320×200 16-color mode, was not possible using stock Mode 13h.

Sometimes the monitor's vertical refresh rate had to be reduced to accommodate these modes within the very limited horizontal scan-rate range of a standard VGA monitor, increasing eye strain. They were also incompatible with some older monitors, producing display problems such as picture detail disappearing into overscan, flickering, vertical roll, and lack of horizontal sync depending on the mode being attempted. Because of this, most VGA tweaks used in commercial products were limited to "monitor-safe" combinations, such as 320×240 (square pixels, three video pages, 60 Hz), 320×400 (double resolution, two video pages, 70 Hz), and 360×480 (highest resolution compatible with both standard VGA monitors and cards, one video page, 60 Hz). Currently, the highest known tweaked VGA resolution is 400×600×256 (400×600 pixel × 256 colors). It is used in the DOS version of Fractint, a popular fractal generator.

Read more about this topic:  Video Graphics Array

Famous quotes containing the words programming and/or tricks:

    If there is a price to pay for the privilege of spending the early years of child rearing in the driver’s seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.
    Melinda M. Marshall (20th century)

    Such tricks hath strong imagination
    That, if it would but apprehend some joy,
    It comprehends some bringer of that joy;
    Or in the night, imagining some fear,
    How easy is a bush supposed a bear?
    William Shakespeare (1564–1616)