Video Graphics Array
From Wikipedia, the free encyclopedia
- "VGA" redirects here. For the IATA airport code see Tirupati Airport.
Video Graphics Array (VGA) is an analog computer display standard first marketed in 1987 by IBM. It has been technologically outdated in the PC market for some time but in the pocket PC market it is currently becoming the standard. VGA was the most recent graphical standard that the majority of manufacturers conformed to, making it the lowest common denominator that all PC graphics hardware supports before a device-specific driver are loaded into the computer. For example, the Microsoft Windows splash screen appears while the machine is still operating in VGA mode, which is the reason that this screen always appears in reduced resolution and color depth.
The term VGA is often used to refer to a resolution of 640×480, regardless of the hardware that produces the picture. It may also refer to the 15-pin D-subminiature VGA connector which is still widely used to carry analog video signals of all resolutions.
VGA was officially superseded by IBM's XGA standard, but in reality it was superseded by numerous extensions to VGA made by clone manufacturers that came to be known as "Super VGA".
Contents |
[edit] Technical details
VGA is referred to as an "array" instead of an "adapter" because it was implemented from the start as a single chip, replacing the Motorola 6845 and dozens of discrete logic chips covering a full-length ISA board that the MDA, CGA, and EGA used. This also allowed it to be placed directly on a PC's motherboard with a minimum of difficulty (it only required video memory, timing crystals and an external RAMDAC), and the first IBM PS/2 models were equipped with VGA on the motherboard.
The VGA specifications are as follows:
- 256 KiB Video RAM
- 16-color and 256-color modes
- 262144-value color palette (six bits each for red, green, and blue)
- Selectable 25 MHz or 28 MHz master clock
- Maximum of 720 horizontal pixels
- Maximum of 480 lines
- Refresh rates at up to 70 Hz
- Vertical Blanking interrupt (Not all cards support this.)
- Planar mode: up to 16 colors (4 bit planes)
- Packed-pixel mode: 256 colors (Mode 13h)
- Hardware smooth scrolling support
- Some "Raster Ops" support
- Barrel shifter
- Split screen support
- Soft fonts
The VGA supports both All Points Addressable graphics modes, and alphanumeric text modes. Standard graphics modes are
As well as the standard modes, VGA can be configured to emulate many of the modes of its predecessors (EGA, CGA, and MDA).
[edit] Standard text modes
Standard alphanumeric text modes for the VGA use 80×25 or 40×25 text cells. Each cell may choose from one of 16 available colors for its foreground and 8 colors for the background; the 8 background colors allowed are the ones without the high-intensity bit set. Each character may also be made to blink; all that are set to blink will blink in unison. The blinking option for the entire screen can be exchanged for the ability to choose the background color for each cell from among all 16 colors. All of these options are the same as those on the CGA adapter as introduced by IBM.
VGA adapters usually support both a monochrome and a color text mode, though the monochrome mode is almost never used. Black and white text on nearly all modern VGA adapters is drawn by using gray colored text on a black background in color mode. VGA monochrome monitors were sold (intended primarily for text applications), but most of them will work at least adequately with a VGA adapter in color mode. Occasionally a faulty connection between a modern monitor and video card will cause the VGA part of the card to detect the monitor as monochrome, and this will cause the BIOS and initial boot sequence to appear in greyscale. Usually once the video card's drivers are loaded (for example by continuing to boot into the operating system) they will override this detection and the monitor will return to color.
In color text mode, each screen character is actually represented by two bytes. The lower, or character byte is the actual character for the current character set, and the higher, or attribute byte is a bitfield used to select various video attributes such as color, blinking, character set, and so forth. This byte-pair scheme is among the features that VGA inherited ultimately from CGA.
[edit] The VGA colour palette
The VGA colour system is backwards compatible with the EGA and CGA adapters, and adds another level of configuration on top of that. The CGA was able to display up to 16 colours, and the EGA extended this by allowing each of the 16 colours to be chosen from a 64-colour palette (these 64 colours are made up of two bits each for red, green and blue: two bits × three channels = six bits = 64 different values.) The VGA further extends this scheme by increasing the EGA palette from 64 entries to 256 entries, but in order to retain backwards compatibility only 64 entries out of the full 256 can be selected at any one time, in blocks of 64 (i.e. the first 64 entries, or the second 64, etc.) This allows for four complete EGA palettes to be stored in the VGA hardware at the same time, and it is possible to rapidly switch between each of these palettes allowing the colours on the screen to be changed almost instantly.[1]
In addition to the extended 256-entry EGA-style palette, each of the 256 entries can be assigned an arbitrary colour value through the VGA DAC. This changed the purpose of the EGA palette somewhat, as under the EGA it was a method of choosing any possible colour using only two bits per channel, but under the VGA it becomes a simple 64-entry lookup table, whose values can be arbitrarily changed - the entries can easily be changed so they no longer reflect the EGA system where the lower two bits in the index represent the amount of red in the colour.
The VGA scheme used six bits per channel (up from the EGA's two bits per channel) when changing an entry in the palette, providing a total of 63 different intensity levels for red, green and blue, resulting in 262,144 possible colours, any 256 of which could be assigned to the palette (and in turn out of those 256, any 16 of them could be displayed in CGA video modes.)
This method did however allow new VGA colours to be used in EGA and CGA graphics modes, providing one remembered how the different palette systems are layed together - to set the text colour to very dark red in text mode for instance, it will need to be set to one of the CGA colours (for example the default colour #7, light grey.) This colour then maps to one in the EGA palette - in the case of CGA colour 7, it maps to EGA palette entry 42. The VGA DAC must then be configured to change colour 42 to dark red, and then immediately anything displayed on the screen in light-grey (CGA colour 7) will become dark red. This feature was often used in 256-colour VGA DOS games when they first loaded, by smoothly fading out the text screen to black.
While CGA and EGA compatible modes only allowed 16 colours to be displayed at any one time, other VGA modes such as the widely used mode 13h allowed all 256 palette entries to be displayed on the screen at the same time, and so in these modes any 256 colours could be shown out of the 262,144 colours available.
[edit] Addressing details
The video memory of the VGA is mapped to the PC's memory via a window in the range between segments 0xA000 and 0xC000 in the PC's real mode address space. Typically these starting segments are:
- 0xA000 for EGA/VGA graphics modes (64 KiB)
- 0xB000 for monochrome text mode (32 KiB)
- 0xB800 for color text mode and CGA-compatible graphics modes (32 KiB)
Due to the use of different address mappings for different modes, it is possible to have a Monochrome Display Adapter and a color adapter such as the VGA, EGA, or CGA installed in the same machine. At the beginning of the 1980s, this was typically used to display Lotus 1-2-3 spreadsheets in high-resolution text on a MDA display and associated graphics on a low-resolution CGA display simultaneously. Many programmers also used such a setup with the monochrome card displaying debugging information while a program ran in graphics mode on the other card. Several debuggers, like Borland´s Turbo Debugger, D86 (by Alan J. Cox) and Microsoft's CodeView could work in a dual monitor setup. Either Turbo Debugger or CodeView could be used to debug Windows. There were also DOS device drivers such as ox.sys, which implemented a serial interface simulation on the MDA display and, for example, allowed the user to receive crash messages from debugging versions of Windows without using an actual serial terminal. It is also possible to use the "MODE MONO" command at the DOS prompt to redirect the output to the monochrome display. When a Monochrome Display Adapter was not present it was possible to use the 0xB000 - 0xB7FF address space as additional memory for other programs (for example by adding the line "DEVICE=EMM386.EXE I=B000-B7FF" into config.sys, this memory would be made available to programs that can be "loaded high" - loaded into high memory.)
[edit] Programming tricks
An undocumented but popular technique nicknamed Mode X (first coined by Michael Abrash) was used to make available programming techniques and graphics resolutions not possible in the standard Mode 13h. This was done by "unchaining" the 256 KiB VGA memory into four separate "planes", which would make all of VGA's 256 KiB 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 a slow CPU such as the 8088 or 80286.
- Several higher-resolution display modes were possible: at 16 colors, 704×528, 736×552, 768×576, and even 800×600 were possible. 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 using many combinations of columns of 256, 320, and 360 pixels, and rows of 200, 240, 256, 400, and 480 lines (the upper limit being 640×400 which used almost every available byte of VGA's 256 KiB video ram). However, 320×240 was the best known and most-frequently used 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, which, while available in all of VGA's 16-color modes, was not possible using stock Mode 13h.
Sometimes the monitor refresh rate had to be reduced to accommodate these modes, 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×400 (double resolution, two video pages), 320×240 (square pixels, three video pages), and 360x480 (highest resolution compatible with standard VGA monitors, one video page).
[edit] References
- ^ Norton, Peter and Wilton, Richard (1988). The new Peter Norton programmer's guide to the IBM PC and PS/2.
[edit] Further reading
- J. D. Neal (1997). VGA Chipset Reference. Hardware Level VGA and SVGA Video Programming Information Page.
- Jordan Brown and John Kingman (1996-05-06). "CHRP™ VGA Display Device Binding to IEEE 1275-1994 Standard for Boot (Initialization, Configuration) Firmware". 1.0.
Size comparison | |
---|---|
Video hardware | ![]() |
MDA | Hercules | CGA | EGA | VGA | MCGA | 8514 | XGA | |
Display resolutions | |
QQVGA | QVGA | VGA | SVGA | XGA | XGA+ | SXGA | SXGA+ | UXGA | QXGA | QSXGA | QUXGA | HXGA | HSXGA | HUXGA | |
Widescreen variants | |
WXGA | WSXGA/WXGA+ | WSXGA+ | WUXGA | WQXGA | WQSXGA | WHXGA | WHSXGA | WHUXGA | WQUXGA |