[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Terminal Types
The terminals supported by Telepathy's emulators are:
TTY A "dumb" terminal, without cursor or color control.
ANSI Similar to the PC ANSI.SYS console driver, with cursor
positioning and color support.
VT102 Emulates the DEC VT102 display terminal.
In these descriptions, a "^" followed by a letter means "control", so
^L is control-L, chr(12).
TTY Emulator
The TTY emulator responds to these control codes:
Code Action
----------------------------------------------------------------
BEL (^G) Sounds the console bell. Set the TF_QUIET flag with
tp_tflags() to disable the bell.
BS (^H) Backs the cursor up one space. No effect if the
cursor is at the beginning of line. If the TF_DESTR
flag is set in tp_tflags(), it erases the character
it backs up over.
HT (^I) Advances the cursor to the next tab stop. Tab stops
are set every eight spaces. Erases characters as the
cursor moves over them.
LF (^J) Moves the cursor down one line. If the cursor is on
the last line of the window, the window scrolls.
FF (^L) Clears the window and moves the cursor to the top
left corner.
CR (^M) Moves the cursor back to the beginning of the line.
the TF_ADDLF flag in tp_tflags() automatically adds a
LF after each CR.
All other control characters are shown as PC graphic characters, or
as "^X" sequences if the TF_ECTRL flag is set with tp_tflags().
ANSI Emulator
The PC ANSI emulator responds to all the same control codes as the
TTY emulator, plus a number of escape sequences. In the rest of
these descriptions, Esc means the escape character, chr(27), and "#"
stands for a decimal number. Any number can be omitted, and will
default to 1 (except where noted).
Code Action
----------------------------------------------------------------
Esc[#A Move cursor up # rows, default 1. The cursor will
not move past the top of the window.
Esc[#B Move cursor down # rows, default 1. The cursor will
not move past the bottom of the window, and the
window will not scroll.
Esc[#C Move cursor right # columns, default 1.
Esc[#D Move cursor left # columns, default 1.
Esc[#;#H Position cursor. The first # is the row, and the
second is the column. 1;1 is the top-left corner of
the window. Row and column number both default to 1.
Esc[#;#f Same as Esc[#;#H
Esc[2J Clear the screen and home the cursor.
Esc[K Clear from the cursor position to the end of line.
Esc[#m Select colors. See table below. Several attributes
can be set at once by separating them with
semicolons.
Esc[6n Query cursor position. The emulator will send back a
string of the form Esc[#;#R where the first # is the
cursor row and the second is the column.
Esc[s Save the cursor position.
Esc[u Restore the cursor position last saved by Esc[s.
Esc[?7h Enable line wrap. This is the default mode. When a
character is typed in the last column of the screen,
the cursor wraps to the next line. Also clears the
tp_tflags() TF_NOWRAP flag.
Esc[?7l Disable line wrap. When a character is typed in the
last column, the cursor does not move. Also sets the
tp_tflags() TF_NOWRAP flag. (The last character of
Esc[?7l is a lower-case "L".)
These are the text colors that can be set by Esc[#m:
Value Setting
----------------------------------------------------------------
0 Default foreground and background colors.
1 Bold (high-intensity foreground).
4 Underline (shows blue-on-black on color screens).
5 Blinking foreground (or high-intensity background
after SETBLINK(.F.)).
7 Reverse foreground and background colors.
8 Invisible text.
30 Black foreground.
31 Red foreground.
32 Green foreground.
33 Yellow foreground.
34 Blue foreground.
35 Magenta foreground.
36 Cyan foreground.
37 White foreground.
40 Black background.
41 Red background.
42 Green background.
43 Yellow background.
44 Blue background.
45 Magenta background.
46 Cyan background.
47 White background.
VT102 Emulator
The VT102 emulator responds to these control codes:
Code Action
----------------------------------------------------------------
NUL Ignored, even within an escape sequence.
BEL (^G) Sounds the console bell. Set the TF_QUIET flag with
tp_tflags() to disable the bell.
BS (^H) Backs the cursor up one space. If the cursor is at
the previous line. The VT102 emulator ignores the
tp_tflags() TF_DESTR flag, and does not erase
characters it backspaces over.
HT (^I) Advances the cursor to the next tab stop. If there
are no more tab stops, the cursor stops at the right
margin. Tab stops may be set with EscH. Initially,
tab stops are set every eight columns.
LF (^J) Moves the cursor down one line. If the cursor is on
the last line of the scrolling region, the display
scrolls. If newline mode is set with Esc[20h, LF
also returns the cursor to the left margin.
VT (^K) Treated as LF.
FF (^L) Treated as LF.
CR (^M) Moves the cursor back to the beginning of the line.
SO (^N) Selects the G1 character set. See Character Sets
below.
SI (^O) Selects the G0 character set. See Character Sets
below.
CAN (^X) If received during an escape sequence, cancels the
sequence.
SUB (^Z) Displays as ".". If received during an escape
sequence, cancels the sequence and displays ".".
Esc Introduces an escape sequence.
All other control characters are ignored, but cancel an escape
sequence if received during one.
Escape sequences for cursor movement and scrolling:
Code Action
----------------------------------------------------------------
Esc7 Save cursor position, display attributes, character
set, and line wrap and origin modes.
Esc8 Restore cursor position and other settings saved by
Esc7.
EscD Cursor moves down one line. If the cursor is on the
last line of the scrolling region, the display
scrolls.
EscE Cursor moves down one line, and returns to the left
margin. If the cursor is on the last line of the
scrolling region, the display scrolls.
EscM Cursor moves up one line. If the cursor is on the
first line of the scrolling region, the display
scrolls down.
EscZ Device attribute request, same as Esc[c. The
emulator responds by sending Esc[?6c, the code for a
VT102.
Esc[#A Move cursor up # rows, default 1. The cursor will
not move past the top of the window, or the top of
the scrolling region if origin mode is set by
Esc[?6h.
Esc[#B Move cursor down # rows, default 1. The cursor will
not move past the bottom of the window, or the bottom
of the scrolling region if origin mode is set by
Esc[?6h.
Esc[#C Move cursor right # columns, default 1.
Esc[#D Move cursor left # columns, default 1.
Esc[#;#H Position cursor. The first # is the row, and the
second is the column. 1;1 is the top-left corner of
the window, or of the scrolling region if origin mode
is set by Esc[?6h. Row and column numbers both
default to 1.
Esc[#;#f Same as Esc[#;#H.
Esc[#;#r Set scrolling region. The first # is the top line of
the region, and the second is the bottom. There must
be at least two lines in the scrolling region.
Escape sequences to insert, delete, and erase text:
Code Action
----------------------------------------------------------------
Esc[#J Erase in display. If # is 0, clears from the cursor
position to the end of the screen. If # is 1, clears
from the top of the screen to (and including) the
cursor position. If # is 2, clears the entire
screen, but does not move the cursor. The scrolling
region does not affect this operation.
Esc[#K Erase in line. If # is 0, clears from the cursor
position to the end of line. If # is 1, clears from
the start of line to (and including) the cursor
position. If # is 2, clears the entire line, but
does not move the cursor.
Esc[#L Insert # lines, default 1. All text from the cursor
line to the bottom of the scrolling region moves down
to make room for the next lines, and the cursor
returns to the left margin. Has no effect if the
cursor is outside the scrolling region.
Esc[#M Delete # lines, default 1, starting with the cursor
line. Text within the scrolling region moves up to
replace the deleted lines, and the cursor returns to
the left margin. Has no effect if the cursor is
outside the scrolling region.
Esc[#P Delete # characters, default 1, starting with the
cursor position. Characters move to the left to fill
in for the deleted characters.
Escape sequences for display attribute control:
Code Action
----------------------------------------------------------------
Esc[0m Reset all attributes.
Esc[1m Select bold (high intensity) text.
Esc[4m Select underlined text. On a color monitor,
underlined text displays with a red background.
Esc[5m Select blinking text.
Esc[7m Select reverse text. With a monochrome display
adapter (MDA or Hercules), reverse text overrides the
bold and underlined attributes.
Esc[22m Turn off the bold attribute.
Esc[24m Turn off the underline attribute.
Esc[25m Turn off the blinking attribute.
Esc[27m Turn off the reverse attribute.
Several attributes can be set or reset at once by separating the
attribute numbers with semicolons.
Escape sequences for control options:
Code Action
----------------------------------------------------------------
EscH Set a tab stop at the cursor position.
Esc[g Clear tab stop at the cursor position.
Esc[3g Clear all tab stops.
Esc[4h Set insert mode. As characters are displayed, text
is pushed to the right to make room. Text which
reaches the right edge of the display is lost.
Esc[4l Reset insert mode. The last character of this
sequence is a lower-case L.
Esc[?6h Set origin mode. When set, the cursor positioning
commands Esc[#;#H and Esc[#;#f are relative to the
top edge of the scrolling region. The cursor is not
permitted to move outside the scrolling region.
Esc[?6l Reset origin mode. When reset, the cursor
positioning commands Esc[#;#H and Esc[#;#f are
relative to the top edge of the display, and can move
the cursor outside the scrolling region, as can
Esc[#A and Esc[#B. The last character of this
sequence is a lower-case L.
Esc[?7h Set auto-wrap mode. When set, displaying a character
in the last position on a line causes the cursor to
wrap around to the next line.
Esc[?7l Reset auto-wrap mode. The cursor will not advance
past the last position on a line. The last character
of this sequence is a lower-case L.
Esc[12h Set remote echo. This command clears the TF_ECHO
flag.
Esc[12l Reset remote echo. This command sets the TF_ECHO
flag. The last character of this sequence is a
lower-case L.
Esc[20h Set newline mode. When set, displaying a line feed
also returns the cursor to the left margin. Sending
a carriage return sends a CRLF sequence.
Esc[20l Reset newline mode. When reset, a line feed moves
the cursor down without changing its column position.
The last character of this sequence is a lower-case
L.
Escape sequence for controlling display character sets:
Code Action
----------------------------------------------------------------
Esc(A Select British character set to G0.
Esc(B Select standard ASCII character set to G0.
Esc(0 Select DEC graphics character set to G0.
Esc)A Select British character set to G1.
Esc)B Select standard ASCII character set to G1.
Esc)0 Select DEC graphics character set to G1.
EscN Single shift G2. Select G2 for the next single
character displayed.
EscO Single shift G3. Select G3 for the next single
character displayed.
Miscellaneous escape sequences:
Code Action
----------------------------------------------------------------
Esc[c Device attribute request. The emulator responds by
sending back Esc[?6c, the code for a DEC VT102.
Esc[6n Cursor position report. The emulator responds by
sending back Esc[#;#R where #;# is the current cursor
row and column position.
Esc[!p Soft reset. Resets all display options and settings
to their defaults.
Escc Hard reset. Same as soft reset, but also clears the
screen and homes the cursor.
Character Sets. There are two levels of character set mapping in the
VT102 emulator. ^O and ^N select one of the two character maps
called G0 and G1 for characters to be displayed. Esc( and Esc)
sequences select different character sets for G0 and G1. In
addition, there are two other character maps, G2, and G3, which can
be selected for single characters by the EscN and EscO sequences.
The contents of these maps cannot be changed.
By default, G0 contains the standard ASCII character set, and G1
contains the DEC graphics character set. G2 is also the graphics
set, and G3 the ASCII set.
All character sets contain 95 symbols, for the ASCII values 32
through 126. There are no high-order characters available.
The British character set is identical to the ASCII set except that
the # symbol is replaced by ..
The DEC graphics character set contains:
Value Char. | Value Char. | Value Char.
----------------+-------------------+----------------
32 space | 64 @ | 96 .
33 ! | 65 A | 97 .
34 " | 66 B | 98 .
35 # | 67 C | 99 .
36 $ | 68 D | 100 .
37 % | 69 E | 101 .
38 & | 70 F | 102 .
39 ' | 71 G | 103 .
40 ( | 72 H | 104 .
41 ) | 73 I | 105 .
42 * | 74 J | 106 +
43 + | 75 K | 107 +
44 , | 76 L | 108 +
45 - | 77 M | 109 +
46 . | 78 N | 110 +
47 / | 79 O | 111 .
48 0 | 80 P | 112 .
49 1 | 81 Q | 113 -
50 2 | 82 R | 114 .
51 3 | 83 S | 115 _
52 4 | 84 T | 116 |
53 5 | 85 U | 117 |
54 6 | 86 V | 118 -
55 7 | 87 W | 119 -
56 8 | 88 X | 120 |
57 9 | 89 Y | 121 .
58 : | 90 Z | 122 .
59 ; | 91 [ | 123 .
60 < | 92 \ | 124 .
61 = | 93 ] | 125 .
62 > | 94 ^ | 126 .
63 ? | 95 blank |
See Also: Terminal Emulation
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson