Nowiki::group    Graphics::''n''    Escape::color    Keyboard::dr-dos    Cursor::windows    -color::control

Functionality Once loaded, ANSI.SYS enabled code sequences that changed the colors of the cursor and characters on the screen, or enabled software programs to move the cursor up or down lines, enabled blinking text, and similar text graphics features. Using this driver, text could be displayed in 16 different colors ("foreground" colors), with 8 optional background colors. It also allowed for the changing of the video mode from standard 80x25 text mode to a number of different graphics modes (for example, 320x200, 640x200, 40-column text mode) depending on which video graphics card was installed.

An interesting feature about ANSI.SYS was that it allowed for the remapping of any key on the keyboard in order to perform shortcuts or macros for complex instructions. This feature was also used by evildoers to create simple trojans out of text files called "ANSI bombs" laced with nefarious keyboard remaps. A number of antivirus utilities were written to ensure that, for example, the F3 function key wasn't remapped to DEL *.* or FORMAT C: and the N-key (for no) wasn't remapped to Y. As a security measure some versions of ANSI.SYS supported a command line switch to disable the key remapping feature.

ANSI.SYS was relatively slow as it mapped to the BIOS calls. There were several third-party replacements that directly mapped the video memory (similar to how most programs that did full-screen display worked on the IBM PC) that made console io useful. Typically these replacements deliberately did not support the keyboard remapping functions and thus defused the "ANSI bombs".

By default, the internal DOS command CLS works by directly calling the corresponding BIOS function to clear the screen, thereby prominently violating the hardware abstraction model otherwise maintained. However, if an ANSI driver is detected by the DR-DOS COMMAND.COM, it will instead send the control sequence defined in the reserved environment variable $CLS to the attached console device.<ref name="Paul_1997_NWDOSTIP"/> If the environment variable is undefined, it falls back to send the sequence ESC [ 2 J instead.<ref name="Paul_1997_NWDOSTIP"/> Specifying other sequences can be used to control various screen settings after a CLS. Due to the difficulties to define environment variables containing binary data COMMAND.COM also accepts a special \nnn notation for octal numbers.<ref name="Paul_1997_NWDOSTIP"/> For example, to send an alternative control sequence like ESC + (for 1Bh 2Bh as used by ASCII terminals), one could define the variable as follows:

SET $CLS=\033+

These features are supported by COMMAND.COM in all versions of DOS Plus and DR-DOS, but not in MS-DOS or PC DOS. They are also supported by the command interpreters in Concurrent DOS, Multiuser DOS and REAL/32, although they use VT52 rather than ANSI control sequences by default (e.g. ESC E).

ANSI.SYS sections
Intro  Usage  Functionality  Occurrence  Features   Notes    References    See also    External links   

PREVIOUS: UsageNEXT: Occurrence