Command: nansi.sys
NANSI.SYS is a console enhancing driver. FreeDOS uses NANSI.SYS
instead of ANSI.SYS.
NANSI.SYS has to be loaded in CONFIG.SYS / FDCONFIG.SYS
When FreeDOS is already running, you can load NANSI.SYS later
with DEVLOAD.
Syntax:
General syntax description:
DEVICE[HIGH]=[drive:][path]NANSI.SYS [/K] [/C] [/X] [/S] [/Tnn] [/R]
[/B|/Q] [/P]
DEVLOAD [drive:][path]NANSI.SYS [/K] [/C] [/X] [/S] [/Tnn] [/R]
[/B|/Q] [/P]
Options:
/K Force 84 key keyboard style.
/X Extended key definitions.
/S Safe mode - no key redefinitions.
/Tnn Mode nn is a text mode.
/R Use BIOS (for some screen readers).
/B Use BIOS for bell sound (beep).
/Q Use no bell sound at all (quiet, no beep).
/P Pass all unknown requests to CON.
/C Force 101+ key keyboard style.
/? Shows the help.
Comments:
Quick instruction:
ESC[#;#H (where # means value 1) is typed: $e[1;1H, means ESC is $e
Slow instruction:
While putting text up on the screen, NANSI.SYS keeps a lookout for the
escape character (chr(27), known as ESC); this character signals the
start of a terminal control sequence. Terminal control sequences fol-
low the format
ESC [ param; param; ...; param cmd
where
ESC is the escape character chr$(27).
[ is the left bracket character.
param is an ASCII decimal number, or a string in quotes.
cmd is a case-specific letter identifying the command.
Usually, zero, one, or two parameters are given. If parameters are
omitted, they usually default to 1; however, some commands (KKR) treat
the no-parameter case specially. Spaces are not allowed between
parameters.
For example, both ESC[1;1H and ESC[H send the cursor to the home posi-
tion (1,1), which is the upper left.
In general, if you ask the cursor to go beyond the edge of the screen,
it goes to the appropriate edge. (ANSI.SYS was not always so nice.)
The following C macro illustrates how one could print a string at a
given location on the screen:
#define printXY(x,y,s) printf("%c[%d;%dH%s", 27, y, x, s);
Either single or double quotes may be used to quote a string. Each
character inside a quoted string is equivalent to one numeric parame-
ter. Quoted strings are normally used only for the Keyboard Key Reas-
signment command.
ESC[#;#H Cursor Position specified by parameters.
ESC[#;#f Horizontal and Vertical Position.
ESC[#A Cursor Up.
ESC[#B Cursor Down.
ESC[#C Cursor Forward.
ESC[#D Cursor Backward.
ESC[#n Device Status, Report! # must be 6. The sequence
ESC[6n causes the console driver to output Cursor
Position Report.
ESC[#;#R Cursor Position Report.
ESC[s Save Cursor Position.
ESC[u Restore Cursor Position.
ESC[#J Erase in Display.# must be 2. Clears the entire
screen.
ESC[K Erase in Line. Deletes from the cursor to the end
of the line.
ESC[#L Insert Lines - not supported in ANSI.SYS.
ESC[#M Delete Lines - not supported in ANSI.SYS.
ESC[#@ Insert Characters - not supported in ANSI.SYS.
ESC[#P Delete Characters - not supported in ANSI.SYS.
ESC["string"p Keyboard Key Reassignment. This feature is a
security risk, and can be disabled with the /s
option when loading NANSI.SYS in config.sys.
ESC[#;#;...#m Set Graphics Rendition:
0 All attributes off (normal white on black)
1 Bold
4 Underline
5 Blink
7 Reverse Video
30 foreground black
31 foreground red
32 foreground green
33 foreground yellow
34 foreground blue
35 foreground magenta
36 foreground cyan
37 foreground white
40 background black
41 background red
42 background green
43 background yellow
44 background blue
45 background magenta
46 background cyan
47 background white
These settings also work at the PROMPT. You have to type there:
prompt $e[1;33;44m for bold (1) / yellow (33) / blue (44).
ESC[=nh Set Video Mode:
Mode Code: Value:
0 text 40x25 Black and White
1 text 40x25 Color
2 text 80x25 Black and White
3 text 80x25 Color
4 bitmap 320x200 4 bits/pixel
5 bitmap 320x200 1 bit/pixel
6 bitmap 640x200 1 bit/pixel
13 bitmap 320x200 4 bits/pixel
14 bitmap 640x200 4 bits/pixel
15 bitmap 640x350 1 bit/pixel
16 bitmap 640x350 4 bits/pixel
17 bitmap 640x480 1 bit/pixel
18 bitmap 640x480 4 bits/pixel
19 bitmap 320x200 8 bits/pixel
Modes 0, 1, and 4-19 require a CGA, EGA or VGA.
Modes 13-16 require an EGA or VGA.
Modes 17-19 require a VGA.
For more information see:
https://gitlab.com/FreeDOS/base/nansi/-/blob/master/DOC/
NANSI/NANSI.DOC OR:
https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/
dos/nansi/4.0d/ OR:
C:\FreeDOS\DOC\NANSI\nansi.doc
Examples:
IN CONFIG.SYS / FDCONFIG.SYS:
device=C:\FREEDOS\BIN\nansi.sys
devicehigh=C:\FREEDOS\BIN\nansi.sys
Example for PROMPT command:
prompt $p$g This is the same as the default setting
prompt $p$g Please enter a command! Additionally shows the text
When NANSI.SYS is loaded, you can also change the colours:
prompt $p$g$e[1;33;44m for bold (1) / yellow (33) / blue (44).
If you like underline and other colours:
prompt $p$g$e[4;30;46m for underline (4) / red (30) / cyan (46).
See also:
config.sys/fdconfig.sys
devload
device/devicehigh
prompt
Copyright © 2003 - 2004 Robert Platt, updated 2008 and 2022
by W. Spiegl.
This file is derived from the FreeDOS Spec Command HOWTO.
See the file H2Cpying for copying conditions.