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

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)