ANSI TERMINAL CODES
------------------------------------------------------------------------
From the "Castle Perilous Manual"
Original text Copyright (c) 1998 CircleWorld
Converted to text & updated by Ian L. <catrap@bigfoot.com> (1/23/00)
------------------------------------------------------------------------
 
ANSI is a standard for screen displays. Here is a listing of ANSI codes for color. Not available for game play, but is handy for coders. 

Wherever you see '#', that should be replaced by the appropriate number. The ESC char is usually hexidecimal 1B (ASCII 27, Octal 033) on most computers. To clarify this, in the example 'ESC[#B', to move the cursor down two lines you would print "\x1b[2B" in perl or in C.

     ESC code sequence      Function

------------------------------------------------------------------------
>> Cursor Controls:
	Ê
     ESC[#;#H or ESC[#;#f   Moves cusor to line #, column #
     ESC[#A                 Moves cursor up # lines
     ESC[#B                 Moves cursor down # lines
     ESC[#C                 Moves cursor forward # spaces
     ESC[#D                 Moves cursor back # spaces
     ESC[#;#R               Reports current cursor line & column
     ESC[s                  Saves cursor position for recall later
     ESC[u                  Return to saved cursor position

------------------------------------------------------------------------
>> Erase Functions:	Ê

     ESC[2J                 Clear screen and home cursor
     ESC[K                  Clear to end of line
Ê	Ê
------------------------------------------------------------------------
>> Set Graphics Rendition:

     ESC[#m                 Set single display attribute
     ESC[#;#;...;#m         Set multiple display attributes where # is:Ê 

            0       for normal displayÊ 
            1       for bold onÊ 
            4       underline (mono only)Ê 
            5       blink onÊ 
            7       reverse video onÊ 
            8       nondisplayed (invisible)Ê 
            30      black foregroundÊ 
            31      red foregroundÊ 
            32      green foregroundÊ 
            33      yellow foregroundÊ 
            34      blue foregroundÊ 
            35      magenta foregroundÊ 
            36      cyan foregroundÊ 
            37      white foregroundÊ 
            40      black backgroundÊ 
            41      red backgroundÊ 
            42      green backgroundÊ 
            43      yellow backgroundÊ 
            44      blue backgroundÊ 
            45      magenta backgroundÊ 
            46      cyan backgroundÊ 
            47      white background
            
     ESC[=#;7h              or..
     ESC[=h                 or..Ê 
     ESC[=0h                or..
     ESC[?7h                Put screen in indicated mode where # is 

            0 for 40 x 25 black & whiteÊ 
            1 for 40 x 25 colorÊ 
            2 for 80 x 25 b&wÊ 
            3 for 80 x 25 colorÊ 
            4 for 320 x 200 color graphicsÊ 
            5 for 320 x 200 b & w graphicsÊ 
            6 for 640 x 200 b & w graphicsÊ 
            7 to wrap at end of line

     ESC[=#;7l              or.. 
     ESC[=l                 or..
     ESC[=0l                or..
     ESC[?7l                Resets mode # set with above command
Ê	Ê
------------------------------------------------------------------------
>> Keyboard Reassignments:	Ê

     ESC[#;#;...p           or..
     ESC["string"p          or..
     ESC[#;"string";#;

Using:  #;"string";#p
The first ASCII code defines which code is to be changed. The remaining codes define what it is to be changed to.Ê 

Example: Reassign the Q and q keys to the A and a keys (and vice versa).Ê 
ÊÊ 
  ESC[65;81p    --> A becomes QÊ 
  ESC[97;113p   --> a becomes qÊ 
  ESC[81;65p    --> Q becomes AÊ 
  ESC[113;97p   --> q becomes aÊ 
ÊÊ 
Example: Reassign the F10 key to a DIR command.Ê 

  ESC [0;68;"dir";13p

The 0;68 is the extended ASCII code for the F10 key and 13 is the ASCIIÊ 
code for a carriage return.Ê 

Other function key codes:Ê 

     F1=59Ê 
     F2=60Ê 
     F3=61Ê 
     F4=62Ê 
     F5=63Ê 
     F6=64Ê 
     F7=65Ê 
     F8=66Ê 
     F9=67Ê 
     F10=68

------------------------------------------------------------------------

Eat snacky smores!
