mirror of
https://github.com/microsoft/MS-DOS.git
synced 2024-11-29 17:15:47 +00:00
227 lines
6.6 KiB
Plaintext
227 lines
6.6 KiB
Plaintext
This document explains the how the ANSI escape sequences are
|
||
defined for the IBM PC.
|
||
|
||
Notes:
|
||
|
||
1. The default value is used when no explicit value is given
|
||
or a value of zero is given.
|
||
|
||
2. Pn - Numeric parameter. A decimal number specified
|
||
with ASCII digits.
|
||
|
||
3. Ps - Selective parameter. Any decimal number that is
|
||
is used to select a subfunction. Multiple subfunctions
|
||
may be selected by separating the parameters with
|
||
semi-colons.
|
||
|
||
C U R S O R F U N C T I O N S
|
||
|
||
CUP - Cursor Postion
|
||
|
||
ESC [ Pl ; Pc H
|
||
|
||
HVP - Horizontal & Vertical Postion
|
||
|
||
ESC [ Pl ; Pc f
|
||
|
||
CUP and HVP move the cursor to the position specified by
|
||
the parameters. The first parameter specifies the line number
|
||
and the second parameter specifies the column number. The
|
||
default value is one. When no parameters are given the cursor
|
||
is moved to the home postion.
|
||
|
||
CUU - Cursor Up
|
||
|
||
ESC [ Pn A
|
||
|
||
Moves the cursor up one line without changing columns. The
|
||
value of Pn determines the number of lines moved. The default
|
||
value for Pn is one. This sequence is ignored if the cursor
|
||
is already on the top line.
|
||
|
||
CUD - Cursor Down
|
||
|
||
ESC [ Pn B
|
||
|
||
Moves the cursor down one line without changing columns.
|
||
The value of Pn determines the number of lines moved. The
|
||
default value for Pn is one. This sequence is ignored if the
|
||
cursor is already on the bottom line.
|
||
|
||
CUF - Cursor Forward
|
||
|
||
ESC [ Pn C
|
||
|
||
Moves the cursor forword one column without changing lines.
|
||
The value of Pn determines the number of columns moved. The
|
||
default value for Pn is one. This sequence is ignored if the
|
||
cursor is already in the rightmost column.
|
||
|
||
ESC [ Pn D
|
||
|
||
Moves the cursor back one column without changing lines. The
|
||
value of Pn determines the number of columns moved. The default
|
||
value for Pn is one. This sequence is ignored if the cursor
|
||
is already in the leftmost column.
|
||
|
||
DSR - Device Status Report
|
||
|
||
ESC [ 6 n
|
||
|
||
The console driver will output a CPR sequence on receipt of
|
||
DSR.
|
||
|
||
CPR - Cursor Position Report (from console driver to system)
|
||
|
||
ESC [ Pn ; Pn R
|
||
|
||
The CPR sequence reports current cursor position via
|
||
standard input. The first parameter specifies the current
|
||
line and the second parameter specifies the current column.
|
||
|
||
SCP - Save Cursor Postion
|
||
|
||
ESC [ s
|
||
|
||
The current cursor position is saved. This cursor position
|
||
can be restored with the RCP sequence.
|
||
|
||
RCP - Restore cursor position
|
||
|
||
ESC [ u
|
||
|
||
Restores the cursor position to the value it had when the
|
||
console driver received the SCP sequence.
|
||
|
||
E R A S I N G
|
||
|
||
ED - Erase Display
|
||
|
||
ESC [ 2 J
|
||
|
||
Erases all of the screen and the cursor goes to the home
|
||
position.
|
||
|
||
EL - Erase Line
|
||
|
||
ESC [ K
|
||
|
||
Erases from the cursor to the end of the line and includes
|
||
the cursor position.
|
||
|
||
|
||
|
||
M O D E S O F O P E R A T I O N
|
||
|
||
SGR - Set Graphics Rendition
|
||
|
||
ESC [ Ps ; ... ; Ps m
|
||
|
||
Invokes the graphic rendition specified by the parameter(s).
|
||
All following characters are rendered according to the
|
||
parameter(s) until the next occurence of SGR.
|
||
|
||
Parameter Parameter Function
|
||
|
||
0 All Attributes Off
|
||
1 Bold On
|
||
4 Underscore On (monochrome displays
|
||
only)
|
||
5 Blink On
|
||
7 Reverse Video On
|
||
8 Concealed On (ISO 6429 standard)
|
||
30 Black foreground (ISO 6429 standard)
|
||
31 Red foreground (ISO 6429 standard)
|
||
32 Green foreground (ISO 6429 standard)
|
||
33 Yellow foreground (ISO 6429 standard)
|
||
34 Blue foreground (ISO 6429 standard)
|
||
35 Magenta foreground (ISO 6429 standard)
|
||
36 Cyan foreground (ISO 6429 standard)
|
||
37 White foregound (ISO 6429 standard)
|
||
40 Black background (ISO 6429 standard)
|
||
41 Red background (ISO 6429 standard)
|
||
42 Green background (ISO 6429 standard)
|
||
43 Yellow background (ISO 6429 standard)
|
||
44 Blue background (ISO 6429 standard)
|
||
45 Magenta background (ISO 6429 standard)
|
||
46 Cyan background (ISO 6429 standard)
|
||
47 White backgound (ISO 6429 standard)
|
||
|
||
SM - Set Mode (IBM/MICROSOFT Private)
|
||
|
||
ESC [ = Ps h
|
||
or ESC [ = h
|
||
or ESC [ = 0 h
|
||
or ESC [ ? 7 h
|
||
|
||
|
||
Invokes the screen width or type specified by the parameter.
|
||
|
||
Parameter Parameter Function
|
||
|
||
0 40 x 25 black and white
|
||
1 40 x 25 color
|
||
2 80 x 25 black and white
|
||
3 80 x 25 color
|
||
|
||
4 320 x 200 color
|
||
5 320 x 200 black and white
|
||
6 640 x 200 black and white
|
||
7 wrap at end of line
|
||
|
||
|
||
RM - Reset Mode
|
||
|
||
ESC [ = Ps l
|
||
or ESC [ = l
|
||
or ESC [ = 0 l
|
||
or ESC [ ? 7 l
|
||
|
||
|
||
Parameters are the same as SM (Set Mode) except that
|
||
parameter 7 will reset wrap at end of line mode.
|
||
|
||
|
||
K E Y B O A R D R E - A S S I G N M E N T
|
||
|
||
Although not part of the ANSI 3.64-1979 or ISO 6429 standard
|
||
the IBM PC keyboard re-assignment was done in a compatible
|
||
way.
|
||
|
||
The control sequence is:
|
||
|
||
ESC [ Pn ; Pn ; ... Pn p
|
||
or ESC [ "string" ; p
|
||
or ESC [ Pn ; "string" ; Pn ; Pn ; "string" ; Pn p
|
||
or any other combination of strings and decimal numbers
|
||
|
||
The final code in the control sequence ("p") is one reserved
|
||
for private use the by ANSI 3.64-1979 standard.
|
||
|
||
The first ASCII code in the control sequence defines which
|
||
code is being mapped. The remaining numbers define the
|
||
sequence of ASCII codes generated when this key is
|
||
intercepted.
|
||
|
||
To every rule there is an exception, however! If the first
|
||
code in the sequence is zero (NUL) then the first and second
|
||
code make up an extended ASCII re-definition.
|
||
|
||
Here are some examples:
|
||
|
||
1. Reassign the Q and q key to the A and a key (and the other
|
||
way as well):
|
||
|
||
ESC [ 6 5 ; 8 1 p A becomes Q
|
||
ESC [ 9 7 ; 1 1 3 p a becomes q
|
||
ESC [ 8 1 ; 6 5 p Q becomes A
|
||
ESC [ 1 1 3 ; 9 7 p q becomes a
|
||
|
||
2. Reassign the F10 key to to a dir command followed by a
|
||
carriage return:
|
||
|
||
ESC [ 0 ; 6 8 ; " d i r " ; 1 3 p
|
||
|
||
The 0;68 is the extended ASCII code for the F10 key. 13
|
||
decimal is a carriage return
|
||
|