.;
.;	KEYS.CMD - Setup VT2xx User-Defined Keys
.;
.;	 10-APR-1987 09:14:17
.;
	.SETT DISP
	.IF P1 NE "" .SETF DISP
	.SETS HEX "0123456789ABCDEF"

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

	.SETN <FORATT> 0	! Add our own carriage control
	.OPEN TI:
			.;	Clear all keys
	.DATA 'ESC'P0;1|'ESC'\
			.;	Define F6
	.SETS FK "F6"
	.SETS KN "17"
	.SETS T "NTD}"
	.GOSUB CONV
			.;	Define F7
	.SETS FK "F7"
	.SETS KN "18"
	.SETS T "@NODES}"
	.GOSUB CONV
			.;	Define F8
	.SETS FK "F8"
	.SETS KN "19"
	.SETS T ""
	.GOSUB CONV
			.;	Define F9
	.SETS FK "F9"
	.SETS KN "20"
	.SETS T ""
	.GOSUB CONV
			.;	Define F10
	.SETS FK "F10"
	.SETS KN "21"
	.SETS T "BYE}"
	.GOSUB CONV
			.;	Define F17
	.SETS FK "F17"
	.SETS KN "31"
	.SETS T ""
	.GOSUB CONV
			.;	Define F18
	.SETS FK "F18"
	.SETS KN "32"
	.SETS T ""
	.GOSUB CONV
			.;	Define F19
	.SETS FK "F19"
	.SETS KN "33"
	.SETS T ""
	.GOSUB CONV
			.;	Define F20
	.SETS FK "F20"
	.SETS KN "34"
	.SETS T ""
	.GOSUB CONV

	.CLOSE
	.DISABLE DISPLAY
	.EXIT

.CONV:
	.TEST T
	.SETN TL <STRLEN>
	.IF TL = 0 .GOTO 50
	.IFT DISP ; 'FK':'T'
	.DATA 'ESC'P1;1|'KN'/
	.SETN TP 0
.30:
	.SETN TP TP+1
	.IF TP > TL .GOTO 40
	.SETS TC T[TP:TP]
	.SETN TO 'TC%V'
	.IF TC = "}" .SETN TO 15
	.SETN T1 TO/16.
	.SETN T2 TO-(T1*16.)
	.SETS TF HEX[T1+1:T1+1]
	.SETS TS HEX[T2+1:T2+1]
	.DATA 'TF''TS'
	.GOTO 30
.40:
	.DATA 'ESC'\
.50:
	.RETURN
