X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fd588,8c9bb68c6cb93afe X-Google-Attributes: gidfd588,public X-Google-Thread: f996b,8c9bb68c6cb93afe X-Google-Attributes: gidf996b,public X-Google-Thread: fbb9d,8c9bb68c6cb93afe X-Google-Attributes: gidfbb9d,public X-Google-ArrivalTime: 1994-11-14 12:25:42 PST Path: nntp.gmd.de!dearn!blekul11!idefix.CS.kuleuven.ac.be!ub4b!EU.net!howland.reston.ans.net!news.sprintlink.net!sashimi.wwa.com!not-for-mail From: Tony Nugent Newsgroups: alt.ascii-art,alt.ascii-art.animation,rec.arts.ascii Subject: Info: Control codes Date: 13 Nov 1994 20:48:40 -0600 Organization: Griffith University, Brisbane, Australia Lines: 643 Sender: boba@wwa.com Approved: boba@wwa.com Message-ID: <3a6j68$rh2@gagme.wwa.com> References: <39c1pp$q4o@gagme.wwa.com> <3a57pv$s3c@gagme.wwa.com> Reply-To: T.Nugent@sct.gu.edu.au NNTP-Posting-Host: gagme.wwa.com Xref: nntp.gmd.de alt.ascii-art:16656 rec.arts.ascii:2828 Tony Nugent writes: Here I go again... following up my own posts!! :-) >>Well, I got snubbed a few other times but I'll try it again. >>Will somebody send me a list or the location of a list of control codes >>for ascii animation? >I'll email you a list of the vt102 control codes, but if you have >the standard msdos ansi codes available, they are very similar >(although there are some differences). >I'm wondering if I should post this list for all to see. >Is there enough interest? Bob? (If I get email to say yes, then >I'll be happy to post it). I've had some interest in this, so here is what I've put together.... Enjoy! ========8<----insert-crowbar-here------------------------------ ========8<----insert-crowbar-here------------------------------ This document is an attempt to define escape sequences for screen manipulation (such as setting attributes and animation), and for interpreting keyboard input. This has been put together from several sources, and its current format reflects this. *** WARNING *** The information here is probably incomplete and contains some inaccuracies. If such inaccuracies are found, I would be most grateful to be informed. I would also be grateful if I could be informed of other sources of similar information, especially in relation to the extended display characteristics of vt220, and any colour specific vt-term emulation. I intend to revamp this document in the future to make it more comprehensive. I take no responsibility for the use or abuse of this information. Many thanks to those responsible for the original sources. This information has been difficult to come by! Tony Nugent T.Nugent@sct.gu.edu.au November 1994 ========8<----insert-crowbar-here------------------------------ ========8<----insert-crowbar-here------------------------------ Escape codes for vt102 terminal. All numbers below are octal. means numeric value, means character string. If is missing it is 0 or in cursor movements 1. Reset and set modes Set Modes Esc [ ; ... ; h 033 133 073 073 150 Reset Modes Esc [ ; ... ; l 033 133 073 073 154 Where is '2'= Lock keyboard (set); Unlock keyboard (reset) '4'= Insert mode (set); Replace mode (reset) '12'= Echo on (set); Echo off (reset) '20'= Return = CR+LF (set); Return = CR (reset) '?1'= Cursorkeys application (set); Cursorkeys normal (reset) '?2'= Ansi (set); VT52 (reset) '?3'= 132 char/row (set); 80 char/row (reset) '?4'= Jump scroll (set); Smooth scroll (reset) '?5'= Reverse screen (set); Normal screen (reset) '?6'= Sets relative coordinates (set); Sets absolute coordinates (reset) '?7'= Auto wrap (set); Auto wrap off (reset) '?8'= Auto repeat on (set); Auto repeat off (reset) '?18'= Send FF to printer after print screen (set); No char after PS (reset) '?19'= Print screen prints full screen (set); PS prints scroll region (reset) '?25'= Cursor on (set); Cursor off (reset) Set scrolling region (n1=upper,n2=lower) Esc [ ; r 033 133 073 162 Cursor movement (=how many chars or lines), cursor stop at margin. Up Esc [ A 033 133 101 Down Esc [ B 033 133 102 Right Esc [ C 033 133 103 Left Esc [ n D 033 133 104 Cursor position (=y,=x, from top of screen or scroll region) Esc [ ; H 033 133 073 110 Or Esc [ ; f 033 133 073 146 Index (cursor down with scroll up when at margin) Esc D 033 104 Reverse index (cursor up with scroll down when at margin) Esc M 033 115 Next line (CR+Index) Esc E 033 105 Save cursor and attribute Esc 7 033 067 Restore cursor and attribute Esc 8 033 070 Keybad character selection Application keypad mode Esc = 033 075 Numeric keypad mode Esc > 033 076 Keypadkeys codes generated Numeric Application VT52 Application 0 0 (060) Esc O p (033 117 160) Esc ? p (033 077 160) 1 1 (061) Esc O q (033 117 161) Esc ? q (033 077 161) 2 2 (062) Esc O r (033 117 162) Esc ? r (033 077 162) 3 3 (063) Esc O s (033 117 163) Esc ? s (033 077 163) 4 4 (064) Esc O t (033 117 164) Esc ? t (033 077 164) 5 5 (065) Esc O u (033 117 165) Esc ? u (033 077 165) 6 6 (066) Esc O v (033 117 166) Esc ? v (033 077 166) 7 7 (067) Esc O w (033 117 167) Esc ? w (033 077 167) 8 8 (070) Esc O x (033 117 170) Esc ? x (033 077 170) 9 9 (071) Esc O y (033 117 171) Esc ? y (033 077 171) - (minus) - (055) Esc O m (033 117 155) Esc ? m (033 077 155) , (comma) , (054) Esc O l (033 117 154) Esc ? l (033 077 154) . (period) . (056) Esc O n (033 117 156) Esc ? n (033 077 156) Enter CR (015)* Esc O M (033 117 115) Esc ? M (033 077 115) PF1 Esc O P Esc O P (033 117 120) Esc P (033 120) PF2 Esc O Q Esc O Q (033 117 121) Esc Q (033 121) PF3 Esc O R Esc O R (033 117 122) Esc R (033 122) PF4 Esc O S Esc O S (033 117 123) Esc S (033 123) * Or CR+LF (015 012) Cursorkeys codes generated (changed by set and reset modes '?1') normal application Up Esc [ A Esc O A 033 133 101 033 117 101 Down Esc [ B Esc O B 033 133 102 033 117 102 Right Esc [ C Esc O C 033 133 103 033 117 103 Left Esc [ D Esc O D 033 133 104 033 117 104 Select chaacter set UK as G0 Esc ( A 033 050 101 US as G0 Esc ( B 033 050 102 Special characters and line drawing character set as G0 Esc ( 0 033 050 060 Alternate ROM as G0 Esc ( 1 033 050 061 Alternate ROM special characters character set as G0 Esc ( 2 033 050 062 UK as G1 Esc ) A 033 051 101 US as G1 Esc ) B 033 051 102 Special characters and line drawing character set as G1 Esc ) 0 033 051 060 Alternate ROM as G1 Esc ) 1 033 051 061 Alternate ROM special characters character set as G1 Esc ) 2 033 051 062 Selects G2 for one character Esc N 033 115 Selects G3 for one character Esc O 033 117 Set graphic rendition Esc [ ; m 033 133 073 156 Where is 0 = Turn off attributes 1 = Bold (Full) 2 = Half 4 = Underline 5 = Blink 7 = Reverse 21 = Normal intensity 22 = Normal intensity 24 = Cancel underlined 25 = Cancel blinking 27 = Cancel reverse Tab stops Set horizontal tab Esc H 033 110 Clear horizontal tab Esc [ g 033 133 147 Or Esc [ 0 g 033 133 060 147 Clear all horizontal tabs Esc [ 3 g 033 133 063 147 Line attributes Double-height Top half Esc # 3 033 043 063 Bottom half Esc # 4 033 043 064 Single-width, single-height Esc # 5 033 043 065 Double-width Esc # 6 033 043 066 Erasing Erase in line End of line (including cursor position) Esc [ K 033 133 113 Or Esc [ 0 K 033 133 060 113 Beginning of line (including cursor position) Esc [ 1 K 033 133 061 113 Complete line Esc [ 2 K 033 133 062 113 Erase in display End of screen (including cursor position) Esc [ J 033 133 112 Or Esc [ 0 J 033 133 060 112 Beginning of screen (including cursor position) Esc [ 1 J 033 133 061 112 Complete display Esc [ 2 J 033 133 062 112 Computer editing Delete characters ( characters right from cursor Esc [ P 033 133 120 Inser line ( lines) Esc [ L 033 133 114 Delete line ( lines) Esc [ M 033 133 115 Printing Esc [ i 033 133 151 Where is ''= Same as '0' '0'= Prints screen (full or scroll region) '4'= Printer controller off '5'= Printer controller on (Print all received chars to printer) '?1'= Print cursor line '?4'= Auto print off '?5'= Auto print on (Prints line to printer when you exit from it) Reports Device status Esc [ n 033 133 156 Where is '0'=Response Ready, no malfunctions detected '3'=Malfunction, error in self-test. '5'=Status report request '6'=Request cursor position. '?10'=Response to printer status request, All ok. '?11'=Response to printer status request, Printer is not ready. '?13'=Response to printer status request, No printer. '?15'=Status report request from printer Cursor position raport (Response to request cursor position) Esc [ ; R 033 133 073 122 Request terminal to identify itself (esc Z may not be supported in future) Esc [ c 033 133 143 Esc [ 0 c 033 133 060 143 Esc Z 033 132 Response to terminal identify (VT102) Esc [ ? 6 c 033 133 077 066 143 Reset to initial state Esc c 033 143 Tests Invoke confidence test Esc [ 2 ; y 033 133 062 073 171 Where is '1'= Power-up test '2'= Data loopback test '4'= EIA loopback test '9'= Power-up tests (continuously) '10'= Data loopback tests (continuously) '12'= EIA loopback tests (continuously) '16'= Printer loopback test '24'= Printer loopback tests (continuously) Screen adjustments Esc # 8 033 043 070 Keyboard indicator Led L1 off Esc [ 0 q 033 133 060 181 Led L1 on Esc [ 1 q 033 133 061 181 VT52 sequences Ansi mode Esc < 033 074 Cursor positioning Up Esc A 033 101 Down Esc B 033 102 Right Esc C 033 103 Left Esc D 033 104 Home Esc H 033 110 Direct cursor address Esc Y 033 131 Reverse linefeed Esc I 033 111 Erase to end of line Esc K 033 113 Erase to end of screen Esc J 033 112 Auto print on Esc ^ 033 136 Auto print off Esc 033 137 Printer controller on Esc W 033 127 Printer controller off Esc X 033 130 Print cursor line Esc V 033 135 Print screen Esc ] 033 135 Indentify request Esc Z 033 132 Response to indetify Esc / Z request (VT52) 033 057 132 Special charset (same Esc F as line draw in VT102 033 106 Normal char set Esc G 033 107 Control characters 000 = Null (fill character) 003 = ETX (Can be selected half-duplex turnaround char) 004 = EOT (Can be turnaround or disconnect char, if turn, then DLE-EOT=disc.) 005 = ENQ (Transmits answerback message) 007 = BEL (Generates bell tone) 010 = BS (Moves cursor left) 011 = HT (Moves cursor to next tab) 012 = LF (Linefeed or New line operation) 013 = VT (Processed as LF) 014 = FF (Processed as LF, can be selected turnaround char) 015 = CR (Moves cursor to left margin, can be turnaround char) 016 = SO (Selects G1 charset) 017 = SI (Selects G0 charset) 021 = DC1 (XON, causes terminal to continue transmit) 023 = DC3 (XOFF, causes terminal to stop transmitting) 030 = CAN (Cancels escape sequence) 032 = SUB (Processed as CAN) 033 = ESC (Processed as sequence indicator) ========8<----insert-crowbar-here------------------------------ ========8<----insert-crowbar-here------------------------------ VT102 Key Support ^[ refers to the ESC character (ascii(27) ^[[H Home ^[[L ^Home ^[[Or PgUp ^[[M ^PgUp ^[[Oq PgDn ^[[H^[[2J ^PgDn ^[[K End ^[[U ^End ^[OC Right Arrow ^[F ^Right Arrow ^[OD Left Arrow ^[B ^Left Arrow ^[OA Up Arrow ^[OB Down Arrow ^[On Insert ^H Backspace ascii(127) Delete ^[D ^Backspace ^[OP F1 (PF1) ^[OQ F2 (PF2) ^[OR F3 (PF3) ^[OS F4 (PF4) Keypad ^[Ol ^[Om / * - ^[Ow ^[Ox ^[Oy 7 8 9 + ^[Ot ^[Ou ^[Ov ^[OM 4 5 6 Enter ^[Oq ^[Or ^[Os 1 2 3 ^[Op ^[On 0 . VT220 Key Support vt220 is the same as vt102, with the following changes: ascii(254) ^[[17^~ ^[[18^~ ^[[19^~ F5 (Break) F6 F7 F8 ^[[20^~ ^[[21^~ ^[[23^~ ^[[24^~ F9 F10 F11 F12 ^[[25^~ ^[[26^~ ^[[28^~ ^[[29^~ F13 F14 F15 (Help) F16 (Do) ^[[31^~ ^[[32^~ ^[[33^~ ^[[34^~ F12 F17 F18 F19 F20 ^[[1^~ Home ^[[2^~ Insert ^[[3^~ Delete ^[[4^~ End -> Select ^[[5^~ PgUp -> Prev screen ^[[6^~ PgDn -> Next screen There are also enhanced display functions of the VT220 terminal for which documentation has not been found as yet. ========8<----insert-crowbar-here------------------------------ ========8<----insert-crowbar-here------------------------------ ANSI Commands ~~~~~~~~~~~~~ ++++++++++++++++++++++++++++++++++++++ NOTE: The following is an _edited_ dump of the on-line 4DOS Help on ANSI commands. Much of it applies to the vt-term codes (eg, vt100, vt102, vt220), while some may be specific to dos. Experimentation is needed. Key substitutions, for instance, are very dos specific (as far as I am aware). ++++++++++++++++++++++++++++++++++++++ An ANSI command string consists of three parts: ESC[ The ASCII character ESC, followed by a left bracket. These two characters must be present in all ANSI strings. parameters Optional parameters for the command. If there are multiple parameters they are separated by semicolons. cmd A single-letter command. The case of the letter is meaningful. For example, to position the cursor to row 7, column 12 the ANSI command is: ESC[7;12H The ESC character is ASCII 27, and can be inserted into text by literally entering it into text with an editor. Consult the documtation for your editor on how to do this. The ANSI commands need to be echo'ed or typed / cat'ed to the screen directly for them to take effect. Commands Command Description ------------------ -------------------------------------------------- ESC[rowsA Cursor up ESC[rowsB Cursor down ESC[colsC Cursor right ESC[colsD Cursor left ESC[row;colH Set cursor position (top left is row 1, column 1) ESC[2J Clear screen ESC[K Clear from cursor to end of line ESC[row;colf Set cursor position, same as "H" command ESC[=modeh Set display mode; see table of mode values below ESC[=model Set display mode; see table of mode values below ESC[attr;attr;..m Set display attributes; see table of attribute values below ESC[key;string;..p Substitute "string" for the specified key; see key substitutions section below. ESC[s Save cursor position (may not be nested) ESC[u Restore cursor position after a save Display Attributes Attribute Description --------- --------------------------------------------------- 0 All attributes off (normal white on black) 1 High intensity (bold) 2 Normal intensity 4 Underline (usually effective only on monochrome displays) 5 Blinking 7 Reverse Video 8 Invisible 30-37 Set the foreground color: 30=Black 31=Red 32=Green 33=Yellow 34=Blue 35=Magenta 36=Cyan 37=White 40-47 Set the background color: 40=Black 41=Red 42=Green 43=Yellow 44=Blue 45=Magenta 46=Cyan 47=White Settings are cumulative, so (for example) to set bright red foreground set all attributes off, then set red, then bold: echo _[0;31;1m. Display Modes Mode Description ---- --------------------------------------------------- 0 Text 40x25 monochrome 1 Text 40x25 color 2 Text 80x25 monochrome 3 Text 80x25 color 4 Graphics 320x200 4-color 5 Graphics 320x200 4-color 6 Graphics 640x200 2-color 7 (cursor wrap kludge) Mode 7 is an unfortunate kludge; Setting mode 7 with an "h" command tells ANSI to wrap text to the next line when it passes the end of a line; setting mode 7 with an "l" (lower-case L) command tells ANSI not to wrap text. For all other modes the "h" and "l" commands are equivalent. Key Substitutions The key substitutions ("p") command causes ANSI to substitute the text in "string" when the specified key is pressed. The key code can be a single character in quotes, a numeric ASCII value, or an extended code for a non ASCII key (e.g. function or cursor keys) in the form 0;n, where n is the scan code for the key. The string to be substituted can be a single character or character string in quotes, a numeric ASCII value, or an extended key code. To clear a key substitution, "substitute" the original key for itself. ========8<----insert-crowbar-here------------------------------ ========8<----insert-crowbar-here------------------------------ Some references: "VT100 User's Guide", 2nd ed., Jan 1979, DEC # EK-VT100-UG "Rainbow 100+/100B Terminal Emulation Manual", June 1984, DEC # QV069-GZ "Installing and Using The VT320 Video Terminal", June 1987, DEC # EK-VT320-UU-001 "VT320 Programmer Reference Manual", July 1987, DEC # EK-VT320-RM-001 "VT330/340 Programmer Ref Manual", 2nd ed, May 1988, Vol 1: Text programming DEC # EK-VT3XX-TP-002 Vol 2: Graphics programming DEC # EK-VT3XX-GP-002 This is from The MS-DOS Kermit internal documentation. This documentation gives a basic description of the vt330/340 codes, and hasn't been included here (yet). ("Be aware that the manuals have plenty of mistakes and tell only part of the story.") ========8<----insert-crowbar-here------------------------------ ========8<----insert-crowbar-here------------------------------ Cheers Tony _____________________________________________________________________ /_ \ Tony Nugent Griffith University, Brisbane, Queensland, Australia\___ \@)_\ Email: T.Nugent@sct.gu.edu.au tnugent@gucis.cit.gu.edu.au \(@\ \__________________________________________________________________\_/