# VT-52 Mode Control Sequences

## Taken from the "Digital VT100 User Guide"

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

### Control Characters

(The control character section as listed below refers to the VT100 terminal, but is assumed at this stage to be identical for the VT52 terminal as I don't have access to any documentation for the latter)

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.

### Mode Control Sequences

(Although the following is taken from the VT100 User Guide, it appears to be correct for the VT52 terminal)

The VT52 terminal accepts and produces the following sequences:

Name | Sequence | Description
--- | --- | ---
Enter ANSI Mode | ESC < | All subsequent escape sequences will be interpreted according to ANSI STandards X3.64-1977 and X3.41-1974. The VT52 escape sequences designated in this section will not be recognised.
Cursor Up | ESC A | Moves the active position upward one line without altering the column position. If an attempt is made to move the cursor above the top margin, the cursor stops at the top margin.
Cursor Down | ESC B | Moves the active position downward one line without altering the column position. If an attempt is made to move the cursor below the bottom margin, the cursor stops at the bottom margin.
Cursor Right | ESC C | Moves the active position to the right. If an attempt is made to move the cursor to the right of the right margin, the cursor stops at the right margin.
Cursor Left | ESC D | Moves the active position to the left. If an attempt is made to move the cursor to the left of the left margin, the cursor stops at the left margin.
Enter Graphics Mode | ESC F | Causes the special graphics character set to be used. Note that the special graphics character sets on the VT52 and VT100 are different.
Exit Graphics Mode | ESC G | Causes the standard ASCII character set to be used.
Cursor Home | ESC H | Move the cursor to the home position
Reverse Line Feed | ESC I | Move the active position upward one position without altering the column position. If the active position is at the top margin, a scroll down is performed.
Erase to End of Screen | ESC J | Erase all characters from the active position to the end of the screen. The active position is not changed.
Erase to End of Line | ESC K | Erase all characters from the active position to the end of the current line. The active position is not changed.
Direct Cursor Address | ESC Y Line Column | Move the cursor to the specified line and column. The line and column numbers are sent as ASCII codes whose values are the number plus 037 octal (31 decimal); 040 octal (32 decimal) refers to the first line or column, 050 octal (40 decimal) refers to the eighth line or column, etc.
Idenitfy | ESC Z | Causes the terminal to send its identifier escape sequence to the host. This sequence is ESC / Z.

This document last updated on Tuesday 21st August 2001.