The ANSI.sys

Printer Friendly Page

- - Back Home - -

Site Directory

PC Protection
Ascii/ISO Codes
Beep Codes
Bootdisk Info
Old Boots Info
Colors Chart
Dos Interlink
Dos Overview
Download Section
Fun Photos
Grain Elevator
GUI's
History
Items for Sale
Links
PCXT Photos
Quotes
°C/°R/°K/°F Charts
TRS80 Stuff
UTC Time

Credits

Valid CSS!



More ANSI Esc Sequences

Other ANSI codes are available, but it takes some programming knowledge to use them. A few are listed here, in case you're interested. The # signs are to be replaced with the indicated parameters.


$e[#;#H moves cursor to line #, column#

$e[#A     moves cursor up # line(s)

$e[#B      moves cursor down # line(s)

$e[#C      moves cursor forward # column(s)

$e[#D      moves cursor backwards # column(s)

$e[2J        clears the screen

$e[k    erases to the end of the line

$e[s     saves current cursor position

$e[u     goes back to the "saved" cursor position

DOS has only limited capabilities when it comes to displaying text on the screen. The dialog between you and DOS is on a line to line basis.

Under the ANSI system, positioning the cursor, setting the text colors and other functions are performed by sending a series of  Ascii  characters. For example, escape ($e (ASCII 27), followed by [31m means, "Change the foreground color to red". Escape followed by [1m means, "Turn bold on".  Subsequent characters will be highlighted as they are typed. Escape plus [5;8f means, "Move the cursor to line 5, row 8" on the screen.

These ANSI commands all start with 2 characters, $e (the code for escape) and [ . When displaying data, a system that is ANSI compatible "watches" for these 2 characters, because the characters that follow them give information about what is actually to be done.

Installing the ANSI system

To make your system ANSI compatible, you must install the ANSI.SYS.  With ANSI.SYS in the DOSMISC directory, add the command:   device=dosmisc\ansi.sys .  (In the Windows GUI version, it will be found in either c:\windows\system or c:\windows\command), add this line to your Windows CONFIG.SYS file:  device=d:\x\ansi.sys ("d" being the drive and "x" being the directory(ies) where the ANSI.SYS file was found).

DOS will install ANSI.SYS each time you boot. ANSI.SYS enlarges DOS by about 5000 bytes, occupying that much more memory. If you are short on memory, you may need to remove ANSI.SYS when running programs that need the extra space. You can do this by editing the CONFIG.SYS and adding "rem" (sans quotes) in front of the ANSI.SYS command line or https://florafox.com/au/perth, (rem device=d:\x\ansi.sys).

To change your DOS prompt, edit your autoexec.bat file with the command:prompt=$e[1;40;33m$p ...  this will give you: "C:\ ..." , (sans quotes), the display will be a bold yellow.

Setting Colors with Batch files.

The escape sequences are difficult to remember. You might want to make special batch files to set your favorite colors. This one changes the color to white on blue whenever you type blue .

At the C:\ prompt, type:

copy con blue.bat  (press Enter

type:  $e[44;37m  (press  Enter)

type:  CTRL + Z  (press  Enter)

Note that there is no  echo off statement in this batch file. If echo was off , the prompt wouldn't be displayed and the ANSI driver wouldn't get the message to change the color.

Note: Trying to create the above batch file in the Windows XP Home Edition DOS enviroment, you will receive the error message:  "'$e[44;37m' is not recognized as an internal or external command, operable program or batch file".