]> wirehaze git hosting - MS-DOS.git/blob - v2.0/source/ANSI.txt

wirehaze git hosting

Merge pull request #151 from jamespack/spelling-fix
[MS-DOS.git] / v2.0 / source / ANSI.txt
1 This document explains the how the ANSI escape sequences are
2 defined for the IBM PC.
3
4 Notes:
5
6 1. The default value is used when no explicit value is given
7 or a value of zero is given.
8
9 2. Pn - Numeric parameter. A decimal number specified
10 with ASCII digits.
11
12 3. Ps - Selective parameter. Any decimal number that is
13 is used to select a subfunction. Multiple subfunctions
14 may be selected by separating the parameters with
15 semi-colons.
16 \f
17 C U R S O R F U N C T I O N S
18
19 CUP - Cursor Postion
20
21 ESC [ Pl ; Pc H
22
23 HVP - Horizontal & Vertical Postion
24
25 ESC [ Pl ; Pc f
26
27 CUP and HVP move the cursor to the position specified by
28 the parameters. The first parameter specifies the line number
29 and the second parameter specifies the column number. The
30 default value is one. When no parameters are given the cursor
31 is moved to the home postion.
32
33 CUU - Cursor Up
34
35 ESC [ Pn A
36
37 Moves the cursor up one line without changing columns. The
38 value of Pn determines the number of lines moved. The default
39 value for Pn is one. This sequence is ignored if the cursor
40 is already on the top line.
41
42 CUD - Cursor Down
43
44 ESC [ Pn B
45
46 Moves the cursor down one line without changing columns.
47 The value of Pn determines the number of lines moved. The
48 default value for Pn is one. This sequence is ignored if the
49 cursor is already on the bottom line.
50
51 CUF - Cursor Forward
52
53 ESC [ Pn C
54
55 Moves the cursor forword one column without changing lines.
56 The value of Pn determines the number of columns moved. The
57 default value for Pn is one. This sequence is ignored if the
58 cursor is already in the rightmost column.
59
60 ESC [ Pn D
61
62 Moves the cursor back one column without changing lines. The
63 value of Pn determines the number of columns moved. The default
64 value for Pn is one. This sequence is ignored if the cursor
65 is already in the leftmost column.
66
67 DSR - Device Status Report
68
69 ESC [ 6 n
70
71 The console driver will output a CPR sequence on receipt of
72 DSR.
73
74 CPR - Cursor Position Report (from console driver to system)
75
76 ESC [ Pn ; Pn R
77
78 The CPR sequence reports current cursor position via
79 standard input. The first parameter specifies the current
80 line and the second parameter specifies the current column.
81
82 SCP - Save Cursor Postion
83
84 ESC [ s
85
86 The current cursor position is saved. This cursor position
87 can be restored with the RCP sequence.
88
89 RCP - Restore cursor position
90
91 ESC [ u
92
93 Restores the cursor position to the value it had when the
94 console driver received the SCP sequence.
95
96 E R A S I N G
97
98 ED - Erase Display
99
100 ESC [ 2 J
101
102 Erases all of the screen and the cursor goes to the home
103 position.
104
105 EL - Erase Line
106
107 ESC [ K
108
109 Erases from the cursor to the end of the line and includes
110 the cursor position.
111
112 \f
113
114 M O D E S O F O P E R A T I O N
115
116 SGR - Set Graphics Rendition
117
118 ESC [ Ps ; ... ; Ps m
119
120 Invokes the graphic rendition specified by the parameter(s).
121 All following characters are rendered according to the
122 parameter(s) until the next occurence of SGR.
123
124 Parameter Parameter Function
125
126 0 All Attributes Off
127 1 Bold On
128 4 Underscore On (monochrome displays
129 only)
130 5 Blink On
131 7 Reverse Video On
132 8 Concealed On (ISO 6429 standard)
133 30 Black foreground (ISO 6429 standard)
134 31 Red foreground (ISO 6429 standard)
135 32 Green foreground (ISO 6429 standard)
136 33 Yellow foreground (ISO 6429 standard)
137 34 Blue foreground (ISO 6429 standard)
138 35 Magenta foreground (ISO 6429 standard)
139 36 Cyan foreground (ISO 6429 standard)
140 37 White foregound (ISO 6429 standard)
141 40 Black background (ISO 6429 standard)
142 41 Red background (ISO 6429 standard)
143 42 Green background (ISO 6429 standard)
144 43 Yellow background (ISO 6429 standard)
145 44 Blue background (ISO 6429 standard)
146 45 Magenta background (ISO 6429 standard)
147 46 Cyan background (ISO 6429 standard)
148 47 White backgound (ISO 6429 standard)
149
150 SM - Set Mode (IBM/MICROSOFT Private)
151
152 ESC [ = Ps h
153 or ESC [ = h
154 or ESC [ = 0 h
155 or ESC [ ? 7 h
156
157
158 Invokes the screen width or type specified by the parameter.
159
160 Parameter Parameter Function
161
162 0 40 x 25 black and white
163 1 40 x 25 color
164 2 80 x 25 black and white
165 3 80 x 25 color
166
167 4 320 x 200 color
168 5 320 x 200 black and white
169 6 640 x 200 black and white
170 7 wrap at end of line
171
172
173 RM - Reset Mode
174
175 ESC [ = Ps l
176 or ESC [ = l
177 or ESC [ = 0 l
178 or ESC [ ? 7 l
179
180
181 Parameters are the same as SM (Set Mode) except that
182 parameter 7 will reset wrap at end of line mode.
183
184 \f
185 K E Y B O A R D R E - A S S I G N M E N T
186
187 Although not part of the ANSI 3.64-1979 or ISO 6429 standard
188 the IBM PC keyboard re-assignment was done in a compatible
189 way.
190
191 The control sequence is:
192
193 ESC [ Pn ; Pn ; ... Pn p
194 or ESC [ "string" ; p
195 or ESC [ Pn ; "string" ; Pn ; Pn ; "string" ; Pn p
196 or any other combination of strings and decimal numbers
197
198 The final code in the control sequence ("p") is one reserved
199 for private use the by ANSI 3.64-1979 standard.
200
201 The first ASCII code in the control sequence defines which
202 code is being mapped. The remaining numbers define the
203 sequence of ASCII codes generated when this key is
204 intercepted.
205
206 To every rule there is an exception, however! If the first
207 code in the sequence is zero (NUL) then the first and second
208 code make up an extended ASCII re-definition.
209
210 Here are some examples:
211
212 1. Reassign the Q and q key to the A and a key (and the other
213 way as well):
214
215 ESC [ 6 5 ; 8 1 p A becomes Q
216 ESC [ 9 7 ; 1 1 3 p a becomes q
217 ESC [ 8 1 ; 6 5 p Q becomes A
218 ESC [ 1 1 3 ; 9 7 p q becomes a
219
220 2. Reassign the F10 key to to a dir command followed by a
221 carriage return:
222
223 ESC [ 0 ; 6 8 ; " d i r " ; 1 3 p
224
225 The 0;68 is the extended ASCII code for the F10 key. 13
226 decimal is a carriage return
227