#
VT100

<it>Please note that this text is under construction.</it>

## Preface

This document accompanies the Konsole program, which is a terminal emulation for the X Windows System. Since material about the extend and precise semantics of the emulatation intended to be handled by this programs is hard to find on the internet today, it came out nessesary to include a more precise specification within their release. Hopefully, this helps to clearify the relation to the VT100, VT102, Linux, XTerm and ansi.sys (ANSI-BBS) terminals, which are the target of these programs. Further, it specifies which codes are interpreted by them, and what has been omitted.

To begin with, all of the above call themselfes "ANSI" emulations, which makes this notion pretty vage. "ANSI" referes here to the American National Standards Institute's documents X3.41-1974 and X3.64-1977. DEC partially implemented this standart in their VT100 terminal, with some additions. The VT102 is a later extention of that. Both the Linux console and the XTerm emulation implement most of VT102, with some additions. MS stepped in later and produced another ANSI emulation, `ansi.sys`, for their OS, which became of some relevance in BBS style telecommunication programs. One can view this as a small subset of the VT100 emulation, with some additions, of cause. This situation is further confused by the fact, that often many versions of the above terminals and emulations are out, one able to do a little more or less then the other.

I'm working towards a close integration of the konsole's source code with this document, but it is still a long way to go.

Currently, the body of this document is mainly a concept data base, that referes to the VT100 component of the emulation. Though the codes accepted by konsole are now clearly indicated, a comparison to the xterm and Linux console emulation is missing.

The konsole emulation sources is not linked closely with it's documentation, and, also accurate at the time of writing, it can still fall slightly appart, though the codes accepted and produced by konsole should be properly listed. Work is currently in progress to fix this issue.

## Notes & todos

- Include complete reference on keyboard material.
- Check for explaination of out-of-bound values.
- Include VT52, VT102, XTERM, LINUX-console codes
- Make the whole document more concept oriented
- See the section Method of description, below
- Derive some summarizing lists.

## Introduction

In a traditional UNIX installation a single machine (host) served several users by means of terminals attached to this host by a serial cable. These terminals (end points) where specialized devices, either regular ttys (printer with keyboard) or later more sophisticated things with cathode ray tubes.

Today, hardware has become so cheap, that each single user could be provided with a complete host/display combination for the former price of a terminal.

Additional, and here we come to the X in the emulation, display devices have become graphical while the original terminal where only able to show characters but not graphics.

To allow programs designed for the original configuration to be used in the contemporary setup, "terminal emulations" where invented. In these emulations, the whole original setup is simulated.

The serial cable is folded into the operating system as a sort of loop back device, and a program, the terminal emulation, uses modern means of graphical user interfaces to behave like an earlier terminal. To complete the picture, the host in the diagram is replaced by the application that runs in the emulation (typically a shell or an old editor). So, terminal emulations are in fact interfaces to character oriented applications.

This document describes the implementations of a program named "konsole", which is such an X terminal emulation. Since konsole is distributed under the GPL, meaning that it's source code is available to whoever likes to hack on it, the program would be incomplete without a proper introduction into the code and it's concepts. Thus, this text is to complement the program and the source with the remaining informations to make a complete product.

## A first refinement

Before we can come to the actual implementation, quite some notions have to be introduced. We have to get us an idea what a terminal emulation does in more detail.

To this end, a simple model of the terminal and it's operation is given, which is later extended and refined as we come deeper into matter and implementation.

At some level conception, a terminal can be described as a (abstract) data model. This means it has some type of state together with operations on that data type. These operations are somehow encoded to be passed over the serial line.

The concrete model is often loosely named the "emulation", the specific encoding chosen, the "protocol".

There are two principle models in use. The first, stream like one, which is related to a tty, consideres the terminal as an indefinit long and wide sheet of paper on which a printer head types the characters that come in over the line. Typical examples are shell scripts, make and other programs producing sequential protocols of their activity. Their basic data type is a list of list of characters.

The second principle model is used by applications written especially for crt devices, so called full screen applications. These treat the terminal as a matrix of characters where each position can be individually addressed and written to. Typical representatives are full screen editors like vi and emacs, file managers like mc and mail readers like mutt.

Though the second model is newer, it's age does not imply a preference. To the contrary, both models have a right for their own and are both to be supported. The first model is fully expressed within konsole in form of it's ref:history buffer.

Note, that although the second model definitely build on the first one in almost any respect, it cannot fully express it, since it introduces a finite line length, while the first model works with indefinite lines.

Since application with both view of things are typically run within the same session, some effort has been made within konsole to maintain both ideas simultaniously, but only with limited success so far.

