ANSI/DEC VT Terminal Character Control Sequences ================================================ I have found that documentation for various VT/ANSI terminal sequences is contradictory and misleading. After extensive testing, the following sequences is what I use to obtain these listed effects. +--------+--------+--------------------+--------------------+----------------------------+ | Char : Action | VT100 | VT52 : UKNC/VT52 | +--------+--------+--------------------+--------------------+----------------------------+ | 07 : Bell | 07 | 07 : 07 | +--------+--------+--------------------+--------------------+----------------------------+ | 08 : Left | 08 | 08 : 08 | | 09 : Right | [C | C : C | | 10 : Down | D | 10 : 10 | | 11 : Up | [A | I : I | | 12 : CLS | [2J[1;1H | HJ : HJ | | 13 : CR | 13 | 13 : 13 | | 30 : Home | [1;1H | Y : Y | | 31,x,y : TAB | [1+y;1+xH | Y<32+y><32+x> : Y<32+y><32+x> | | 127 : Delete | 0808 | 0808 : 0808 | +--------+--------+--------------------+--------------------+----------------------------+ | 17,n : COLOUR | [...m | : &00+n: ,160,'0'-'7' | | : | | : &40+n: ,167,'0'-'7' | | : | | : &80+n: ,161,'0'-'7', | | : | | : ,162,'0'-'7' | | 20 : Reset | [0m | :,191,163,,191,164,| | : | | :,160,'7',,167,'7',| | : | | :,161,'0',,162,'0' | | 22,n : MODE | as VDU 20,12 | :,166,'1'-'4' | | : | | : then VDU 20,12 | +--------+--------+--------------------+--------------------+----------------------------+ | 16 : CLG | | : | | 18,a,n : GCOL | | : | | 19... : Palette| | : | | 23... : | | : | | 24... : | | : | | 25... : PLOT | | : | | 26... : | | : | | 28... : | | : | | 29... : | | : | +--------+--------+--------------------+--------------------+----------------------------+ Notes ----- 08 and 13 appear to be the only universal control characters. Everything else appears to be interpreted differently by different systems. In particular, the VT100 appears to implement 10 as NEWLINE instead of DOWN, necessitating using D. Documentation states that [B should do DOWN, matching the pattern of A/B/C/D, but again that also does NEWLINE instead of DOWN, necessitating using D instead. Colour selection builds an [5;4;7;30;1;40;100m sequence as follows: PRINT CHR$27;"["; IF (A AND 16):PRINT "5;"; ELSE PRINT "25;"; :REM Flash IF (A AND 32):PRINT "4;"; ELSE PRINT "24;"; :REM Underline IF (A AND 64):PRINT "7;"; ELSE PRINT "27;"; :REM Inverse IF (A AND 128) THEN PRINT ;40+(A AND 7); :REM Background IF (A AND 8) :PRINT";";100+(A AND 7); :REM Bright background ELSE PRINT ;30+(A AND 7); :REM Foreground IF (A AND 8)=0:PRINT ";21"; ELSE PRINT ";1"; :REM Bright foreground ENDIF PRINT "m"; On the UKNC the RGB colour number 0,1,2,3,4,5,6,7 is mapped to 0,4,2,6,1,5,3,7. RT11Em's VT52 implementation appears to have bugs in it. CHR$10 does NEWLINE instead of DOWN. A VT100 [...m colour sequence appears to crash either RT11 or the emulator.