SUMMARY: VT Escape Codes

From: Smith, Lawrie <Lawrie.Smith_at_capita.co.uk>
Date: Thu, 13 Dec 2001 12:21:51 +0000

Many thanks to ALLAN HAWDON [allan.hawdon_at_kcl.ac.uk] for

        Cursor on <CSI>?25h
        Cursor off <CSI>?25l

        where <CSI> is <ESC>[ if you're using 7-bit control sequences
                   and hex 98 if you're using 8-bit controls.

        You're probably using 7-bit.

And also to Michael A. Crowley [mcrowley_at_MtHolyoke.edu] for

Check: www.vt100.net

Included below is other VT Command codes for this who are interested.
>From http://www.cs.utk.edu/~shuford/terminal/dec.html
VT Terminal Command Codes

ANSI Compatible Mode

        Cursor Movement Commands
                Cursor up ESC [ Pn A
                Cursor down ESC [ Pn B
                Cursor forward (right) ESC [ Pn C
                Cursor backward (left) ESC [ Pn D
                Direct cursor addressing ESC [ Pl; Pc H or
                                                ESC [ Pl; Pc f
                Index ESC D
                Next Line ESC E
                Reverse index ESC M
                Save cursor and attributes ESC 7
                Restore cursor and attributes ESC 8
                * Pn = decimal parameter in string of ASCII digits.(default
1)
                * Pl = line number (default 0); Pc = column number (default
0)

        Line Size (Double-Height and Double-Width) Commands
                Change this line to double-height top half ESC
# 3
                Change this line to double-height bottom half ESC # 4
                Change this line to single-width single-height ESC # 5
                Change this line to double-width single-height ESC # 6

        Character Attributes
                ESC [ Ps;Ps;Ps;...,Ps m
                Ps = 0 or None All Attributes Off
                        1 Bold on
                        4 Underscore on
                        5 Blink on
                        7 Reverse video on
                        21 bold off
                        24 underline off
                        25 blink off
                        27 inverse off

                Any other parameter values are ignored.

        Erasing
                From cursor to end of line ESC [ K or
ESC [ 0 K
                From beginning of line to cursor ESC [ 1 K
                Entire line containing cursor ESC [ 2 K
                From cursor to end of screen ESC [ J or ESC [ 0
J
                From beginning of screen to cursor ESC [ 1 J
                Entire screen ESC [ 2 J

        Programmable LEDs
                ESC [ Ps;Ps;...Ps q
                Ps = 0 or None All LEDs Off
                        1 L1 on
                        2 L2 on
                        3 L3 on
                        4 L4 on
                Any other parameter values are ignored.




        Character Set (G0 and G1 Designators)
                Charactor Set G0 Designator G1
Designator
                United Kingdom (UK) ESC ( A ESC ) A
                United States (USASCII) ESC ( B ESC ) B
                Special graphics characters ESC ( 0 ESC ) 0
                 and line drawing set
                Alternate character ROM ESC ( 1 ESC ) 1
                Alternate character ROM ESC ( 2 ESC ) 2
                 special graphics characters

        Scrolling Region
                ESC [ Pt ; Pb r
                Pt is the number of the top line of the scrolling region;
                Pb is the number of the bottom line of the scrolling region
                and must be greater than Pt.
                (The default for Pt is line 1, the default for Pb is the end

                 of the screen)

        TAB stops
                Set tab at current column ESC H
                Clear tab at curent column ESC [ g or ESC [ 0 g
                Clear all tabs ESC [ 3 g

        Modes
                                                To Set To Reset
        Mode Name Mode Sequence Mode
Sequence
        Line feed/new line New line ESC [20h Line feed
ESC [20l
        Cursor key mode Application ESC [?1h Cursor
ESC [?l
        ANSI/VT52 mode ANSI N/A VT52
ESC [?2l
        Column mode 132 Col ESC [?3h 80 Col
ESC [?3l
        Scrolling mode Smooth ESC [?4h Jump
ESC [?4l
        Screen mode Reverse ESC [?5h Normal
ESC [?5l
        Origin mode Relative ESC [?6h Absolute
ESC [?6l
        Wraparound On ESC [?7h Off
ESC [?7l
        Auto repeat On ESC [?8h Off
ESC [?8l
        Interlace On ESC [?9h Off
ESC [?9l
        Graphic proc. option On ESC 1 Off
ESC 2
        Keypad mode Application ESC = Numeric
ESC >

        Reports
                Cursor Position Report
                Invoked by ESC [ 6 n
                Response is ESC [ Pl; Pc R
                * Pl = line number; Pc = column number

        Status Report
                Invoked by ESC [ 5 n
                Response is ESC [ 0 n (terminal ok)
                                                ESC [ 3 n (terminal not ok)

        What Are You
                Invoked by ESC [ c or ESC [ O c
                Response is ESC [ ?1 ; Ps C
                Ps = 0 Base VT100, no options
                        1 Processor option (STP)
                        2 Advanced Video option (AVO)
                        3 AVO and STP
                        4 Graphocs processor option (GO)
                        5 GO and STP
                        6 GO and AVO
                        7 GO, STP, and AVO
        Alternately invoked by ESC Z (not recommended.) Response is the
same.

        Reset
                ESC c

        Confidence Tests
        Fill Screen with "Es" ESC # 8
        Invoke Test(s) ESC [ 2 ; Ps y
        Ps = 1 Power-up self test
                                                (ROM checksum, RAM, NVR,
                                                keyboard and AVO if
installed)
                2(loop back connector required) Data Loop Back
                4(loop back connector required) ETA Modern Control Test
                8 Repeat selected test(s)
                                                indefinitely
                                                (until failure or power off)

VT52 Compatible Mode
        Cursor Up ESC A
        Cursor Down ESC B
        Cursor Right ESC C
        Cursor Left ESC D
        Select Special Graphics character set ESC F
        Select ASCII character set ESC G
        Cursor to home ESC H
        Reverse line feed ESC I
        Erase to end of screen ESC J
        Erase to end of line ESC K
        Direct cursor address ESC Ylc (see note 1)
        Identify ESC Z (see
note 2)
        Enter alternate keypad mode ESC =
        Exit alternate keypad mode ESC >
        Enter ANSI mode ESC <

        NOTE 1: Line and column numbers for direct cursor address are single
                character codes whose values are the desired number plus
                37 (in Octal). Line and column numbers start at 1.
        NOTE 2: Response to ESC Z is ESC / Z.



        Parameters to Direct cursor addressing can be omitted if 1.
        "Index" is broken if NEWLINE is enabled (set-up).
        "Reverse index" scrolls up retaining the same column.

        CHARACTER SET DESIGNATORS: G0 = Shift-In, G1 = Shift-Out

> ANSI/VT52 mode ANSI N/A VT52 ESC [?2l
        ANSI/VT52 mode ANSI ESC < VT52 ESC [?2l
        Modes can be combined using ";", for example "ESC [ ? 3 ; 4 ; 7 h"

        CONFIDENCE TESTS: Parameter bits are summed into one parameter.

        Hardcopy ESC # 7
        Graphic processor ON ESC 1
        Graphic processor OFF ESC 2

The reference card showed incorrect graphics for octal code 140; its
correct graphic is ` (accent grave).

   [The notation <ESC> denotes a single ASCII Escape character, 1Bx.]


                                ANSI mode w/cursor ANSI mode w/cursor
Cursor Key VT52 mode key mode reset key mode set
--------------------------------------------------------------------------
   UP <ESC>A <ESC>[A <ESC>OA
  DOWN <ESC>B <ESC>[B <ESC>OB
  RIGHT <ESC>C <ESC>[C <ESC>OC
  LEFT <ESC>D <ESC>[D <ESC>OD


*******************************
* Special Graphics Characters *
*******************************


        If the Special Graphics set is selected, the graphics for ASCII
codes
0137 through 0176 will be replaced according to the following table (see the
SCS control sequence).


Octal ASCII Special Octal ASCII Special
Code graphic graphic code graphic graphic
----------------------------------------------------------------------------
---
0137      _         Blank                0157       o       Horiz Line -
scan 1
0140      \         Diamond              0160       p       Horiz Line -
scan 3
0141      a         Checkerboard         0161       q       Horiz Line -
scan 5
0142      b         Digraph: HT          0162       r       Horiz Line -
scan 7
0143      c         Digraph: FF          0163       s       Horiz Line -
scan 9
0144      d         Digraph: CR          0164       t       Left "T" (|-)
0145      e         Digraph: LF          0165       u       Right "T" (-|)
0146      f         Degree Symbol        0166       v       Bottom "T" (|_)
0147      g         +/- Symbol           0167       w       Top "T" (T)
0150      h         Digraph: NL          0170       x       Vertical Bar (|)
0151      i         Digraph: VT          0171       y       Less/Equal (<_)
0152      j         Lower-right corner   0172       z       Grtr/Egual (>_)
0153      k         Upper-right corner   0173       {       Pi symbol
0154      l         Upper-left corner    0174       |       Not equal (=/)
0155      m         Lower-left corner    0175       }       UK pound symbol
0156      n         Crossing lines (+)   0176       ~       Centered dot
NOTE 1: Codes 0152-0156 and 0164-0170 are used to draw rectangular grids"
each
piece of this set is contiguous with other so the lines formed will be
unbroken.
NOTE 2: Codes 0157-0163 give better vertical resolution than dashes and
underlines when drawing graphs; using these segments, 120 x 132 resolution
may
be obtained in 132 column mode with the Advanced Video Option installed.
*****************************
* Terminal Control Commands *
*****************************
Control Characters
------------------
        The control characters recognized by the VT100 are listed below.
All
other control characters cause no action to be taken.
       Control characters (codes 00 - 037 inclusive) are specifically
excluded
from the control sequence syntax, but may be embedded within a control
sequence.  Embedded control characters are executed as soon as they are
encountered by the VT100.  The processing of the control sequence then
continues with the next character recieved.  The exceptions are: if the
<ESC>
character occurs, the current control sequence is aborted, and a new one
commences beginning with the <ESC> just recieved.  If the character <CAN>
(030) or the character <SUB> (032) occurs, the current control sequence is
aborted.  The ability to embed control characters allows the synchronization
characters XON and XOFF to be interpreted properly without affecting the
control sequence.
Control         Octal
Character       Code    Action Taken
----------------------------------------------------------------------------
--
<NUL>           0000    Ignored on input; not stored in buffer
<ENQ>           0005    Transmit ANSWERBACK message
<BEL>           0007    Sound bell
<BS>            0010    Move cursor to the left one position, unless it is
at
                        the left margin, in which case no action is taken.
<HT>            0011    Move cursor to the next tab stop, or to the right
                        margin if no further tabs are set.
<LF>            0012    Causes either a line feed or new line operation (See
                        new line mode.)
<VT>            0013    Same as <LF>.
<FF>            0014    Same as <LF>.
<CR>            0015    Move the cursor to the left margin of the current
line.
<SO>            0016    Invoke the G1 character set, as designated by the
SCS
                        control sequence.
<SI>            0017    Invoke the G0 character set, as selected by the
<ESC>(
                        sequence.
<DC1>           0021    Causes terminal to resume transmission (XON).
<DC3>           0023    Causes terminal to stop transmitting all codes
except
                        XOFF and XON (XOFF).
<CAN>           0030    If sent during a control sequence, the sequence id
                        immediately terminated and not executed.  It also
                        causes the error character (checkerboard) to be
                        displayed.
<SUB>           0032    Same as <CAN>.
<ESC>           0033    Introduces a control sequence.
<DEL>           0177    Ignored on input; not stored in buffer.
        The VT100 is an upward and downward software-compatible terminal;
that is, previous Digital video terminals have Digital's private standards
for control sequences. The American National Standards Institute has since
standardized escape and control sequences in terminals in documents
X3.41-1974
and X3.64-1977.
        The VT100 is compatible with both the previous Digital standard and
ANSI standards.  Customers may use existing Digital software designed around
the VT52 or new VT100 software.  The VT100 has a "VT52 compatible" mode in
which the VT100 responds to control sequences like a VT52.  In this mode,
most
of the new VT100 features cannot be used.
        Throughout this document references will be made to "VT52 mode" or
"ANSI mode".  These two terms are used to indicate the VT100's software
compatibility.
NOTE: The ANSI standards allow the manufacturer flexibility in implementing
each function.  This document describes how the VT100 will respond to the
implemented ANSI central function.
Definitions
-----------
        Control Sequence Introducer (CSI) - An escape sequence that provides
                supplementary controls and is itself a prefix affecting the
                interpretation of a limited number of contiguous characters.
                In the VT100, the CSI is: <ESC>[
        Parameter:  (1) A string of zero or more decimal characters which
                represent a single value.  Leading zeros are ignored.  The
                decimal characters have a range of 0 (060) to 9 (071).
                (2) The value so represented.
        Numeric Parameter:  A parameter that represents a number, designated
by
                Pn.
        Selective Parameter:  A parameter that selects a subfunction from a
                specified set of subfunctions, designated by Ps.  In
general, a
                control sequence with more than one selective parameter
causes
                the same effect as several control sequences, each with one
                selective parameter, e.g., CSI Psa; Psb; Psc F is identical
to
                CSI Psa F CSI Psb F CSI Psc F.
        Parameter String:  A string of parameters separated by a semicolon.
        Default: A function-dependent value that is assumed when no explicit
                value, or a value of 0, is specified.
        Final character:  A character whose bit combination terminates an
                escape or control sequence.
        EXAMPLE:  Control sequence to turn off all character attributes,
then
        turn on underscore and blink attributes (SGR).  <ESC>[0;4;5m
                Sequence:
                       Delimiters
                          / \
                         /   \
                         |   |
                        \ / \ /
                <ESC>[ 0 ; 4 ; 5 m
                ^^^^^^ ^   ^   ^ ^
                |||||| |   |   | |
                \||||/  \  |  /  +------Final character
                 \||/    \ | /
                 CSI   Selective
                       Parameters
                The octal representation of this string is:
                        033 0133 060 073 064 073 065 0155
                      <ESC>   [   0   ;   4   ;   5    m
                Alternate sequences which will accomplish the same thing:
                        1) <ESC>[;4;m
                        2) <ESC>[m
                           <ESC>[4m
                           <ESC>[5m
                        3) <ESC>[0;04;005m
Control Sequences
-----------------
        All of the following control sequences are transmitted from the Host
to
VT100 unless otherwise noted.  All of the control sequences are a subset of
those defined in ANSI X 3.64 1977 and ANSI X 3.41 1974.
        The following text conforms to these formatting conventions:
                1) Control characters are designated by angle brackets (e.g.
                        the Escape character is <ESC>).
                2) Parameters are indicated by curly braces.
                3) Parameter types usually are indicated as one of:
                        {Pn}    A string of digits representing a numerical
                                value.
                        {Ps}    A character that selects an item from a
list.
                        {a-z}   Any lowercase sequence of one44 or more
                                characters in braces represent a value to be
                                entered (as in {Pn}), and the name in the
                                braces will be referred to in explanatory
text.
                4) Spaces in the control sequence are present for clarity
and
                        may be omitted.  Spaces which are required will be
                        surrounded by single quotes: ' '.
                5) All other characters are literals.
Kind regards
Lawrie Smith
Capita Technical Services
West Malling
email:	lawrie.smith_at_capita.co.uk
Tel:	01732 877266
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
Received on Thu Dec 13 2001 - 12:23:27 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:43 NZDT