Text mode

From Wikipedia, the free encyclopedia

Text mode is a kind of computer display mode in which the content of the screen is internally represented in terms of textual characters rather than individual pixels. Typically, the screen consists of a uniform grid of character cells, each of which contains one of the characters of the character set.

Text mode video rendering came to prominence in the early 1970s, when video-oriented text terminals started to replace teleprinters in the interactive use of computers.

Text mode applications communicate with the user with command-line interfaces and text user interfaces. Many character sets used in text mode applications also contain a limited set of predefined semi-graphical characters usable for drawing boxes and other rudimentary graphics which can be used to highlight the content or to simulate widget or control interface objects found in GUI programs.

The advantages of text modes compared to graphics modes include lower memory consumption and faster screen manipulation. Also, text mode applications have relatively low bandwidth requirements in remote terminal use. An obvious disadvantage of text mode is the restricted screen content, which makes text mode impractical for many types of applications.

An important characteristic of text mode programs is that they assume constant width fonts, where every character has the same width on screen, which allows to easily maintain the vertical alignment when displaying semi-graphical characters.

Depending on the environment, the screen buffer can be directly addressable. Programs that display output on remote video terminals must issue special control sequences to manipulate the screen buffer. The most popular standards for such control sequences are ANSI and VT100.

Programs accessing the screen buffer through control sequences may lose synchronization with the actual display, and so many text mode programs have a redisplay everything command, often associated with the Ctrl-L key combination.

The border between text mode and graphical programs can sometimes be fuzzy, especially on the PC's VGA hardware, because many later text mode programs tried to push the model to the extreme by playing with the video controller. For example, they redefined the character set in order to create custom semi-graphical characters, or even created the appearance of a graphical mouse by redefining the appearance of the characters over which the mouse was shown at a given time.

Text mode rendering with user-defined characters has also been useful for 2D computer and video games because the game screen can be manipulated much faster than with pixel-oriented rendering.

Many modern programs with a graphical interface simulate the display style of text mode programs, notably when it is important to preserve the vertical alignment of text, e.g., during computer programming.  There exist also software components to emulate text mode, such as terminal emulators or Win32 consoles.

[edit] Technical basis

A video controller implementing a text mode usually uses two distinct areas of memory: a character memory containing the pixel structure of each character of the font in use, and a display matrix or screen buffer containing the matrix of the characters of the screen, with indices to the character memory.

The character memory usually resides in a read-only memory by default. However, many systems also allow the use of RAM for this purpose, making it possible to redefine the character set for application-specific purposes. The use of RAM-based characters also facilitates some special techniques, such as the implementation of a pixel-graphics framebuffer. In some historical graphics chips, including the TMS9918 and the MOS Technology VIC, this was actually the canonical way of doing pixel graphics.

Text modes often assign attributes to the displayed characters. For example, the VT100 terminal allows each character to be underlined, brightened, blinking or inverse. Color-supporting devices usually allow the color of each character, and often the background color as well, to be selected from a limited palette of colors. These attributes can either coexist with the character indices or use a different memory area called color memory or attribute memory.

Some text mode implementations also have the concept of line attributes. For example, the VT100-compatible line of text terminals supports the doubling of the width and height of the characters on individual text lines.

[edit] 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:

Text res. Char. size Graphics res. Colors Adapters
80×25 9×14 720×350 B&W Text MDA
40×25 8×8 320×200 16 colors CGA, EGA
80×25 8×8 640×200 16 colors CGA, EGA
80×25 8×14 640×350 16 colors EGA
80×43 8×8 640×350 16 colors EGA
80×25 9×16 720×400 16 colors VGA
80×50 9×8 720×400 16 colors VGA

MDA text could be emphasized with bright, underline, reverse and blinking attributes.

Video cards in general are backward compatible, i.e. EGA supports all MDA and CGA modes, VGA supports MDA, CGA and EGA modes.

By far 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. This mode was available on practically all IBM and compatible personal computers. All 80×25 modes also had a virtual 80×24 mode, used by some applications that needed a status bar on the last row, like terminal emulators. In reality, it was the same 80×25 mode, but restrained by software to make the last row unaccesible.

Two other VGA text modes, 90×43 and 90×50, but were very rarely used. The 40 column text modes were never very popular, and were used only for demonstration purposes or with very old hardware.

Some cards (e.g. S3) supported very large text modes, like 100×37 or even 160×120. In Linux systems, a program called SVGATextMode was often used with SVGA cards to set up very large console text modes.

[edit] See also

In other languages