Hubbry Logo
search
logo

ANSI.SYS

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
ANSI.SYS

ANSI.SYS is a device driver in the DOS family of operating systems that provides extra console functions through ANSI escape sequences. It is partially based upon a subset of the text terminal control standard proposed by the ANSI X3L2 Technical Committee on Codes and Character Sets (the "X3 Committee").

As it was not installed by default, and was notoriously slow, little software took advantage of it and instead resorted to directly manipulating the IBM PC hardware. A number of third-party alternatives that ran at reasonable speed were created, such as ANSI.COM, NANSI.SYS and ANSIPLUS.EXE to attempt to change this.[independent source needed]

To use ANSI.SYS under DOS, a line is added to the CONFIG.SYS (or CONFIG.NT under Windows NT based versions of Windows) file that reads:

where drive: and path are the drive letter and path to the directory in which the file ANSI.SYS is found, and options can be a number of optional switches to control the behaviour. ANSI.SYS may also be loaded into upper memory via DEVICEHIGH/HIDEVICE.

Using this driver, programs that write to the standard output can write escape sequences to make use of the 16 text foreground colors and 8 background colors available in VGA-compatible text mode, make text blink, change the location of the cursor on the screen, and blank the screen. They could also change the video mode from standard 80×25 text mode to a number of different graphics modes (for example, 320×200 graphics mode with text drawn as pixels, though ANSI.SYS is not able to turn individual pixels on and off).

The standard ANSI.SYS is very slow as it maps escape sequences to BIOS calls (which managed to be designed so that two calls were needed to put a character on the screen and move the cursor right). Several companies made third-party replacements such as NANSI.SYS that interface directly with the video memory, in a similar way to most DOS programs that have a full-screen user interface.

COMMAND.COM checked if this driver was in use, and changed the CLS command to use an escape sequence instead of a BIOS call.

An interesting (mis)feature of ANSI.SYS is the ability to remap any key on the keyboard in order to perform shortcuts or macros for complex instructions. Using special escape sequences, the user can define any keystroke that has a character-code mapping to simulate an arbitrary sequence of such keystrokes. This was used to create simple trojans out of text files laced with nefarious keyboard remaps, known as "ANSI bombs". A number of products were released to protect users against this:

See all
User Avatar
No comments yet.