Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / apps / konsole / developer-doc / old-documents / More / villanova-vt100-esc-codes.txt
blob8142978ed85a1d16f16a9774fbb8ab17432859e5
1 Date: Sat, 27 Oct 90 15:59:27 -0400
2 From: tihor@acf4.NYU.EDU (Stephen Tihor)
3 Message-Id: <9010271959.AA10105@acf4.NYU.EDU>
4 To: tihor@acf4.NYU.EDU
5 Subject: Re: VT100/52/ANSI et.al. Escape codes
6 Newsgroups: comp.os.vms
7 In-Reply-To: <9010240014.AA10730@ucbvax.Berkeley.EDU> 23 Oct 90 16:00 EDT
9 /* acf4:comp.os.vms */
10 /* 20950709@VUVAXCOM.BITNET (Jim McRee [Merlin]) /  4:00 pm  Oct 23, 1990 */
12                                 Villanova University
13                         Campus Computing - Terminal Emulation
14                   Includes VT100 and VT52 Terminal and Control Codes
16         This file contains control and terminal codes for the VT100 terminals,
17 ANSI terminals, and VT52 terminals. Many of the codes were derived from PC/
18 Intercomm, from Mark of the Unicorn Software.  I have researched some of them
19 and added some of my own.
21                                         Thank you,
22                                         Jim McRee  (209507097@VUVAXCOM.BITNET)
24 (* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** *)
26                               CONTROL SEQUENCE SUMMARY
28   * For additional information on the DEC VT100 and VT102 terminals, please
29     consult the VT100 USER GUIDE and VT102 USER GUIDE, published by Digital
30     Equipment Corporation as part numbers EK-VT100-UG and EK-VT102-UG.
33 CONTROL CHARACTERS:
34 ------------------
36 Character
37 Name    Decimal Action Taken
38 ---------------------------------------------------------------
39 NUL     0       Fill character; ignored on input.
40 ENQ     5       Transmit answerback message.
41 BEL     7       Ring the bell.
42 BS      8       Move cursor left.
43 HT      9       Move cursor to next tab stop.
44 LF      10      Line feed; causes print if in autoprint.
45 VT      11      Same as LF.
46 FF      12      Same as LF.
47 CR      13      Move cursor to left margin or newline.
48 SO      14      Invoke G1 character set.
49 SI      15      Invoke G0 character set.
50 XON     17      Resume transmission.
51 XOFF    19      Halt transmission.
52 CAN     24      Cancel escape sequence and display checkerboard.
53 SUB     26      Same as CAN.
54 ESC     27      Introduce a control sequence.
55 DEL     127     Fill character; ignored on input.
57   * All characters less than 32 decimal which are not listed above are ignored.
59 (* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** *)
61 ANSI MODE SUMMARY:
62 -----------------
64   *In ANSI sequences, parameters are given as a string of ASCII digits
65    ('0' - '9') seperated by semicolons.  Pn refers to a number whose value
66    used directly.  Ps refers to a number used as a selector.
68 CURSOR MOVEMENT:
69 ---------------
71         Cursor Up:      Esc [ Pn A
72         Cursor Down:    Esc [ Pn B
73         Cursor Left:    Esc [ Pn C
74         Cursor Right:   Esc [ Pn D
76         Direct Addressing :  Esc [ Pn(row);Pn(col);H or
77                              Esc [ Pn(row);Pn(col);f
79                              ie.  (Pascal)
80                                 Writeln (Esc,'[',Row:1,';',col:1,';','H');
82         Index:          Esc D
83         New Line:       Esc E
84         Reverse Line:   Esc M
86         Save cursor & Attributes:     Esc 7
87         Restore cursor & attributes:  Esc 8
89 ERASING:
90 -------
92         Cursor to end of line           Esc [ K
93         Beginning of line to cursor     Esc [ 1 K
94         Entire line                     Esc [ 2 K
95         Cursor to end of screen         Esc [ J
96         Beginning of screen to cursor   Esc [ 1 J
97         Entire screen                   Esc [ 2 J
99        (Some programs expect Esc [ J to always clear the entire
100         screen, but this does not conform to the standard.)
102 MODES:
103 -----
105         Set with        Esc [ Ps h
106         Reset with      Esc [ Ps l
108 Mode name               Ps      Set             Reset
109 -------------------------------------------------------------------
110 Keyboard action         2       Locked          Unlocked
111 Insertion               4       Insert          Overwrite
112 Send - Receive          12      Full            Echo
113 Line feed/New line      20      New line        Line feed
114 Cursor key              ?1      Application     Cursor
115 ANSI/VT52               ?2      ANSI            VT52
116 Column                  ?3      132             80
117 Scrolling               ?4      Smooth          Jump
118 Screen                  ?5      Reverse         Normal
119 Origin                  ?6      Relative        Absolute
120 Wraparound              ?7      Wrap            Truncate
121 Auto key repeat         ?8      Repeating       No repeat
122 Print form feed         ?18     Yes             No
123 Print extent            ?19     Full screen     Scrolling region
125 Keypad application      Esc =
126 Keypad numeric mode     Esc >
128 EDITING:
129 -------
131         Insert line             Esc [ Pn L
132         Delete line             Esc [ Pn M
133         Delete character        Esc [ Pn P
134         Scrolling region        Esc [ Pn(top);Pn(bot) r
136 PRINTING:
137 --------
139         Print screen or region  Esc [ i
140         Print cursor line       Esc [ ? 1 i
141         Enter auto print        Esc [ ? 5 i
142         Exit auto print         Esc [ ? 4 i
143         Enter print controller  Esc [ 5 i
144         Exit print controller   Esc [ 4 i
146 LINE SIZE:
147 ---------
149         The following is a list of the available styles of printing on the
150 screen.  "Yes" in any column means that the option is supported by the escape
151 code on that line.  "No" means that the option is not supported by the escape
152 code on that line; however, it may, and almost certainly is, supported by
153 another escape sequence.
155 Double-height and double-width double the size of the characters in their
156 respective ways (ie. Double-height is twice as tall as usual).  _Line
157 designates underlining.  Blink is for blinking characters.  Side is the
158 orientation of the character.  Normal means that there is no orientation.
160 Top and bottom refers to the position of the character in order to make a
161 complete character.  The top and bottom sequences will be important if you use
162 the double height option.  You will need to print the line twice to get a
163 complete line.  The first printing will print the top part of the characters
164 and the second printing will print the bottom part.
166 Inverse refers to the condition of the character.  "No" indicates that the
167 character will be printed in the color it normally is printed in with its usual
168 backround.  "Yes" means that the character will be printed in the backround
169 color and the character's backround will be the color it is usually printed in.
170 Shade refers to the brightness of the character.  Normal is the standard
171 brightness of the character.  Bright is bold type.  Dark is a darker brightness
172 than usual.
174 The escape code is the command you would type before the text you want to print
175 to get the indicated effects.  This section was greatly expanded in version 1.1
176 of this file.
178 Double  Double
179 Height  Width   _Line   Blink  Side    Inverse  Shade   Escape Code
180 -----------------------------------------------------------------------
181  No      No       No     No    Normal    No     Normal  <ESC>[0m
182  Yes     Yes      No     No    Top       No     Bright  <ESC>#3<ESC>[1m
183  Yes     Yes      No     No    Bottom    No     Bright  <ESC>#4<ESC>[1m
184  Yes     Yes      No     No    Top       No     Dark    <ESC>#3<ESC>[2m
185  Yes     Yes      No     No    Bottom    No     Dark    <ESC>#4<ESC>[2m
186  Yes     Yes      No     No    Top       No     Normal  <ESC>#3<ESC>[3m
187  Yes     Yes      No     No    Bottom    No     Normal  <ESC>#4<ESC>[3m
188  Yes     Yes      Yes    No    Top       No     Normal  <ESC>#3<ESC>[4m
189  Yes     Yes      Yes    No    Bottom    No     Normal  <ESC>#4<ESC>[4m
190  Yes     Yes      No     Yes   Top       No     Normal  <ESC>#3<ESC>[5m
191  Yes     Yes      No     Yes   Bottom    No     Normal  <ESC>#4<ESC>[5m
192  Yes     Yes      No     No    Top       Yes    Normal  <ESC>#3<ESC>[7m
193  Yes     Yes      No     No    Bottom    Yes    Normal  <ESC>#3<ESC>[7m
194  No      Yes      No     No    Normal    No     Normal  <ESC>#6<ESC>[0m
195  No      Yes      No     No    Normal    No     Bright  <ESC>#6<ESC>[1m
196  No      Yes      No     No    Normal    No     Dark    <ESC>#6<ESC>[2m
197  No      Yes      Yes    No    Normal    No     Normal  <ESC>#6<ESC>[4m
198  No      Yes      No     Yes   Normal    No     Normal  <ESC>#6<ESC>[5m
199  No      Yes      No     No    Normal    Yes    Normal  <ESC>#6<ESC>[7m
200  No      No       No     No    Normal    No     Bright  <ESC>#7<ESC>[1m
201  No      No       No     No    Normal    No     Dark    <ESC>#7<ESC>[2m
202  No      No       Yes    No    Normal    No     Normal  <ESC>#7<ESC>[4m
203  No      No       No     Yes   Normal    No     Normal  <ESC>#7<ESC>[5m
204  No      No       No     No    Normal    Yes    Normal  <ESC>#7<ESC>[7m
206 * Some codes have been eliminated due to a repetition of effects.  To the best
207   of my knowledge, these codes are complete and correct.  If you should find
208   any errors, or you find some new sequences/effects, please inform me.
210 * <ESC>#3 and <ESC>#4 behave in the same way as <ESC>#3[3m and <ESC>#4[4m.
212 CHARACTER SETS:
213 --------------
215 Character set           G0              G1
216 -----------------------------------------------------
217 United Kingdom (UK)     Esc ( A         Esc ) A
218 United States (US)      Esc ( B         Esc ) B
219 Graphics                Esc ( 0         Esc ) 0
220 Default ROM             Esc ( 1         Esc ) 1
221 Alternate ROM           Esc ( 2         Esc ) 2
223 Switch to G0/G1         Esc O           Esc N
225 TAB STOPS:
226 ---------
228         Set tab at current column       Esc H
229         Clear tab at current column     Esc [ g
230         Clear all tabs                  Esc [ 3 g
232 MISCELLANEOUS:
233 -------------
235         Hard Reset                      Esc c
237         Character attributes            Esc [ Ps m
238                                     or  Esc [ Ps ; Ps ; Ps m
239                 0 - All attributes off
240                 1 - Bold on
241                 4 - Underscore on
242                 5 - Blink on
243                 7 - Reverse on
245         Programmable LEDs               Esc [ Ps q
246                 0 - All LEDs off
247           (1 - 4) - Turn respective LED on
249         Fill screen with "E"s (test)    Esc # 8
251 (* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** *)
253 NON-VT100 CONTROL SEQUENCES:
254 ----------------------------
256         *Some VT100 terminal programs also understand a few other escape
257          sequences than the standard VT100.  I cannot guarantee that any of
258          these nonstandard codes will work with any particular terminal, but
259          they may be useful if they do work.
261         Transmit a file         Esc { T filenameCR   ---> CR = Carriage Return
262         Receive a file          Esc { R filenameCR   ---> CR = Carriage Return
263         Append to a file        Esc { A filenameCR   ---> CR = Carriage Return
264         Save collected text     Esc { S
265         Save collected text     Esc S
267         * These sequences will probably be most useful in developing a micro
268           version of a VT100 emulator or in adapting an existing one.
270 (* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** *)
272 VT52 MODE SUMMARY:
273 -----------------
275         Cursor up               Esc A
276         Cursor down             Esc B
277         Cursor right            Esc C
278         Cursor left             Esc D
279         Graphics character set  Esc F
280         ASCII character set     Esc G
281         Home cursor             Esc H
282         Reverse line feed       Esc I
283         Erase to end of screen  Esc J
284         Erase to end of line    Esc K
285         Print cursor line       Esc V
286         Enter print controller  Esc W
287         Exit print controller   Esc X
288         Cursor address          Esc Y row col
289         Identify                Esc Z
290         Print screen            Esc ]
291         Enter auto print        Esc ^
292         Exit auto print         Esc -
293         Alternate keypad        Esc =
294         Numeric keypad          Esc >
295         Enter ANSI mode         Esc <
297         * Row and column numbers are single characters with a bias of 31.
298           E.g., "$" means row/column 5.)
300 KEYPAD AND FUNCTION KEY SUMMARY:
301 -------------------------------
303         CURSOR CONTROL KEYS:
304         -------------------
305                                 Vt52    ANSI and Cursor Key modes
306                 Arrow Key       Mode    Reset           Set
307                 ---------------------------------------------------
308                 Up              Esc A   Esc [ A         Esc O A
309                 Down            Esc B   Esc [ B         Esc O B
310                 Right           Esc C   Esc [ C         Esc O C
311                 Left            Esc D   Esc [ D         Esc O D
313         AUXILLIARY KEYPAD:
314         -----------------
316                      VT52 Mode                       ANSI Mode
317         Key     Numeric         Application     Numeric         Application
318         ----------------------------------------------------------------------
319         0       0               Esc ? p         0               Esc O p
320         1       1               Esc ? q         1               Esc O q
321         2       2               Esc ? r         2               Esc O r
322         3       3               Esc ? s         3               Esc O s
323         4       4               Esc ? t         4               Esc O t
324         5       5               Esc ? u         5               Esc O u
325         6       6               Esc ? v         6               Esc O v
326         7       7               Esc ? w         7               Esc O w
327         8       8               Esc ? x         8               Esc O x
328         9       9               Esc ? y         9               Esc O y
329         -       -               Esc ? m         -               Esc O m
330         ,       ,               Esc ? l         ,               Esc O l
331         .       .               Esc ? n         .               Esc O n
332         ENTER   ^M              Esc ? M         ^M              Esc O M
333         PF1     Esc P           Esc P           Esc O P         Esc O P
334         PF2     Esc Q           Esc Q           Esc O Q         Esc O Q
335         PF3     Esc R           Esc R           Esc O R         Esc O R
336         PF4     Esc S           Esc S           Esc O S         Esc O S
338 VT100 CURRENT STATES:
339 --------------------
341         Esc [ c         DA:Device Attributes
343                         or
345         Esc Z           DECID:Identify Terminal (ANSI mode)
347                         * For PC/Intercomm and some other emulators,
348                           irrespective of the parameter(s) present, the
349                           response is always
351                                 Esc [ ? 6 c
353                           (i.e., a VT102)  Other DEC terminals will respond
354                           according to their configuration and mode.
356         Esc Z           Identify (VT52 mode)
358                         * The sequence Esc / Z is always returned.
360         Esc [ <sol> x   DECREQTPARM: Request Terminal Parameters
362                         * <sol> values other than 1 are ignored.  Upon
363                           receipt of a <sol> value of 1, the following
364                           response is sent:
366                                 Esc[3;<par>;<nbits>;<xspeed>;<rspeed>;1;0x
368                                 * Where <par>, <nbits>, <xspeed>, and <rspeed>
369                                   are as for VT100s with the following
370                                   exceptions:
372                                   <nbits>       Values of 5 and 6 bits per
373                                                 character are sent as 7 bits.
375                                   <xspeed>,<rspeed>
376                                                 These two numbers will always
377                                                 be the same.  9600 baud is
378                                                 sent for 7200 baud.
380         Esc [ Ps n      DSR: Device Status Report
382                         * Parameter values other than 5, 6, are ignored.
383                           If the parameter value is 5, the sequence
384                           Esc [ O n is returned.  If the parameter value is
385                           6, the CPR: Cursor Position Report sequence
386                           Esc [ Pn ; Pn R is returned with the Pn set to
387                           cursor row and column numbers.
388 /* ---------- */