Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

ANSI.SYS

From Wikipedia, the free encyclopedia
DOS device driver

ANSI.SYS is adevice driver in theDOS family ofoperating systems that provides extraconsole functions throughANSI escape sequences. It is partially based upon a subset of thetext terminal control standard proposed by theANSI 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 asANSI.COM,[1]NANSI.SYS[2] andANSIPLUS.EXE[3] to attempt to change this.[independent source needed]

Usage

[edit]

To useANSI.SYS under DOS, a line is added to theCONFIG.SYS (orCONFIG.NT underWindows NT based versions ofWindows) file that reads:

DEVICE=drive:\path\ANSI.SYSoptions

wheredrive: andpath are thedrive letter and path to thedirectory in which the fileANSI.SYS is found, andoptions can be a number of optional switches to control the behaviour.ANSI.SYS may also be loaded intoupper memory viaDEVICEHIGH/HIDEVICE.

  • /K use extended keyboard BIOS functions (INT 16h) rather than standard ones[4] This made the F11 and F12 keys work.
  • /L force number of lines
  • /R adjust line scrolling to support screen readers[4]
  • /S or/SCREENSIZE set screensize
  • /X support redefinition of extended key codes independent of standard codes[4]

Functionality

[edit]

Using this driver, programs that write to thestandard output can write escape sequences to make use of the 16 text foreground colors and 8 background colors available inVGA-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×25text 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 standardANSI.SYS is very slow as it maps escape sequences toBIOS calls (which managed to be designed so thattwo calls were needed to put a character on the screen and move the cursor right). Several companies made third-party replacements such asNANSI.SYS[2] that interface directly with thevideo 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 theCLS command to use an escape sequence instead of a BIOS call.[5]

Keyboard remapping

[edit]

An interesting (mis)feature ofANSI.SYS is the ability to remap any key on thekeyboard 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.[6] This was used to create simpletrojans out of text files laced with nefarious keyboard remaps, known as "ANSI bombs". A number of products were released to protect users against this:

  • Many replacements forANSI.SYS support a command line switch to disable the key remapping feature, f.e. the option/S (Secure) inDatalight ROM-DOS[7] or NANSI.SYS[2] ofFreeDOS. Other ANSI drivers like ANSIPLUS can be configured to disable the redefinition of keys as well.[3]
  • Some replacements were deliberately designed never to support the keyboard remapping functions.[8][9]
  • PKWARE produced aterminate-and-stay-resident program, PKSFANSI (PK Safe ANSI), which filters out keyboard remapping escape codes as they are written to the standard output.[10] 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

[edit]

ANSI.SYS appeared inMS-DOS 2.0, the first version of the operating system supporting device drivers.[11] 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 andDR-DOS.[12]

ANSI.SYS was required to run some software that used its cursor and color control functions.[12] It could also be used to enable elaborate color codes in theCOMMAND.COM prompt. These uses were overshadowed by the use ofANSI.SYS inBBSes; ANSI escape sequences were used to enable BBSes to sendtext graphics more elaborate thanASCII art, and to control the cursor in ways that were used in a number ofonline games and similar features.

Most versions of Windows did not supportANSI escape codes in any useful way (it could be used by MSDOS emulation in some versions). InWindows 10 support for similar escape sequences was built into theWin32 console (the text terminal window), but must be activated using theWindows API functionSetConsoleMode by setting theENABLE_VIRTUAL_TERMINAL_PROCESSING flag.[13]

Features

[edit]

CSI (Control Sequence Introducer) is a placeholder for the common two-byte escape lead-in sequence "ESC [" (that is,0x1B 0x5B).[12] The ANSI standard also defines an alternative single-byte CSI code0x9B, which is not supported by ANSI.SYS (this code instead drew a cent sign⟨¢⟩ fromCP437).

Standard DOSANSI.SYS drivers support only the following sub-set of ANSI escape sequences:[12]

