kristofer sweger Home
ANSIPLUS Home


Display Mode and Character Set

Esc [#;#h  Set Video Mode
Esc [#;#l  Reset Video Mode

The screen display mode is selected by the Esc [h control sequence. Any parameter supplied to Esc [h (except for the value 7) is taken to be a display mode byte, which is passed along to the ROM BIOS Int 10h/AH=0 Set Mode function as CPU Register AL.

As in the DOS ANSI.sys driver, the value 7 is used to control line wrapping. The Esc [7l (that’s lower case " L ") control sequence resets line wrapping, causing characters output past the end of a line to be ignored. Esc [7h allows line wrapping, so characters output past the end of a line will be placed on the next line. If you want to select display mode 7 (monochrome text), however, ANSIPLUS gives you a way: just include an exclamation point after the left bracket. So, for example,

Esc [3h would set the display mode to 80x25 color text,
Esc [18h would set the display mode to 640x480 VGA 16 color graphics (Note that because ANSI control sequence parameters are all specified as decimal numbers, mode 18 decimal is the same as mode 12 in hexadecimal.),
Esc [7h enables line wrapping, and
Esc [!7h selects 80x25 monochrome text.

For VESA Super VGA video controllers, mode values of 256 or more are assumed to be VESA modes, and a VESA set mode call will be issued. For certain EGA compatible boards, values in either the full AX register or in both AX and BX are required to select extended display modes. For such boards, the ANSIPLUS driver lets the user specify a full AX value as the first parameter, and BX as a second parameter.

Because ANSIPLUS merely passes video display mode selectors through to the video controller, video display modes that are not part of the VGA or VESA standards will require different parameters for selection, depending on the type of video controller being used. The table to the right gives examples that all select 800x600 16 color graphics mode for different "legacy" video controllers. Consult the documentation for your VGA or EGA to find allowable video modes for your system.

Mode Codes Vary for
Older Video Controllers
Escape Sequence Controller
Esc [28421;98h Vega V7
Esc [88h Paradise VGA
Esc [121h Genoa EGA600
Esc [41h Tseng 4000
Esc [258h VESA

Esc [!#;#t  Select Character Set Height

ANSIPLUS controls VGA/EGA character height with the Esc [!t control sequence. Any of the nine heights from 8 to 16 scan lines may be selected. In 80 column text modes on a standard VGA, text heights from 8 through 16 scan lines will give 50, 44, 40, 36, 33, 30, 28, 26 or 25 lines of text, respectively.

VGA and SVGA controllers have built-in character fonts for 8, 14 and 16 scan lines. EGA supports only 8 and 14 (so on an EGA, requests of 15 or 16 are reduced to 14). Other heights (9-13 and 15) are supported by ANSIPLUS in text modes and 16-color graphics modes by automatically adjusting one of the built-in fonts to the requested height. When running in a text mode window under Windows 3.1, the direct VGA/EGA port access that this special adjustment requires may cause some Windows video drivers (eg., Tseng ET-4000 256-color) to freeze the application until it is switched to full screen by Alt+Enter. Other drivers (eg., Diamond Stealth 64) can handle both full screen and windowed font adjustment with no complaint.

In text modes, changing the character height causes the video mode to be re-initialized (which clears the screen), because all characters in a text mode must be the same size. If the ANSIPLUS driver has been configured either to use EMS for scroll-back or to use XMS or HMA memory to preserve scroll-back data during display mode changes, the driver will preserve the screen contents and cursor location when the text height is changed; otherwise, the text on the screen will be lost. If a second parameter is supplied, the character set is installed in the VGA/EGA character table selected by that parameter, and the screen mode is not re-initialized first. Use this second option only when changing the character set selection, but keeping the same character height.

In VGA/EGA graphics modes, characters of multiple sizes can coexist on the screen, so changing the character height leaves the screen contents intact. The new character set is installed as the current character set, and the total number of text lines is recomputed. The screen is not cleared, and the cursor is placed as close on the screen to its former position as possible under the new line size.

For example, the following character selection sequences are recognized:

Esc [!16t Select 16 high, standard VGA characters (25 line mode).
Esc [!12t Select 12 high characters (33 line mode).
Esc [!16;3t Select 16 high using character table 3.
Esc [!8t Select 8 high CGA characters (43/50 line mode).

Esc [!#;...#e  Select graphics mode text treatment options

Several text treatments are controlled with the ANSIPLUS Esc [!e control sequence:

Esc [!0e Disables (resets) all the following text treatment options
Esc [!1e Enables bold characters
Esc [!2e Enables slanted characters (italics)
Esc [!3e Enables black shadows on characters
Esc [!4e Enables underlining
Esc [!5e Enables blinking
Esc [!6e Enables black outlines on characters
Esc [!7e Enables reverse video

Any combination of text treatments may be in force simultaneously, except that if both outline and shadow are requested, outline will be used. The slant (italics) treatment is not performed on character codes 0B0h through 0DFh (the block graphic characters), or on codes 01h and 02h (the "happy faces"), because distorting these characters destroys their appearance, and thus their utility. All other treatments are performed for all character codes.

Slanted, black shadow, black outline and underline operate in 16-color VGA/EGA graphics modes only. In text modes, bold characters are given a high intensity foreground, and blinking is visible only if blinking is enabled (i.e., 8 background colors instead of 16) on the VGA/EGA.

Esc (0  Select VT100 Graphics for Character Set G0
Esc )0  Select VT100 Graphics for Character Set G1

VT100 graphics character emulation is enabled for character sets "G0" and "G1" by the Esc (0 and Esc )0 escape sequences. The graphics character set is turned off by issuing the Esc ( or Esc ) escape sequence with any other character than "0" (that’s "zero"). When either G0 or G1 has graphics enabled, you can switch back and forth between the G0 set and the G1 set with the SO character (code 14 decimal) to select G1, and the SI character (code 15 decimal) to select G0.

© Copyright 2000-2007, Kristofer Sweger. All rights reserved.
Rev. 10/17/07