Installing and Using the VT420 Video Terminal

9
VT420 Programming Summary

This chapter is a summary of the control functions and commands described in the VT420 Programmer Reference Manual. Programmers can use this chapter as a quick-reference tool.

NOTE: The application of the control functions and commands on the VT420 affects each session independently.

The chapter is divided into sections that correspond to the chapters of the VT420 Programmer Reference Manual. For example, to find out more about 2 Character Encoding, you would go to Chapter 2 of the VT420 Programmer Reference Manual.

2 Character Encoding

Control Characters

C0 (7-Bit) Control Characters Recognized

Name Mnemonic
Column/Row
Function
Null NUL
0/0
NUL has no function (ignored by the terminal).
Enquiry ENQ
0/5
Sends the answerback message. (Communications Set-Up)
Bell BEL
0/7
Sounds the bell tone if the bell is enabled in the Keyboard Set-Up.
Back space BS
0/8
Moves the cursor one character position to the left. If the cursor is at the left margin, no action occurs.
Horizontal tab HT
0/9
Moves the cursor to the next tab stop. If there are no more tab stops, the cursor moves to the right margin. HT does not cause text to auto wrap.
Line feed LF
0/10
Causes a line feed or a new line operation, depending on the setting of line feed/new line mode.
Vertical tab VT
0/11
Treated as LF.
Form feed FF
0/12
Treated as LF.
Carriage return CR
0/13
Moves the cursor to the left margin on the current line.
Shift out
(Locking shift 1)
SO (LS1)
0/14
Maps the G1 character set into GL. You designate G1 by using a select character set (SCS) sequence.
Shift in
(Locking shift 0)
SI (LS0)
0/15
Maps the G0 character set into GL. You designate G0 by using a select character set (SCS) sequence.
Device control 1 (XON) DC1
1/1
Also known as XON. If XON/XOFF flow control is enabled in the Communications Set-Up, DC1 clears DC3 (XOFF). This action causes the VT420 to continue sending characters.
Device control 3 (XOFF) DC3
1/3
Also known as XOFF. If XON/XOFF flow control is enabled in the Communications Set-Up, DC3 causes the VT420 to stop sending characters. The terminal cannot resume sending characters until it receives a DC1 control character.
Device control 4 DC4
1/4
Introduces an SSU session management command. The VT420 and host use this control to separate SSU commands from ANSI text and control functions.
Cancel CAN
1/8
Immediately cancels an escape sequence, control sequence, or device control string in progress. The VT420 does not display any error characters.
Substitute SUB
1/10
Immediately cancels an escape sequence, control sequence, or device control string in progress. The VT420 displays a reverse question mark for an error character.
Escape ESC
1/11
Introduces an escape sequence. ESC also cancels any escape sequence, control sequence, or device control string in progress.
Delete DEL
7/15
Ignored when received, unless a 96-character set is mapped into GL. DEL is not used as a fill character. Digital does not recommend using DEL as a fill character. Use NUL instead.

C1 (8-Bit) Control Characters Recognized

Name Mnemonic
Column/Row
Function
Index IND
8/4
Moves the cursor down one line in the same column. If the cursor is at the bottom margin, the page scrolls up.
Next line NEL
8/5
Moves the cursor to the first position on the next line. If the cursor is at the bottom margin, the page scrolls up.
Horizontal tab set HTS
8/8
Sets a horizontal tab stop at the column where the cursor is.
Reverse index RI
8/13
Moves the cursor up one line in the same column. If the cursor is at the top margin, the page scrolls down.
Single shift 2 SS2
8/14
Temporarily maps the G2 character set into GL, for the next graphic character. You designate the G2 set by using a select character set (SCS) sequence.
Single shift 3 SS3
8/15
Temporarily maps the G3 character set into GL, for the next graphic character. You designate the G3 set by using a select character set (SCS) sequence.
Device control string DCS
9/0
Introduces a device control string. Used for loading function keys or a soft character set.
Start of string SOS
9/8
Ignored.
DEC private identification DECID
9/10
Makes the terminal send its device attributes response to the host (same as an ANSI device attributes (DA) sequence). Programs should use the ANSI DA sequence instead.

NOTE: If the printer is in controller mode, the terminal sends the sequence to the printer.

Control sequence introducer CSI
9/11
Introduces a control sequence.
String terminator ST
9/12
Ends a device control string. You use ST in combination with DCS.
Operating system command OSC
9/13
Introduces an operating system command.*
Privacy message PM
9/14
Introduces a privacy message string.*
Application program command APC
9/15
Introduces an application program command.*
* The VT420 ignores all following characters until it receives a SUB, ST, or any other C1 control character.

8-Bit Control Characters and Their 7-Bit Equivalents

Name 8-Bit Character 7-Bit Sequence
Index IND ESC D
Next line NEL ESC E
Horizontal tab set HTS ESC H
Reverse index RI ESC M
Single shift 2 SS2 ESC N
Single shift 3 SS3 ESC O
Device control string DCS ESC P
Start of string SOS ESC X
DEC private identification DECID ESC Z
Control sequence introducer CSI ESC [
String terminator ST ESC \
Operating system command OSC ESC ]
Privacy message PM ESC ^
Application program command APC ESC _

Using Macros

The VT420 lets you define and invoke macros to suit the needs of your application. A macro is a string of ANSI text and commands downloaded into the terminal. By invoking the macro, you can execute a group of control functions with one operation.

Name Mnemonic Sequence
Define macro DECDMAC DCS Pid ; Pdt ; Pen ! z D...D ST
Pid = macro ID number (0-63).
Pdt = macros to delete first.
0 = delete all current macros.
1 = delete all current macros.
Other = terminal ignores the macro.
Pen = encoding format for macro text.
0 = standard ASCII characters.
1 = hex pairs for each ASCII character.
Other = terminal ignores the macro.
D...D = control string data
! = repeat sequence introducer.
Invoke macro DECINVM CSI Pid * z
Pid = macro ID number.

3 Keyboard Codes

Codes Sent by Editing Keys

Key Code Sent
VT400 Mode VT100, VT52 Modes
Find CSI 1 ~ The editing keys do not send codes in these two modes.
Insert Here CSI 2 ~
Remove CSI 3 ~
Select CSI 4 ~
Prev CSI 5 ~
Next CSI 6 ~

