VT100 codes ...

Khanone at aol.com Khanone at aol.com
Tue Mar 25 14:24:26 CET 1997


Here is a standard set of VT100 codes ... There are more, but some terminal
emulators don't recognise them.  (Sorry, but working from memory here - the
actual effects may be incorrect (like <ESC>[1J may clear text BELOW cursor,
instead of above))

N.B. I use the word <ESC> to signify the escape character (ASCII code 27).

<ESC>[nJ  - Clear portions of the screen.
       n = 0, clears screen below cursor
       n = 1, clears screen above cursor
       n = 2, clears entire screen.

<ESC>[nK - Clear portions of the line.
      n = 0, clears text to the left of the cursor
      n = 1, clears text to the right of the cursor
      n = 2, clears entire line of text.

<ESC>[n;oH - Position cursor at a specified co-ordinates.
      n = Vertical (Row) positioning
      o = Horizontal (Column) positioning

<ESC>[n;or - Define a scroll region (Not all VT100's support this though
[???])
     n = Top line of scroll region
     o = Bottom line of scroll region.
     (N.B. Cursor must be placed within scroll region for it to work)

<ESC>[xm - Define text attributes.
    x = 1, bold
    x = 2, (italics - not a true VT100 type, though)
    x = 4, underline
    x = 5, blinking
    x = 7, inverse video.
    x = 21, cancel bold
    x = 27 cancel inverse video.
    (N.B. There are codes to cancel the other types, but I'm not too sure on
values)

<ESC>[xM - Delete current line, and shift text up the screen to fill deleted
area.
    x = Number of lines to delete.

<ESC>[xL - Insert a new blank line at cursor, and scroll text down to make
room.
    x = Number of lines to insert.

<ESC>[x@ - Insert space after cursor, and scroll line along to make room.

<ESC>[xP - Move cursor left, delete character under cursor, and shift the
rest of the
    line to the left.

Function codes: (Not always supported on VT100's, but are on VT220's:)

<ESC>[?5h - inverse video entire screen
<ESC>[?5l - restore to normal video.
<ESC>[?25h - hide cursor
<ESC>[?25l - display cursor
<ESC>[?23h - smooth scroll (Yes, it IS annoying, but can be used to good
effect)
<ESC>[?23l - jump scroll
<ESC>#3 - Double-width, double-height lettering (top half)
<ESC>#4 - Double-width, double-height lettering (bottom half)
<ESC>#6 - Double-width, single height lettering
<ESC>#8 - Test screen (On VT220's displays a screen full of E's. <EG>)
<ESC>7 - Remember cursor state, and position.
<ESC>8 - Restore cursor state and position.

(N.B. Codes 23 and 25 may be the other way round - experiment!)


Okay, that's all I can remember off-hand.  Covers most of the codes.  And if
you're wondering how or even why I had them memorised, well, we had a lot of
time at college, and lots of VT220's connected to a DEC Micro-VAX.  Hence, a
few of us spent a fair bit of time writing "demos" - sequences of codes, and
letters, which when displayed at a baud of 4800/9600 looked quite good.  Sad,
when I look back.  But then, I am British ... <g>

Oh, and as an aside, I much preferred DECs "Phone" utility over the Unix Talk
facility ...



More information about the mud-dev-archive mailing list