=[ (ALMOST) FULL USE OF ANSi BY TREACH/CFH'95 ]=

Not many programmers know exactly what ANSi is , means and what you
can do with it. So I wrote this textfile to make ANSi more under-
standable.

1. What does ANSi mean?
ANSi stands for : American National Standards Institute. This is an
organisation dedicated to standardizing all manner of technical 
systems , including computers. The ANSi.SYS driver implents display
and keyboard controls according to the principles of a particular
standard.

2. What are the functions of ANSi?

ANSi's functions are : 

 - Colorizing DOS :)
 - Redefining keys
 - Making music     (*
 - Animating things (*
 
   (* Not yet implented in this textfile

3. So.. Colors.. HOW??

All ANSi commands start with a "<-" wich is a escape code. If I would show
you the real one. You wouldn't be seeing it since ANSI.SYS recognizes it
and won't show it. After the escape code you place a "[" (left square 
bracket). So all ANSi codes begin with "<-[".

Usage of ANSi codes :  <-[<number>;<number><letter code>
Example             :  <-[12;10H  (Moves cursor to 12/10)

Look at table I for a summary of the letter codes.

 ____________________________________________
| Code | Purpose                             | Table I
|______|_____________________________________|
| H    | Move cursor to a specified position |
| A    | Move cursor up                      |
| B    | Move cursor down                    |
| C    | Move cursor right                   |
| D    | Move cursor left                    |
| 2J   | Erase the screen                    |
| K    | Erase from cursor to end of line    |
| m    | Set characteristics of the display  |
| p    | Redefine a key                      |
|______|_____________________________________|

Examples :

ANSi code       What does it do?

<-[1;1H         Moves cursor to coordinate 1/1
<-[6A           Moves cursor up 6 rows
<-[5B           Moves cursor down 5 rows
<-[28C          Moves cursor right 28 columns
<-[19D          Moves cursor left 19 columns
<-[2J           Clears screen  
<-[K            Erase from cursor pos. to end of line
<-[31;44m       Sets color display to red foreground 
                and blue background (See Figure I)
<-['I';'i'p     Redefines capital 'I' to a lower 'i' (ELiTE.. :) (FiGURE ii :)

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

Figure I : Parameters for controlling color display

0 Reset to normal        
1 Bold
5 Blink
7 Reverse
8 Invisible

Set foreground   Set background

30 Black         40 Black  
31 Red           41 Red 
32 Green         42 Green    
33 Yellow        43 Yellow 
34 Blue          44 Blue 
35 Magenta       45 Magenta   
36 Cyan          46 Cyan 
37 White         47 White  

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

Figure II : Codes to use when redefining non-character keys

7  beep
9  TAB
13 ENTER  
27 ESC

015 SHIFT-TAB     072 Cursor up
071 HOME          080 Cursor down
079 END           075 Cursor left
0119 CTRL-HOME    077 Cursor right
0117 CTRL-END     0115 CTRL-cursor left
073 PGUP          0116 CTRL-cursor right
081 PGDN          082 INS
0132 CTRL-PGUP    083 DEL
0118 CTRL-PGDN    

       F1   F2   F3   F4   F5   F6   F7   F8   F9   F10  
       059  060  061  062  063  064  065  066  067  068
SHiFT- F1   F2   F3   F4   F5   F6   F7   F8   F9   F10  
       084  085  086  087  088  089  090  091  092  093
CTRL-  F1   F2   F3   F4   F5   F6   F7   F8   F9   F10  
       094  095  096  097  098  099 0100 0101 0102 0103
ALT-   F1   F2   F3   F4   F5   F6   F7   F8   F9   F10  
       0104 0105 0106 0107 0108 0109 0110 0111 0112 0113 (or 0103.. not sure)
ALT-   Q    W    E    R    T    Y    U    I    O    P
       016  017  018  019  020  021  022  023  024  025
ALT-   A    S    D    F    G    H    J    K    L
       030  031  032  033  034  035  036  037  038
ALT-   Z    X    C    V    B    N    M
       044  045  046  047  048  049  050
ALT-   1    2    3    4    5    6    7    8    9    0
       0120 0121 0122 0123 0124 0125 0126 0127 0128 0129
ALT-   -    =
       0130 0131

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

Well.. That was that for now. Next time we'll go in depth with ansi music
and animations..

Treach/CFH'95
treach@sonority.idn.nl

