ANSI.SYS is a
device driver in the
DOS
DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems.
DOS may also refer to:
Computing
* Data over signalling (DoS), multiplexing data onto a signalling channel
* Denial-of-service attack (DoS), an attack on a communicat ...
family of
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also i ...
s that provides extra
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 ...
functions through
ANSI escape sequence
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape charac ...
s. It is partially based upon a subset of the
text terminal
A computer terminal is an electronic or electromechanical hardware device that can be used for entering data into, and transcribing data from, a computer or a computing system. The teletype was an example of an early-day hard-copy terminal and ...
control standard proposed by the
ANSI
The American National Standards Institute (ANSI ) is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organi ...
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 ,
and
to attempt to change this.
Usage
To use under DOS, a line is added to the (or under
Windows NT
Windows NT is a proprietary graphical operating system produced by Microsoft, the first version of which was released on July 27, 1993. It is a processor-independent, multiprocessing and multi-user operating system.
The first version of Win ...
based versions of
Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ser ...
) file that reads:
:
DEVICE=''drive:''\''path''\ANSI.SYS ''options''
where ''drive:'' and ''path'' are the
drive letter
In computer data storage, drive letter assignment is the process of assigning alphabetical identifiers to volumes. Unlike the concept of UNIX mount points, where volumes are named and located arbitrarily in a single hierarchical namespace, driv ...
and path to the
directory
Directory may refer to:
* Directory (computing), or folder, a file system structure in which to store computer files
* Directory (OpenVMS command)
* Directory service, a software application for organizing information about a computer network's u ...
in which the file is found, and ''options'' can be a number of optional switches to control the behaviour. may also be loaded into
upper memory
In DOS memory management, the upper memory area (UMA) refers to memory between the addresses of 640 KB and 1024 KB ( 0xA0000–0xFFFFF) in an IBM PC or compatible. IBM reserved the uppermost 384 KB of the 8088 CPU's 1024 KB ...
via /.
* use extended keyboard BIOS functions (
INT 16h) rather than standard ones
* force number of lines
* adjust line scrolling to support screen readers
* or set screensize
* support redefinition of extended key codes independent of standard codes
Functionality
Once loaded, enables code sequences to apply various text formatting features. Using this driver, programs that write to the
standard output
In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
can make use of the 16 text foreground colors and 8 background colors available in
VGA-compatible text mode
VGA text mode was introduced in 1987 by IBM as part of the VGA 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 ...
, make text blink, change the location of the cursor on the screen, and blank the screen. It also allows for the changing of the video mode from standard 80×25
text mode
Text mode is a computer display mode in which content is internally represented on a computer screen in terms of characters rather than individual pixels. Typically, the screen consists of a uniform rectangular grid of ''character cells'', each ...
to a number of different graphics modes (for example, 320×200 graphics mode with text drawn as pixels, though ANSI.SYS does not provide calls to turn individual pixels on and off).
The standard is relatively slow as it maps escape sequences to the equivalent
BIOS calls. Several companies made third-party replacements that interface directly with the
video memory
Dynamic random-access memory (dynamic RAM or DRAM) is a type of random-access semiconductor memory that stores each bit of data in a memory cell, usually consisting of a tiny capacitor and a transistor, both typically based on metal-oxid ...
, in a similar way to most DOS programs that have a full-screen user interface.
By default, the internal DOS command 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 , it will instead send the control sequence defined in the reserved
environment variable
An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs. For example, a running process can query the value of the TEMP envi ...
to the attached console device.
If the environment variable is undefined, it falls back to send the sequence instead.
Specifying other sequences can be used to control various screen settings after a . Due to the difficulties to define environment variables containing binary data COMMAND.COM also accepts a special notation for
octal number
The octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7. This is to say that 10octal represents eight and 100octal represents sixty-four. However, English, like most languages, uses a base-10 number ...
s.
For example, to send an alternative control sequence like (for as used by
ASCII terminal
ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because of ...
s), one could define the variable as follows:
:
SET $CLS=\033+
These features are supported by in all versions of
DOS Plus
DOS Plus (erroneously also known as DOS+) was the first operating system developed by Digital Research's OEM Support Group in Newbury, Berkshire, UK, first released in 1985. DOS Plus 1.0 was based on CP/M-86 Plus combined with the PCMODE ...
and
DR-DOS, but not in MS-DOS or PC DOS. They are also supported by the command interpreters in
Concurrent DOS,
Multiuser DOS
Multiuser DOS is a real-time multi-user multi-tasking operating system for IBM PC-compatible microcomputers.
An evolution of the older Concurrent CP/M-86, Concurrent DOS and Concurrent DOS 386 operating systems, it was originally developed by ...
and
REAL/32
Multiuser DOS is a real-time multi-user multi-tasking operating system for IBM PC-compatible microcomputers.
An evolution of the older Concurrent CP/M-86, Concurrent DOS and Concurrent DOS 386 operating systems, it was originally developed by ...
, although they use
VT52
The VT50 was a CRT-based computer terminal introduced by Digital Equipment Corporation (DEC) in July 1974. It provided a display with 12 rows and 80 columns of upper-case text, and used an expanded set of control characters and forward-only scro ...
rather than ANSI control sequences by default (e.g. ).
Keyboard remapping
An interesting feature of is the ability to remap any key on the
keyboard
Keyboard may refer to:
Text input
* Keyboard, part of a typewriter
* Computer keyboard
** Keyboard layout, the software control of computer keyboards and their mapping
** Keyboard technology, computer keyboard hardware and firmware
Music
* Musi ...
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 feature was also used to create simple
trojan
Trojan or Trojans may refer to:
* Of or from the ancient city of Troy
* Trojan language, the language of the historical Trojans
Arts and entertainment Music
* ''Les Troyens'' ('The Trojans'), an opera by Berlioz, premiered part 1863, part 189 ...
s out of text files laced with nefarious keyboard remaps, known as "ANSI bombs". A number of products were released to protect users against this:
* Some versions of ANSI.SYS support a command line switch to disable the key remapping feature, f.e. the option (Secure) in ANSI.SYS of
Datalight ROM-DOS or NANSI.SYS
of
FreeDOS
FreeDOS (formerly Free-DOS and PD-DOS) is a free software operating system for IBM PC compatible computers. It intends to provide a complete MS-DOS-compatible environment for running legacy software and supporting embedded systems.
FreeDOS can ...
. Other ANSI drivers like ANSIPLUS can be configured to disable the redefinition of keys as well.
* Setting
CONFIG.SYS in
PTS-DOS
PTS-DOS (aka PTS/DOS) is a disk operating system, a DOS clone, developed in Russia by PhysTechSoft and Paragon Technology Systems.
History and versions
PhysTechSoft was formed in 1991 in Moscow, Russia by graduates and members of MIPT, inf ...
provides a built-in ANSI driver not supporting the keyboard remapping functions.
* Some of the third-party ANSI.SYS replacements were deliberately designed never to support the keyboard remapping functions.
*
PKWARE
PKWARE, Inc. is an enterprise data protection software company that provides discovery, classification, masking and encryption solutions, along with data compression software, used by organizations in financial services, manufacturing, militar ...
produced a
TSR program, PKSFANSI (PK Safe ANSI), which filters out keyboard remapping escape codes as they are written to the standard output.
This has the advantage that the user can load some useful remappings from a text file and then run PKSFANSI to prevent further, possibly malicious remappings.
Occurrence
appeared in
MS-DOS 2.0
MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few ope ...
, the first version of the operating system supporting device drivers.
It was supported by all following versions of MS-DOS. It is also present in many non-Microsoft DOS systems, e.g.
IBM PC DOS
IBM PC DOS, an acronym for IBM Personal Computer Disk Operating System, is a discontinued disk operating system for IBM PC compatibles. It was manufactured and sold by IBM from the early 1980s into the 2000s. Developed by Microsoft, it was also ...
and
DR-DOS.
was required to run some software that used its cursor and color control functions.
It could also be used to enable elaborate color codes in the prompt. These uses were overshadowed by the use of in
BBS
BBS may refer to:
Ammunition
* BBs, BB gun metal bullets
* BBs, airsoft gun plastic pellets
Computing and gaming
* Bulletin board system, a computer server users dial into via dial-up or telnet; precursor to the Internet
* BIOS Boot Specificat ...
es; ANSI escape sequences were used to enable BBSes to send
text graphics more elaborate than
ASCII art, and to control the cursor in ways that were used in a number of
online games and similar features.
Most versions of Windows did not support
ANSI escape codes
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape char ...
in any useful way (it could be used by MSDOS emulation in some versions). In
Windows 10
Windows 10 is a major release of Microsoft's Windows NT operating system. It is the direct successor to Windows 8.1, which was released nearly two years earlier. It was released to manufacturing on July 15, 2015, and later to retail on J ...
support for similar escape sequences was built into 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 oc ...
(the text terminal window), but must be activated using the
Windows API
The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
function by setting the flag.
Features
CSI (
Control Sequence Introducer
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape charac ...
) is a placeholder for the common two-byte escape lead-in sequence "" (that is, ).
The ANSI standard also defines an alternative single-byte CSI code , which is not supported by ANSI.SYS.
Standard DOS drivers support only the following sub-set of ANSI escape sequences:
There are also some escape sequences specific to the implementation of . They are not generally supported by ANSI consoles in other operating systems.
In some DOS implementations, video modes above 7 are not documented. Under
Multiuser DOS
Multiuser DOS is a real-time multi-user multi-tasking operating system for IBM PC-compatible microcomputers.
An evolution of the older Concurrent CP/M-86, Concurrent DOS and Concurrent DOS 386 operating systems, it was originally developed by ...
, the only valid argument in conjunction with
PCTERM is 7.
See also
*
ANSI escape sequence
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape charac ...
Notes
References
External links
*
* {{cite web , url=http://www.ansilove.org , title=A set of tools for converting ANSi/BiN/ADF/iDF/TUNDRA/XBiN files into PNG images , author-first=Frederic , author-last=Cambus , date=2017-04-19 , access-date=2017-09-11 , url-status=live , archive-url=https://web.archive.org/web/20170911084034/https://www.ansilove.org/ , archive-date=2017-09-11
DOS drivers
DOS files
DOS technology