Appendix B

VT100 Family Programming Summary

This appendix provides a summary of VT100 family escape and control sequences. Sequences unique to the VT101, VT102, and VT131, and the VT125 are in Appendix C and Appendix D, respectively.

Control Characters

Name Character Mnemonic Octal Code Function
Null NUL 000 Ignored when received (not stored in input buffer), used as a fill character.
Enquire ENQ 005 Transmits answerback message.
Bell BEL 007 Generates a bell tone.
Backspace BS 010 Moves cursor to the left one character position, unless it is at the left margin, in which case no action occurs.
Horizontal Tab HT 011 Moves cursor to the next tab stop, or to the right margin if there are no more tab stops.
Line Feed LF 012 Causes a line feed or a new line operation. (Refer to line feed/new line mode.)
Vertical Tab VT 013 Processed as LF.
Form Feed FF 014 Processed as LF.
Carriage Return CR 015 Moves cursor to left margin on the current line.
Shift Out SO 016 Selects G1 character set, as designated by a select character set sequence.
Shift In SI 017 Selects G0 character set, as designated by a select character set sequence.
Device Control 1 DC1 021 Processed as XON. Causes terminal to continue transmitting characters.
Device Control 3 DC3 023 Processed as XOFF. Causes terminal to stop transmitting all characters except XOFF and XON.
Cancel CAN 030 If received during an escape or control sequence, sequence is cancelled and the substitution character is displayed.
Substitute SUB 032 Processed as CAN.
Escape ESC 033 Processed as a sequence introducer.
Delete DEL 177 Ignored when received (not stored in input buffer).

ANSI Compatible Sequences