In both models, the notion of a current position (historically a printer's head, nowadays visualized by a cursor) is present. "Printing" a charater at the current position and advancing the head together with the starting a new line are the most fundamental operations of the emulation.

The full screen model basically adds the possibility to position the cursor and to overwrite and clear the screen.

A plethora of additional (more or less usefull) commands are then added on this by every specific emulation, see below for the awful details.

## Parts of the model

<it>All the following in this section is an outline</it>.

Parts of the terminal description

- State
  This is mainly the screen, the cursor (including it's graphical state) and some hidden mode variables. Note that the state cannot be investigated by the attached host.
- Interface
  That's what goes over the wire. Beside being related to objects, this appears so closely related to contemporal process communication, that it might be discussed in likely terms.
  We have information flowing in both directions. On could destinguist between:
- Commands
  These are "calls" of the terminals interface by the host which cause some change of the terminals state, but do not end in a response.
- Requests
  These are "calls" of the terminals interface by the host which do not cause any change of the terminals state, but end in a response of the terminal. Clearly, requests are somehow used to investigate the state of the terminal.
- Events
  These are signals from the terminal caused by the user affecting the mouse or keyboard to the host.
- Replys
  These are send by the terminal as a result of a Request from the hosts.
- Encoding/Decoding

##

Control Sequences

Conceptually, the commands to the terminal emulation are encoded if form of byte sequences to meet the restrictions of the transport media. These sequences have pretty different originations and therefore the format of the sequences are inhomogenous.

Refering both to their origin and form, one can group the overall encoding schemes as follows:

Name | Pattern | Scope | Comment
Printable Ascii Characters | 32..126 | ASCII ECMA | This is the most original pattern of all. The characters to be displayed are passed over the chanel and are interpreted by the terminal (emulation) as instructions to display the corresponding glyph of the ascii character set. Contempory emulations include the upper half (128..255) of the extentions to the national ascii character sets, also.
Ascii Control Characters | 0..26,28..31,127 | ASCII ECMA | Ascii defines some non-printable, but format effecting characters, too. Depending on the emulation, at least some of them are given a meaning. The typically implemented ones are those that are handled by a teletype like device.
Simple Escape Sequence | ESC C | ECMA | These sequences are made up from an ESC character followed by exactly one other character in the range ???..???.
CSI Sequence | ESC [ Parameters {I} C | ECMA |
The remaining codes are nonstandard but traditionalized hacks.
DEC hacks | ESC C D | VT100 |
XTERM hacks | ESC ] Pn ; text BEL | XTERM |
VT52 uses a different (incompatible) set of escape codes. VT100 includes the VT52 emulation as a mode.
Simple Escape Sequence | ESC C | VT52 |
Complex Escape Sequence | ESC Y X Y | VT52 |

### More on Control Sequences

#### Control Characters

Control characters (codes 0x00 - 0x1f 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 a 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 (0x0c) or the character SUB (0x0e) 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.

#### CSI Sequences

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).

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:

- `<ESC>[;4;m`
- `<ESC>[m`
  `<ESC>[4m`
  `<ESC>[5m`
- `<ESC>[0;04;005m`

#### DEC hacks

These form two groups of commands.

In one first the first character is a hash (#) and the following a digit. This command group is used to denote VT100 specific instructions and can safely be sonsidered to be obsolete. See DECALN, DECDHLB, DECDHLT, DECDWL and DECSWL.

The second one is used to specify character set mappings (see SCS). A CSI instruction to do this is specified in ECMA, and this should be used as a replacement.

#### XTERM hacks

##

Host to Terminal (Instructions by Code)

### CSI codes

ICH | CSI | @ | {Pn} | Insert Character
CUU | CSI | A | {Pn} | Cursor Up
CUD | CSI | B | {Pn} | Cursor Down
CUF | CSI | C | {Pn} | Cursor Foreward
CUB | CSI | D | {Pn} | Cursor Backward
CHA | CSI | G | {Pn} | Cursor Horizontal Absolute
CUP | CSI | H | {Pn;Pn} | Cursor Position
ED | CSI | J | {Ps} | Erase in Display
EL | CSI | K | {Ps} | Erase in Line
IL | CSI | L | {Pn} | Insert Line
DL | CSI | M | {Pn} | Delete Line
DCH | CSI | P | {Pn} | Delete Character
CPR | CSI | R | {Pn;Pn} | Cursor Position Report
ECH | CSI | X | {Pn} | Erase Character
DA | CSI | c | {Pn} | Device Attributes Request
VPA | CSI | d | {Pn} | Vertical Position Absolute
HVP | CSI | f | {Pn;Pn} | Horizontal and Vertical Position
TBC | CSI | g | {Ps} | Tabulation Clear
SM | CSI | h | {Ps;...} | Set Mode
MC | CSI | i | {Pn} | Media Copy
RM | CSI | l | {Ps;...} | Reset Mode
SGR | CSI | m | {Ps;...} | Select Graphic Rendition
DSRREQ | CSI | n | {Ps} | Device Status Report
DSRREP | CSI | n | {Status} | Device Status Report Reply
DECLL | CSI | q | {Ps;...} | Load LEDs
DECSTBM | CSI | r | {Pn;Pn} | Set Top and Bottom Margins
DECREQTPARM | CSI | x | {Ps} | Request Terminal Parameters
DECREPTPARM | CSI | x | {sol;par;nbits;xspd;rspd;cmul;flags} | Report Terminal Parameters
DECTST | CSI | y | {2;Ps} | Invoke Confidence Test

### CTL codes

NUL | CTL | @ |  | Null
SOH | CTL | A |  | Start Of Heading
STX | CTL | B |  | Start Of Text
ETX | CTL | C |  | End Of Text
EOT | CTL | D |  | End Of Transmission
ENQ | CTL | E |  | Enquiry
ACK | CTL | F |  | Acknowledge
BEL | CTL | G |  | Bell
BS | CTL | H |  | Back Space
HT | CTL | I |  | Horizontal Tabulation
LF | CTL | J |  | Line Feed
VT | CTL | K |  | Vertical Tabulation
FF | CTL | L |  | Form Feed
CR | CTL | M |  | Carriage Return
LS0 | CTL | N |  | Lock Shift Zero (Shift Out - SO)
LS1 | CTL | O |  | Lock Shift One (Shift In - SI)
DLE | CTL | P |  | Data Link Escape
DC1 | CTL | Q |  | Device Control One
DC2 | CTL | R |  | Device Control Two
DC3 | CTL | S |  | Device Control Three
DC4 | CTL | T |  | Device Control Four
NAK | CTL | U |  | Negative Acknowledge
SYN | CTL | V |  | Synchronous Idle
ETB | CTL | W |  | End Of Transmission Block
CAN | CTL | X |  | Cancel
EM | CTL | Y |  | End Of Medium
SUB | CTL | Z |  | Substitute
ESC | CTL | [ |  | Escape
FS | CTL | \ |  | File Separator (IS4 - Information Separator Four)
GS | CTL | ] |  | Group Separator (IS3 - Information Separator Three)
RS | CTL | ^ |  | Record Separator (IS2 - Information Separator Two)
US | CTL | _ |  | Unit Separator (IS1 - Information Separator One)

### DEL codes

DEL | DEL |  |  | Delete Character

### ESC codes

DECSC | ESC | 7 |  | Save Cursor
DECRC | ESC | 8 |  | Restore Cursor
VT52ANSI | ESC | < |  | VT52 ANSI Ansi Mode
VT52KPAM | ESC | = |  | VT52 Enter alternate keypad mode
VT52KPNM | ESC | > |  | VT52 Exit alternate keypad mode
VT52CUU | ESC | A |  | VT52 Cursor Up
VT52CUD | ESC | B |  | VT52 Cursor Down
VT52CUF | ESC | C |  | VT52 Cursor Forward
VT52CUB | ESC | D |  | VT52 Cursor Back
NEL | ESC | E |  | Next Line
VT52SCSF | ESC | F |  | VT52 Select special graphics character set
VT52SCSG | ESC | G |  | VT52 Select ASCII character set
HTS | ESC | H |  | Horizontal Tab Set
VT52RI | ESC | I |  | VT52 Reverse Index
VT52EDS | ESC | J |  | VT52 Clear To End Of Screen
VT52EDL | ESC | K |  | VT52 Clear To End Of Line
RI | ESC | M |  | Reverse Index
DECID | ESC | Z |  | Identify Terminal
RIS | ESC | c |  | Reset to Initial State
LS2 | ESC | n |  | Lock Shift Two
LS3 | ESC | o |  | Lock Shift Three

### HSH codes

DECDHLT | HSH | 3 |  | Double Height Line (Top)
DECDHLB | HSH | 4 |  | Double Height Line (Bottom)
DECSWL | HSH | 5 |  | Single-width Line
DECDWL | HSH | 6 |  | Double Width Line
DECALN | HSH | 8 |  | Screen Alignment Display

### PRI codes

DECDA | PRI | c | {1;Pn} | Device Attributes Reply
DECSET | PRI | h | {Ps;...} | DEC Private Set Mode
DECRST | PRI | l | {Ps;...} | DEC Private Reset Mode
XTERESTORE | PRI | r | {Ps;...} | XTerm Private Restore Mode
XTESAVE | PRI | s | {Ps;...} | XTerm Private Save Mode

### PRN codes

PRINT | PRN |  | {0x20..0x7e,0xa0..0xff} | Printable Characters

### SCS codes

SCS | SCS |  | {Pc;Cs} | Select Character Set

### VT5 codes

VT52CUP | VT5 |  | {X;Y} | VT52 Cursor Position

##

Host to Terminal (Instructions by Group)

- Host to Terminal (Commands,Requests)
  - Commands
    - Character Display Operation
    - Rendition related status
    - Cursor
    - Cursor related status
    - Edit
    - Miscellaneous
    - General mode setting
    - Miscellaneous status
    - VT52
    - Not implemented
    - Ignored
  - Requests
- Terminal to Host (Replies, Events)
  - Replies
  - Events
- Modes
  - Modes

### Commands (Character Display Operation)

PRINT | PRN |  | {0x20..0x7e,0xa0..0xff} | Printable Characters

### Commands (Rendition related status)

LS0 | CTL | N |  | Lock Shift Zero (Shift Out - SO)
LS1 | CTL | O |  | Lock Shift One (Shift In - SI)
LS2 | ESC | n |  | Lock Shift Two
LS3 | ESC | o |  | Lock Shift Three
SCS | SCS |  | {Pc;Cs} | Select Character Set
SGR | CSI | m | {Ps;...} | Select Graphic Rendition

### Commands (Cursor)

BS | CTL | H |  | Back Space
CHA | CSI | G | {Pn} | Cursor Horizontal Absolute
CR | CTL | M |  | Carriage Return
CUB | CSI | D | {Pn} | Cursor Backward
CUD | CSI | B | {Pn} | Cursor Down
CUF | CSI | C | {Pn} | Cursor Foreward
CUP | CSI | H | {Pn;Pn} | Cursor Position
CUU | CSI | A | {Pn} | Cursor Up
FF | CTL | L |  | Form Feed
HT | CTL | I |  | Horizontal Tabulation
HVP | CSI | f | {Pn;Pn} | Horizontal and Vertical Position
IND | ESC | D |  | Index
LF | CTL | J |  | Line Feed
NEL | ESC | E |  | Next Line
RI | ESC | M |  | Reverse Index
VPA | CSI | d | {Pn} | Vertical Position Absolute
VT | CTL | K |  | Vertical Tabulation

### Commands (Cursor related status)

DECRC | ESC | 8 |  | Restore Cursor
DECSC | ESC | 7 |  | Save Cursor
DECSTBM | CSI | r | {Pn;Pn} | Set Top and Bottom Margins
HTS | ESC | H |  | Horizontal Tab Set
TBC | CSI | g | {Ps} | Tabulation Clear

### Commands (Edit)

DCH | CSI | P | {Pn} | Delete Character
DL | CSI | M | {Pn} | Delete Line
ECH | CSI | X | {Pn} | Erase Character
ED | CSI | J | {Ps} | Erase in Display
EL | CSI | K | {Ps} | Erase in Line
ICH | CSI | @ | {Pn} | Insert Character
IL | CSI | L | {Pn} | Insert Line

### Commands (Miscellaneous)

BEL | CTL | G |  | Bell
CAN | CTL | X |  | Cancel
DECALN | HSH | 8 |  | Screen Alignment Display
DECTST | CSI | y | {2;Ps} | Invoke Confidence Test
SUB | CTL | Z |  | Substitute

### Commands (General mode setting)

DECRST | PRI | l | {Ps;...} | DEC Private Reset Mode
DECSET | PRI | h | {Ps;...} | DEC Private Set Mode
RM | CSI | l | {Ps;...} | Reset Mode
SM | CSI | h | {Ps;...} | Set Mode
XTERESTORE | PRI | r | {Ps;...} | XTerm Private Restore Mode
XTESAVE | PRI | s | {Ps;...} | XTerm Private Save Mode

### Commands (Miscellaneous status)

DECKPAM | ESC | = |  | Keypad Application Mode
DECKPNM | ESC | > |  | Keypad Numeric Mode
RIS | ESC | c |  | Reset to Initial State
VT52ANSI | ESC | < |  | VT52 ANSI Ansi Mode

### Commands (VT52)

VT52CUB | ESC | D |  | VT52 Cursor Back
VT52CUD | ESC | B |  | VT52 Cursor Down
VT52CUF | ESC | C |  | VT52 Cursor Forward
VT52CUH | ESC | H |  | VT52 Cursor Home
VT52CUP | VT5 |  | {X;Y} | VT52 Cursor Position
VT52CUU | ESC | A |  | VT52 Cursor Up
VT52EDL | ESC | K |  | VT52 Clear To End Of Line
VT52EDS | ESC | J |  | VT52 Clear To End Of Screen
VT52KPAM | ESC | = |  | VT52 Enter alternate keypad mode
VT52KPNM | ESC | > |  | VT52 Exit alternate keypad mode
VT52REP | ESC | Z |  | VT52 Report Terminal Type
VT52RI | ESC | I |  | VT52 Reverse Index
VT52SCSF | ESC | F |  | VT52 Select special graphics character set
VT52SCSG | ESC | G |  | VT52 Select ASCII character set

### Commands (Not implemented)

DECDHLB | HSH | 4 |  | Double Height Line (Bottom)
DECDHLT | HSH | 3 |  | Double Height Line (Top)
DECDWL | HSH | 6 |  | Double Width Line
DECLL | CSI | q | {Ps;...} | Load LEDs
DECSWL | HSH | 5 |  | Single-width Line
MC | CSI | i | {Pn} | Media Copy

### Commands (Ignored)

ACK | CTL | F |  | Acknowledge
DC2 | CTL | R |  | Device Control Two
DC3 | CTL | S |  | Device Control Three
DC4 | CTL | T |  | Device Control Four
DEL | DEL |  |  | Delete Character
DLE | CTL | P |  | Data Link Escape
EM | CTL | Y |  | End Of Medium
EOT | CTL | D |  | End Of Transmission
ETB | CTL | W |  | End Of Transmission Block
ETX | CTL | C |  | End Of Text
FS | CTL | \ |  | File Separator (IS4 - Information Separator Four)
GS | CTL | ] |  | Group Separator (IS3 - Information Separator Three)
NAK | CTL | U |  | Negative Acknowledge
NUL | CTL | @ |  | Null
RS | CTL | ^ |  | Record Separator (IS2 - Information Separator Two)
SOH | CTL | A |  | Start Of Heading
STX | CTL | B |  | Start Of Text
SYN | CTL | V |  | Synchronous Idle
US | CTL | _ |  | Unit Separator (IS1 - Information Separator One)

### Commands (Requests)

DA | CSI | c | {Pn} | Device Attributes Request
DECID | ESC | Z |  | Identify Terminal
DECREQTPARM | CSI | x | {Ps} | Request Terminal Parameters
DSRREQ | CSI | n | {Ps} | Device Status Report
ENQ | CTL | E |  | Enquiry

##

Terminal to Host

### Replies

CPR | CSI | R | {Pn;Pn} | Cursor Position Report
DECDA | PRI | c | {1;Pn} | Device Attributes Reply
DECREPTPARM | CSI | x | {sol;par;nbits;xspd;rspd;cmul;flags} | Report Terminal Parameters
DSRREP | CSI | n | {Status} | Device Status Report Reply

### Events

CUB | CSI | D | {Pn} | Cursor Backward
CUD | CSI | B | {Pn} | Cursor Down
CUF | CSI | C | {Pn} | Cursor Foreward
CUU | CSI | A | {Pn} | Cursor Up
KEYBOARD |  |  |  | Keyboard Events
MOUSE |  |  |  | Mouse Events

##

Modes

### Modes

DECANM |  |  |  | ANSI/VT52 Mode
DECARM |  |  |  | Auto Repeat Mode
DECAWM |  |  |  | Autowrap Mode
DECCKM |  |  |  | Cursor Keys Mode
DECCOLM |  |  |  | Column Mode
DECINLM |  |  |  | Interlace Mode
DECKPAM | ESC | = |  | Keypad Application Mode
DECKPNM | ESC | > |  | Keypad Numeric Mode
DECOM |  |  |  | Origin Mode
DECRC | ESC | 8 |  | Restore Cursor
DECRST | PRI | l | {Ps;...} | DEC Private Reset Mode
DECSC | ESC | 7 |  | Save Cursor
DECSCLM |  |  |  | Scrolling Mode
DECSCNM |  |  |  | Screen Mode
DECSET | PRI | h | {Ps;...} | DEC Private Set Mode
DECSTBM | CSI | r | {Pn;Pn} | Set Top and Bottom Margins
HTS | ESC | H |  | Horizontal Tab Set
LNM |  |  |  | Line Feed/New Line Mode
LS0 | CTL | N |  | Lock Shift Zero (Shift Out - SO)
LS1 | CTL | O |  | Lock Shift One (Shift In - SI)
LS2 | ESC | n |  | Lock Shift Two
LS3 | ESC | o |  | Lock Shift Three
RIS | ESC | c |  | Reset to Initial State
RM | CSI | l | {Ps;...} | Reset Mode
SCS | SCS |  | {Pc;Cs} | Select Character Set
SGR | CSI | m | {Ps;...} | Select Graphic Rendition
SM | CSI | h | {Ps;...} | Set Mode
TBC | CSI | g | {Ps} | Tabulation Clear
VT52ANSI | ESC | < |  | VT52 ANSI Ansi Mode
XTERESTORE | PRI | r | {Ps;...} | XTerm Private Restore Mode
XTESAVE | PRI | s | {Ps;...} | XTerm Private Save Mode

##

Appendix A - Notion Details

The following text is a collection of several sorts of definitions and explainations. It is incomplete in many respects and a working draft. .

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:

- Individual character literals are set in bold face. Ascii representation is used throughout, so ESC means the binary value of 27 and [ a value of 91.

- Parameters are indicated by italic type faces.
- 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 one or more characters represent a value to be entered (as in Pn), and the name in the will be referred to in explanatory text.

- Spaces are used only to improve readability, they do not occure in the control sequences unless otherwise indicated.

The following attributes below have the following meaning:

- VT100 - This code is known to VT100.
- ANSI - This code is defined by ANSI.
- DEC - This code is DEC private.
- Command - Sent from host to the terminal. FIXME:add Inquiery.
- Reply - Sent from terminal to the host (as response to an Inquiery).
- Event - Sent from terminal to the host (caused by a user activity).
- Mode - The entry is a mode.

ACK | Acknowledge | VT100 XTERM Linux KONSOLE
| `0x06`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
BEL | Bell | VT100
| `0x07`
| Sound bell
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | gui | Bell |  | see above
BS | Back Space | VT100
| `0x08`
| Move cursor to the left one position, unless it is at the left margin, in which case no action is taken.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | BackSpace |  | see above
CAN | Cancel | VT100
| `0x18`
| If sent during a control sequence, the sequence id immediately terminated and not executed. It also causes the error character (checkerboard) to be displayed.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | ShowCharacter | 2 | see above
CHA | Cursor Horizontal Absolute | ECMA KONSOLE
| `ESC [ Pn G`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | xterm | scr | setCursorX | p | see above
CPR | Cursor Position Report | ECMA VT100
| `ESC [ Pn;Pn R` | Default: 1 1

The CPR sequence reports the active position by means of the parameters. This sequence has two parameter values, the first specifying the line and the second specifying the column. The default condition with no parameters present, or parameters of 0, is equivalent to a cursor at home position.

The numbering of the lines depends upon the state of the Origin Mode (DECOM).

This control sequence is sent in reply to a device status report (DSRREQ) command sent from the host.

CR | Carriage Return | VT100
| `0x0d`
| Move the cursor to the left margin of the current line.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | Return |  | see above
CUB | Cursor Backward | ECMA VT100
| `ESC [ Pn D` | Default: 1
| Moves the cursor to the left. The distance moved is determined by the parameter. If the parameter missing, zero, or one, the cursor is moved one position. The cursor cannot be moved past the left margin.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | cursorLeft | p | see above
CUD | Cursor Down | ECMA VT100
| `ESC [ Pn B` | Default: 1
| Moves the cursor down a number of lines as specified in the parameter without changing columns. The cursor cannot be moved past the bottom margin.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | cursorDown | p | see above
CUF | Cursor Foreward | ECMA VT100
| `ESC [ Pn C` | Default: 1
| Moves the cursor to the right a number of positions specified in the parameter. The cursor cannot be moved past the right margin.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | cursorRight | p | see above
CUP | Cursor Position | ECMA VT100
| `ESC [ Pn;Pn H` | Default: 1 1

Moves the curor to the position specified by the parameters. The first parameter specifies the line, and the second specifies the column. A value of zero for either line or column moves the cursor to the first line or column in the display. The default string (<ESC>H) homes the cursor. In the VT100, this command behaves identically to it's format effector counterpart, HVP.

The numbering of the lines depends upon the state of the Origin Mode (DECOM).

| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | setCursorYX | p,q | see above
CUU | Cursor Up | ECMA VT100
| `ESC [ Pn A` | Default: 1
| Moves the cursor up without changing columns. The cursor is moved up a number of lines as indicated by the parameter. The cursor cannot be moved beyond the top margin.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | cursorUp | p | see above
DA | Device Attributes Request | ECMA VT100
| `ESC [ Pn c` | Default: 0
| The host requests the VT100 to send a DA sequence to indentify itself. This is done by sending the DA sequence with no parameters, or with a parameter of zero. The device replies by (DECDA).
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | reportTerminalType |  | see above
DC1 | Device Control One | VT100
| `0x11`
| Causes terminal to resume transmission (XON).
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
DC2 | Device Control Two | VT100 XTERM Linux KONSOLE
| `0x12`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
DC3 | Device Control Three | VT100 XTERM Linux KONSOLE
| `0x13`
| Causes terminal to stop transmitting all codes except XOFF and XON (XOFF).
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
DC4 | Device Control Four | VT100 XTERM Linux KONSOLE
| `0x14`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
DCH | Delete Character | ECMA KONSOLE
| `ESC [ Pn P`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | xterm | scr | deleteChars | p | see above
DECALN | Screen Alignment Display | VT100
| `ESC # 8`
| Causes the VT100 to fill it's screen with uppercase Es for screen focus and alignment.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | helpAlign |  | see above
DECANM | ANSI/VT52 Mode | VT100
| This is a private parameter to the SM and RM control sequences. The reset state causes only VT52 compatible escape sequences to be recognized. The set state causes only ANSI compatible escape sequences to be recognized. See the entries for MODES, SM, RM and VT52ANSI.
DECARM | Auto Repeat Mode | VT100
| This is a private parameter to the SM and RM control sequences. The reset state causes no keyboard keys to auto-repeat, the set state causes most of them to. See MODES, SM and RM.
DECAWM | Autowrap Mode | VT100
| This is a private parameter to the SM and RM control sequences. The reset state prevents the cursor from moving when characters are recieved while at the right margin. The set state causes these characters to advance to the next line, causing a scroll up if required and permitted. See MODES, SM, and RM.
DECCKM | Cursor Keys Mode | VT100
| This is a private parameter to the SM and RM control requences. This mode is only effective when the terminal is in keypad application mode (DECKPAM) and the ANSI/VT52 mode (DECANM) is set. Under these conditions, if this mode is reset, the cursor keys will send ANSI cursor control commands. If setm the cursor keys will send application function commands. See MODES, RM, and SM.
DECCOLM | Column Mode | VT100
| This is a private parameter to the SM and RM control sequences. The reset state causes an 80 column screen to be used. The set state causes a 132 column screen to be used. See MODES, RM, and SM.
DECDA | Device Attributes Reply | VT100
| `ESC [ ? 1;Pn c`
| Response to the DA request (VT100 to host) is generated by the VT100 as a DECDA control sequence with the numeric parameters as follows:
| Pn | Meaning
| 0 | No options
| 1 | Processor Option (STP)
| 2 | Advanced Video Option (AVO)
| 3 | AVO and STP
| 4 | Graphics Option (GPO)
| 5 | GPO and STP
| 6 | GPO and AVO
DECDHLB | Double Height Line (Bottom) | VT100
| `ESC # 4`

This sequence cause the line containing the cursor to become the bottom half of a double-height, double width line. If the line was single width single height, all characters to the right of the center of the screen will be lost. The cursor remains over the same character position, unless it would be to the right of the right margin, in which case it is moved to the right margin.

DECDHLB and DECDHLT should be used in pairs on adjacent lines with each line containing the same character string.

| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
DECDHLT | Double Height Line (Top) | VT100
| `ESC # 3`

Cause the line containing the cursor to become the top half of a double-height, double width line. If the line was single width single height, all characters to the right of the center of the screen will be lost. The cursor remains over the same character position, unless it would be to the right of the right margin, in which case it is moved to the right margin.

DECDHLB and DECDHLT should be used in pairs on adjacent lines with each line containing the same character string.

| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
DECDWL | Double Width Line | VT100
| `ESC # 6`
| This causes the line that contains the cursor to become double-width single height. If the line was single width, all characters ro the right of the center of the screen will be lost. The cursor remains over the same character position, unless it would be to the right of the right margin, in which case it is moved to the right margin.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
DECID | Identify Terminal | VT100
| `ESC Z`
| This sequence causes the same response as the DA sequence. This sequence will not be supported in future models.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | reportTerminalType |  | see above
DECINLM | Interlace Mode | VT100
| This is a private parameter to the RM and SM control sequences. The reset state (non-interlace) causes the video processor to display 240 scan lines per frame. The set state causes the video processor to display 480 scan lines per screen. See MODES, RM, and SM.
DECKPAM | Keypad Application Mode | VT100
| `ESC =`
| The auxiliary keypad keys will transmit control sequences.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | setMode | MODE_AppKeyPad | see above
DECKPNM | Keypad Numeric Mode | VT100
| `ESC >`
| The auxiliary keypad keys will send ASCII codes corresponding to the characters engraved on their keys.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | resetMode | MODE_AppKeyPad | see above
DECLL | Load LEDs | VT100
| `ESC [ Ps;... q` | Default: 0
| Load the four programmable LEDs on the keyboard according to the parameter(s).
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 0 | VT100 | emu | Ignore |  | Clear all LEDs
| 1 | VT100 | emu | Ignore |  | Light LED 1
| 2 | VT100 | emu | Ignore |  | Light LED 2
| 3 | VT100 | emu | Ignore |  | Light LED 3
| 4 | VT100 | emu | Ignore |  | Light LED 4
DECOM | Origin Mode | VT100

This is a private parameter to SM and RM control sequences. The reset state causes the origin (or home position) to be the upper left character position of the screen. Line and column numbers are, therefore, independent of current margin settings. The cursor may be positioned outside the margins with a cursor position (CUP) or horizontal and vertical position (HVP) control.

The set state causes the origin to be at the upper left character position within the current margins. Line and column numbers are, therefore, relative to the current margin settings. The cursor cannot be positioned outside of the margins.

The cursor is moved to the new home position when this mode is set or reset. Lines and columns are numbered consecutively, with the origin being line 1, column 1.

DECRC | Restore Cursor | VT100
| `ESC 8`
| This sequence causes the previously saved cursor position, graphic rendition, and character set to be restored.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | restoreCursor |  | see above
DECREPTPARM | Report Terminal Parameters | ECMA VT100
| `ESC [ sol;par;nbits;xspd;rspd;cmul;flags x`
| This sequence is generated by the VT100 to notify the host of the status of selected terminal parameters. The status sequence may be sent when requested by the host (via DECREQTPARM) or at the terminal's discretion. On power up or reset, the VT100 is inhibited from sending unsolicited reports. The meanings of the sequence paramters are:
| cmul | Meaning
| 1 | The bit rate multiplier is 16
| flags | Meaning
| 0-15 | This value communicates the four switch values in block 5 of SET-UP B, which are only visible to the user when an STP option is installed.
| nbits | Meaning
| 1 | 8 bits per character
| 2 | 7 bits per character
| par | Meaning
| 1 | No parity set
| 4 | Parity set and odd
| 5 | Parity set and even
| sol | Meaning
| 1 | This message is a report.
| 2 | This message is a report, and the terminal is only reporting on request.
| speed | Meaning (xspd,rspd)
| 0 | Speed set to 50 bps
| 8 | Speed set to 75 bps
| 16 | Speed set to 110 bps
| 24 | Speed set to 134.5 bps
| 32 | Speed set to 150 bps
| 40 | Speed set to 200 bps
| 48 | Speed set to 300 bps
| 56 | Speed set to 600 bps
| 64 | Speed set to 1200 bps
| 72 | Speed set to 1800 bps
| 80 | Speed set to 2000 bps
| 88 | Speed set to 2400 bps
| 96 | Speed set to 3600 bps
| 104 | Speed set to 4800 bps
| 112 | Speed set to 9600 bps
| 120 | Speed set tp 19200 bps
DECREQTPARM | Request Terminal Parameters | ECMA VT100
| `ESC [ Ps x`
| The host sends this sequence to request the VT100 to send a DECREPTPARM sequence back. {Ps} can be either 0 or 1. If 0, the terminal will be allowed to send unsolicited DECREPTPARMs. These reports will be generated each time the terminal exits the SET-UP mode. If {Ps} is 1, then the terminal will only generate DECREPTPARMs in response to a request.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 0 | VT100 | emu | reportTerminalParms | 2 | Meaning
| 1 | VT100 | emu | reportTerminalParms | 3 | Meaning
DECRST | DEC Private Reset Mode | VT100 KONSOLE
| `ESC [ ? Ps;... l`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 1 | VT100 | emu | resetMode | MODE_AppCuKeys | Meaning
| 2 | VT100 | emu | resetMode | MODE_Ansi | Meaning
| 3 | VT100 | emu | setColumns | 80 | Meaning
| 4 | VT100 | emu | Ignored |  | Meaning
| 5 | VT100 | scr | resetMode | MODE_Screen | Meaning
| 6 | VT100 | scr | resetMode | MODE_Origin | Meaning
| 7 | VT100 | scr | resetMode | MODE_Wrap | Meaning
| 8 | VT100 | emu | Ignored |  | Meaning
| 9 | VT100 | emu | Ignored |  | Meaning
| 25 | VT100 | emu | resetMode | MODE_Cursor | Meaning
| 47 | xterm | emu | resetMode | MODE_AppScreen | Meaning
| 1000 | xterm | emu | resetMode | MODE_Mouse1000 | Meaning
| 1001 | xterm | emu | Ignored |  | Meaning
| 1047 | xterm | emu | resetMode | MODE_AppScreen | Meaning
| 1048 | xterm | scr | restoreCursor |  | Meaning
DECSC | Save Cursor | VT100
| `ESC 7`
| Causes the cursor position, graphic rendition, and character set to be saved. (See DECRC)
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | saveCursor |  | see above
DECSCLM | Scrolling Mode | VT100
| This is a private parameter to RM and SM control sequences. The reset state causes scrolls to "jump" instantaneuously one line at a time. The set state causes the scrolls to be "smooth", and scrolls at a maximum rate of siz lines/sec. See MODES, RM, and SM.
DECSCNM | Screen Mode | VT100
| This is a private parameter to RM and SM control sequences. The reset state causes the screen to be black with white characters; the set state causes the screen to be white with black characters. See MODES, RM, and SM.
DECSET | DEC Private Set Mode | VT100 KONSOLE
| `ESC [ ? Ps;... h`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 1 | VT100 | emu | setMode | MODE_AppCuKeys | Meaning
| 3 | VT100 | emu | setColumns | 132 | Meaning
| 4 | VT100 | emu | Ignored |  | Meaning
| 5 | VT100 | scr | setMode | MODE_Screen | Meaning
| 6 | VT100 | scr | setMode | MODE_Origin | Meaning
| 7 | VT100 | scr | setMode | MODE_Wrap | Meaning
| 8 | VT100 | emu | Ignored |  | Meaning
| 9 | VT100 | emu | Ignored |  | Meaning
| 25 | VT100 | emu | setMode | MODE_Cursor | Meaning
| 47 | xterm | emu | setMode | MODE_AppScreen | Meaning
| 1000 | xterm | emu | setMode | MODE_Mouse1000 | Meaning
| 1001 | xterm | emu | Ignored |  | Meaning
| 1047 | xterm | emu | setMode | MODE_AppScreen | Meaning
| 1048 | xterm | scr | saveCursor |  | Meaning
DECSTBM | Set Top and Bottom Margins | VT100
| `ESC [ Pn;Pn r` | Default: 1 ScreenLines

This sequence sets the top and bottom margins to define the scrolling region. The first parameter is the line number of the first line in the scrolling region; the second parameter is the line number of the bottom line of the scrolling region.

Default is the entire screen (no margins). The minimum region allowed is two lines, i.e., the top line must be less than the bottom. The cursor is placed in the home position (See DECOM).

| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | setMargins | p,q | see above
DECSWL | Single-width Line | VT100
| `ESC # 5`
| This causes the line which contains the cursor to become single-width, single-height. The cursor remains on the same character position. This is the default condition for all new lines on the screen.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
DECTST | Invoke Confidence Test | ECMA VT100
| `ESC [ 2;Ps y`
| Ps is the parameter indicating the test to be done. It is computed by taking the weight indicated for each desired test and adding them together. If Ps is 0, no test is performed but the VT100 is reset.
| Weight | Meaning
| 1 | POST (ROM checksum, RAM NVR, keyboardm and AVO)
| 2 | Data Loop Back (Loopback connector required)
| 3 | EIA Modem Control Test (Loopback connector req.)
| 4 | Repeat Testing until failure
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
DEL | Delete Character | VT100
| `0x7f`
| Ignored
DL | Delete Line | ECMA KONSOLE
| `ESC [ Pn M`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | konsole | scr | deleteLines | p | see above
DLE | Data Link Escape | VT100 XTERM Linux KONSOLE
| `0x10`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
DSRREP | Device Status Report Reply | ECMA VT100
| `ESC [ Status n`
| Reports the general status of the VT100 according to the following parameters. DSRREP with a parameter of 0 or 3 is always sent as a response to a requesting DSRREQ with a parameter of 5.
| Status | Meaning
| 0 | Ready, no faults detected
| 3 | Malfunction detected
DSRREQ | Device Status Report | ECMA VT100
| `ESC [ Ps n`
| Requests status of the VT100 according to the following parameters.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 5 | VT100 | emu | reportStatus |  | Report Status (using a DSRREP control sequence)
| 6 | VT100 | emu | reportCursorPosition |  | Report Active Position (using a CPR sequence)
ECH | Erase Character | ECMA KONSOLE
| `ESC [ Pn X`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | konsole | scr | eraseChars | p | see above
ED | Erase in Display | ECMA VT100
| `ESC [ Ps J` | Default: 0
| This sequence erases some or all of the characters in the display according to the parameter. Any complete line erased by this sequence will return that line to single width mode.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 0 | VT100 | scr | clearToEndOfScreen |  | Erase from the cursor to the end of the screen.
| 1 | VT100 | scr | clearToBeginOfScreen |  | Erase from the start of the screen to the cursor.
| 2 | VT100 | scr | clearEntireScreen |  | Erase the entire screen.
EL | Erase in Line | ECMA VT100
| `ESC [ Ps K` | Default: 0
| Erases some or all characters in the active line, according to the parameter.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 0 | VT100 | scr | clearToEndOfLine |  | Erase from cursor to the end of the line.
| 1 | VT100 | scr | clearToBeginOfLine |  | Erase from the start of the line to the cursor.
| 2 | VT100 | scr | clearEntireLine |  | Erase the entire line.
EM | End Of Medium | VT100 XTERM Linux KONSOLE
| `0x19`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
ENQ | Enquiry | VT100
| `0x05`
| Transmit the ANSWERBACK message. The answerback message can be loaded in SET-UP B (i.e. is a configurable string).
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | reportAnswerBack |  | see above
EOT | End Of Transmission | VT100 XTERM Linux KONSOLE
| `0x04`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
ESC | Escape | ECMA VT100
| `0x1b`
| Introduces a control sequence.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
ETB | End Of Transmission Block | VT100 XTERM Linux KONSOLE
| `0x17`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
ETX | End Of Text | VT100 XTERM Linux KONSOLE
| `0x03`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
FF | Form Feed | VT100
| `0x0c`
| Same as LF.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | NewLine |  | see above
FS | File Separator (IS4 - Information Separator Four) | VT100 XTERM Linux KONSOLE
| `0x1c`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
GS | Group Separator (IS3 - Information Separator Three) | VT100 XTERM Linux KONSOLE
| `0x1d`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
HT | Horizontal Tabulation | VT100
| `0x09`
| Move cursor to the next tab stop, or to the right margin if no further tabs are set.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | Tabulate |  | see above
HTS | Horizontal Tab Set | ECMA VT100
| `ESC H`
| Set a tab stop at the current cursor position.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | changeTabStop | TRUE | see above
HVP | Horizontal and Vertical Position | ECMA VT100
| `ESC [ Pn;Pn f` | Default: 1 1

Moves the cursor to the position specified by the parameters. The first parameter specifies the line, and the second specifies the column. A parameter of 0 or 1 causes the active position to move to the first line or column in the display. In the VT100, this control behaves identically with it's editor counterpart, CUP. The numbering of hte lines depends upon the state of the Origin Mode (DECOM).

| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | setCursorYX | p,q | see above
ICH | Insert Character | ECMA KONSOLE
| `ESC [ Pn @`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | konsole | scr | insertChars | p | see above
IL | Insert Line | KONSOLE
| `ESC [ Pn L`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | xterm | scr | insertLines | p | see above
IND | Index | ECMA VT100
| `ESC D`
| This sequence causes the cursor to move downward one line without changing the column. If the cursor is at the bottom margin, a scroll up is performed.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | index |  | see above
KEYBOARD | Keyboard Events | KONSOLE
| FIXME. explain
| Key | Code
| AltButton | "\033"
| Return | MODE_NewLine ? "\r\n" : "\r"
| Backspace | MODE_BsHack ? "\x7f" : "\x08"
| Delete | MODE_BsHack ? "\033[3~" : "\x7f"
| Up | !MODE_Ansi ?"\033A" : MODE_AppCuKeys ?"\033OA" : "\033[A"
| Down | !MODE_Ansi ?"\033B" : MODE_AppCuKeys ?"\033OB" : "\033[B"
| Right | !MODE_Ansi ?"\033C" : MODE_AppCuKeys ?"\033OC" : "\033[C"
| Left | !MODE_Ansi ?"\033D" : MODE_AppCuKeys ?"\033OD" : "\033[D"
| F1 | Xterm? "\033[11~": "\033[[A"
| F2 | Xterm? "\033[12~": "\033[[B"
| F3 | Xterm? "\033[13~": "\033[[C"
| F4 | Xterm? "\033[14~": "\033[[D"
| F5 | Xterm? "\033[15~": "\033[[E"
| F6 | "\033[17~"
| F7 | "\033[18~"
| F8 | "\033[19~"
| F9 | "\033[20~"
| F10 | "\033[21~"
| F11 | "\033[23~"
| F12 | "\033[24~"
| Home | "\033[7~"
| End | "\033[8~"
| Prior | "\033[5~"
| Next | "\033[6~"
| Insert | "\033[2~"
| Control_Space | "\x00"
| Control_Print | reportAnswerBack()
| Ascii | Character
LF | Line Feed | VT100
| `0x0a`
| Causes either a line feed or new line operation (See LNM.)
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | NewLine |  | see above
LNM | Line Feed/New Line Mode | ECMA VT100

This is a parameter to SM and RM control sequences. The reset state causes the interpretation of the LF character to imply only vertical movement of the cursor and causes the RETURN key to send the single code CR.

The set state causes the LF character to imply movement to the first position of the following line, and causes the RETURN key to send the code pair CR LF. This is the New Line option.

This mode does not affect the Index (IND) or the next line (NEL) format effectors.

LS0 | Lock Shift Zero (Shift Out - SO) | VT100
| `0x0e`
| Invoke the G1 character set, as designated by the SCS control sequence.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | useCharset | 1 | see above
LS1 | Lock Shift One (Shift In - SI) | VT100
| `0x0f`
| Invoke the G0 character set, as selected by the <ESC>( sequence.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | useCharset | 0 | see above
LS2 | Lock Shift Two | KONSOLE
| `ESC n`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | xterm | scr | useCharset | 2 | see above
LS3 | Lock Shift Three | KONSOLE
| `ESC o`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | xterm | scr | useCharset | 3 | see above
MC | Media Copy | ECMA VT100
| `ESC [ Pn i`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 0 | VT100 | emu | Ignored |  | Meaning
MOUSE | Mouse Events | KONSOLE
| FIXME. explain
NAK | Negative Acknowledge | VT100 XTERM Linux KONSOLE
| `0x15`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
NEL | Next Line | ECMA VT100
| `ESC E`
| This causes the cursor to move to the first position of the next line down. If the cursor is on the bottom line, a scroll is performed.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | NextLine |  | see above
NUL | Null | VT100 XTERM Linux KONSOLE
| `0x00`
| NUL is used as media- or time-fill. It is ignored by Konsole, but may be sensible for devices which requiere a recognizable amount of time to complete some commands (e.g. form feed on a non-buffering printing device).
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
PRINT | Printable Characters | ECMA VT100
| `0x20..0x7e,0xa0..0xff`
| Printable characters are basically displayed. They my cause a line wrap when the cursor is already located at the end of the line. The VT100 has a unique way to do this by producing a line wrap before the character would be displayed on the next line. This feature allows to print at the rightmost column without producing an implicit line feed.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | ShowCharacter | p | see above
RI | Reverse Index | ECMA VT100
| `ESC M`
| Move the cursor up one line without changing columns. If the cursor is on the top line, a scroll down is performed.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | reverseIndex |  | see above
RIS | Reset to Initial State | ECMA VT100
| `ESC c`
| Resets the VT100 to the state is has upon power up. This also causes the execution of the POST and signal INT H to be asserted briefly.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | resetTerminal |  | see above
RM | Reset Mode | ECMA VT100
| `ESC [ Ps;... l`
| Resets one or more VT100 modes as specified by each selective parameter in the parameter string. Each mode to be reset is specified by a separate parameter. See MODES and SM.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 4 | xterm | scr | resetMode | MODE_Insert | Meaning
| 20 | VT100 | emu | resetMode | MODE_NewLine | LNM
RS | Record Separator (IS2 - Information Separator Two) | VT100 XTERM Linux KONSOLE
| `0x1e`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
SCS | Select Character Set | ECMA VT100
| `ESC Pc;Cs`

The appropriate D0 and G1 character sets are designated from one of the five possible sets. The G0 and G1 sets are invoked by the characters LS1 and LS0, respectively.

The United Kingdom and ASCII sets conform to the "ISO international register of character sets to be used with escape sequences". The other sets are private character sets. Special graphics means that the graphic characters fpr the codes 0137 to 0176 are replaced with other characters. The specified character set will be used until another SCS is recieved.

| Cs | Character Set
| A | United Kingdom Set
| B | ASCII Set
| 0 | Special Graphics
| 1 | Alternate Character ROM (Standard Character Set)
| 2 | Alternate Character ROM (Special Graphics)
| Pc | Character Selection
| ( | Select G0 Set
| ) | Select G1 Set
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | setCharset | p-'(',q | see above
SGR | Select Graphic Rendition | ECMA VT100
| `ESC [ Ps;... m`

Invoke the graphic rendition specified by the parameter(s). All following characters transmitted to the VT100 are rendered according to the parameter(s) until the next occurrence of an SGR.

All other parameter values are ignored.

Without the Advanced Video Option, only one type of character attribute is possible, as determined by the cursor selection; in that case specifying either underscore or reverse will activate the currently selected attribute.

| Subcode | Emulation | Scope | Operation | Args | Meaning
| 0 | VT100 | scr | setDefaultRendition |  | Attributes Off
| 1 | VT100 | scr | setRendition | RE_BOLD | Bold or increased intensity
| 4 | VT100 | scr | setRendition | RE_UNDERLINE | Underscore
| 5 | VT100 | scr | setRendition | RE_BLINK | Blink
| 7 | VT100 | scr | setRendition | RE_REVERSE | Negative (reverse) image
| 10 | konsole | emu | Ignored |  | Meaning
| 11 | konsole | emu | Ignored |  | Meaning
| 12 | konsole | emu | Ignored |  | Meaning
| 22 | VT100 | scr | resetRendition | RE_BOLD | Meaning
| 24 | VT100 | scr | resetRendition | RE_UNDERLINE | Meaning
| 25 | VT100 | scr | resetRendition | RE_BLINK | Meaning
| 27 | VT100 | scr | resetRendition | RE_REVERSE | Meaning
| 30 | xterm | scr | setForeColor | 0 | Meaning
| 31 | xterm | scr | setForeColor | 1 | Meaning
| 32 | xterm | scr | setForeColor | 2 | Meaning
| 33 | xterm | scr | setForeColor | 3 | Meaning
| 34 | xterm | scr | setForeColor | 4 | Meaning
| 35 | xterm | scr | setForeColor | 5 | Meaning
| 36 | xterm | scr | setForeColor | 6 | Meaning
| 37 | xterm | scr | setForeColor | 7 | Meaning
| 39 | xterm | scr | setForeColorToDefault |  | Meaning
| 40 | xterm | scr | setBackColor | 0 | Meaning
| 41 | xterm | scr | setBackColor | 1 | Meaning
| 42 | xterm | scr | setBackColor | 2 | Meaning
| 43 | xterm | scr | setBackColor | 3 | Meaning
| 44 | xterm | scr | setBackColor | 4 | Meaning
| 45 | xterm | scr | setBackColor | 5 | Meaning
| 46 | xterm | scr | setBackColor | 6 | Meaning
| 47 | xterm | scr | setBackColor | 7 | Meaning
| 49 | xterm | scr | setBackColorToDefault |  | Meaning
| 90 | xterm | scr | setForeColor | 8 | Meaning
| 91 | xterm | scr | setForeColor | 9 | Meaning
| 92 | xterm | scr | setForeColor | 10 | Meaning
| 93 | xterm | scr | setForeColor | 11 | Meaning
| 94 | xterm | scr | setForeColor | 12 | Meaning
| 95 | xterm | scr | setForeColor | 13 | Meaning
| 96 | xterm | scr | setForeColor | 14 | Meaning
| 97 | xterm | scr | setForeColor | 15 | Meaning
| 100 | xterm | scr | setBackColor | 8 | Meaning
| 101 | xterm | scr | setBackColor | 9 | Meaning
| 102 | xterm | scr | setBackColor | 10 | Meaning
| 103 | xterm | scr | setBackColor | 11 | Meaning
| 104 | xterm | scr | setBackColor | 12 | Meaning
| 105 | xterm | scr | setBackColor | 13 | Meaning
| 106 | xterm | scr | setBackColor | 14 | Meaning
| 107 | xterm | scr | setBackColor | 15 | Meaning
SM | Set Mode | ECMA VT100
| `ESC [ Ps;... h`
| Causes one or more modes to be set within the VT100 as specified by each selective parameter string. Each mode to be set is specified by a seperate parameter. A mode is considered set until it is reset by a Reset Mode (RM) control sequence. See RM and MODES.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 4 | VT100 | scr | setMode | MODE_Insert | Meaning
| 20 | VT100 | emu | setMode | MODE_NewLine | LNM
SOH | Start Of Heading | VT100 XTERM Linux KONSOLE
| `0x01`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
STX | Start Of Text | VT100 XTERM Linux KONSOLE
| `0x02`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
SUB | Substitute | VT100
| `0x1a`
| Same as CAN.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | scr | ShowCharacter | 2 | see above
SYN | Synchronous Idle | VT100 XTERM Linux KONSOLE
| `0x16`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
TBC | Tabulation Clear | ECMA VT100
| `ESC [ Ps g`
| If the parameter is missing or 0, this will clear the tab stop at the cursor's position. If it is 3, this will clear all of the tab stops. Any other parameter is ignored.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 0 | VT100 | scr | changeTabStop | FALSE | Meaning
| 3 | VT100 | scr | clearTabStops |  | Meaning
US | Unit Separator (IS1 - Information Separator One) | VT100 XTERM Linux KONSOLE
| `0x1f`
| Ignored
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | Ignored |  | see above
VPA | Vertical Position Absolute | ECMA KONSOLE
| `ESC [ Pn d`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | xterm | scr | setCursorY | p | see above
VT | Vertical Tabulation | VT100
| `0x0b`
| Same as LF.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT100 | emu | NewLine |  | see above
VT52ANSI | VT52 ANSI Ansi Mode | VT100 XTERM VT52 KONSOLE
| `ESC <`
| This is an extention to the VT52 commands to embed the emulation into VT100. It allows to return back to VT100 emulation (ANSI mode). See also DECANM and SM.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | emu | setMode | MODE_Ansi | see above
VT52CUB | VT52 Cursor Back | KONSOLE
| `ESC D`
| See CUB.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | scr | cursorLeft | 1 | see above
VT52CUD | VT52 Cursor Down | KONSOLE
| `ESC B`
| See CUD.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | scr | cursorDown | 1 | see above
VT52CUF | VT52 Cursor Forward | KONSOLE
| `ESC C`
| See CUF.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | scr | cursorRight | 1 | see above
VT52CUH | VT52 Cursor Home | KONSOLE
| `ESC H`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | scr | setCursorYX | 1,1 | see above
VT52CUP | VT52 Cursor Position | KONSOLE
| `ESC Y X;Y`
| 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.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | scr | setCursorYX | p-31,q-31 | see above
VT52CUU | VT52 Cursor Up | KONSOLE
| `ESC A`
| See CUU.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | scr | cursorUp | 1 | see above
VT52EDL | VT52 Clear To End Of Line | KONSOLE
| `ESC K`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | scr | clearToEndOfLine |  | see above
VT52EDS | VT52 Clear To End Of Screen | KONSOLE
| `ESC J`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | scr | clearToEndOfScreen |  | see above
VT52KPAM | VT52 Enter alternate keypad mode | KONSOLE
| `ESC =`
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | emu | setMode | MODE_AppKeyPad | see above
VT52KPNM | VT52 Exit alternate keypad mode | KONSOLE
| `ESC >`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | emu | resetMode | MODE_AppKeyPad | see above
VT52REP | VT52 Report Terminal Type | KONSOLE
| `ESC Z`
| Response to ESC Z is ESC / Z.
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | emu | reportTerminalType |  | see above
VT52RI | VT52 Reverse Index | KONSOLE
| `ESC I`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | scr | reverseIndex |  | see above
VT52SCSF | VT52 Select special graphics character set | KONSOLE
| `ESC F`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | scr | setAndUseCharset | 0,'0' | see above
VT52SCSG | VT52 Select ASCII character set | KONSOLE
| `ESC G`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| N/A | VT52 | scr | setAndUseCharset | 0,'B' | see above
XTERESTORE | XTerm Private Restore Mode | XTERM KONSOLE
| `ESC [ ? Ps;... r`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 1 | xterm | emu | restoreMode | MODE_AppCuKeys | Meaning
| 6 | xterm | scr | restoreMode | MODE_Origin | Meaning
| 7 | xterm | scr | restoreMode | MODE_Wrap | Meaning
| 1000 | xterm | emu | restoreMode | MODE_Mouse1000 | Meaning
| 1001 | xterm | emu | Ignored |  | Meaning
XTESAVE | XTerm Private Save Mode | XTERM KONSOLE
| `ESC [ ? Ps;... s`
| FIXME. explain
| Subcode | Emulation | Scope | Operation | Args | Meaning
| 1 | xterm | emu | saveMode | MODE_AppCuKeys | Meaning
| 6 | xterm | scr | saveMode | MODE_Origin | Meaning
| 7 | xterm | scr | saveMode | MODE_Wrap | Meaning
| 1000 | xterm | emu | saveMode | MODE_Mouse1000 | Meaning
| 1001 | xterm | emu | Ignored |  | Meaning

##

On VT100

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.

##

Modes

The Following is a list of VT100 modes which may be changed with Set Mode (SM) and Reset Mode (RM) controls.

### ANSI Specified Modes

Parameter | Mnemonic | Function

0 |  | Error (Ignored)
20 | LNM | Line Feed/New Line Mode

### DEC Private Modes

If the first character in the parameter string is ? (077), the parameters are interpreted as DEC private parameters according to the following:

Parameter | Mnemonic | Function

0 |  | Error (Ignored)
1 | DECCKM | Cursor Key
2 | DECANM | ANSI/VT52
3 | DECCOLM | Column
4 | DECSCLM | Scrolling
5 | DECSCNM | Screen
6 | DECOM | Origin
7 | DECAWM | Auto Wrap
8 | DECARM | Auto Repeat
9 | DECINLM | Interlace

Any other parameter values are ignored.

The following modes, which are specified in the ANSI standard, may be considered to be permanently set, permanently reset, or not applicable, as noted.

Mnemonic | Function | State
CRM | Control Representation | Reset
EBM | Editing Boundary | Reset
ERM | Erasure | Set
FEAM | Format Effector Action | Reset
FETM | Format Effector Transfer | Reset
GATM | Guarded Area Transfer | NA
HEM | Horizontal Editing | NA
IRM | Insertion-replacement | Reset
KAM | Keyboard Action | Reset
MATM | Multiple area transfer | NA
PUM | Positioning Unit | Reset
SATM | Selected Area Transfer | NA
SRTM | Status Reporting Transfer | Reset
TSM | Tabulation Stop | Reset
TTM | Transfer Termination | NA
VEM | Vertical Editing | NA

## Keyboard Codes

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

Cursor Key | VT52 mode | ANSI mode w/cursor key mode reset | ANSI mode w/cursor 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 Code | ASCII Graphic | Special Graphic

0137 | _ | Blank
0140 | ` | Diamond
0141 | a | Checkerboard
0142 | b | Digraph: (HT)
0143 | c | Digraph: (FF)
0144 | d | Digraph: (CR)
0145 | e | Digraph: (LF)
0146 | f | Degree Symbol: °
0147 | g | +/- Symbol: ±
0150 | h | Digraph: (NL)
0151 | i | Digraph: (VT)
0152 | j | Lower-right corner
0153 | k | Upper-right corner
0154 | l | Upper-left corner
0155 | m | Lower-left corner
0156 | n | Crossing lines (+)

Octal Code | ASCII Graphic | Special Graphic

0157 | o | Horiz Line - scan 1
0160 | p | Horiz Line - scan 3
0161 | q | Horiz Line - scan 5
0162 | r | Horiz Line - scan 7
0163 | s | Horiz Line - scan 9
0164 | t | Left "T" (|-)
0165 | u | Right "T" (-|)
0166 | v | Bottom "T" (|_)
0167 | w | Top "T" (T)
0170 | x | Vertical Bar (|)
0171 | y | Less/Equal: ≤
0172 | z | Graeter/Egual: ≥
0173 | { | Pi symbol: π
0174 | | | Not equal: ≠
0175 | } | UK pound symbol: £
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.

## References

This text is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Lars Dölle, 1998