[go: nahoru, domu]

Jump to content

Video Graphics Array

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Pawelkg (talk | contribs) at 11:44, 1 June 2006 (interwiki). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Video Graphics Array (VGA) is an analog computer display standard first marketed in 1987 by IBM. 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 PS/2 models were equipped with VGA on the motherboard. Since from its inception it wasn't restricted to being an add-on board, the name refers to the chip itself.

As with most IBM hardware the VGA was extensively cloned by other manufacturers. While the VGA in its original form has been obsolete for some time, it was the last IBM standard that the majority of manufacturers decided to follow, making it the only standard graphics interface that can be relied on to be present on the PC architecture. VGA was technically superseded by IBM's XGA standard, but in reality it was superseded by the numerous extensions to VGA made by clone manufacturers that came to be known as Super VGA.

VGA remains a relevant graphics standard. It forms the "lowest common denominator" that all PC graphics cards need to support prior to a device-specific driver being loaded. On Windows machines, 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 compared to following screens.

Technical details

The VGA specifications are as follows:

  • 256 KB Video RAM
  • 16-color and 256-color modes
  • 262,144-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
  • 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

  • 640×480 in 16 colors
  • 640×350 in 16 colors
  • 320×200 in 16 colors
  • 320×200 in 256 colors (Mode 13h)

As well as the standard modes, VGA can be configured to emulate many of the modes of its predecessors (EGA, CGA, and MDA).

The term VGA is also often used to refer to a resolution of 640×480, regardless of the hardware that produces the picture. For embedded devices, there now exist QVGA (320×240) and QQVGA (160×120) and 1/8 VGA (240×160) display modes. An XVGA display has 1024 by 768 pixels of 256 colors. IBM refers to this mode as "8514" after the model number of the first IBM monitor capable of displaying this resolution.

VGA is also used to refer to the method of connecting the computer to the monitor (that is, a "VGA cable", as opposed to a DVI cable). The standard cable for VGA is terminated by compact male 15-pin DE-15 D-subminiature connectors at both ends. VGA cables are not limited to carrying VGA-sized images, with resolutions of 1600×1200 and higher possible. Some early VGA adapters used regular DE-9 D-subminiature connectors (of the same type used for EGA, CGA, and MDA) instead of the later standard high density DE-15's.

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 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; also, Mode X allowed the video adapter to assist in copying video RAM regions, which was sometimes faster than if a slow CPU (such as the 8088 or 80286) were to do the same task. Several higher-resolution display modes were possible using this technique, but 320×240 was probably the best known and most-frequently used since it was a typical 4:3 aspect ratio resolution with square pixels.

Another popular feature of Mode X programming was the availability of multiple video pages in hardware used to perform 'page-flipping', also known as double buffering. The official Mode 13h was not capable of double buffering, but it was possible using Mode X. (All of VGA's 16-color modes supported double buffering.)

Due to the highly configurable nature of the VGA, very many Mode X 'tweaked' modes were possible. FRACTINT, a popular fractal display program, utilized several tweaked VGA modes that pushed the VGA to the limit - extended 16-color modes such as 704×528, 736×552, 768×576, and even 800×600 were possible. Other 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 top practical limit being 640×400 which used almost every available byte of VGA's 256 KB video ram).

It should be noted, however, that the refresh/scan rate had to be reduced to accommodate these modes and that they were incompatible with some 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), and 360x480 (highest resolution compatible with standard VGA monitors).

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.

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.

Addressing details

The video memory of the VGA is mapped to the PC's memory via a window in the range between 0xA0000 and 0xC0000 in the PC's real mode address space. Typically these are:

  • 0xB0000 for monochrome text mode
  • 0xB8000 for color text mode and CGA-compatible graphics modes
  • 0xA0000 for EGA/VGA graphics modes

Due to the use of different address mappings for different modes it is possible to have an Monochrome Display Adapter and a color adapter such as the VGA, EGA, or CGA installed in one machine. At the beginning of the 1980s, this was used, for example, to display Lotus 1-2-3 spreadsheets in high-resolution text on a MDA display and associated graphics on a low-resolution CGA display. Later, many programmers used such a setup, with the monochrome card displaying debugging information while a program ran in graphics mode on the other card. Notably, Microsoft's CodeView debugger could work in a dual monitor setup to debug Windows. There were also DOS device drivers, usually named 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 you could include the 0xB000 - 0xB7FF memory space for programs. For example adding the line "DEVICE=EMM386.EXE I=B000-B7FF" would make this memory available to programs that you have loaded high.