Set Mode
Name Mnemonic Mode Sequence
Line feed/new line LMN New line ESC [ 20 h
Cursor key DECCKM Application ESC [ ? 1 h
ANSI/VT52 DECANM ANSI N/A
Column DECCOLM 132 column ESC [ ? 3 h
Scrolling DECSCLM Smooth ESC [ ? 4 h
Screen DECSCNM Reverse ESC [ ? 5 h
Origin DECOM Relative ESC [ ? 6 h
Auto wrap DECAWM On ESC [ ? 7 h
Auto repeat DECARM On ESC [ ? 8 h
Interlace DECINLM On ESC [ ? 9 h
Reset Mode
Name Mnemonic Mode Sequence*
Line feed/new line LMN Line feed ESC [ 20 l
Cursor key DECCKM Cursor ESC [ ? 1 l
ANSI/VT52 DECANM VT52 ESC [ ? 2 l
Column DECCOLM 80 column ESC [ ? 3 l
Scrolling DECSCLM Jump ESC [ ? 4 l
Screen DECSCNM Normal ESC [ ? 5 l
Origin DECOM Absolute ESC [ ? 6 l
Auto wrap DECAWM Off ESC [ ? 7 l
Auto repeat DECARM Off ESC [ ? 8 l
Interlace DECINLM Off ESC [ ? 9 l
* The last character of the sequence is lowercase L (1548).
Cursor Key Codes Generated
Cursor ANSI Character Generated
Reset (Cursor) Set (Application)
Up ESC [ A ESC O A
Down ESC [ B ESC O B
Right ESC [ C ESC O C
Left ESC [ D ESC O D
Keypad Character Selection
Name Mnemonic Sequence
Alternate DECKPAM ESC =
Numeric DECKPNM ESC >
Auxiliary Keypad Codes Generated
Key VT52 Alternate Keypad Mode Off (Numeric Mode) VT52 Alternate Keypad Mode On ANSI Numeric Keypad Mode ANSI Alternate Keypad Mode
0 0 ESC ? p 0 ESC O p
1 1 ESC ? q 1 ESC O q
2 2 ESC ? r 2 ESC O r
3 3 ESC ? s 3 ESC O s
4 4 ESC ? t 4 ESC O t
5 5 ESC ? u 5 ESC O u
6 6 ESC ? v 6 ESC O v
7 7 ESC ? w 7 ESC O w
8 8 ESC ? x 8 ESC O x
9 9 ESC ? y 9 ESC O y
- (minus) - (minus) ESC ? m - (minus) ESC O m
, (comma) , (comma) ESC ? l* , (comma) ESC O l*
. (period) . (period) ESC ? n . (period) ESC O n
ENTER Same as RETURN ESC ? M Same as RETURN ESC O M
PF1 ESC P ESC P ESC O P ESC O P
PF2 ESC Q ESC Q ESC O Q ESC O Q
PF3 ESC R ESC R ESC O R ESC O R
PF4 ESC S ESC S ESC O S ESC O S
* The last character of the sequence is lowercase L (1548).
Select Character Sets (SCS)
Character Set G0 Designator G1 Designator
United Kingdom (UK) ESC ( A ESC ) A
United States (USASCII) ESC ( B ESC ) B
Special characters and line drawing set ESC ( 0 ESC ) 0
Alternate character ROM ESC ( 1 ESC ) 1
Alternate character ROM, special graphics characters ESC ( 2 ESC ) 2
Name Mnemonic Sequence
Single Shift 2 SS2 ESC N
Single Shift 3 SS3 ESC O
Character Attributes
Name Mnemonic Sequence
Select graphic rendition (no attributes) SGR ESC [ m
Select graphic rendition (no attributes) SGR ESC [ 0 m
Select graphic rendition (select attributes, reverse video, or underline as determined by cursor SET-UP feature) SGR ESC [ 4 m
Select graphic rendition (select attribute, reverse video, or underline as determined by cursor SET-UP feature) SGR ESC [ 7 m
Scrolling Region
Name Mnemonic Sequence
Set top and bottom margins DECSTBM ESC [ Pt ; Pb r
Cursor Movement Commands
Name Mnemonic Sequence
Cursor up CUU ESC [ Pn A
Cursor down CUD ESC [ Pn B
Cursor forward (right) CUF ESC [ Pn C
Cursor backward (left) CUB ESC [ Pn D
Cursor position CUP ESC [ Pl; Pc H
Cursor position (home) CUP ESC [ H
Horizontal and vertical position HVP ESC [ Pl; Pc f
Horizontal and vertical position (home) HVP ESC [ f
Index IND ESC D
Reverse index RI ESC M
Next line NEL ESC E
Save cursor (and attributes) DECSC ESC 7
Restore cursor (and attributes) DECRC ESC 8
Tab Stops
Name Mnemonic Sequence
Horizontal tab set (at current column) HTS ESC H
Tabulation clear (at current column) TBC ESC [ g
Tabulation clear (at current column) TBC ESC [ 0 g
Tabulation clear (all tabs) TBC ESC [ 3 g
Line Attributes
Name Mnemonic Sequence
Double-height top half DECDHL ESC # 3
Double-height bottom half DECDHL ESC # 4
Single-width single-height DECSWL ESC # 5
Double-width single-height DECDWL ESC # 6
Erasing
Name Mnemonic Sequence
Erase in line (cursor to end of line) EL ESC [ K
Erase in line (cursor to end of line) EL ESC [ 0 K
Erase in line (beginning of line to cursor) EL ESC [ 1 K
Erase in line (entire line containing cursor) EL ESC [ 2 K
Erase in display (cursor to end of screen) ED ESC [ J
Erase in display (cursor to end of screen) ED ESC [ 0 J
Erase in display (beginning of screen to cursor) ED ESC [ 1 J
Erase in display (entire screen) ED ESC [ 2 J
Reports
Name Mnemonic Sequence
Device status report (request status of VT101) DSR ESC [ 5 n
Response:
Terminal OK
Terminal not OK
DSR
DSR
ESC [ 0 n
ESC [ 3 n
Device status report (report cursor position DSR ESC [ 6 n
Report cursor position CPR ESC [ Pl; Pc R
Device attributes (what are you) DA ESC [ c
Device attributes (what are you) DA ESC [ 0 c
Identify terminal (what are you) DECID ESC Z (not recommended)
Device attributes Response DA ESC [ ? 1 ; Ps 0c
Reset
Name Mnemonic Sequence
Reset to initial state RIS ESC c
Test and Adjustments
Name Mnemonic Sequence
Screen alignment display
(Fill screen with "Es")
DECALN ESC # 8
Invoke confidence test (power-up test) DECTST ESC [ 2; 1 y
Invoke confidence test
(Data loopback test, requires test connector)
DECTST ESC [ 2; 2 y
Invoke confidence test
(repeat power-up test continuously until failure or power-off)
DECTST ESC [ 2; 9 y
Invoke confidence test
(repeat data loopback test continuously until failure or power-off, requires test connector)
DECTST ESC [ 2; 10 y
Keyboard LEDs (Indicators)
Name Mnemonic Sequence
Load LEDs
(all off)
DECLL ESC [ 0 q
Load LEDs
(L1 on)
DECLL ESC [ 1 q
Load LEDs
(L2 on)
DECLL ESC [ 2 q
Load LEDs
(L3 on)
DECLL ESC [ 3 q
Load LEDs
(L4 on)
DECLL ESC [ 4 q

VT52 Compatible Mode

Set and Reset Modes
Name Sequence
Enter ANSI mode ESC <
Keypad Character Selection
Name Sequence
Enter alternate keypad mode ESC =
Exit alternate keypad mode ESC >
Character Sets
Name Sequence
Special graphics character set ESC F*
Select US/UK character set (as determined by US/UK character SET-UP feature) ESC G
Cursor Position
Name Sequence
Cursor up† ESC A
Cursor down† ESC B
Cursor right† ESC C
Cursor left† ESC D
Cursor to home ESC H
Direct cursor address ESC Y Pl Pc
Reverse line feed ESC I

† Same when sent from the terminal.

‡ Line and column numbers for direct cursor address are single character codes whose values are the desired number plus (378). Line and column numbers start at one.

Erasing
Name Sequence
Erase to end of line ESC K
Erase to end of screen ESC J
Reports
Name Sequence
Identify (what are you) ESC Z
Response ESC / Z