HOME

TheInfoList



OR:

VGA text mode was introduced in 1987 by IBM as part of the
VGA Video Graphics Array (VGA) is a video display controller and accompanying de facto graphics standard, first introduced with the IBM PS/2 line of computers in 1987, which became ubiquitous in the PC industry within three years. The term can now ...
standard for its IBM PS/2 computers. Its use on IBM PC compatibles was widespread through the 1990s and persists today for some applications on modern computers. The main features of VGA text mode are colored (programmable 16 color
palette Palette may refer to: * Cosmetic palette, an archaeological form * Palette, another name for a color scheme * Palette (painting), a wooden board used for mixing colors for a painting ** Palette knife, an implement for painting * Palette (company) ...
) characters and their background, blinking, various shapes of the
cursor Cursor may refer to: * Cursor (user interface), an indicator used to show the current position for user interaction on a computer monitor or other display device * Cursor (databases), a control structure that enables traversal over the records in ...
(block/underline/hidden static/blinking), and loadable fonts (with various glyph sizes). The
Linux console The Linux console is a system console internal to the Linux kernel. A system console is the device which receives all kernel messages and warnings and which allows logins in single user mode. The Linux console provides a way for the kernel and ...
traditionally uses hardware VGA text modes, and the
Win32 console Windows Console is the infrastructure for console applications in Microsoft Windows. An instance of a Windows Console has a screen buffer and an input buffer. It allows console apps to run inside a window or in hardware text mode (so as to occ ...
environment has an ability to switch the screen to text mode for some text window sizes.


Data arrangement


Text buffer

Each screen character is represented by two
bytes The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable uni ...
aligned as a 16-bit word accessible by the CPU in a single operation. The lower, or character, byte is the actual code point for the current character set, and the higher, or attribute, byte is a
bit field A bit field is a data structure that consists of one or more adjacent bits which have been allocated for specific purposes, so that any single bit or group of bits within the structure can be set or inspected. A bit field is most commonly used to r ...
used to select various video attributes such as color, blinking, character set, and so forth. This byte-pair scheme is among the features that the VGA inherited from the EGA, CGA, and ultimately from the MDA. # Depending on the mode setup, attribute bit 7 may be either the blink bit or the fourth background color bit (which allows all 16 colors to be used as background colours). # Attribute bit 3 (foreground intensity) also selects between fonts A and B (see
below Below may refer to: *Earth * Ground (disambiguation) *Soil *Floor * Bottom (disambiguation) *Less than *Temperatures below freezing *Hell or underworld People with the surname *Ernst von Below (1863–1955), German World War I general *Fred Below ...
). Therefore, if these fonts are not the same, this bit is simultaneously an additional code point bit. # Attribute bit 0 also enables underline, if certain other attribute bits are set to zero (see
below Below may refer to: *Earth * Ground (disambiguation) *Soil *Floor * Bottom (disambiguation) *Less than *Temperatures below freezing *Hell or underworld People with the surname *Ernst von Below (1863–1955), German World War I general *Fred Below ...
). Colors are assigned in the same way as in 4-bit indexed color graphic modes (see VGA color palette). VGA modes have no need for the MDA's reverse and bright attributes because foreground and background colors can be set explicitly.


Underline

The VGA hardware has the ability to enable an underline on any character that has attribute bit 0 set. However, since this is an MDA-compatible feature, the attribute bits not used by the MDA must be set to zero or the underline will not be shown. This means that only bits 3 (intensity) and 7 (blink) can be set concurrently with bit 0 (underline). "Table 6. Sample cursor shapes, Base video port address, Internal mode bits, Screen attribute bit 7 role, Byte for internal mode register at port 3D8h (CGA), 3B8h (MDA) and virtual (EGA/VGA)" With the default VGA palette, setting bit 0 to enable underline will also change the text colour to blue. This means text in only two colors can be underlined (5555FF and 0000AA with the default palette). Despite all this, the underline is not normally visible in color modes, as the location of the underline defaults to a scanline below the character glyph, rendering it invisible. If the underline location is set to a visible scanline (as it is by default when switching to an MDA-compatible monochrome text mode), then the underline will appear.


Fonts

