# VT-100 Control Sequences

## Taken from the "Digital VT100 User Guide

The following notes, relating to the VT100 control sequences, are taken from the Programming section of the official Digital VT100 User Guide.

### Control Characters

Control characters have values of 000 octal to 037 octal, and 177 octal. The control characters recognised by the VT100 are as follows, with all other control codes causing no action to be taken:

Control Character | Octal Code | Hex Code | Action Taken
--- | --- | --- | ---
NUL | 000 | 00 | Ignored on input (not stored in buffer; see full duplex protocol)
ENQ | 005 | 05 | Transmit answerback message
BEL | 007 | 07 | Sound bell tone from keyboard
BS | 010 | 08 | Move the cursor to the left one character position, unless it is at the left margin, in which case no action occurs
HT (TAB) | 011 | 09 | Move the cursor to the next tab stop, or to the right margin if no further tab stops are present on the line
LF | 012 | 0A | This code causes a line feed or a new line operation (See new line mode)
VT | 013 | 0B | Interpreted as LF
FF | 014 | 0C | Interpreted as LF
CR | 015 | 0D | Move cursor to left margin on the current line
SO | 016 | 0E | Invoke G1 character set, as designated by SCS control sequence
SI | 017 | 0F | Invoke G0 character set, as designated by ESC control sequence
XON | 021 | 11 | Causes terminal to resume transmission
XOFF | 022 | 12 | Causes terminal to stop transmission of all codes except XOFF and XON
CAN | 030 | 18 | If sent during a control sequence, the sequence is immediately terminated and not executed. It also causes the error character to be displayed
SUB | 032 | 1A | Interpreted as CAN
ESC | 033 | 1B | Aborts any control sequence in progress, and introduces a control sequence
DEL | 177 | 7F | Ignored on input, not stored in input buffer

Control character codes (codes 0 octal to 37 octal 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 received. The exceptions are:

1. If the character ESC occurs, the current control sequence is aborted, and a new one commences beginning with the ESC just received.

2. If the character CAN or SUB occurs, the current control sequence is aborted.

The ability to embed control characters allows the synchronisation characters XON and XOFF to be interpreted properly without affecting the control sequence.

The VT100 terminal accepts and produces the following sequences, which are a subset of those specified in ANSI X-3.64 1977 and ANSI X-3.41 1974:

Name | Host to VT100 | VT100 to Host | Sequence | Description | Default Value
--- | --- | --- | --- | --- | ---
CPR |  | * | ESC [ Pn ; Pn R | Cursor Position Report | N/A
This sequencee 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 numbering of lines depends on the state of the Origin Mode (DECOM). This control sequence is solicited by a device status report (DSR) sent from the host.
CUB | * | * | ESC [ Pn D | Cursor Backward | 1
This sequence moves the active position to the left. The distance moved is determined by the parameter. If the parameter value is zero or one, the active position is moved one position to the left. If the parameter value is n (where n is greater than one), the active position is moved n positions to the left. If an attempt is made to move the active position to the left of the left margin, the active position stops at the left margin.
CUD | * | * | ESC [ Pn B | Cursor Down | 1
This sequence moves the active position downward without altering the column position. The distance moved is determined by the parameter. If the parameter value is zero or one, the active position is moved one line downward. If the parameter value is n (where n is greater than one), the active position is moved n lines downward. If an attempt is made to move the active position below the bottom margin, the active position stops at the bottom margin.
CUF | * | * | ESC [ Pn C | Cursor Forward | 1
This sequence moves the active position to the right. The distance moved is determined by the parameter. If the parameter value is zero or one, the active position is moved one position to the right. If the parameter value is n (where n is greater than one), the active position is moved n positions to the right. If an attempt is made to move the active position to the right of the right margin, the active position stops at the right margin.
CUP | * |  | ESC [ Pn ; Pn H | Cursor Position | 1 ; 1
This sequence moves the active position to the position specified by the parameters. This sequence has two parameter values, the first specifying the line position and the second specifying the column position. A parameter value of zero or one for the first or second parameter moves the active position to the first line or column in the display respectively. The default condition with no parameters is equivalent to a "cursor to home" action. In the VT100, this sequence behaves identically with its format effector counterpart, HVP.
CUU | * | * | ESC [ Pn A | Cursor Up | 1
This sequence moves the active position upward without altering the column position. The distance moved is determined by the parameter. If the parameter value is zero or one, the active position is moved one line upward. If the parameter value is n (where n is greater than one), the active position is moved n lines upward. If an attempt is made to move the active position above the top margin, the active position stops at the top margin.
DA | * |  | ESC [ Pn c | Device Attribute (Request) | 0
The host requests the VT100 to send a device attribute (DA) control sequence to identify itself by sending this sequence with either no parameter or a parameter of zero.
DA |  | * | ESC [ ? 1 ; Pn c | Device Attribute (Response) | N/A
The response to the DA request is generated by the VT100 as a DA control sequence with the numeric parameter being the arithmetic sum of the following: 1 Processor Option (STP) 2 Advanced Video Option (AVO) 4 Graphics Option (GPO) If no options are fitted, the value zero is returned.
DSR | * | * | ESC [ Ps n | Device Status Report | 0

This document last updated on Monday 20th August 2001