author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Wed, 05 Aug 2015 23:55:34 +0300 | |
changeset 1729 | 22ffd80639c0 |
parent 1334 | 9bf0d5a1f0cf |
child 1905 | fba288d59662 |
permissions | -rw-r--r-- |
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1032
diff
changeset
|
1 |
.. -*- coding: utf-8; -*- |
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1032
diff
changeset
|
2 |
.. include:: HEADER.rst |
953 | 3 |
|
4 |
========================================================== |
|
5 |
This document describes how to control a VT100 terminal. |
|
6 |
========================================================== |
|
7 |
.. contents:: |
|
8 |
||
9 |
ANSI escape sequence is a sequence of ASCII characters, the first two of which |
|
10 |
are the ASCII "Escape" character 27 (1Bh) and the left-bracket character " [ " |
|
11 |
(5Bh). The character or characters following the escape and left-bracket |
|
12 |
characters specify an alphanumeric code that controls a keyboard or display |
|
13 |
function. |
|
14 |
||
15 |
+----------------+---------------------------------------+-------------+ |
|
16 |
|Esc[2;1yEsc[20h |Confidence power up testSet new line |DECTSTLMN | |
|
17 |
| |mode | | |
|
18 |
+----------------+---------------------------------------+-------------+ |
|
19 |
|Esc[2;2yEsc[?1h |Confidence loopback testSet cursor key |DECTSTDECCKM | |
|
20 |
| |to application | | |
|
21 |
+----------------+---------------------------------------+-------------+ |
|
22 |
|Esc[2;9ynone |Repeat power up testSet ANSI (versus |DECTSTDECANM | |
|
23 |
| |VT52) | | |
|
24 |
+----------------+---------------------------------------+-------------+ |
|
25 |
|Esc[2;10yEsc[?3h|Repeat loopback testSet number of |DECTSTDECCOLM| |
|
26 |
| |columns to 132 | | |
|
27 |
+----------------+---------------------------------------+-------------+ |
|
28 |
|Esc[0qEsc[?4h |Turn off all four ledsSet smooth |DECLL0DECSCLM| |
|
29 |
| |scrolling | | |
|
30 |
+----------------+---------------------------------------+-------------+ |
|
31 |
|Esc[1qEsc[?5h |Turn on LED #1Set reverse video on |DECLL1DECSCNM| |
|
32 |
| |screen | | |
|
33 |
+----------------+---------------------------------------+-------------+ |
|
34 |
|Esc[2qEsc[?6h |Turn on LED #2Set origin to relative |DECLL2DECOM | |
|
35 |
+----------------+---------------------------------------+-------------+ |
|
36 |
|Esc[3qEsc[?7h |Turn on LED #3Set auto-wrap mode |DECLL3DECAWM | |
|
37 |
+----------------+---------------------------------------+-------------+ |
|
38 |
|Esc[4qEsc[?8h |Turn on LED #4Set auto-repeat mode |DECLL4DECARM | |
|
39 |
+----------------+---------------------------------------+-------------+ |
|
40 |
|Esc[?9h |Set interlacing mode |DECINLM | |
|
41 |
+----------------+---------------------------------------+-------------+ |
|
42 |
|Esc[20l |Set line feed mode |LMN | |
|
43 |
+----------------+---------------------------------------+-------------+ |
|
44 |
|Esc[?1l |Set cursor key to cursor |DECCKM | |
|
45 |
+----------------+---------------------------------------+-------------+ |
|
46 |
|Esc[?2l |Set VT52 (versus ANSI) |DECANM | |
|
47 |
+----------------+---------------------------------------+-------------+ |
|
48 |
|Esc[?3l |Set number of columns to 80 |DECCOLM | |
|
49 |
+----------------+---------------------------------------+-------------+ |
|
50 |
|Esc[?4l |Set jump scrolling |DECSCLM | |
|
51 |
+----------------+---------------------------------------+-------------+ |
|
52 |
|Esc[?5l |Set normal video on screen |DECSCNM | |
|
53 |
+----------------+---------------------------------------+-------------+ |
|
54 |
|Esc[?6l |Set origin to absolute |DECOM | |
|
55 |
+----------------+---------------------------------------+-------------+ |
|
56 |
|Esc[?7l |Reset auto-wrap mode |DECAWM | |
|
57 |
+----------------+---------------------------------------+-------------+ |
|
58 |
|Esc[?8l |Reset auto-repeat mode |DECARM | |
|
59 |
+----------------+---------------------------------------+-------------+ |
|
60 |
|Esc[?9l |Reset interlacing mode |DECINLM | |
|
61 |
+----------------+---------------------------------------+-------------+ |
|
62 |
|Esc= |Set alternate keypad mode |DECKPAM | |
|
63 |
+----------------+---------------------------------------+-------------+ |
|
64 |
|Esc> |Set numeric keypad mode |DECKPNM | |
|
65 |
+----------------+---------------------------------------+-------------+ |
|
66 |
|Esc(A |Set United Kingdom G0 character set |setukg0 | |
|
67 |
+----------------+---------------------------------------+-------------+ |
|
68 |
|Esc)A |Set United Kingdom G1 character set |setukg1 | |
|
69 |
+----------------+---------------------------------------+-------------+ |
|
70 |
|Esc(B |Set United States G0 character set |setusg0 | |
|
71 |
+----------------+---------------------------------------+-------------+ |
|
72 |
|Esc)B |Set United States G1 character set |setusg1 | |
|
73 |
+----------------+---------------------------------------+-------------+ |
|
74 |
|Esc(0 |Set G0 special chars. & line set |setspecg0 | |
|
75 |
+----------------+---------------------------------------+-------------+ |
|
76 |
|Esc)0 |Set G1 special chars. & line set |setspecg1 | |
|
77 |
+----------------+---------------------------------------+-------------+ |
|
78 |
|Esc(1 |Set G0 alternate character ROM |setaltg0 | |
|
79 |
+----------------+---------------------------------------+-------------+ |
|
80 |
|Esc)1 |Set G1 alternate character ROM |setaltg1 | |
|
81 |
+----------------+---------------------------------------+-------------+ |
|
82 |
|Esc(2 |Set G0 alt char ROM and spec. graphics |setaltspecg0 | |
|
83 |
+----------------+---------------------------------------+-------------+ |
|
84 |
|Esc)2 |Set G1 alt char ROM and spec. graphics |setaltspecg1 | |
|
85 |
+----------------+---------------------------------------+-------------+ |
|
86 |
|EscN |Set single shift 2 |SS2 | |
|
87 |
+----------------+---------------------------------------+-------------+ |
|
88 |
|EscO |Set single shift 3 |SS3 | |
|
89 |
+----------------+---------------------------------------+-------------+ |
|
90 |
|Esc[m |Turn off character attributes |SGR0 | |
|
91 |
+----------------+---------------------------------------+-------------+ |
|
92 |
|Esc[0m |Turn off character attributes |SGR0 | |
|
93 |
+----------------+---------------------------------------+-------------+ |
|
94 |
|Esc[1m |Turn bold mode on |SGR1 | |
|
95 |
+----------------+---------------------------------------+-------------+ |
|
96 |
|Esc[2m |Turn low intensity mode on |SGR2 | |
|
97 |
+----------------+---------------------------------------+-------------+ |
|
98 |
|Esc[4m |Turn underline mode on |SGR4 | |
|
99 |
+----------------+---------------------------------------+-------------+ |
|
100 |
|Esc[5m |Turn blinking mode on |SGR5 | |
|
101 |
+----------------+---------------------------------------+-------------+ |
|
102 |
|Esc[7m |Turn reverse video on |SGR7 | |
|
103 |
+----------------+---------------------------------------+-------------+ |
|
104 |
|Esc[8m |Turn invisible text mode on |SGR8 | |
|
105 |
+----------------+---------------------------------------+-------------+ |
|
106 |
|Esc[Line;Liner |Set top and bottom lines of a window |DECSTBM | |
|
107 |
+----------------+---------------------------------------+-------------+ |
|
108 |
|Esc[ValueA |Move cursor up n lines |CUU | |
|
109 |
+----------------+---------------------------------------+-------------+ |
|
110 |
|Esc[ValueB |Move cursor down n lines |CUD | |
|
111 |
+----------------+---------------------------------------+-------------+ |
|
112 |
|Esc[ValueC |Move cursor right n lines |CUF | |
|
113 |
+----------------+---------------------------------------+-------------+ |
|
114 |
|Esc[ValueD |Move cursor left n lines |CUB | |
|
115 |
+----------------+---------------------------------------+-------------+ |
|
116 |
|Esc[H |Move cursor to upper left corner |cursorhome | |
|
117 |
+----------------+---------------------------------------+-------------+ |
|
118 |
|Esc[;H |Move cursor to upper left corner |cursorhome | |
|
119 |
+----------------+---------------------------------------+-------------+ |
|
120 |
|Esc[Line;ColumnH|Move cursor to screen location v,h |CUP | |
|
121 |
+----------------+---------------------------------------+-------------+ |
|
122 |
|Esc[f |Move cursor to upper left corner |hvhome | |
|
123 |
+----------------+---------------------------------------+-------------+ |
|
124 |
|Esc[;f |Move cursor to upper left corner |hvhome | |
|
125 |
+----------------+---------------------------------------+-------------+ |
|
126 |
|Esc[Line;Columnf|Move cursor to screen location v,h |CUP | |
|
127 |
+----------------+---------------------------------------+-------------+ |
|
128 |
|EscD |Move/scroll window up one line |IND | |
|
129 |
+----------------+---------------------------------------+-------------+ |
|
130 |
|EscM |Move/scroll window down one line |RI | |
|
131 |
+----------------+---------------------------------------+-------------+ |
|
132 |
|EscE |Move to next line |NEL | |
|
133 |
+----------------+---------------------------------------+-------------+ |
|
134 |
|Esc7 |Save cursor position and attributes |DECSC | |
|
135 |
+----------------+---------------------------------------+-------------+ |
|
136 |
|Esc8 |Restore cursor position and attributes |DECSC | |
|
137 |
+----------------+---------------------------------------+-------------+ |
|
138 |
|EscH |Set a tab at the current column |HTS | |
|
139 |
+----------------+---------------------------------------+-------------+ |
|
140 |
|Esc[g |Clear a tab at the current column |TBC | |
|
141 |
+----------------+---------------------------------------+-------------+ |
|
142 |
|Esc[0g |Clear a tab at the current column |TBC | |
|
143 |
+----------------+---------------------------------------+-------------+ |
|
144 |
|Esc[3g |Clear all tabs |TBC | |
|
145 |
+----------------+---------------------------------------+-------------+ |
|
146 |
|Esc#3 |Double-height letters, top half |DECDHL | |
|
147 |
+----------------+---------------------------------------+-------------+ |
|
148 |
|Esc#4 |Double-height letters, bottom half |DECDHL | |
|
149 |
+----------------+---------------------------------------+-------------+ |
|
150 |
|Esc#5 |Single width, single height letters |DECSWL | |
|
151 |
+----------------+---------------------------------------+-------------+ |
|
152 |
|Esc#6 |Double width, single height letters |DECDWL | |
|
153 |
+----------------+---------------------------------------+-------------+ |
|
154 |
|Esc[K |Clear line from cursor right |EL0 | |
|
155 |
+----------------+---------------------------------------+-------------+ |
|
156 |
|Esc[0K |Clear line from cursor right |EL0 | |
|
157 |
+----------------+---------------------------------------+-------------+ |
|
158 |
|Esc[1K |Clear line from cursor left |EL1 | |
|
159 |
+----------------+---------------------------------------+-------------+ |
|
160 |
|Esc[2K |Clear entire line |EL2 | |
|
161 |
+----------------+---------------------------------------+-------------+ |
|
162 |
|Esc[J |Clear screen from cursor down |ED0 | |
|
163 |
+----------------+---------------------------------------+-------------+ |
|
164 |
|Esc[0J |Clear screen from cursor down |ED0 | |
|
165 |
+----------------+---------------------------------------+-------------+ |
|
166 |
|Esc[1J |Clear screen from cursor up |ED1 | |
|
167 |
+----------------+---------------------------------------+-------------+ |
|
168 |
|Esc[2J |Clear entire screen |ED2 | |
|
169 |
+----------------+---------------------------------------+-------------+ |
|
170 |
|Esc5n |Device status report |DSR | |
|
171 |
+----------------+---------------------------------------+-------------+ |
|
172 |
|Esc0n |Response: terminal is OK |DSR | |
|
173 |
+----------------+---------------------------------------+-------------+ |
|
174 |
|EscLine;ColumnR |Response: cursor is at v,h |CPR | |
|
175 |
+----------------+---------------------------------------+-------------+ |
|
176 |
|Esc[c |Identify what terminal type |DA | |
|
177 |
+----------------+---------------------------------------+-------------+ |
|
178 |
||
179 |
Codes for use in VT52 compatibility mode |
|
180 |
======================================== |
|
181 |
+-------------+-------------------------------------------+ |
|
182 |
|Esc< |Enter/exit ANSI mode (VT52) setansi | |
|
183 |
+-------------+-------------------------------------------+ |
|
184 |
|Esc= |Enter alternate keypad mode altkeypad | |
|
185 |
+-------------+-------------------------------------------+ |
|
186 |
|Esc> |Exit alternate keypad mode numkeypad | |
|
187 |
+-------------+-------------------------------------------+ |
|
188 |
|EscF |Use special graphics character set setgr | |
|
189 |
+-------------+-------------------------------------------+ |
|
190 |
|EscG |Use normal US/UK character set resetgr | |
|
191 |
+-------------+-------------------------------------------+ |
|
192 |
|EscA |Move cursor up one line cursorup | |
|
193 |
+-------------+-------------------------------------------+ |
|
194 |
|EscB |Move cursor down one line cursordn | |
|
195 |
+-------------+-------------------------------------------+ |
|
196 |
|EscC |Move cursor right one char cursorrt | |
|
197 |
+-------------+-------------------------------------------+ |
|
198 |
|EscD |Move cursor left one char cursorlf | |
|
199 |
+-------------+-------------------------------------------+ |
|
200 |
|EscH |Move cursor to upper left corner cursorhome| |
|
201 |
+-------------+-------------------------------------------+ |
|
202 |
|EscLineColumn|Move cursor to v,h location cursorpos(v,h) | |
|
203 |
+-------------+-------------------------------------------+ |
|
204 |
|EscI |Generate a reverse line-feed revindex | |
|
205 |
+-------------+-------------------------------------------+ |
|
206 |
|EscK |Erase to end of current line cleareol | |
|
207 |
+-------------+-------------------------------------------+ |
|
208 |
|EscJ |Erase to end of screen cleareos | |
|
209 |
+-------------+-------------------------------------------+ |
|
210 |
|EscZ |Identify what the terminal is ident | |
|
211 |
+-------------+-------------------------------------------+ |
|
212 |
|Esc/Z |Correct response to ident identresp | |
|
213 |
+-------------+-------------------------------------------+ |
|
214 |
||
215 |
VT100 Special Key Codes |
|
216 |
======================= |
|
217 |
||
218 |
These are sent from the terminal back to the computer when the particular key is pressed. Note that the numeric keypad keys send different codes in numeric mode than in alternate mode. See escape codes above to change keypad mode. |
|
219 |
||
220 |
Function Keys: |
|
221 |
============== |
|
222 |
||
223 |
+-----+---+ |
|
224 |
|EscOP|PF1| |
|
225 |
+-----+---+ |
|
226 |
|EscOQ|PF2| |
|
227 |
+-----+---+ |
|
228 |
|EscOR|PF3| |
|
229 |
+-----+---+ |
|
230 |
|EscOS|PF4| |
|
231 |
+-----+---+ |
|
232 |
||
233 |
Arrow Keys: |
|
234 |
=========== |
|
235 |
||
236 |
||
237 |
+-----+-----+-----+ |
|
238 |
| |Reset|Set | |
|
239 |
+-----+-----+-----+ |
|
240 |
|up |EscA |EscOA| |
|
241 |
+-----+-----+-----+ |
|
242 |
|down |EscB |EscOB| |
|
243 |
+-----+-----+-----+ |
|
244 |
|right|EscC |EscOC| |
|
245 |
+-----+-----+-----+ |
|
246 |
|left |EscD |EscOD| |
|
247 |
+-----+-----+-----+ |
|
248 |
||
249 |
Numeric Keypad Keys: |
|
250 |
==================== |
|
251 |
||
252 |
+-----+---------+ |
|
253 |
|EscOp|0 | |
|
254 |
+-----+---------+ |
|
255 |
|EscOq|1 | |
|
256 |
+-----+---------+ |
|
257 |
|EscOr|2 | |
|
258 |
+-----+---------+ |
|
259 |
|EscOs|3 | |
|
260 |
+-----+---------+ |
|
261 |
|EscOt|4 | |
|
262 |
+-----+---------+ |
|
263 |
|EscOu|5 | |
|
264 |
+-----+---------+ |
|
265 |
|EscOv|6 | |
|
266 |
+-----+---------+ |
|
267 |
|EscOw|7 | |
|
268 |
+-----+---------+ |
|
269 |
|EscOx|8 | |
|
270 |
+-----+---------+ |
|
271 |
|EscOy|9 | |
|
272 |
+-----+---------+ |
|
273 |
|EscOm|-(minus) | |
|
274 |
+-----+---------+ |
|
275 |
|EscOl|,(comma) | |
|
276 |
+-----+---------+ |
|
277 |
|EscOn|.(period)| |
|
278 |
+-----+---------+ |
|
279 |
|EscOM|^M | |
|
280 |
+-----+---------+ |
|
281 |
||
282 |
Printing: |
|
283 |
========= |
|
284 |
||
285 |
+------+------------+--------------------------------------------+ |
|
286 |
|Esc[i |Print Screen|Print the current screen | |
|
287 |
+------+------------+--------------------------------------------+ |
|
288 |
|Esc[1i|Print Line |Print the current line | |
|
289 |
+------+------------+--------------------------------------------+ |
|
290 |
|Esc[4i|Stop Print |Disable log | |
|
291 |
+------+------------+--------------------------------------------+ |
|
292 |
|Esc[5i|Start Print |Start log; all received text is echoed to a | |
|
293 |
| | | printer | |
|
294 |
+------+------------+--------------------------------------------+ |
|
295 |