VT100.net VT102 User Guide

D Control Functions (Sequence Formats)

General

This appendix summarizes the ANSI code extension techniques defined in standards X3.41-1974 and X3.64-1979. Those specifications cover many special cases and details not included here.

Control Functions

The ANSI standards define types of characters used for specific purposes. You can determine a character's type by its position in the ASCII table (Table D-1). There are two general categories of characters:

This table and the ANSI system can work for either a 7-bit or 8-bit character environment. The VT102 uses only 7-bit characters.

NOTE: The ASCII 7-bit table corresponds to International Standards Organization (ISO) standard 646 and International Telegraph and Telephone Consultive Committee (CCITT) alphabet 5.

All control characters and groups of characters (sequences) not intended for display on the screen are control functions. Not all control functions perform an action in every ANSI device, but each device can recognize all control functions and discard any that do not apply to it. Therefore, each device performs a subset of the ANSI functions.

Because different devices use different subsets, compliance with ANSI does not mean compatibility between devices. Compliance only means that a particular function, if defined in the ANSI standard, is invoked by the same control function in all devices. If an ANSI device does not perform an action that has a control function defined in the ANSI standard, it cannot use that control function for any other purpose.

Table D-1 ASCII Table
ASCII Table B7 B6 B5 B4 B3 B2 B1 BITS 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 ROW 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 1 0 0 1 2 0 1 0 3 0 1 1 4 1 0 0 5 1 0 1 6 1 1 0 7 1 1 1 COLUMN (XON) (XOFF) ESC 33271B OCTALDECIMALHEX ASCII CHARACTER KEY NUL 000 SOH 111 STX 222 ETX 333 EOT 444 ENQ 555 ACK 666 BEL 777 BS 1088 HT 1199 LF 1210A VT 1311B FF 1412C CR 1513D SO 1614E SI 1715F DLE 201610 DC1 211711 DC2 221812 DC3 231913 DC4 242014 NAK 252115 SYN 262216 ETB 272317 CAN 302418 EM 312519 SUB 32261A ESC 33271B FS 34281C GS 35291D RS 36301E US 37311F SP 403220 ! 413321 " 423422 # 433523 $ 443624 % 453725 & 463826 ' 473927 ( 504028 ) 514129 * 52422A + 53432B , 54442C - 55452D . 56462E / 57472F 0 604830 1 614931 2 625032 3 635133 4 645234 5 655335 6 665436 7 675537 8 705638 9 715739 : 72583A ; 73593B < 74603C = 75613D > 76623E ? 77633F @ 1006440 A 1016541 B 1026642 C 1036743 D 1046844 E 1056945 F 1067046 G 1077147 H 1107248 I 1117349 J 112744A K 113754B L 114764C M 115774D N 116784E O 117794F P 1208050 Q 1218151 R 1228252 S 1238353 T 1248454 U 1258555 V 1268656 W 1278757 X 1308858 Y 1318959 Z 132905A [ 133915B \ 134925C ] 135935D ^ 136945E _ 137955F ` 1409660 a 1419761 b 1429862 c 1439963 d 14410064 e 14510165 f 14610266 g 14710367 h 15010468 i 15110569 j 1521066A k 1531076B l 1541086C m 1551096D n 1561106E o 1571116F p 16011270 q 16111371 r 16211472 s 16311573 t 16411674 u 16511775 v 16611876 w 16711977 x 17012078 y 17112179 z 1721227A { 1731237B | 1741247C } 1751257D ~ 1761267E DEL 1771277F MA-7246

Escape and Control Sequences

Escape and control sequences provide more controls in addition to the control characters in the ASCII 7-bit table. These multiple-character control sequences are not displayed but control the displaying, processing, and transmission of characters. At the end of a sequence or during an error condition, the terminal continues to display received characters. See Error Recovery in Chapter 5 for specific error conditions.

Escape Sequences

The format for an escape sequence is as follows.

ESC
033
I....I
040-057
F
060-176
Escape sequence introducer Intermediate characters
(0 or more characters)
Final character
(1 character)
Escape Sequence Introducer

This is the ESC character (octal 033) defined by ANSI X3.4-1977. After receiving ESC, the terminal stores (but does not display) all control characters received in the proper range.

Intermediate Characters

These are characters received after ESC in the octal range of 040 - 057 (column 2 of the ASCII table). The terminal stores intermediate characters as part of the control function.

Final Character

This is a character received after ESC in the octal range of 060 - 176 (columns 3 - 7 of the ASCII table). The final character indicates the end of the control function. The intermediate and final characters together define the function of the sequence. The terminal then performs the specified function and continues to display received characters. ANSI standard control functions have a final character in the octal range of 100 - 176 (columns 4 - 7 of the ASCII table). Private sequences have a final character in the octal range of 060 - 077 (column 3 of the ASCII table).

Example

Action: Designate ASCII character set as G0.

Sequence

ESC   (    B
033  050  102
 |    |    |
 |    |    +------- Final Character
 |    +------------ Intermediate Character
 +----------------- Escape Sequence Introducer

Control Sequence Format

The format of a control sequence is as follows.

CSI
033 133
P.....P
060-077
I.....I
040-057
F
100-176
Control sequence introducer Parameter characters
(0 or more characters)
Intermediate characters
(0 or more characters)
Final character
(1 character)
Control Sequence Introducer

The CSI is the ESC (octal 033) and [ (octal 133) characters defined by ANSI X3.41-1977. These characters provide 8-bit control functions by using 7-bit characters. The VT102 supports only 7-bit characters. After receiving CSI characters, the terminal stores (but does not display) all control characters received in the proper range.

Parameter Characters

These are characters received after the CSI character, in the octal range of 060 - 077 (column 3 of the ASCII table). The parameter characters modify the action or interpretation of the control function. The terminal interprets parameter characters as private when the < = > ? characters (octal 074 - 077) begin the parameter string. The : character (octal 072) is reserved. This means an ANSI-specified control sequence can have a parameter function with a private interpretation.

The terminal uses two types of parameter characters, numeric and selective. A numeric parameter represents a decimal number, designated by Pn. The decimal characters have a range of 0 - 9 (octal 060 - 071). A selective parameter comes from a list of specified parameters, designated by Ps.

If a control sequence includes more than one parameter, the parameters are separated by a delimiter, the ; character (octal 073).

Intermediate Characters

These are characters received after the CSI character, in the octal range of 040 - 057 (column 2 of the ASCII table). The terminal stores these characters as part of the control function.

NOTE: The terminal does not use intermediate characters in control functions.

Final Character

This is a character received after the CSI character, in the octal range of 100 - 176 (columns 4 - 7 of the ASCII table). The final character indicates the end of the control function. The intermediate and final characters together define the function of the sequence. The terminal then performs the specified function and continues to display received characters. ANSI standard control functions have a final character in the octal range of 100 - 157 (columns 4 - 6 of the ASCII table). Private sequences have a final character in the octal range of 160 - 176 (column 7 of the ASCII table).

Example

Action: Clear all horizontal tabs.

Sequence

ESC   [    3    g
033  133  063  147
 |    |    |    |
 +--+-+    |    |
    |      |    +----- Final Character
    |      +---------- Parameter Character
    +----------------- Control Sequence Introducer

Sequence Examples

These examples show the use of multiple functions selected in one sequence, private parameters and private sequences.

ESC
033
[
133
?
077
4
064
h
150
Set smooth scroll mode
(? = ANSI private parameter)
ESC
033
[
133
2
062
;
073
1
061
y
171
Invoke self-test
(y = ANSI private sequence)