Screen fonts used in EGA and VGA are
monospace A monospaced font, also called a fixed-pitch, fixed-width, or non-proportional font, is a font whose letters and characters each occupy the same amount of horizontal space. This contrasts with variable-width fonts, where the letters and spaci ...
raster fonts containing 256 glyphs. All glyphs in a font are the same size, but this size can be changed. Typically, glyphs are 8 dots wide and 8–16 dots high, however the height can be any value up to a maximum of 32. Each row of a glyph is coded in an 8-bit byte, with high bits to the left of the glyph and low bits to the right. Along with several hardware-dependent fonts stored in the adapter's
ROM Rom, or ROM may refer to: Biomechanics and medicine * Risk of mortality, a medical classification to estimate the likelihood of death for a patient * Rupture of membranes, a term used during pregnancy to describe a rupture of the amniotic sac * R ...
, the text mode offers 8 loadable fonts. Two active font pointers (font A and font B) select two of the available fonts, although they usually point to the same font. When they each point to different fonts, attribute bit 3 (see above) acts as a font selection bit instead of as a foreground color bit. On real VGA hardware, this overrides the bit's use for color selection, but on many clones and emulators, the color selection remains — meaning one font is displayed as normal intensity, and the other as high-intensity. This error can be overcome by changing the palette registers to contain two copies of an 8-color palette. There are modes with a character box width of 9 dots (e.g. the default 80×25 mode), however the 9th column is used for spacing between characters, so the content cannot be changed. It is always blank, and drawn with the current background colour. An exception to this is in ''Line Graphics Enable'' mode, which causes code points 0xC0 to 0xDF inclusive to have the 8th column repeated as the 9th. These code points cover those
box-drawing character Box-drawing characters, also known as line-drawing characters, are a form of semigraphics widely used in text user interfaces to draw various geometric frames and boxes. Box-drawing characters typically only work well with monospaced fonts. In ...
s which must extend all the way to the right side of the glyph box. For this reason, placing letter-like characters in code points 0xC0–0xDF should be avoided. The box-drawing characters from 0xB0 to 0xBF are not extended, as they do not point to the right and so do not require extending.


Cursor

The shape of the cursor is restricted to a rectangle the full width of the character box, and filled with the foreground color of the character at the cursor's current location. Its height and position may be set to anywhere within a character box;. The EGA and many VGA clones allowed a split-box cursor (appearing as two rectangles, one at the top of the character box and one at the bottom), by setting the end of the cursor before the start, however if this is done on the original VGA, the cursor is completely hidden instead. The VGA standard does not provide a way to alter the blink rate, although common workarounds involve hiding the cursor and using a normal character glyph to provide a so-called software cursor. A mouse cursor in TUI (when implemented) is not usually the same thing as a hardware cursor, but a moving rectangle with altered background or a special glyph. Some text-based interfaces, such as that of
Impulse Tracker Impulse Tracker is a multi-track music tracker (music sequencer). Originally released in 1995 by Jeffrey Lim as freeware with commercial extensions, it was one of the last tracker programs for the DOS platform. In 2014, on its 20th anniversary, ...
, went to even greater lengths to provide a smoother and more graphic-looking mouse cursor. This was done by constantly re-generating character glyphs in real-time according to the cursor's on-screen position.


Access methods

There are generally two ways to access VGA text-mode for an application: through the Video BIOS interface or by directly accessing video RAM and I/O ports. The latter method is considerably faster, and allows quick reading of the text buffer, for which reason it is preferred for advanced TUI programs. The VGA text buffer is located at physical memory address 0xB8000. Since this address is usually used by
16-bit 16-bit microcomputers are microcomputers that use 16-bit microprocessors. A 16-bit register can store 216 different values. The range of integer values that can be stored in 16 bits depends on the integer representation used. With the two mos ...
x86 processes operating in real-mode, it is also the first half of memory segment 0xB800. The text buffer data can be read and written, and
bitwise operation In computer programming, a bitwise operation operates on a bit string, a bit array or a binary numeral (considered as a bit string) at the level of its individual bits. It is a fast and simple action, basic to the higher-level arithmetic oper ...
s can be applied. A part of text buffer memory above the scope of the current mode is accessible, but is not shown. The same physical addresses are used in
protected mode In computing, protected mode, also called protected virtual address mode, is an operational mode of x86-compatible central processing units (CPUs). It allows system software to use features such as virtual memory, paging and safe multi-tasking ...
. Applications may either have this part of memory mapped to their
address space In computing, an address space defines a range of discrete addresses, each of which may correspond to a network host, peripheral device, disk sector, a memory cell or other logical or physical entity. For software programs to save and retrieve s ...
or access it via the operating system. When an application (on a modern multitasking OS) does not have control over the
console Console may refer to: Computing and video games * System console, a physical device to operate a computer ** Virtual console, a user interface for multiple computer consoles on one device ** Command-line interface, a method of interacting with ...
, it accesses a part of system RAM instead of the actual text buffer. For computers in the 1980s, very fast manipulation of the text buffer, with the hardware generating the individual pixels as fast as they could be displayed, was extremely useful for a fast UI. Even on relatively modern hardware, the overhead of text mode emulation via hardware APA (graphics) modes (in which the program generates individual pixels and stores them into the video buffer) may be noticeable.


Modes and timings


Video signal

From the monitor's side, there is no difference in input signal in a text mode and an
All Points Addressable A dot matrix is a 2-dimensional patterned array, used to represent characters, symbols and images. Most types of modern technology use dot matrices for display of information, including mobile phones, televisions, and printers. The system is al ...
(APA) mode of the same size. A text mode signal may have the same timings as
VESA VESA (), formally known as Video Electronics Standards Association, is an American technical standards organization for computer display standards. The organization was incorporated in California in July 1989To retrieve the information, searc ...
standard modes. The same registers are used on adapter's side to set up these parameters in a text mode as in APA modes. The text mode output signal is essentially the same as in graphic modes, but its source is a text buffer and character generator, not a framebuffer as in APA.