Codes Sent by Arrow Keys

Key Cursor Key Mode Setting (DECCKM)
ANSI Mode* VT52 Mode*
Cursor Application Cursor or Application
[Up] CSI A SS3 A ESC A
[Down] CSI B SS3 B ESC B
[Right] CSI C SS3 C ESC C
[Left] CSI D SS3 D ESC D
* ANSI mode applies to VT400 and VT100 modes. VT52 mode is not compatible with ANSI mode.

Codes Sent by Numeric Keypad Keys

Key Numeric Keypad Mode Setting (DECNKM)
ANSI Mode* VT52 Mode*
Numeric Application Numeric Application
0 0 SS3 p 0 ESC ? p
1 1 SS3 q 1 ESC ? q
2 2 SS3 r 2 ESC ? r
3 3 SS3 s 3 ESC ? s
4 4 SS3 t 4 ESC ? t
5 5 SS3 u 5 ESC ? u
6 6 SS3 v 6 ESC ? v
7 7 SS3 w 7 ESC ? w
8 8 SS3 x 8 ESC ? x
9 9 SS3 y 9 ESC ? y
- (minus) - SS3 m - ESC ? m
, (comma) , SS3 l , ESC ? l
. (period) . SS3 n . ESC ? n
Enter CR or CR LF SS3 M CR or CR LF ESC ? M
PF1 SS3 P SS3 P ESC P ESC P
PF2 SS3 Q SS3 Q ESC Q ESC Q
PF3 SS3 R SS3 R ESC R ESC R
PF4 SS3 S SS3 S ESC S ESC S
* ANSI mode applies to VT400 and VT100 modes. VT52 mode is not compatible with ANSI standards.
† You cannot use these sequences on a VT52 terminal.
‡ Keypad numeric mode. Enter sends the same codes as Return. You can use line feed/new line mode (LNM) to change the code sent by Return. When LNM is reset, pressing Return sends one control character (CR). When LNM is set, pressing Return sends two control characters (CR, LF).

Codes Sent by the Top-Row Function Keys

Legend Key Number Code Sent
VT400 Mode VT100, VT52 modes
Hold F1* -- --
Print F2* -- --
Set-Up F3* -- --
Session F4* -- --
Break F5* -- --
F6 F6 CSI 1 7 ~ --
F7 F7 CSI 1 8 ~ --
F8 F8 CSI 1 9 ~ --
F9 F9 CSI 2 0 ~ --
F10 F10 CSI 2 1 ~ --
F11 (ESC) F11 CSI 2 3 ~ ESC
F12 (BS) F12 CSI 2 4 ~ BS
F13 (LF) F13 CSI 2 5 ~ LF
F14 F14 CSI 2 6 ~ --
Help F15 CSI 2 8 ~ --
Do F16 CSI 2 9 ~ --
F17 F17 CSI 3 1 ~ --
F18 F18 CSI 3 2 ~ --
F19 F19 CSI 3 3 ~ --
F20 F20 CSI 3 4 ~ --
* F1 through F5 are local function keys that do not send codes.

Keys Used to Send 7-Bit Control Characters

Control Character Mnemonic Code Table Position Key Pressed With Ctrl (All Modes) Dedicated Function Key
NUL 0/00 2 or space bar --
SOH 0/01 A --
STX 0/02 B --
ETX 0/03 C --
EOT 0/04 D --
ENQ 0/05 E --
ACK 0/06 F --
BEL 0/07 G --
BS 0/08 H F12 (BS)*
HT 0/09 I Tab
LF 0/10 J F13 (LF)*
VT 0/11 K --
FF 0/12 L --
CR 0/13 M Return
SO 0/14 N --
SI 0/15 O --
DLE 1/00 P --
DC1 1/01 Q† --
DC2 1/02 R --
DC3 1/03 S† --
DC4 1/04 T --
NAK 1/05 U --
SYN 1/06 V --
ETB 1/07 W --
CAN 1/08 X --
EM 1/09 Y --
SUB 1/10 Z --
ESC 1/11 3 or [ F11 (ESC)*
FS 1/12 4 or / --
GS 1/13 5 or ] --
RS 1/14 6 or ~ --
US 1/15 7 or ? --
DEL 7/15 8 Delete
* 7-bit control characters sent in VT100 or VT52 modes only.
† 7-bit control codes sent only when XON/XOFF support is off.

4 Emulating VT Series Terminals

Selecting an Operating Level (DECSCL)

Sequence Level Selected
Level 1
CSI 6 1 " p VT100 mode
Level 4*
CSI 6 n " p VT400 mode, 8-bit controls
CSI 6 n ; 0 " p VT400 mode, 8-bit controls
CSI 6 n ; 1 " p VT400 mode, 7-bit controls (D)
CSI 6 n ; 2 " p VT400 mode, 8-bit controls
* Level 4 includes levels 2 and 3. In these sequences, n can be 2 or 3, or 4
(D) = default

Sending C1 Controls to the Host

Sequence Mode Before Mode After
7-Bit Controls (S7C1T)
ESC sp F VT400 mode, 8-bit controls VT400 mode, 7-bit controls
VT400 mode, 7-bit controls Same. Terminal ignores sequence.
VT100 or VT52 mode Same. Terminal ignores sequence.
8-Bit Controls (S8C1T)
ESC sp G VT400 mode, 8-bit controls Same. Terminal ignores sequence.
VT400 mode, 7-bit controls VT400 mode, 8-bit controls
VT100 or VT52 mode Same. Terminal ignores sequence.

Character Set Mode (DECNRCM)

(Worldwide Model Only)
Default: Multinational

Mode Sequence Function
Set
(national)
CSI ? 4 2 h The terminal uses 7-bit characters from an NRC set.
Reset
(multinational)
CSI ? 4 2 l* The terminal uses 7-bit and 8-bit characters from the DEC Multinational or ISO Latin-1 set.
* The last character in the sequence is a lowercase L.

5 Using Character Sets

Selecting Graphic Character Sets

  1. Designate the set as G0, G1, G2, or G3.
  2. Map the designated set into the in-use table.

Designating Character Sets (SCS Sequences)

You designate a hard character set as G0 through G3 by using a select character set (SCS) escape sequence. You cannot designate a 96-character set as G0.

Format:

ESC I1 I2 ... In F

