[comp.sys.atari.st] VT control codes

S61304@PRIME-A.POLY-SOUTH-WEST.AC.UK ("Simon Chappell") (03/14/90)

<Start of document>

MODES

                         TO SET                 TO RESET
MODE NAME            MODE        SEQUENCE   MODE      SEQUENCE

Line feed/new line   New line    ESC [20h   Line feed ESC [20l*
Cursor key mode      Application ESC [?1h   Cursor    ESC [?1l*
ANSI/VT52 mode       ANSI                   VT52      ESC [?2l*
Column mode          132 col     ESC [?3h   80 col    ESC [?3l*
Scrolling mode       Smooth      ESC [?4h   Jump      ESC [?4l*

Screen mode          Reverse     ESC [?5h   Normal    ESC [?5l*
Origin mode          Relative    ESC [?6h   Absolute  ESC [?6l*
Wraparound           On          ESC [?7h   Off       ESC [?7l*
Auto repeat          On          ESC [?8h   Off       ESC [?8l*
Interlace            On          ESC [?9h   Off       ESC [?9l*
Keypad mode          Application ESC =      Numeric   ESC >

* The last character of the sequence is a lowercase L



CURSOR MOVEMENT COMMANDS

Cursor up                     ESC [ Pn A
Cursor down                   ESC [ Pn B
Cursor forward (right)        ESC [ Pn C
Cursor backward (left)        ESC [ Pn D
Direct cursor addressing      ESC [ Pl; Pc H *  or
                              ESC [ Pl; Pc f *
Index                         ESC D
New line                      ESC E
Reverse index                 ESC M
Save cursor and attributes    ESC 7
Restore cursor and attributes ESC 8

* Pl = line number, Pc = column number




LINE SIZE (DOUBLE-HEIGHT AND DOUBLE-WIDTH) COMMANDS

Change this line to double-height top half      ESC #3
Change this line to double-height bottom half   ESC #4
Change this line to single-width single-height  ESC #5
Change this line to double-width single-height  ESC #6




CHARACTER ATTRIBUTES

    ESC [ Ps; Ps; Ps; ... ;Ps m

Ps refers to a selective parameter. Multiple parameters are seperated by
the semi-colon character. The parameters are executed in order and have
the following meanings:

    0 or none       All attributes off
    1               Bold on
    4               Underscore on
    5               Blink on
    7               Reverse video on

All other parameter values are ignored.




ERASING

From cursor to end of line          ESC [ K    or    ESC [ 0 K
From beginning of line to cursor    ESC [ 1 K
Entire line containing cursor       ESC [ 2 K
From cursor to end of screen        ESC [ J    or    ESC [ 0 J
From beginning of screen to cursor  ESC [ 1 J
Entire screen                       ESC [ 2 J





SCROLLING REGION

    ESC [ Pt; Pb r

Pt is the number of the top line of the scrolling region; Pb is the number
of the bottom line of the scrolling region and must be greater than Pt.




TAB STOPS

Set tab at current column      ESC H
Clear tab at current column    ESC [ g     or     ESC [ 0 g
Clear all tabs                 ESC [ 3 g

<End of document>


NOTES ON USING THESE VT SCREEN CONTROL CODES

Ignore any spaces in the codes that I have shown. Remember that the case
is very important. Note that the 'ESC' is representative of the control
code with the ASCII code of 27. Do not type any of the '*' characters,
they are only there to draw your attention to various aspects. For some
of the escape sequences you _do_ actually use numbers, so where you
have things like Pc = column number, actually substitute an integer
number instead.

I do not know exactly which VT series terminals these are supposed to run
on but I know that they worked on the VT320 terminal that I used during my
placement year. These escape sequences were supplied during a DEC course
but do not have any copyright attached to them so I _think_ that it
should be OK to pass them to friends.




THE ATARI ST VT52 EMULATOR

After a little research through some books I found a list of the VT52
codes implemeted in the Atari VT52 emulator. These codes are slightly
different from the above "official" codes, but try them and see. :-)

Cursor up                          ESC A
Cursor down                        ESC B
Cursor right                       ESC C
Cursor left                        ESC D
Clear home                         ESC E
Cursor home                        ESC H
Cursor up                          ESC I
Clear below cursor                 ESC J
Clear remainder of line            ESC K
Insert line                        ESC L
Delete line                        ESC M
Position cursor                    ESC Y + chr$(32+line) + chr$(32+column)
Select character colour            ESC b + chr$(colour_number)
Select background colour           ESC c + chr$(colour_number)
Clear screen to cursor position    ESC d
Enable cursor                      ESC e
Disable cursor                     ESC f
Save cursor position               ESC j
Set cursor to the saved position   ESC k
Clear line                         ESC l
Clear from start                   ESC o
Reverse on                         ESC p
Reverse off                        ESC q
Automatic overflow on              ESC v
Automatic overflow off             ESC w


I hope that the above lists help in some respects. I make no guarantee
about the accuracy of the above information. I also take no responsibility
if it makes your computer or monitor blow up, or _ANY OTHER_ bad thing
happens as a result of your reading this text.

| Simon Chappell
| BSc(Hons) Computing and Informatics (final year)
| Polytechnic South West (Plymouth)
|
| The box said nothing, only this time louder.
|
| JANET      S61304@uk.ac.psw.pa     BITNET   S61304@pa.psw.ac.uk
| INTERNET   S61304%uk.ac.psw.pa@nsfnet-relay.ac.uk