PC common text modes

Depending on the graphics adapter used, a variety of text modes are available on IBM PC compatible computers. They are listed on the table below: VGA and compatible cards support MDA, CGA and EGA modes. All colored modes have the same design of text attributes. MDA modes have some specific features (see above) — a text could be emphasized with bright, underline, reverse and blinking attributes. The most common text mode used in DOS environments and initial Windows consoles is the default 80 columns by 25 rows, or ''80×25'', with 16 colors and 8×16 pixels large characters. VGA cards always have a built-in font of this size whereas other sizes may require downloading a differently sized font. This mode was available on practically all IBM and compatible personal computers. Linux kernel 2.6 and later assumes modes ''from 0000h to 00FFh'' as standard (hexadecimal), if VGA BIOS supports, and it understands them as increased by 0x0100. Same for VESA BIOS modes ''from 0100h to 07FFh'' (Linux increases them by 0x0100). Modes ''from 0900h to 09FFh'' are Video7 special modes, (Usually 0940h=80×43, 0941h=132×25, 0942h=132×44, 0943h=80×60, 0944h=100×60, 0945h=132×28 for the standard Video7 BIOS).Official Linux documentation. 1995-1999 Martin Mares. Video Mode Selection Support
/ref> Linux 2.x allows to check supported video resolutions by kernel argument "vga=ask" or "vga=". Later versions of Linux allow specifying resolution by modes ''from 1000h to 7FFFh''. The code has a "0xHHWW" form where HH is a number of rows and WW is a number of columns. E.g., 1950h (0x1950) corresponds to a 80×25 mode, 2B84h (0x2b84) to ''132×43'' etc. (Linux 3.x and later allows to set resolution by "video=:x", but it is for video framebuffer graphical mode.) Two other VGA text modes, ''80×40'' and ''80×50'', exist but are less common.
Windows NT 4.0 Windows NT 4.0 is a major release of the Windows NT operating system developed by Microsoft and oriented towards businesses. It is the direct successor to Windows NT 3.51, which was released to manufacturing on July 31, 1996, and then to retail ...
displayed its system messages during the boot process in 80×50 text mode. Character sizes and graphical resolutions for the extended
VESA VESA (), formally known as Video Electronics Standards Association, is an American technical standards organization for computer display standards. The organization was incorporated in California in July 1989To retrieve the information, searc ...
-compatible Super VGA text modes are ''manufacturer's dependent''. Some cards (e.g. S3) supported custom very large text modes, like 132×43 and 132×25. Like as in graphic modes, graphic adapters of 2000s commonly are capable to set up an arbitrarily-sized text mode (in reasonable limits) instead of choosing its parameters from some list.


SVGATextMode

On Linux and DOS systems with so named SVGA cards, a program called SVGATextMode can be used to set up better looking text modes than EGA and VGA standard ones. This is particularly useful for
large Large means of great size. Large may also refer to: Mathematics * Arbitrarily large, a phrase in mathematics * Large cardinal, a property of certain transfinite numbers * Large category, a category with a proper class of objects and morphisms ...
(≥ 17") monitors, where the normal 80×25 VGA text mode's 720×400 pixel resolution is far lower than a typical graphics mode would be. SVGATextMode allows setting of the
pixel clock In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device. In most digital display devices, pixels are the sma ...
and higher
refresh rate The refresh rate (or "vertical refresh rate", "vertical scan rate", terminology originating with the cathode ray tubes) is the number of times per second that a raster-based display device displays a new image. This is independent from frame rate ...
, larger font size, cursor size, etc., and allows a better use of the potential of a video card and monitor. In non-Windows systems, the use of SVGATextMode (or alternative options such as the Linux framebuffer) to obtain a sharp text is critical for
LCD monitor A thin-film-transistor liquid-crystal display (TFT LCD) is a variant of a liquid-crystal display that uses thin-film-transistor technology to improve image qualities such as addressability and contrast. A TFT LCD is an active matrix LCD, in cont ...
s of 1280×1024 (or higher resolution) because none of so named standard text modes fits to this matrix size. SVGATextMode also allows a fine tuning of video signal timings. Despite the name of this program, only a few of its supported modes conform to SVGA (i.e. VESA) standards.


General restrictions

VGA text mode has some hardware-imposed limitations. Because these are too restrictive for modern (post 2000) applications, the hardware text mode on VGA compatible video adapters only has a limited use. * 8 colors may be used by font A and other 8 colors by font B; so, if font A ≠ font B (512 characters mode), then the palette should be halved and a text may effectively use only 8 colors.
** Normally, first 8 colors of the same palette. If blink is disabled, then all 16 colors are available for background.


See also

* General article about '' text mode'' of computer display


References

{{DEFAULTSORT:Vga Compatible Text Mode Text user interface IBM PC compatibles DOS on IBM PC compatibles