SequenceEffect
ESC [r ACursor up (CUU)
ESC [r BCursor down (CUD)
ESC [c CCursor forward (CUF)
ESC [c DCursor back (CUB)
ESC [r;c fHorizontal and vertical position (HVP)
ESC [r;c HCursor position (CUP)
ESC [n JErase display (ED) (n=0, 2 or n=0, 1, 2)[nb 1]
ESC [n KErase in line (EL) (n=0 or n=0, 1, 2)[nb 1]
ESC [n mSelect graphic rendition (SGR) (n=0..47)
ESC [ 6 nDevice status report (DSR) requests cursor position,
returned as cursor position report (CPR):
ESC [r;c R
ESC [ sSave cursor position (SCP)
ESC [ uRestore cursor position (RCP)

There are also some escape sequences specific to the implementation ofANSI.SYS. They are not generally supported by ANSI consoles in other operating systems.

SequenceEffect
ESC [n h
ESC [ ?n h
ESC [ =n h
ESC [ >n h[nb 2]
Setscreen mode (SM)[nb 2]
ESC [n l
ESC [ ?n l
ESC [ =n l
ESC [ >n l[nb 2]
Reset screen mode (RM)[nb 2]
ESC [n qEnable (n=1) or disable (n=0)/X support[nb 3]
ESC [ LInsert line (IL)[nb 4]
ESC [ MDelete line (DL)[nb 4]
ESC $ ) 1Switch keyboard input mode to Korean (Hangul)[nb 5]
ESC ( 2Switch keyboard input mode to English[nb 5]
ESC [ +Enable console output[nb 6]
ESC [ -Disable console output[nb 6]
ESC [a;b;... pSet key re-definement (SKR/KR)
Screen modes
ModeDescriptionModeDescription
040 × 25 monochrome140 × 25 color
280 × 25 monochrome380 × 25 color
4320 × 200 color5320 × 200 monochrome
6640 × 200 monochrome
7Wrap at end of line[nb 7]
13320 x 200 color (graphics)14640 x 200 color (16-color graphics)
15640 x 350 monochrome (2-color graphics)16640 x 350 color (16-color graphics)
17640 x 480 monochrome (2-color graphics)18640 x 480 color (16-color graphics)
19320 x 200 color (256-color graphics)
114640 x 480 color (16-color graphics)[nb 8]115640 x 475 color (16-color graphics)[nb 8]

In some DOS implementations, video modes above 7 are not documented. UnderMultiuser DOS, the only valid argument in conjunction withPCTERM is 7.

See also

[edit]

Notes

[edit]
  1. ^abArguments 0, 1, 2 are only supported and distinguished by Japanese versions ofMS-DOS andPC DOSANSI.SYS. Western issues ofANSI.SYS will not support or not distinguish between them. They are, however, also supported byMultiuser DOS.
  2. ^abcdLead-in prefix '>' is only supported in Japanese versions ofMS-DOS,PC DOS andDR-DOSANSI.SYS to access special Japanese display modes.
  3. ^This non-standard escape sequence is only supported byMS-DOS andPC DOSANSI.SYS. It can be used to enable or disable extended keyboard support at runtime similar to theANSI.SYS/X startup option.
  4. ^abThese non-standard escape sequences to insert and delete lines are only supported by Japanese versions ofMS-DOS andPC DOS. They are also supported by Western issues ofMultiuser DOS, but not by DR-DOS.
  5. ^abThese non-standard escape sequences to switch between the Korean and English keyboard input modes are only supported by Korean versions ofMS-DOS,PC DOS andDR-DOSANSI.SYS.
  6. ^abThese non-standard escape sequences to disable and reenable any output to theCON: device are supported byANSI.SYS ofDR-DOS 7.02 and higher only. They are used to mute the console output during boot, for example in conjunction withDR-WebSpyderboot floppies.
  7. ^A value of 7 is used to either enable (withSM) or disable (withRM) the wrap around at the end of rows. If enabled, the option causes extra characters to wrap onto the next line, while these characters will be lost, if wrapping is disabled.
  8. ^abVideo modes 114 and 115 are only supported by JapaneseDOS/V issues ofANSI.SYS found inDR DOS 6.0,Novell DOS 7 and higher.

References

[edit]
  1. ^Mefford, Michael (1989-02-07)."ANSI.com: Download It Here".PC Magazine. Retrieved2011-08-10.
  2. ^abcKegel, Daniel; Almy, Tom; Auer, Eric (1999-02-28)."NANSI – An Enhanced MS-DOS Console Driver". 4.0. Dan Kegel's Web Hostel.Archived from the original on 2018-05-19. Retrieved2011-08-10.
  3. ^abSweger, Kristofer (2007) [2000]."Configuring ANSIPLUS".Archived from the original on 2018-10-04. Retrieved2018-10-04.
  4. ^abc"Guide to using ANSI.SYS". Archived fromthe original on 2007-06-23. Retrieved2017-09-11.
  5. ^Paul, Matthias R. (1997-07-30) [1994-05-01].NWDOS-TIPs — Tips & Tricks rund um Novell DOS 7, mit Blick auf undokumentierte Details, Bugs und Workarounds. Release 157 (in German) (3 ed.).Archived from the original on 2017-09-10. Retrieved2014-08-06.{{cite book}}:|work= ignored (help) (NB. NWDOSTIP.TXT is a comprehensive work on Novell DOS 7 and OpenDOS 7.01, including the description of many undocumented features and internals. It is part of the author's yet largerMPDOSTIP.ZIP collection maintained up to 2001 and distributed on many sites at the time. The provided link points to a HTML-converted older version of theNWDOSTIP.TXT file.)[1]
  6. ^"ANSI Keyboard codes - ANSI.SYS Key and Extended Key Codes".µVGA - VGA Microcontroller interface. SECONS Ltd. 2012.Archived from the original on 2017-09-11. Retrieved2017-09-11.
  7. ^Datalight, Inc.; GPvNO (April 2005) [1999]."Datalight ROM-DOS User's Guide"(PDF).Datalight, Inc. 3010-0200-0716. Retrieved2018-09-16.
  8. ^"PTS-DOS 2000 Pro User Manual"(PDF). Buggingen, Germany:Paragon Technology GmbH. 1999.Archived(PDF) from the original on 2018-05-12. Retrieved2018-05-12.
  9. ^Günther, Jens; Ernst, Tobias (2004-04-25) [1996]. Ellsässer, Wolfgang (ed.)."Inoffizielle deutschsprachige PTS-DOS-FAQ (PTS/FAQD)" [Unofficial German PTS-DOS FAQ] (in German). Retrieved2018-10-02.
  10. ^Massingill, Michael D. Pearson, Dave (ed.)."PK SAFE ANSI (PKSFANSI.COM)".Archived from the original on 2017-09-11. Retrieved2017-09-11.
  11. ^Field, Tim (November 1983)."Installable Device Drivers for PC DOS 2.0 - Inside the IBM PC".BYTE.8 (11):188–196. Retrieved2016-03-19.
  12. ^abcd"Chapter 9: Configuring the System".Caldera, Inc. 1998. Archived fromthe original on 2017-09-10. Retrieved2017-09-10. (NB. DR-DOS 7 user documentation, description ofANSI.SYS escape sequences (incomplete))
  13. ^"Console Virtual Terminal Sequences".Windows Console. 20 September 2022.

External links

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=ANSI.SYS&oldid=1291899478"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp