|
VT100 Terminal Control Escape Sequences[ Status | Setup | Fonts | Cursor | Scrolling | Tabs | Erasing | Printing | Keyboard | Colours ]Many computer terminals and terminal emulators support colour and cursor control through a system of escape sequences. One such standard is commonly referred to as ANSI Colour. Several terminal specifications are based on the ANSI colour standard, including VT100. The following is a partial listing of the VT100 control set. Important: You must set HyperTerminal to VT100 mode for the following to be working.
Device StatusThe following codes are used for reporting terminal/display settings, and vary depending on the implementation:Query Device Code <ESC>[c
Report Device Code <ESC>[{code}0c
Query Device Status <ESC>[5n
Report Device OK <ESC>[0n
Report Device Failure <ESC>[3n
Query Cursor Position <ESC>[6n
Report Cursor Position <ESC>[{ROW};{COLUMN}R
Terminal SetupTheh and l codes are used for
setting terminal/display mode, and vary depending on the implementation.
Line Wrap is one of the few setup codes that tend to be used
consistently:
Reset Device <ESC>c
Enable Line Wrap <ESC>[7h
Disable Line Wrap <ESC>[7l
FontsSome terminals support multiple fonts: normal/bold, swiss/italic, etc. There are a variety of special codes for certain terminals; the following are fairly standard:Font Set G0 <ESC>(
Font Set G1 <ESC>)
Cursor ControlCursor Home <ESC>[{ROW};{COLUMN}H
Cursor Up <ESC>[{COUNT}A
Cursor Down <ESC>[{COUNT}B
Cursor Forward <ESC>[{COUNT}C
Cursor Backward <ESC>[{COUNT}D
Example: following HC12 code will move the cursor to the left, 8 characters. ldaa #$1B ; esc character jsr putchar ldaa #'[' jsr putchar ldaa #'8' ; $38 in hex jsr putchar ldaa #'D' jsr putchar
Force Cursor Position <ESC>[{ROW};{COLUMN}f
Save Cursor <ESC>[s
Unsave Cursor <ESC>[u
Save Cursor & Attrs <ESC>7
Restore Cursor & Attrs <ESC>8
ScrollingScroll Screen <ESC>[r
Scroll Screen <ESC>[{start};{end}r
Scroll Down <ESC>D
Scroll Up <ESC>M
Tab ControlSet Tab <ESC>H
Clear Tab <ESC>[g
Clear All Tabs <ESC>[3g
Erasing TextErase End of Line <ESC>[K
Erase Start of Line <ESC>[1K
Erase Line <ESC>[2K
Erase Down <ESC>[J
Erase Up <ESC>[1J
Erase Screen <ESC>[2J
Example: following HC12 code will clear the screen. ldaa #$1B jsr putchar ldaa #'[' jsr putchar ldaa #'2' jsr putchar ldaa #'J' jsr putchar More Examples: print the following HC12 messages to control the screen. t1 DC.B $1B, '[1A', $00 ; move cursor up 1 line t2 DC.B $1B, '[2B', $00 ; move cursor down 2 lines t3 DC.B $1B, '[3C', $00 ; move cursor right 3 positions t4 DC.B $1B, '[4D', $00 ; move cursor left 4 positions t5 DC.B $1B, '[4', $3B, '4H', $00 ; move cursor to 4,4 position t6 DC.B $1B, '[4', $3B, '4f', $00 ; move cursor to 4,4 position t7 DC.B $1B, '[12', $3B, '12H', $00 ; move cursor to 12,12 position t8 DC.B $1B, '[5', $3B, '31', $3B, '42m', $00 ; set blink, red foreground, green background t9 DC.B $1B, '[37', $3B, '40m', $00 ; set white foreground, black background
PrintingSome terminals support local printing:Print Screen <ESC>[i
Print Line <ESC>[1i
Stop Print Log <ESC>[4i
Start Print Log <ESC>[5i
Define KeySet Key Definition <ESC>[{key};"{string}"p
Set Display AttributesSet Attribute Mode <ESC>[{attr1};...;{attrn}m
[ Top | Status | Setup | Fonts | Cursor | Scrolling | Tabs | Erasing | Printing | Keyboard | Colours ] |
|