ANSI

Computer Methods in Chemical Engineering


ANSI


Usage:    device=[d:][path]ansi.sys  ... include in the config.sys file
          device=[d:][path]nansi.sys ... include in the config.sys file

Function: * Load the screen/key driver.
          * Out to screen:
              ESC [ param; param; ...; param cmd
              where param is an ASCII decimal number, or a string in quotes.
                    cmd   is a case-specific letter identifying the command.
              Spaces are not allowed between parameters.
              If parameters are omitted, they usually default to 1.
          * ANSI.SYS comes with DOS; whereas, NANSI.SYS is the enhanced version.
            (Differences between nansi.sys and the standard ansi.sys are marked
            with a vertical bar (|).)
              1. It supports new escape sequences.
              2. It provides much faster output under certain conditions.
              3. It supports the 43-line mode of the EGA.
              4. The bell is now 1/4 second instead of 1/2 second long.
Note:     # is specified as numeric numbers, not HEX or DEC.
          ESC is HEX 1B or DEC 27

ESC [#;#H  ... move cursor (1st # = line, 2nd # = column, no # = home)
ESC [#;#f  ... same as ESC [#;#H  ... not recommended
ESC [#A    ... move cursor up # lines (default=1)
ESC [#B    ... move cursor down # lines (default=1)
ESC [#C    ... move cursor right # columns (default=1)
ESC [#D    ... move cursor left # columns (default=1)
ESC [6n    ... report the cursor position as ESC[#;#R on screen
ESC [s     ... save current position; this position can be restored by ESC[u
ESC [u     ... restore to the position saved by ESC [s
ESC [2J    ... clear screen and position cursor to home
ESC [K     ... erase from the cursor to the end of line
|ESC [#L    ... Inserts # blank lines at cursor line
|ESC [#M    ... Deletes # lines, including cursor line
|ESC [#@    ... Inserts # blank chars at cursor
|ESC [#P    ... Deletes # chars, including cursor char
|ESC[#;#r   ... Set Scrolling Region from (1st #) to (2nd #)
                    Used to create split screens.
                    (Top defaults to 1; bottom defaults to the last line)
                    Affects insert-line, delete-line, erase-in-display, and
                    scrolling.
ESC [#;...;#m  set screen attribute
                   #=0 ... normal, i.e. reset
                   #=1 ... bold on
                   #=4 ... underscore on
                   #=5 ... blink on
                   #=7 ... reverse on
                   #=8 ... invisible on
                   #=30 .. black  foreground;  #=40 .. black  background
                   #=31 .. red    foreground;  #=41 .. red    background
                   #=32 .. green  foreground;  #=42 .. green  background
                   #=33 .. yellow foreground;  #=43 .. yellow background
                   #=34 .. blue   foreground;  #=44 .. blue   background
                   #=35 .. purple foreground;  #=45 .. purple background
                   #=36 .. cyan   foreground;  #=46 .. cyan   background
                   #=37 .. white  foreground;  #=47 .. white  background
ESC [=#h   ... set screen width & resolution
                   #=0 ... 40*25 b&w
                   #=1 ... 40*25 color
                   #=2 ... 80*25 b&w
                   #=3 ... 80*25 color
                   #=4 ... 320*200 b&w
                   #=5 ... 320*200 color
                   #=6 ... 640*200 b&w
                   #=7 ... wrap at end of line
|                  #13 ... bitmap 320x200 4 bits/pixel ?
|                  #14 ... bitmap 640x200 4 bits/pixel
|                  #16 ... bitmap 640x350 4 bits/pixel
|                  #43 ... (43-line mode for EGA)
|                          To enter 43 line mode, ESC[=3h ESC[=43h.
|                          To exit 43 line mode, ESC[=3h.
ESC [=#l   ... same as ESC [=#h
ESC [#;#;...;#p                  ... | keyboard key reassignment
ESC ["string";p                  ... | (1st # = ASCII code for the key)
ESC [#;"string";#;#;"string";#p  ... | (all following strings & #'s=new)
         ... If 1st # is 0, then the 2nd # determines the extended ASCII code.
         ... Either single or double quotes may be used.
|        ... If no parameters given, all keys are reset to their default values.

Example:  ESC [65;81p         {A becomes Q}
                |  |
                |  Q
                A
          ESC [0;68;"dir";13p {F10 becomes dir(CR)}
                |          |
                |          13 is the (CR)
                0;68 is the extended ASCII code for F10 key
          ESC [0;68;0;68p     {restore F10}
          ESC[1;1H            {position cursor to home}
          ESC[H               {position cursor to home}
          ESC[32;40;1m        {bright green characters on black background}
          PROMPT $e[31m$e[s$e[47m$e[H$e[K$e[15C$d$e[10C$t$e[10C$p$e[0m$e[u$g$e[40m$e[32m   {create a clock on top}
          PROMPT $e[s$e[H$e[K$t$e[u$p$g
          PROMPT $e[s$e[H$e[K$e[66C$t$h$h$h$e[u$p$g



Return to Prof. Nam Sun Wang's Home Page
Return to Computer Methods in Chemical Engineering (ENCH250)

Computer Methods in Chemical Engineering -- ANSI
Forward comments to:
Nam Sun Wang
Department of Chemical & Biomolecular Engineering
University of Maryland
College Park, MD 20742-2111
301-405-1910 (voice)
301-314-9126 (FAX)
e-mail: nsw@umd.edu ©1996-2006 by Nam Sun Wang
UMCP logo