I1, intermediate character
Designates the character set as G0, G1, G2, or G3.

I1 Character Code Set Selection
94-Character Sets
( left parenthesis 2/8 G0 (initial setting for GL)
) right parenthesis 2/9 G1
* asterisk 2/10 G2 (initial setting for GR)
+ plus sign 2/11 G3
96-Character Sets*
- hyphen 2/13 G1
. period 2/14 G2
/ slash 2/15 G3
* You cannot designate a 96-character set into G0.

I2...In F, intermediate and final characters
Selects one of the standard character sets.

Character Set I2...In F Characters Code
94-Character Sets
ASCII (initial G1 and G0 setting) B 4/2
DEC Supplemental Graphic (initial G2 and G3 setting) %5 2/5, 3/5
DEC Special Graphics 0 3/0
DEC Technical > 3/14
User-preferred supplemental < 3/12
NRC Sets*
ISO United Kingdom A 4/1
DEC Dutch 4 3/4
DEC Finnish 5 3/5
ISO French R 5/2
DEC French Canadian 9 3/9
ISO German K 4/11
ISO Italian Y 5/9
DEC Norwegian/Danish 6 3/6
ISO Norwegian/Danish ` 6/0
DEC Portuguese %6 2/5, 3/6
ISO Spanish Z 5/10
DEC Swedish 7 3/7
DEC Swiss = 3/13
96-Character Sets
ISO Latin-1 Supplemental A 4/1
* Only one NRC set is available at a time. You must select national mode to use NRC sets. See "Character Set Mode (DECNRCM)" at the end of "4 Emulating VT Series Terminals".

Mapping Character Sets

After you designate a character set as G0, G1, G2, or G3, you must map the set into the in-use table as GL or GR. To map a set, you use locking-shift or single-shift control functions.

To use a national replacement character set, you must select national replacement character set mode. When you reset this mode, the terminal uses 7-bit and 8-bit characters from one of the multinational character sets (DEC Multinational or ISO Latin-1). When you set this mode, the terminal uses 7-bit characters from an NRC set.

See "Character Set Mode (DECNRCM)" at the end of "4 Emulating VT Series Terminals".

Locking Shifts (LS)

When you use a locking shift, the character set remains in GL or GR until you use another locking shift.

Name Mnemonic Code Maps...
Locking shift G0 LS0 SI Maps G0 into GL. (default)
Locking shift G1 LS1 SO G1 into GL.
The following locking shift functions are available only in VT400 mode.
Locking shift G1 right LS1R ESC ~ G1 into GR.
Locking shift G2 LS2 ESC n G2 into GL.
Locking shift G2 right LS2R ESC } G2 into GR.
Locking shift G3 LS3 ESC o G3 into GL.
Locking shift G3 right LS3R ESC | G3 into GR.

Single Shifts (SS)

You use a single shift when you want to display the next character from a different character set. A single shift maps the G2 or G3 set into GL. The character set is active for only one character. Then the terminal returns to the previous character set in GL.

Name 8-Bit Code 7-Bit Code Function
Single shift 2 SS2 ESC N Maps G2 into GL for the next character.
Single shift 3 SS3 ESC O Maps G3 into GL for the next character.

Assigning User-Preferred Supplemental Sets (DECAUPSS)

Default: DEC Supplemental Graphic

Sequence Set Selected
DCS 0 ! u % 5 ST DEC Supplemental Graphic
DCS 1 ! u A ST ISO Latin-1 Supplemental

ANSI Conformance Levels

ESC sp Final

Final ANSI Conformance Level
L Level 1
M Level 2
N Level 3

Soft Character Sets

You can only load soft character sets in VT400 mode.

Character Cell Sizes

Cell Size 80 Columns 132 Columns
24 lines/screen
Width 10 pixels 6 pixels
Height 16 16
36 lines/screen
Width 10 6
Height 10 10
48 lines/screen
Width 10 6
Height 8 8

Converting Binary Code to an ASCII Character

Binary Value Hex Value Hex Value + 3F Offset Character Equivalent
000000 00 3F ?
000001 01 40 @
000010 02 41 A
000011 03 42 B
000100 04 43 C
 
000101 05 44 D
000110 06 45 E
000111 07 46 F
001000 08 47 G
001001 09 48 H
 
001010 0A 49 I
001011 0B 4A J
001100 0C 4B K
001101 0D 4C L
001110 0E 4D M
 
001111 0F 4E N
010000 10 4F O
010001 11 50 P
010010 12 51 Q
010011 13 52 R
 
010100 14 53 S
010101 15 54 T
010110 16 55 U
010111 17 56 V
011000 18 57 W
 
011001 19 58 X
011010 1A 59 Y
011011 1B 5A Z
011100 1C 5B [
011101 1D 5C \
 
011110 1E 5D ]
011111 1F 5E ^
100000 20 5F _
100001 21 60 `
100010 22 61 a
 
100011 23 62 b
100100 24 63 c
100101 25 64 d
100110 26 65 e
100111 27 66 f
 
101000 28 67 g
101001 29 68 h
101010 2A 69 i
101011 2B 6A j
101100 2C 6B k
 
101101 2D 6C l
101110 2E 6D m
101111 2F 6E n
110000 30 6F o
110001 31 70 p
 
110010 32 71 q
110011 33 72 r
110100 34 73 s
110101 35 74 t
110110 36 75 u
 
110111 37 76 v
111000 38 77 w
111001 39 78 x
111010 3A 79 y
111011 3B 7A z
 
111100 3C 7B {
111101 3D 7C |
111110 3E 7D }
111111 3F 7E ~

Downloading Soft Characters

Use the following sequence format:

