home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 15a / nansi987.zip / NANSI.DOC < prev    next >
Text File  |  1987-09-13  |  9KB  |  179 lines

  1.  
  2. nansi   - enhanced MS-DOS ansi console driver
  3.  
  4. SYNOPSIS
  5.         Include in \config.sys the line
  6.                 device=nansi.sys
  7.  
  8. DESCRIPTION
  9.         Nansi.sys is a console driver which understands ANSI control
  10.         sequences. It has several advantages over ANSI.SYS (the driver
  11.         supplied with DOS):
  12.         1. It supports new escape sequences (see below).
  13.         2. It provides MUCH faster output under certain conditions.
  14.         3. It supports the 43-line mode of the EGA.
  15.         4. The darned bell is now 1/4 second instead of 1/2 second long.
  16.  
  17.         What a console driver does:
  18.         When you, for example, type
  19.                 C:> type foo.txt
  20.         COMMAND.COM opens the file foo.txt, reads it, and writes it to
  21.         the console driver, which puts it up on the screen.
  22.  
  23.         Both ansi.sys and nansi.sys use IBM Video BIOS to control the screen.
  24.         However, nansi.sys bypasses BIOS if the screen is in a text mode; this
  25.         allows much faster operation under certain conditions.
  26.  
  27.         While putting text up on the screen, (n)ansi.sys keeps a lookout for
  28.         the escape character (chr(27), known as ESC); this character signals
  29.         the start of a terminal control sequence.
  30.         Terminal control sequences follow the format
  31.                 ESC [ param; param; ...; param cmd
  32.         where
  33.                 ESC     is the escape character chr$(27).
  34.                 [       is the left bracket character.
  35.                 param   is an ASCII decimal number, or a string in quotes.
  36.                 cmd     is a case-specific letter identifying the command.
  37.         Usually, zero, one, or two parameters are given.  If parameters
  38.         are omitted, they usually default to 1; however, some commands
  39.         (KKR and DKOCT) treat the no-parameter case specially.
  40.         Spaces are not allowed between parameters.
  41.  
  42.         For example, both ESC[1;1H and ESC[H send the cursor to the home
  43.         position (1,1), which is the upper left.
  44.  
  45.         Either single or double quotes may be used to quote a string.
  46.         Each character inside a quoted string is equivalent to one numeric
  47.         parameter.  Quoted strings are normally used only for the Keyboard
  48.         Key Reassignment command.
  49.  
  50. Control Sequences
  51.         The following table lists the sequences understood by nansi.sys.
  52.         Differences between nansi.sys and the standard ansi.sys are marked
  53.         with a vertical bar (|).
  54.  
  55. Cursor Positioning
  56. Short   Long name               Format          Notes
  57. CUP     cursor position         ESC[y;xH        Sets cursor position.
  58. HVP     cursor position         ESC[y;xf        Same as CUP; not recommended.
  59. CUU     cursor up               ESC[nA          n = # of lines to move
  60. CUD     cursor down             ESC[nB
  61. CUF     cursor forward          ESC[nC          n = # of columns to move
  62. CUB     cursor backward         ESC[nD
  63. DSR     Device Status, Report!  ESC[6n          Find out cursor position.
  64. CPR     Cursor Position report  ESC[y;xR        Response to DSR, as if typed.
  65. SCP     Save Cursor Position    ESC[s           Not nestable.
  66. RCP     Restore Cursor Position ESC[u
  67.  
  68. Editing
  69. ED      Erase in Display        ESC[2J  Clears screen.
  70. EL      Erase in Line           ESC[K   Clears to end of line.
  71. IL  |   Insert Lines            ESC[nL  Inserts n blank lines at cursor line.
  72. DL  |   Delete Lines            ESC[nM  Deletes n lines including cursor line.
  73. ICH |   Insert Characters       ESC[n@  Inserts n blank chars at cursor.
  74. DCH |   Delete Characters       ESC[nP  Deletes n chars including cursor char.
  75.  
  76.  
  77. Mode-Setting
  78. SGR     Set Graphics Rendition  ESC[n;n;...nm   See character attribute table.
  79. SM      Set Mode                ESC[=nh         See screen mode table.
  80. RM      Reset Mode              ESC[=nl         See screen mode table.
  81. IBMKKR  Keyboard Key Reass.     ESC["string"p
  82.         The first char of the string gives the key to redefine; the rest
  83.         of the string is the key's new value.
  84.         To specify unprintable chars, give the ASCII value of the char
  85.         outside of quotes, as a normal parameter.
  86.         IBM function keys are two byte strings; see the IBM Basic manual.
  87.         For instance, ESC[0;";dir a:";13;p redefines function key 1 to
  88.         have the value "dir a:" followed by the ENTER key.
  89.       | If no parameters given, all keys are reset to their default values.
  90.  
  91. DKOCT | Output char translate   ESC[n;ny
  92.       | When first char is encountered in output request, it is replaced with
  93.       | the second char.  This might be useful for previewing text before
  94.       | sending it to a printer with a funny print wheel.
  95.       | If no parameters are given, all chars are reset to normal.
  96.  
  97.  
  98. Character Attributes
  99.         The Set Graphics Rendition command is used to select foreground
  100.         and background colors or attributes.
  101.         When you use multiple parameters, they are executed in sequence, and
  102.         the effects are cumulative.
  103.            Attrib code          Value
  104.                 0               All attributes off (normal white on black)
  105.                 1               Bold
  106.                 4               Underline
  107.                 5               Blink
  108.                 7               Reverse Video
  109.                 8               Invisible (but why?)
  110.                 30-37           foregnd blk/red/grn/yel/blu/magenta/cyan/white
  111.                 40-47           background
  112.  
  113. Screen Modes
  114.         The IBM BIOS supports several video modes; the codes given in the
  115.         BIOS documentation are used as parameters to the Set Mode command.
  116.       | (In bitmap modes, the cursor is simulated with a small blob (^V).)
  117.             Mode Code           Value
  118.                 0               text 40x25 Black & White
  119.                 1               text 40x25 Color
  120.                 2               text 80x25 Black & White
  121.                 3               text 80x25 Color
  122.                 4               bitmap 320x200 4 bits/pixel
  123.                 5               bitmap 320x200 1 bit/pixel
  124.                 6               bitmap 640x200 1 bit/pixel
  125.                 7               (cursor wrap kludge)
  126.                 13 (EGA)        bitmap 320x200 4 bits/pixel ?
  127.                 14 (EGA)        bitmap 640x200 4 bits/pixel
  128.                 16 (EGA)        bitmap 640x350 4 bits/pixel
  129.         Mode 7 is an unfortunate kludge; Setting mode 7 tells the cursor
  130.         to wrap around to the next line when it passes the end of a line;
  131.         Resetting mode 7 tells the cursor to not wrap, but rather stay put.
  132.       | If your computer has the Enhanced Graphics Adaptor, modes between
  133.       | 8 and 15 are also supported; see the EGA BIOS for info.
  134.       | The EGA also lets you use a shorter character cell in text modes
  135.       | in order to squeeze 43 lines of text out of the 25-line text modes.
  136.       | To enter 43 line mode, set the desired 25-line text mode (0 to 3),
  137.       | then Set Mode 43.  For instance: ESC[=3h ESC[=43h.
  138.       | To exit 43 line mode, set the desired 25-line text mode again.
  139.       | Nansi.sys ignores mode 43 unless there is an EGA on your computer.
  140.  
  141. Faster Output
  142.       | Any program that sets the console to RAW mode, and buffers its
  143.       | output properly, can achieve extremely high screen update speeds in
  144.       | return for giving up the special functions of the keys ^C, ^S, and ^P.
  145.       | See IOCTL in the MS-DOS 3.x Technical Reference for more info.
  146.         Also, a small improvement in speed may be noticed with some
  147.         programs that use the DOS console in normal mode, as this driver
  148.         efficiently implements the (standard but undocumented) INT 29h
  149.         most-favored-device putchar used by DOS.
  150.  
  151. EXAMPLES
  152.         See the files setraw.asm for Macro Assembler, and Microsoft C
  153.         routines rawtest.c and setraw.c for entering and leaving raw mode.
  154.  
  155. BUGS
  156.         Insert and delete character do not work in graphics modes.
  157.         Graphics mode writing is slow.
  158.         The simulated cursor in graphics mode slows down single-char
  159.         writes by a factor of 3; it should be disable-able.
  160.         Does not support erase-to-end-of-screen and other useful functions.
  161.  
  162. Version
  163.         This version, 2.2, created February 1986.  Problems should
  164.         be reported to Daniel Kegel, 1-60 CIT, Pasadena, CA 91126
  165.         (or, after June 1986, 2648 169th Ave SE, Bellevue, Wa. 98008).
  166.         Your suggestions for improvement would be most welcome.
  167.  
  168. NOTE
  169.         This program may be distributed for educational and personal use
  170.         only.  Commercial use is verboten; get in touch with the author.
  171.  
  172. FILES
  173.         nansi.doc       - this file
  174.   
  175.         setraw.asm      - for assembly programs
  176.         setraw.c        - for Microsoft C programs
  177.         setraw.c        - for Microsoft C programs
  178.         rawtest.c       - example for Microsoft C
  179.