1 This document explains the how the ANSI escape sequences are
2 defined for the IBM PC.
6 1. The default value is used when no explicit value is given
7 or a value of zero is given.
9 2. Pn - Numeric parameter. A decimal number specified
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
17 C U R S O R F U N C T I O N S
23 HVP - Horizontal & Vertical Postion
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.
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.
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.
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.
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.
67 DSR - Device Status Report
71 The console driver will output a CPR sequence on receipt of
74 CPR - Cursor Position Report (from console driver to system)
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.
82 SCP - Save Cursor Postion
86 The current cursor position is saved. This cursor position
87 can be restored with the RCP sequence.
89 RCP - Restore cursor position
93 Restores the cursor position to the value it had when the
94 console driver received the SCP sequence.
102 Erases all of the screen and the cursor goes to the home
109 Erases from the cursor to the end of the line and includes
114 M O D E S O F O P E R A T I O N
116 SGR - Set Graphics Rendition
118 ESC [ Ps ; ... ; Ps m
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.
124 Parameter Parameter Function
128 4 Underscore On (monochrome displays
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)
150 SM - Set Mode (IBM/MICROSOFT Private)
158 Invokes the screen width or type specified by the parameter.
160 Parameter Parameter Function
162 0 40 x 25 black and white
164 2 80 x 25 black and white
168 5 320 x 200 black and white
169 6 640 x 200 black and white
170 7 wrap at end of line
181 Parameters are the same as SM (Set Mode) except that
182 parameter 7 will reset wrap at end of line mode.
185 K E Y B O A R D R E - A S S I G N M E N T
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
191 The control sequence is:
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
198 The final code in the control sequence ("p") is one reserved
199 for private use the by ANSI 3.64-1979 standard.
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
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.
210 Here are some examples:
212 1. Reassign the Q and q key to the A and a key (and the other
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
220 2. Reassign the F10 key to to a dir command followed by a
223 ESC [ 0 ; 6 8 ; " d i r " ; 1 3 p
225 The 0;68 is the extended ASCII code for the F10 key. 13
226 decimal is a carriage return