.;
.;	VT220.CMD - Setup VT220 Characteristics
.;
.;	 25-FEB-1987 09:25:03
.;
	.ENABLE CONTROL-Z
	.SETS TT P1
	.IF TT NE ""			.GOTO 20
.10:	.ASKS TT Which terminal (TTn:)
	.IFT <EOF> .GOTO 100
	.IF TT = "" .SETS TT "TI:"
.20:	.PARSE TT ":" TT JUNK
	.SETS TT TT+":"
	.SETN DVTT 4		! DV.TTY
	.TESTDEVICE 'TT'
	.PARSE <EXSTRI> "," JUNK CW1 CW2 CW3 CW4 STR
			.;	Check that device is a terminal
	.SETN N 'CW1'
	.IF DVTT NE N&DVTT		.GOTO 10
			.;	Check that device is on-line
	.TEST STR "ONL"
	.IF <STRLEN> = 0		.GOTO 10

	.SETN N 10.		! LF in decimal
	.SETS LF "'N%V'"	! Convert to ASCII

	.SETN N 13.		! CR in decimal
	.SETS CR "'N%V'"	! Convert to ASCII

	.SETN N 15.		! SI in decimal
	.SETS SI "'N%V'"	! Convert to ASCII

	.SETN N 27.		! ESC in decimal
	.SETS ESC "'N%V'"	! Convert to ASCII

	.SETN <FORATT> 0	! Add our own carriage control
	.OPEN 'TT'
			.;	Set ANSI mode
	.DATA 'ESC'[?2h'CR'
			.;	Turn off printer controller mode
	.DATA 'ESC'[?4i'CR'
			.;	Turn off auto print
	.DATA 'ESC'[4i'CR'
			.;	Set 132 column mode
	.DATA 'ESC'[?3h'CR'
			.;	Clear all horizontal tabs
	.DATA 'ESC'[3g'CR'
			.;	Erase screen
	.DATA 'ESC'[2J'CR'
			.;	Set horizontal tabs every 8 columns
	.DATA 'ESC'[1;9f'ESC'H'CR'
	.DATA 'ESC'[1;17f'ESC'H'CR'
	.DATA 'ESC'[1;25f'ESC'H'CR'
	.DATA 'ESC'[1;33f'ESC'H'CR'
	.DATA 'ESC'[1;41f'ESC'H'CR'
	.DATA 'ESC'[1;49f'ESC'H'CR'
	.DATA 'ESC'[1;57f'ESC'H'CR'
	.DATA 'ESC'[1;65f'ESC'H'CR'
	.DATA 'ESC'[1;73f'ESC'H'CR'
	.DATA 'ESC'[1;81f'ESC'H'CR'
	.DATA 'ESC'[1;89f'ESC'H'CR'
	.DATA 'ESC'[1;97f'ESC'H'CR'
	.DATA 'ESC'[1;105f'ESC'H'CR'
	.DATA 'ESC'[1;113f'ESC'H'CR'
	.DATA 'ESC'[1;121f'ESC'H'CR'
	.DATA 'ESC'[1;129f'ESC'H'CR'
			.;	Set cursor function keys to ANSI
	.DATA 'ESC'[?1l'CR'
			.;	Unlock keyboard
	.DATA 'ESC'[2l'CR'
			.;	Replacement mode
	.DATA 'ESC'[4l'CR'
			.;	Local echo off
	.DATA 'ESC'[12h'CR'
			.;	80 column mode
	.DATA 'ESC'[?3l'CR'
			.;	Jump scroll mode
	.DATA 'ESC'[?4l'CR'
			.;	White characters on dark screen
	.DATA 'ESC'[?5l'CR'
			.;	Reset wrap-around mode
	.DATA 'ESC'[?7l'CR'
			.;	Auto-repeating keys
	.DATA 'ESC'[?8h'CR'
			.;	No FF after print screen function
	.DATA 'ESC'[?18l'CR'
			.;	Print screen prints entire screen
	.DATA 'ESC'[?19h'CR'
			.;	Set top and bottom margins
	.DATA 'ESC'[1;24r'CR'
			.;	Make cursor visible
	.DATA 'ESC'[?25h'CR'
			.;	Numeric keypad
	.DATA 'ESC'>'CR'
			.;	National character set
	.DATA 'ESC'[?42h'CR'
			.;	Line feed does not imply CR
	.DATA 'ESC'[20l'CR'
			.;	Select ASCII Character set as G0
	.DATA 'ESC'(B'CR'
			.;	Invoke G0 into GL
	.DATA 'SI''CR'
			.;	Select ASCII Character set as G1
	.DATA 'ESC')B'CR'
			.;	Invoke G1 into GR
	.DATA 'ESC'~'CR'
			.;	Select ASCII Character set as G2
	.DATA 'ESC'*B'CR'
			.;	Select ASCII Character set as G3
	.DATA 'ESC'+B'CR'
			.;	Turn off all graphic renditions
	.DATA 'ESC'[0m'CR'
			.;	Turn off all character attributes
	.DATA 'ESC'[0"q'CR'
			.;	Clear any down-line loaded character sets
	.DATA 'ESC'P1;1;2{ @'ESC'/'CR'
	.CLOSE
.100:	.DISABLE DISPLAY