DCS Pfn; Pcn; Pe; Pcmw; Pss; Pt; Pcmh; Pcss { Dscs Sxbp1 ; Sxbp2 ;...; Sxbpn ST

DECDLD Parameter Characters

Parameter Name Description
Pfn Font number Selects the DRCS font buffer to load. Each session has only one font buffer. Pfn has two valid values, 0 and 1. Both values refer to DRCS buffer 1 for each session.
Pcn Starting character

Selects where to load the first character in the DRCS font buffer. The location corresponds to a location in the ASCII code table. For example, a Pcn value of 0 means that the first soft character is loaded into position 2/0 of the character table. A Pcn value of 1 means position 2/1 in the table, and so on up to Pcn = 95 (position 7/15).

Pcn is affected by the character set size. See Pcss below.

Pe Erase control

Selects which characters to erase from the DRCS buffer before loading the new font.

0 = erase all characters in the DRCS buffer with this number, width and rendition.
1 = erase only characters in locations being reloaded.
2 = erase all renditions of the soft character set (normal, bold, 80-column, 132-column).

NOTE: Erased characters are undefined (not blank). The terminal displays these characters as the error character (reverse question mark).

Pcmw Character matrix width

Selects the maximum character cell width.

0 = 10 pixels wide for 80 columns, 6 pixels wide for 132 columns. (default)
1 = illegal.
2 = 5 × 10 pixel cell (VT220 compatible).
3 = 6 × 10 pixel cell (VT220 compatible).
4 = 7 × 10 pixel cell (VT220 compatible).
5 = 5 pixels wide.
6 = 6 pixels wide.
.
.
.
10 = 10 pixels wide.
Pss Font set size

Defines the screen width and screen height for this font.

0, 1 = 80 columns, 24 lines. (default)
2 = 132 columns, 24 lines
11 = 80 columns, 36 lines
12 = 132 columns, 36 lines
21 = 80 columns, 48 lines
22 = 132 columns, 48 lines

If the number of columns or lines per screen changes, the terminal uses the appropriate variation of the soft set. If you try to display a DRCS character when there is no soft set defined for the current number of lines and columns, the terminal displays the error character (reverse question mark).

Pt Text or full cell

Defines the font as a text font or full-cell font.

0 = text. (default)
1 = text.
2 = full cell.

Full-cell fonts can individually address all pixels in a cell.

Text fonts cannot individually address all pixels. If you specify a text cell, the terminal automatically performs spacing and centering of the characters.

Pcmh Character matrix height

Selects the maximum character cell height.

0 or omitted = 16 pixels high. (default)
1 = 1 pixel high.
2 = 2 pixels high.
3 = 3 pixels high.
.
.
16 = 16 pixels high.

Pcmh values over 16 are illegal. If the value of Pcmw is 2, 3, or 4, Pcmh is ignored.

Pcss Character set size

Defines the character set as a 94- or 96-character graphic set.

0 = 94-character set. (default)
1 = 96-character set.

The value of Pcss changes the meaning of the Pcn (starting character) parameter above.

Examples
  • If Pcss = 0 (94-character set)

    The terminal ignores any attempt to load characters into the 2/0 or 7/15 table positions.

    Pcn Specifies
    1 column 2/row 1
    .
    .
    94 column 7/row 14
  • If Pcss = 1 (96-character set)

    Pcn Specifies
    0 column 2/row 0
    .
    .
    95 column 7/row 15

Dscs
defines the name for the soft character set. You use this name in the select character set (SCS) escape sequence. You use the following format for the Dscs name:

I F

I is 0, 1 or 2 intermediate characters from the range 2/0 to 2/15 in the ASCII character set.
F is a final character in the range 3/0 to 7/14.

Sxbp1 ; Sxbp2 ; ... ; Sxbpn
are the sixel bit patterns for individual characters, separated by semicolons (3/11). Your character set can have 1 to 94 patterns or 1 to 96 patterns, depending on the setting of the character set size parameter (Pcss). Each sixel bit pattern is in the following format:

S...S/S...S

the first S...S
represents the upper columns of the soft character.

/ (2/5)
advances the sixel pattern to the lower columns of the soft character.

the second S...S
represents the sixels in the lower columns of the soft character.

ST
is the string terminator. ST is an 8-bit C1 character. You can use the equivalent 7-bit sequence ESC \ (1/11, 5/12) when coding for a 7-bit environment.

Valid DECDLD Parameter Combinations

Pt Pcmw Pcmh Pss*
80-column, 24 lines
0 or 1 0 to 8 0 to 16 0 or 1
2 0 to 10 0 to 16 0, 1
 
132-column, 24 lines
0 or 1 0 to 5 0 to 16 2
2 0 to 6 1 to 16 2
 
80-column, 36 lines
0 or 1 0 to 8 0 to 10 11
2 0 to 10 0 to 10 11
 
132-column, 36 lines
0 or 1 0 to 5 0 to 10 12
2 0 to 6 0 to 10 12
 
80-column, 48 lines
0 or 1 0 to 8 0 to 8 21
2 0 to 10 0 to 8 21
 
132-column, 48 lines
0 or 1 0 to 5 0 to 8 22
2 0 to 6 0 to 8 22
* The default values are the maximum legal values in each case.

Clearing a Soft Character Set

You can clear a soft character set that you loaded into the terminal by using the following DECDLD control string:

DCS 1;1;2 { sp @ ST

Any of the following actions also clear the soft character set:

6 Page Memory

Setting the Page Format

Name Mnemonic Sequence
Set columns per page DECSCPP CSI Pn $ |
Pn columns (80 or 132).
Column mode DECCOLM Set: CSI ? 3 h
132 columns.
Reset: CSI ? 3 l
80 columns. (D)
Set lines per page DECSLPP CSI Pn t
Pn lines per page.
The number of pages depend on how many sessions you use.
Pn Dual Sessions Single Session
24 3 pages 6 pages
25 2 5
36 2 4
48 1 3
72 1 2
144 -- 1
Set left and right margins DECSLRM CSI Pl ; Pr s
Pl = left column.
Pr = right column.
Set top and bottom margins DECSTBM CSI Pt ; Pb r
Pt = top line.
Pb= bottom line.
Origin mode DECOM Set: CSI ? 6 h
Move within margins.
Reset: CSI ? 6 l
Move outside margins. (D)
Vertical split screen mode DECVSSM Set: CSI ? 69 h
Left and right margins can be changed.
Reset: CSI ? 69 l
Left and right margins cannot be changed. (D)
(D) = default.

Moving Through Page Memory

Name Mnemonic Sequence*
Next page NP CSI Pn U
Move Pn pages forward.
C = home.
Preceding page PP CSI Pn V
Move Pn pages backward.
C = home.
Page position absolute PPA CSI Pn sp P
Move to page Pn.
C = same as old page.
Page position backward PPB CSI Pn sp R
Move Pn pages backward.
C = same as old page.
Page position relative PPR CSI Pn sp Q
Move Pn pages forward.
C = same as old page.
* C = new cursor position.

7 Visual Character and Line Attributes

Character and Line Attribute Sequences

Name Mnemonic Sequence
Select graphic rendition SGR CSI Ps...Ps m
Ps = character attribute value(s).
(See the list below.)
Single-width, single-height line DECSWL ESC # 5
Double-width, single-height line DECDWL ESC # 6
Double-width, double-height line DECDHL ESC # 3 (top half)
ESC # 4 (bottom half)

Visual Character Attribute Values

Ps Attribute
VT100 or VT400 Mode
0 All attributes off
1 Bold
4 Underline
5 Blinking
7 Reverse video
VT400 Mode Only
22 Bold off
24 Underline off
25 Blinking off
27 Reverse video off

8 Editing

Editing Sequences

Name Mnemonic Sequence
Insert/replace mode IRM Set: CSI 4 h
Insert characters.
Reset: CSI 4 l
Replace characters.
Delete column DECDC CSI Pn ' ~
Pn columns.
Insert column DECIC CSI Pn ' }
Pn columns.
Delete line DL CSI Pn M
Pn lines.
Insert line IL CSI Pn L
Delete character DCH CSI Pn P
Pn characters.
Insert character ICH CSI Pn @
Pn characters.
Erase in display ED CSI Ps J
Ps = 0, cursor to end. (D)
Ps = 1, beginning to cursor.
Ps = 2, complete display.
Erase in line EL CSI Ps K
Ps = 0, cursor to end. (D)
Ps = 1, beginning to cursor.
Ps = 2, complete line.
Erase character* ECH CSI Pn X
Pn characters.
Select character protection attribute* DECSCA CSI Ps " q
Ps = 0, DECSED and DECSEL can erase. (D)
Ps = 1, DECSED and DECSEL cannot erase.
Ps = 2, DECSED and DECSEL can erase.
Selective erase in display* DECSED CSI ? Ps J
Ps = 0, cursor to end. (D)
Ps = 1, beginning to cursor.
Ps = 2, complete display.
Selective erase in line* DECSEL CSI ? Ps K
Ps = 0, cursor to end. (D)
Ps = 1, beginning to cursor.
Ps = 2, complete line.

* Available in VT400 mode only.
(D) = default

9 Rectangular Area Operations

Rectangular Area Control Functions

Name Mnemonic Sequence*
Copy rectangular area DECCRA CSI Pts; Pl; Pbs; Prs; Pps; Ptd; Pld; Ppd $ v
Pts = top-line border.
Pl = left-column border.
Pbs = bottom-line border.
Prs = right-column border.
Pps = source page number.
Ptd = destination top-line border.
Pld = destination left-column border.
Ppd = destination page number.
Erase rectangular area DECERA CSI Pt; Pl; Pb; Pr $ z
Pt = top-line border.
Pl = left-column border.
Pb = bottom-line border.
Pr = right-column border.
Fill rectangular area DECFRA CSI Pch; Pt; Pl; Pb; Pr $ x
Pch = decimal code of fill character.
Pt = top-line border.
Pl = left-column border.
Pb = bottom-line border.
Pr = right-column border.
Selective erase rectangular area DECSERA CSI Pt; Pl; Pb; Pr $ {
Pt = top-line border.
Pl = left-column border.
Pb = bottom-line border.
Pr = right-column border.
Select attribute change extent DECSACE CSI Ps * x
Ps = character positions affected.
0
or
1
= stream of character positions.
2 = rectangular area of character positions.
Change attributes in rectangular area DECCARA CSI Pt; Pl; Pb; Pr; Ps1..Psn $ r
Pt = top-line border.
Pl = left-column border.
Pb = bottom-line border.
Pr = right-column border.
Psn = visual character attributes.
Reverse attributes in rectangular area DECRARA CSI Pt; Pl; Pb; Pr; Ps1..Psn $ t
Pt = top-line border.
Pl = left-column border.
Pb = bottom-line border.
Pr = right-column border.
Psn = visual character attributes.
* These sequences work in VT400 mode only.

10 Cursor Movement and Panning

Cursor Movement and Panning Sequences

Name Mnemonic Sequence
Enabling the Cursor
Text cursor enable mode DECTCEM Set: CSI ? 25 h
Visible cursor. (D)
Reset: CSI ? 25 l
Invisible cursor.
Moving the Cursor*
Back index† DECBI ESC 6
Forward index† DECFI ESC 9
Cursor position CUP CSI Pl ; Pc H
Line Pl, column Pc.
Horizontal and vertical position HVP CSI Pl ; Pc f
Line Pl, column Pc.
(Digital recommend using CUP instead.)
Cursor forward CUF CSI Pn C
Pn columns right.
Cursor backward CUB CSI Pn D
Pn columns left.
Cursor up CUU CSI Pn A
Pn lines up.
Cursor down CUD CSI Pn B
Pn lines down.
Panning*
Pan down SU CSI Pn S
Pn lines down.
Pan up SD CSI Pn T
Pn lines up.
Vertical cursor coupling mode DECVCCM Set: CSI ? 61 h
Coupled. (D)
Reset: CSI ? 61 l
Uncoupled.
Page cursor coupling mode DECPCCM Set: CSI ? 64 h
Coupled. (D)
Reset: CSI ? 64 l
Uncoupled.
* In these sequences, the default value for Pn, Pl, and Pc is 1.
† Available in VT400 mode only.
(D) = default.

11 Keyboard, Printing, and Display Commands

Keyboard Control Sequences

Mode Mnemonic Sequence
Set Reset
Keyboard action KAM CSI 2 h
Locked.
CSI 2 l
Unlocked. (D)
Backarrow key DECBKM CSI ? 67 h
Backspace.
CSI ? 67 l
Delete. (D)
Line feed/ new line LNM CSI 20 h
New Line.
CSI 20 l
Line feed. (D)
Autorepeat DECARM CSI ? 8 h
Repeat. (D)
CSI ? 8 l
No repeat.
Autowrap DECAWM CSI ? 7 h
Autowrap.
CSI ? 7 l
No autowrap. (D)
Cursor keys DECCKM CSI ? 1 h
Application.
CSI ? 1 l
Cursor. (D)
Keypad application/ numeric DECKPAM ESC =
Application.
ESC >
Numeric. (D)
Numeric keypad mode DECNKM CSI ? 66 h
Application.
CSI ? 66 l
Numeric. (D)
Keyboard usage mode DECKBUM CSI ? 68 h
Data processing.
CSI ? 68 l
Typewriter. (D)
Key position DECKPM CSI ? 81 h
Position reports.
CSI ? 81 l
Character codes. (D)
Name Mnemonic Sequence
Enable local functions DECELF CSI Pf1; Pc1; ... Pfn; Pcn + q
Pfn = function number.
0 = all local functions.
1 = local copy and paste.
2 = local panning.
3 = local window resize.
Pcn = control performed.
0 = factory default.
1 = enable local function.
2 = disable local function.
Local function key control DECLFKC CSI Pk1; Pf1; ... Pkn; Pfn * }
Pkn = function key number.
0 = all local function keys.
1 = F1 or Hold.
2 = F2 or Print.
3 = F3 or Set-Up.
4 = F4 or Session.
Pfn = function performed.
0 = factory default.
1 = local function.
2 = send key sequence.
3 = disable key.
Select modifier key reporting DECSMKR CSI Pm1; Pf1; ... Pmn; Pfn + r
Pmn = key number.
0 = all keys.
1 = left Shift.
2 = right Shift.
3 = lock key.
4 = Ctrl.
5 = left Alt Function.
6 = right Alt Function.
7 = left Compose Character.
8 = right Compose Character.
Pcn = control performed.
0 = factory default.
1 = modifier function.
2 = extended keyboard report.
3 = key disabled.
Extended keyboard report DECEKBD APC : ppp mm ST
ppp = key position number.
mm = modifier key state.
0 = not pressed.
1 = pressed.
(D) = default.

Programming UDKs

Definable Keys
F6 through F14 Help
Do F17 through F20
DECUDK Device Control String Format

DCS Pc ; Pl | Ky1/St1; ... Kyn/Stn ST

Pc is the clear parameter.
0 or none = clear all keys before loading new values (default).
1 = clear one key at a time, before loading a new value.
Pl is the lock parameter.
0 or none = lock the keys.
1 = do not lock the keys.

Ky1/St1;...Kyn/Stn are the key definition strings.

The key selector number (Kyn) indicates which key you are defining.

Key Value Key Value Key Value
F6 17 F11 23 Do 29
F7 18 F12 24 F17 31
F8 19 F13 25 F18 32
F9 20 F14 26 F19 33
F10 21 Help 28 F20 34

The string parameters (Stn) are the key definitions, encoded as pairs of hex codes.

3/0 through 3/9 (0 through 9)

4/1 through 4/6 (A through F)

6/1 through 6/6 (a through f)

Printing Control Sequences

Name Mnemonic Sequence
Printer extent mode DECPEX Set: CSI ? 19 h
Page. (D)
Reset: CSI ? 19 l
Scrolling region.
Print form feed mode DECPFF Set: CSI ? 18 h
Form feed.
Reset: CSI ? 18 l
No form feed. (D)
Auto print mode MC On: CSI ? 5 i
Off: CSI ? 4 i
Printer controller mode MC On: CSI 5 i
Off: CSI 4 i
Print page MC CSI i or CSI 0 i
Print composed main display MC CSI ? 10 i
Print all pages MC CSI ? 11 i
Print cursor line MC CSI ? 1 i
Start printer-to-host session MC CSI ? 9 i
Stop printer-to-host session MC CSI ? 8 i
Assign printer to active session MC CSI ? 18 i
Release printer MC CSI ? 19 i
Send line attributes --
  Single-width ESC # 5
  Double-width ESC # 6
  Double-width/double-height
    Top half ESC # 3
    Bottom half ESC # 4
Send visual character attributes --
  Clear all attributes ESC [ 0 m
  Set attributes ESC [ 0; Ps; Ps; ... Ps m
Ps = attribute.
See text.
(D) = default.

Screen Display Control Sequences

Name Mnemonic Sequence
Send/receive mode SRM Set: CSI 12 h
Local echo off. (D)
Reset: CSI 12 l
Local echo on.
Screen mode DECSCNM Set: CSI ? 5 h
Light background.
Reset: CSI ? 5 l
Dark background. (D)
Scrolling mode DECSCLM Set: CSI ? 4 h
Smooth scroll. (D)
Reset: CSI ? 4 l
Jump scroll.
Select number of lines per screen DECSNLS CSI Pn * |
Pn = number of lines.
Select active status display* DECSASD CSI Ps $ }
Ps = 0, main display.
Ps = 1, status line.
Select status line type* DECSSDT CSI Ps $ ~
Ps = 0, none.
Ps = 1, indicator. (D)
Ps = 2, host-writable.
* Available in VT400 mode only.
(D) = default.

12 VT420 Reports

Sequences for VT420 Reports

Name Mnemonic Sequence
Primary Device Attributes
Primary DA request
(Host to VT420)
DA CSI c or CSI 0 c
Primary DA response
(VT420 to Host)
DA CSI ? Psc; Ps1; ... Psn c
Psc = operating level.
61 = level 1 (VT100 family).
62,63,64 = level 4 (VT400 family).
Ps1...Psn = extensions.
1 = 132 columns.
2 = printer port.
6 = selective erase.
7 = soft character set.
8 = user-defined keys.
9 = NRC sets.
15 = DEC technical set.
18 = user windows.
19 = two sessions.
21 = horizontal scrolling.
See Table 9-1 for alias responses.
Secondary Device Attributes
Secondary DA request
(Host to VT420)
DA CSI > c or CSI > 0 c
Secondary DA response
(VT420 to Host)
DA CSI > 41; Pv ; 0 c

Pv = firmware version.

Tertiary Device Attributes (VT400 Mode Only)
Tertiary DA request
(Host to VT420)
DA CSI = c or CSI = 0 c
DECRPTUI response
(VT420 to host)
DA DCS ! | D...D ST

D...D = unit ID.

Device Status Reports
VT420 Operating Status
Request
(Host to VT420)
DSR CSI 5 n
Report
(VT420 to Host)
DSR CSI 0 n
No malfunction.
CSI 3 n
Malfunction.
Cursor Position Report
Request
(Host to VT420)
DSR CSI 6 n
Report
(VT420 to Host)
CPR CSI Pl; Pc R
Pl = line number.
Pc = column number.
Extended Cursor Position Report
Request
(Host to VT420)
DSR CSI ? 6 n
Report
(VT420 to host)
DECXCPR CSI ? Pl; Pc; Pp R
Pl = line number.
Pc = column number.
Pp = page number.
Printer Status
Request
(Host to VT420)
DSR CSI ? 15 n
Report
(VT420 to host)
DSR CSI ? 13 n
No printer.
CSI ? 10 n
Printer ready.
CSI ? 11 n
Printer not ready.
CSI ? 18 n
Printer busy.
CSI ? 19 n
Printer assigned to other session.
UDK Status (VT400 Mode Only)
Request
(Host to VT420)
DSR CSI ? 25 n
Report
(VT420 to host)
DSR CSI ? 20 n
UDKs unlocked.
CSI ? 21 n
UDKs locked.
Keyboard Status
Request
(Host to VT420)
DSR CSI ? 26 n
Report
(VT420 to host)
DSR CSI ? 27; Pla; Pst; Ptyp n
Pla = keyboard dialect.
1 = North American.
2 = British.
3 = Flemish.
4 = French Canadian.
5 = Danish.
6 = Finnish.
7 = German.
8 = Dutch.
9 = Italian.
10 = Swiss French.
11 = Swiss German.
12 = Swedish.
13 = Norwegian.
14 = French/Belgian.
15 = Spanish.
16 = Portuguese.
28 = Canadian (English).
 
Pst = keyboard status.
0 = keyboard ready.
3 = no keyboard.
8 = keyboard busy.
 
Ptyp = keyboard type.
0 = LK201.
1 = LK401
Macro Space
Request
(Host to VT420)
DSR CSI ? 62 n
Report
(VT420 to host)
DECMSR CSI Pn * {
Pn = number of bytes / 16.
Memory Checksum
Request
(Host to VT420)
DSR CSI ? 63; Pid n
Pid = request label.
Report
(VT420 to host)
DECCKSR DCS Pid ! ~ D..D ST
Pid = request label.
D..D = checksum.
Data Integrity
Request
(Host to VT420)
DSR CSI ? 75 n
Report
(VT420 to host)
DSR CSI ? 70 n
No communication errors.
CSI ? 71 n
Communication errors.
CSI ? 73 n
Not reported since last power-up or RIS.
Multiple Session Status
Request
(Host to VT420)
DSR CSI ? 85 n
Report
(VT420 to host)
DSR CSI ? 80; Ps2 n
SSU sessions enabled.
Ps2 = Maximum number of sessions.
CSI ? 81; Ps2 n
SSU sessions available but pending.
Ps2 = Maximum number of sessions.
CSI ? 83 n
SSU sessions not ready.
CSI ? 87 n
Sessions on separate lines.
Requesting Checksum of Rectangular Area
(VT400 Mode Only)
Request
(Host to VT420)
DECRQCRA CSI Pid; Pp; Pt; Pl; Pb; Pr * y
Pid = request label.
Pp = page number.
Pt = top-line border.
Pl = left-column border.
Pb = bottom-line border.
Pr = right-column border.
Checksum report
(VT420 to host)
DECCKSR DCS Pid ! ~ D...D ST
Pid = request label.
D...D = checksum.
Terminal State Reports (VT400 Mode Only)
Request (Host to VT420) DECRQTSR CSI Ps $ u
Ps = report requested.
0 = ignored.
1 = terminal state report.
Terminal state report
(VT420 to host)
DECTSR DCS 1 $ s D..D ST
D...D = report data.
Restore DECRSTS DCS Ps $ p D...D ST
Ps = data string format.
0 = error.
1 = terminal state report.
D...D = restored data.
Presentation State Reports (VT400 Mode Only)
Request
(Host to VT420)
DECRQPSR CSI Ps $ w
Ps = report requested.
0 = error.
1 = cursor information report.
2 = tab stop report.
Cursor information report
(VT420 to Host)
DECCIR DCS 1 $ u D...D ST

D...D = data string.

See the VT420 Programmer Reference Manual for description.

Tab stop report
(VT420 to host)
DECTABSR DCS 2 $ u D...D ST
D...D = tab stops.
Restore DECRSPS DCS Ps $ t D...D ST
Ps = data string format.
0 = error.
1 = cursor information report.
2 = tab stop report.
D...D = data string.
Mode Settings (VT400 Mode Only)
Request mode
(Host to VT420)
DECRQM CSI Pa $ p
Pa = ANSI mode. (Table 9-2)
CSI ? Pd $ p
Pd = DEC private mode. (Table 9-3)
Report mode
(VT420 to host)
DECRPM CSI Pa; Ps $ y
Pa = ANSI mode. (Table 9-2)
Ps = mode state.
0 = unknown mode.
1 = set.
2 = reset.
3 = permanently set.
4 = permanently reset.
Set mode SM CSI Pa; ... Pa h
Pa = ANSI mode(s). (Table 9-2)
CSI ? Pd; ... Pd h
Pd = DEC private mode(s). (Table 9-3)
Reset mode RM CSI Pa; ... Pa l
Pa = ANSI mode(s). (Table 9-2)
CSI ? Pd; ... Pd l
Pd = DEC private mode(s). (Table 9-3)
Control Function Settings (VT400 Mode Only)
Request
(Host to VT420)
DECRQSS DCS $ q D...D ST
D...D = intermediate and/or final characters of function. (Table 9-4)
Report
(VT420 to host)
DECRPSS DCS Ps $ r D...D ST
Ps = 0, valid request.
Ps = 1, invalid request.
D...D = intermediate and/or final characters of function. (Table 9-4)
Saving and Restoring the Cursor State
Save cursor state DECSC ESC 7
Restore cursor state DECRC ESC 8
Window Report (VT400 Mode Only)
Request
(Host to VT420)
DECRQDE CSI " v
Report
(VT420 to host)
DECRPDE CSI Ph; Pw; Pml; Pmt; Pmp " w
Ph = number of lines.
Pw = number of columns.
Pml = first column at left.
Pmt = top line.
Pmp = page number.
User-Preferred Supplemental Set (VT400 Mode)
Request
(Host to VT420)
DECRQUPSS CSI & u
Report
(VT420 to host)
DECAUPSS DCS 0 ! u % 5 ST
DEC Supplemental Graphic
DCS 1 ! u A ST
ISO Latin-1 Supplemental
Table 9-1 Alias Primary DA Responses from the VT420
Terminal Identification Sequence Meaning
VT100 DA ESC [ ? 1; 2 c VT100 terminal
VT101 DA ESC [ ? 1; 0 c VT101 terminal
VT102 DA ESC [ ? 6 c VT102 terminal
VT220 DA* CSI ? 62; 1; 2; 6; 7; 8; 9 c VT220 terminal
VT320 DA* CSI ? 63; 1; 2; 6; 7; 8; 9 c VT320 terminal
VT420 DA* CSI ? 64; 1; 2; 6; 7; 8; 9; 15; 18; 19; 21 c VT420 terminal

NOTE: To change an alias response, you must use the General Set-Up screen. See Chapter 5, "Using Set-Up".

* These responses correspond to the international model of the terminal. The North American model does not support NRC sets (9).
Table 9-2 ANSI Modes for DECRQM, DECRPM, SM, and RM
Mode Mnemonic Pa
Guarded area transfer GATM* 1
Keyboard action KAM 2
Control representation CRM† 3
Insert/replace IRM 4
Status reporting transfer SRTM* 5
Vertical editing VEM* 7
Horizontal editing HEM* 10
Positioning unit PUM* 11
Send/receive SRM 12
Format effector action FEAM* 13
Format effector transfer FETM* 14
Multiple area transfer MATM* 15
Transfer termination TTM* 16
Selected area transfer SATM* 17
Tabulation stop TSM* 18
Editing boundary EBM* 19
Line feed/new line LNM 20
* This control function is permanently reset.
† The host cannot change the setting of CRM. You can only change CRM from set-up. If CRM is set, the terminal ignores DECRQM and most other control functions.
Table 9-3 DEC Private Modes for DECRQM, DECRPM, SM, and RM
Mode Mnemonic Pd
Cursor keys DECCKM 1
ANSI DECANM 2
Column DECCOLM 3
Scrolling DECSCLM 4
Screen DECSCNM 5
Origin DECOM 6
Autowrap DECAWM 7
Autorepeat DECARM 8
Print form feed DECPFF 18
Printer extent DECPEX 19
Text cursor enable DECTCEM 25
National replacement character set DECNRCM 42
Horizontal cursor coupling DECHCCM† 60
Vertical cursor coupling DECVCCM 61
Page cursor coupling DECPCCM 64
Numeric keypad DECNKM 66
Backarrow key DECBKM 67
Keyboard usage DECKBUM 68
Vertical split screen DECVSSM 69
Transmit rate limiting DECXRLM 73
Keyboard position DECKPM 81
† This control function is permanently reset.
Table 9-4 Control Functions for DECRQSS Requests
Control Function Mnemonic Intermediate and Final Character(s)
Select active status display DECSASD $ }
Select attribute change extent DECSACE * x
Set character attribute DECSCA " q
Set conformance level DECSCL " p
Set columns per page DECSCPP $ |
Set lines per page DECSLPP t
Set number of lines per screen DECSNLS * |
Set status line type DECSSDT $ ~
Set left and right margins DECSLRM s
Set top and bottom margins DECSTBM r
Select graphic rendition SGR m
Enable local functions DECELF + q
Local function key control DECLFKC * }
Select modifier key reporting DECSMKR + r

13 Resetting and Testing the Terminal

Resetting and Testing Sequences

Name Mnemonic Sequence
Resetting the Terminal
Soft terminal reset* DECSTR CSI ! p
Hard terminal reset RIS ESC c
Not recommended.
Secure reset DECSR ESC [ Pr + p
Pr can be any number from 0 to 16383.
Secure reset confirmation DECSRC ESC [ Pr * q
Pr can be any number from 0 to 16383.
Tabulation clear TBC CSI 0 g
Clear tab at cursor position.
CSI 3 g
Clear all tabs.
Testing the Terminal
Screen alignment display DECALN ESC # 8
Invoke confidence test DECTST CSI 4; Ps1; ... Psn y
Ps = test to run.
0 = all tests.
1 = power-up self-test.
2 = RS-232 port data loopback.
3 = printer port loopback.
6 = RS-232 modem control line loopback.
7 = DEC-423 port loopback.
9 = repeat tests.
* Available in VT420 mode only.

Soft Terminal Reset (DECSTR) States

Mode Mnemonic State After DECSTR
Text cursor enable DECTCEM Cursor enabled.
Insert/replace IRM Replace.
Origin DECOM Absolute (cursor origin at upper-left of screen).
Autowrap DECAWM No autowrap.
National replacement character set DECNRCM Multinational set.
Keyboard action KAM Unlocked.
Numeric keypad DECNKM Numeric characters.
Cursor keys DECCKM Normal (arrow keys).
Other Control Functions
Set top and bottom margins DECSTBM Top margin = 1.
Bottom margin = page length.
All character sets G0, G1, G2, G3, GL, GR VT420 default settings.
(DECSTR works only in VT400 mode.)
Select graphic rendition SGR Normal rendition.
Select character attribute DECSCA Normal (erasable by DECSEL and DECSED).
Save cursor state DECSC Home position with VT420 defaults.
Assign user-preferred supplemental set DECAUPSS Set selected in set-up.
Select active status display DECSASD Main display (first 24 lines).
Keyboard position mode. DECKPM Character codes.

14 Session Management

Enable Session Command

CSI & x

A. VT52 Mode Control Codes

Sequence Action
ESC A Cursor up.
ESC B Cursor down.
ESC C Cursor right.
ESC D Cursor left.
ESC F Enter graphics mode.
ESC G Exit graphics mode.
ESC H Move the cursor to the home position.
ESC I Reverse line feed.
ESC J Erase from the cursor to the end of the screen.
ESC K Erase from the cursor to the end of the line.
ESC Y Pl Pc Move cursor to line Pl and column Pc.
ESC Z Identify. (host to terminal)
ESC / Z Report. (terminal to host)
ESC = Enter alternate keypad mode.
ESC > Exit alternate keypad mode.
ESC < Exit VT52 mode. (Enter VT100 mode.)
ESC ^ Enter autoprint mode.
ESC _ Exit autoprint mode.
ESC W Enter printer controller mode.
ESC X Exit printer controller mode.
ESC ] Print the screen.
ESC V Print the line with the cursor.