Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - mit/monitor/ttytbl.new
There are no other files named ttytbl.new in the archive.
; THIS MODULE CONTAINS TERMINAL-SPECIFIC INFORMATION FOR THE
; VIRTUAL TERMINAL SYSTEM

; THESE ROUTINES USED TO BE IN STG. IN TTYSRV, AC Q3 IS RENAMED FX,
;  AND HOLDS A FORK INDEX. Q3 WAS USED IN SEVERAL OF THESE ROUTINES,
;  WHICH IMPLIES THAT SOMETHING SOMEWHERE WAS SCREWED UP. NONETHELESS,
;  ALL SUCH USES HAVE BEEN REPLACED WITH FX FOR NOW.

DEFINE TY(BB,CRPD,LFPD,TBPD,FFPD,WID,LEN)<
	^D<<BB>B2+<CRPD>B7+<LFPD>B11+<TBPD>B15+<FFPD>B19+<WID>B27+<LEN>B35>
>
	RESCD


TTYPE0::TY(0,0,0,2,12,72,66)	; 0 - MOD 33
	TY(6,0,0,2,12,72,66)	; 1 - MOD 35
	TY(1,0,0,2,12,72,66)	; 2 - MOD 37
	TY(1,10,0,0,0,80,66)	; 3 - TI
	TY(1,0,0,0,0,89,44)	; 4 - IMLAX (SST MONITOR)
	TY(1,0,0,0,0,80,24)	; 5 - DATAMEDIA 2500
	TY(1,0,12,0,0,80,24)	; 6 - HP2645
	TY(1,0,0,0,0,80,66)	; 7 - NVT
	TY(1,6,6,2,12,72,66)	; 8 - DEFAULT: MAX PADDING, ETC.
	TY(7,0,0,0,0,0,0)	; 9 - 'IDEAL' TERMINAL, NO FILL INF SIZ
	TY(2,0,4,0,12,72,20)	; 10 - VT05
	TY(2,0,0,0,0,80,12)	; 11 - VT50
	TY(0,6,6,2,12,80,66)	; 12 - LA30
	TY(1,0,0,0,0,80,30)	; 13 - GT40 (WITH SMALL CHAR STRAPPING)
	TY(1,0,0,0,0,132,66)	; 14 - LA36. SAME AS VT50 BUT WIDER
	TY(3,0,0,0,0,80,24)	; 15 - VT52
	TY(1,0,0,0,0,80,24)	; 16 - GLASS TTYS
	TY(3,0,0,0,0,80,24)	; 17 - FOX 1100	;35 
	TY(3,0,0,0,0,80,24)	; 18 - VT100 ;105 
	TY(3,0,0,0,0,80,24)	; 19 - Teleray 1061
	TY(3,0,0,0,0,80,24)	; 20 - Heath 19
	TY(3,0,0,0,0,80,24)	; 21 - Concept 100
	TY(3,0,0,0,0,80,24)	; 22 - VT100
	TY(3,0,0,0,0,132,66)	; 23 - LA38
	TY(7,0,0,0,0,132,66)	; 24 - LA120
	TY(3,0,0,0,0,84,50)	; 25 - PTV (Plasma TV VT52)
	TY(3,0,0,0,0,80,24)	; 26 - SUPDUP VT
	TY(3,0,0,0,0,80,24)	; 27 - HP2640
	TY(3,0,0,0,0,80,48)	; 28 - Ann Arbor Ambassador
	TY(3,0,0,0,0,84,62)	; 29 - BBN Bitgraph

NTTYPS==:.-TTYPE0

DEFINE	TY2(ADDR,FLAGS<0>)
    <	FLAGS!ADDR
    >

TTYPE2::
	TY2(T33DT)		; 0 - TTY 33
	TY2(T35DT)		; 1 - TTY 35
	TY2(T33DT)		; 2 - TTY 37
	TY2(TTIDT)		; 3 - TI
	TY2(IMLXDT)		; 4 - IMLAX
	TY2(DM25DT)		; 5 - DM2500
	TY2(THPDT)		; 6 - HP2645
	TY2(TNVTDT)		; 7 - NVT
	TY2(T33DT)		; 8 - DEFAULT
	TY2(LA36DT)		; 9 - IDEAL
	TY2(VT05DT)		; 10 - VT05
	TY2(VT50DT)		; 11 - VT50
	TY2(LA30DT)		; 12 - LA30
	TY2(T33DT)		; 13 - GT40 
	TY2(LA36DT)		; 14 - LA36
	TY2(VT52DT)		; 15 - VT52
	TY2(GLASDT)		; 16 - GLASS TTY
	TY2(FOXDT)		; 17 - FOX
	TY2(VT10DT)		; 18 - VT100
	TY2(T106DT)		; 19 - TELERAY 1061
	TY2(H19DT)		; 20 - HEATH H19
	TY2(C100DT)		; 21 - CONCEPT 100 
	TY2(VT1ADT)		; 22 - VT100 (ANSI)
	TY2(LA36DT)		; 23 - LA38
	TY2(LA36DT)		; 24 - LA120
	TY2(PTVDT)		; 25 - PTV
	TY2(SUPDT)		; 26 - SUPDUP VT
	TY2(HP40DT)		; 27 - HP2640
	TY2(AAADT)		; 28 - ANN ARBOR AMBASSADOR
	TY2(BBNDT)		; 29 - BBN BITGRAPH (VERSION 1)

IFN <.-TTYPE2>-NTTYPS,<PRINTX %%TERM TYPE TABLES OF DIFFERENT LENGTHS>

; Display control tables.  Table for each terminal type, indexed
; by function.

; The format for functional table entries is as follows:
;	If entry is zero then it is not supported.
;	If 1B0 is set then bits 1-35 contain immediate 7 bit bytes up to
;		either a 0 of the end of the word.
;	If 1B1 is set then bits 12-17 (DPCNT) contain the number of 
;		characters, bits 9-11 contain the byte size, and the RH
;		contains the address of a string to output.
;	If 1B2 is set then bits 12-17 (DPCNT) contain the estimated number of 
;		characters, and  the RH contains the address of a routine 
;		to call.  If 1B3 is also set, the routine is parameterized
;		(will take repeat count).
;
; Notes on writing terminal-dependent routines.
; Arguments appear in registers Q1 and Q2.  You can scratch registers
; 	T1, T3, and T4.  Don't clobber T2 under any circumstances.
;
; There are several support routines for TTY-dependant code.
; 
;	VTSCHR: output character contained in T3
; 	VTSPAD: pad for time in T3 (milliseconds, decimal)
;	VTSDEC: output (decimal) number in T3 as ascii character string
;	VTSESC: output <ESC> char, followed by char contained in T3

;;; MACROS FOR MAKING TERMINAL PRIMITIVES

; Macro for defining terminal primitives
DEFINE DPYDEF (CODE)
   < 	DPY'CODE==:%NCODE
	%NCODE==%NCODE+1
	DEFINE DP.'CODE (ENT)
	    <	RELOC %TABLE+DPY'CODE
		ENT
	     >
    >

; Macro for starting a terminal table
DEFINE DPYTBL (NAME)
    <	%TABLE==.
	NAME::			;+++ global only for debugging
    >

; Macro for terminating a terminal table
DEFINE DPYEND
    <	RELOC %TABLE+%NCODE
    >

; Display table entries

%NCODE==0

DPYDEF (SIZ)			; Screen size
DPYDEF (CAP)			; Capability word
DPYDEF (PAD)			; Padding char (null is default)
DPYDEF (UP)			; Cursor up
DPYDEF (DWN)			; Cursor down (usually linefeed (^J))
DPYDEF (FWD)			; Cursor forward
DPYDEF (BCK)			; Cursor back (usually backspace (^H))
DPYDEF (CRT)			; Carriage return
DPYDEF (TAB)			; Tab 
DPYDEF (CLS)			; Home and clear screen
DPYDEF (CES)			; Clear to end of screen
DPYDEF (CEL)			; Clear to end of line
DPYDEF (ERC)			; Erase character
DPYDEF (HOM)			; Home cursor
DPYDEF (ABS)			; Absolute cursor position 
				;   Takes: Q1/ vpos,,hpos
DPYDEF (INL)			; Insert line
DPYDEF (DLL)			; Delete line
DPYDEF (INC)			; Insert character
DPYDEF (DLC)			; Delete character
DPYDEF (MVL)			; Move lines (scroll region)
DPYDEF (MVC)			; Move characters
DPYDEF (VBL)			; Visible bell
DPYDEF (NL)			; Newline - Move cursor to beginning of 
				;   next line. If cursor is currently on
				;   the last line, this should scroll up
				;   if TC%SCR is set in the characteristics
				;   word, or wrap to the top of the screen
				;   if TC%SCR is not set. All terminals
				;   MUST have this function!

; INI (Initialization, done at ^C time I guess)
; OPT (Cursor optimization info (pointer to routine or table)

; Macros for table entries
; Short 7-bit string
DEFINE	DPBYTE	(A,B,C,D,E)
   <	BYTE (1) 1 (7) A,B,C,D,E
   >

; Longer ASCIZ string
DEFINE	DPSTR	(A,S<0>)
   <	1B1+7B11+<S>B17+[ASCIZ /A/]
   >

; 8 or 9 bit byte string (useful for padding)
DEFINE	DPSTRX	(A,B,S<0>)
   <	1B1+^D<B>B11+<S>B17+[BYTE (B) A',0]
   >

; Routine
DEFINE	DPROUT	(A,ES<0>,PARM<0>)
   <	IFE PARM,<1B2+<ES>B17+A>
	IFN PARM,<1B2+1B3+<ES>B17+A>
   >	

;;; HIGHER LEVEL CONSTRUCTS
;
; These macros are defined as a matter of convenience

; Capabilites a "reasonable" CRT can be expected to have
TC$CRT==TC%MOV!TC%BS!TC%HOM!TC%CLR!TC%SCL!TC%SCR
; Full insert/delete
TC$FID==TC%CID!TC%LID

; Macro to generate <esc> <char>
DEFINE DPESC	(CHAR)	
   <	DPBYTE	.CHESC,CHAR
   >

;Macro to do a space
DPYSPC:	DPBYTE 40

; Macro for basic glass CRT
DEFINE DPYGLS
   <	
DP.CAP	<TC%BS!TC%SCR>
DP.DWN	<DPBYTE .CHLFD>
DP.BCK	<DPBYTE .CHBSP>
DP.CRT	<DPBYTE .CHCRT>
DP.NL	<DPBYTE .CHCRT,.CHLFD>
>

; Macro for basic printing terminal
DEFINE DPYPRT <
DP.CAP	<TC%PRT!TC%SCR>
DP.DWN	<DPBYTE .CHLFD>
DP.CRT	<DPBYTE .CHCRT>
DP.BCK	<DPBYTE .CHBSP>
DP.FWD	<DPBYTE " ">
DP.NL	<DPBYTE .CHCRT,.CHLFD>
>

; There are enough VT52 simulators around to have this macro.
DEFINE DPYV52 <
DP.CAP	<TC$CRT>
DP.SIZ	<^D24,,^D80>
DP.DWN	<DPBYTE .CHLFD>
DP.BCK	<DPBYTE .CHBSP>
DP.CRT	<DPBYTE .CHCRT>
DP.NL	<DPBYTE .CHCRT,.CHLFD>
DP.UP	<DPESC	"A">
DP.FWD	<DPESC	"C">
DP.TAB 	<DPBYTE .CHTAB>	
DP.CLS	<DPBYTE .CHESC,"H",.CHESC,"J">
DP.CES	<DPESC	"J">
DP.CEL	<DPESC	"K">
DP.HOM	<DPESC	"H">
DP.ABS	<DPROUT VT52AB,4>
>
;;; TERMINAL DEFINITIONS

;TTY 33, 37
DPYTBL	(T33DT)
DP.SIZ	<^D0,,^D72>
DP.CAP	<TC%PRT!TC%SCR>
DP.DWN	<DPBYTE	 .CHLFD>
DP.CRT	<DPBYTE  .CHCRT>
DP.FWD	<DPBYTE  40>
DP.NL	<DPBYTE .CHCRT,.CHLFD>
DPYEND

;TTY 35
DPYTBL	(T35DT)
DP.SIZ	<^D0,,^D72>
DP.CAP	<TC%PRT!TC%SCR>
DP.DWN	<DPBYTE	 .CHLFD>
DP.CRT	<DPBYTE  .CHCRT>
DP.FWD	<DPBYTE  40>
DP.TAB	<DPBYTE	 .CHTAB,.CHDEL,.CHDEL> ; Two pad chars
DP.NL	<DPBYTE  .CHCRT,.CHLFD>
DPYEND

; TI Silent 700
DPYTBL	(TTIDT)
DP.SIZ	<^D0,,^D80>
DP.CAP	<TC%PRT!TC%SCR>
DP.DWN	<DPBYTE	 .CHLFD>
DP.CRT  <DPROUT TIPD1,^D10>
DP.BCK	<DPBYTE	 .CHBSP>
DP.FWD	<DPBYTE  40>
DP.NL	<DPROUT TIPD2,^D11>
DPYEND

TIPD2:	MOVEI T3,.CHLFD
	CALL VTSCHR
TIPD1:	MOVEI T3,.CHCRT
	CALL VTSCHR
	MOVEI T3,377		;LONGEST POSSIBLE VALUE!
	CALLRET VTSPAD

; IMLAX, MIT-ITS intellegent terminal protocol
%tdmov==200
%tdmv1==201
%tdeof==202
%tdeol==203
%tddlf==204
%tdmtf==205
%tdmtn==206
%tdcrl==207
%tdnop==210
%tdbs==211
%tdlf==212
%tdrcr==213
%tdors==214
%tdqot==215
%tdfs==216
%tdmv0==217
%tdclr==220
%tdbel==221
%tdini==222
%tdilp==223
%tddlp==224
%tdicp==225
%tddcp==226
%tdbow==227
%tdrst==230
%tdgrf==231
%tdrsu==232
%tdrsd==233

DPYTBL	(IMLXDT)
DP.SIZ	<^D44,,^D89>
DP.CAP	<<TC$CRT&^-TC%SCR>+TC%LID+TC%CID+TC%MET> ;No scroll (usually LM or KTV)
DP.FWD	<DPBYTE .CHDEL,%TDFS-176>
; DP.CRT	<DPBYTE .CHDEL,%TDRCR-176>
; DP.BCK	<DPBYTE	.CHDEL,%TDBS-176>
; DP.DWN	<DPBYTE .CHDEL,%TDLF-176>
DP.CLS	<DPBYTE .CHDEL,%TDCLR-176>
DP.CES	<DPBYTE .CHDEL,%TDEOF-176>
DP.CEL	<DPBYTE .CHDEL,%TDEOL-176>
DP.ERC	<DPBYTE .CHDEL,%TDDLF-176>
DP.ABS	<DPROUT IMLXAB,4>
DP.INL	<DPROUT IMLINL,3,1>
DP.DLL	<DPROUT IMLDLL,3,1>
DP.INC	<DPROUT IMLINC,3,1>
DP.DLC	<DPROUT	IMLDLC,3,1>
DP.NL	<DPBYTE .CHDEL,%TDCRL-176>
DPYEND

IMLXAB:	MOVEI T3,.CHDEL
	CALL VTSCHR
	MOVEI T3,%TDMV0-176
	CALL VTSCHR
	HLRZ T3,Q1
	CALL VTSCHR
	HRRZI T3,(Q1)
	CALLRET VTSCHR

IMLINC:	SKIPA Q2,[%TDICP-176]
IMLDLC:	 MOVEI Q2,%TDDCP-176
	JRST IMLDL0

IMLINL:	SKIPA Q2,[%TDILP-176]
IMLDLL:  MOVEI Q2,%TDDLP-176
IMLDL0:	MOVEI T3,.CHDEL
	CALL VTSCHR
	MOVEI T3,(Q2)
	CALL VTSCHR
	MOVEI T3,(Q1)		; Count
	CALLRET VTSCHR

; DATAMEDIA 2500
; Loser makes CR act like CRLF, then ignores LF after CR.  Thus CR can't
; be used for DP.CRT. Fine for DP.NL, though.
DPYTBL	(DM25DT)
DP.SIZ	<^D24,,^D80>
DP.CAP	<TC$CRT>
DP.UP	<DPBYTE  32>		; ^Z
DP.DWN	<DPBYTE  .CHLFD>
DP.FWD 	<DPBYTE  34>		; ^\
DP.BCK	<DPBYTE  .CHBSP>
DP.ABS	<DPROUT  DM25AB,3>
DP.CEL	<DPBYTE	 27>		; ^W
DP.CES	<DPBYTE  37>		; ^_ (not sure of this)
DP.CLS	<DPBYTE	 36,36>		; ^^ (twice for some obscure reason)
DP.NL	<DPBYTE  .CHCRT,.CHLFD>
DPYEND

DM25AB:	MOVEI T3,"L"-100
	CALL VTSCHR
	HRRZI T3,(Q1)		; Hpos
	TRC T3,140		; Magic?
	CALL VTSCHR
	HLRZ T3,Q1		; Vpos
	TRC T3,140
	CALLRET VTSCHR

; HP 2645, HP2640
DPYTBL	(THPDT)	
DPYV52	
DP.CAP	<TC$CRT+TC%LID+TC%CID+TC%WRP>
DP.ABS	<DPROUT HPABS,11>	; Sigh, VT52 superset modulo this
DP.TAB	<0>			; Tabs must be set up
DP.INL	<DPESC "L">
DP.DLL	<DPESC "M">
DP.DLC	<DPESC "P">
DP.INC	<DPROUT	HPINC,4,1>
DPYEND

DPYTBL	(HP40DT)
DPYV52
DP.ABS 	<DPROUT HP0ABS,11>
DPYEND


HP0ABS:	SKIPA Q2,["r"]
HPABS:	 MOVEI Q2,"y"
	HRROI T3,[ASCIZ |&a|]
	CALL VTSSTR
	HLRZ T3,Q1
	CALL VTSDEC
	MOVEI T3,(Q2)
	CALL VTSCHR
	HRRZI T3,(Q1)
	CALL VTSDEC
	MOVEI T3,"C"
	CALLRET VTSCHR

HPINC:	MOVEI T3,"Q"		; Insert mode
	CALL VTSESC
	MOVEI Q2,(Q1)		; Save count
HPINC1:	MOVEI T3," "
	CALL VTSCHR
	SOJG Q1,HPINC1
	MOVEI T3,"R"
	CALL VTSESC
HPINC2:	MOVEI T3,"H"-100
	CALL VTSCHR
	SOJG Q2,HPINC2
	RET

; NVT
DPYTBL	(TNVTDT)
DP.SIZ	<^D0,,^D80>
DP.CAP	<TC%SCR>
DP.CRT	<DPBYTE .CHCRT>
DP.DWN	<DPBYTE .CHLFD>
DP.NL	<DPBYTE .CHCRT,.CHLFD>
DPYEND

; VT05
DPYTBL	(VT05DT)
DP.SIZ	<^D20,,^D72>
DP.CRT	<TC$CRT>
DP.UP	<DPBYTE  .CHCNZ>	;+++ padding
DP.DWN	<DPBYTE  "K"-100>	;+++ padding
DP.BCK	<DPBYTE  .CHBSP>
DP.FWD	<DPBYTE  .CHCNX>
DP.CRT	<DPBYTE	 .CHCRT>
DP.NL	<DPBYTE  .CHCRT,.CHLFD>
DP.HOM	<DPBYTE  .CHCRB>	; ^] +++ padding
DP.CES	<DPBYTE  .CHCUN>	; ^_ +++ padding
DP.CEL	<DPBYTE  .CHCCF>	; ^^ +++ padding
DPYEND

; VT50
DPYTBL	(VT50DT)
DP.SIZ	<^D12,,^D80>
DPYGLS
DP.UP	<DPESC	"A">
DP.FWD	<DPESC	"C">
DP.TAB	<DPBYTE	 .CHTAB>
DP.HOM	<DPBYTE	 .CHESC, "H">
DP.CEL	<DPESC	 "K">
DP.CES	<DPBYTE	 .CHESC, "J">
DPYEND

; LA30
DPYTBL	(LA30DT)
DPYPRT
DP.SIZ	<^D0,,^D131>
DPYEND

; GT40

; LA36
DPYTBL (LA36DT)
DPYPRT				; Just the basics here
DP.SIZ	<^D0,,^D131>
DPYEND

; VT52

DPYTBL (VT52DT)
DPYV52
DPYEND

VT52AB:	MOVEI T3,"Y"
	CALL VTSESC
	HLRZ T3,Q1
	ADDI T3,40
	CALL VTSCHR
	HRRZI T3,(Q1)
	ADDI T3,40
	CALLRET VTSCHR

; GLASS TTY
DPYTBL	(GLASDT)
DP.SIZ	<^D24,,^D80>
DPYGLS
DPYEND

; FOX 1100
DPYTBL	(FOXDT)
DPYGLS
DP.CAP	<TC$CRT>
DP.SIZ	<^D24,,^D80>
DP.UP	<DPESC	"A">
DP.FWD	<DPESC	"C">
DP.TAB 	<DPBYTE .CHTAB>		;+++ Tabs must be set up
DP.CLS	<DPBYTE	.CHESC,"H",.CHESC,"J">
DP.CES	<DPESC	"J">		;+++ padding (.12)
DP.CEL	<DPESC	"I">
DP.HOM	<DPESC	"H">
DP.ABS	<DPROUT FOXABS,6>
DPYEND

FOXABS:	MOVEI T3,"Y"		; Yes, Y is horizontal, X is vertical!
	CALL VTSESC
	HRRZI T3,40(Q1)
	CALL VTSCHR
	MOVEI T3,"X"
	CALL VTSESC
	HLRZ T3,Q1
	ADDI T3,40
	CALLRET VTSCHR

; VT100
;+++ TABs must be set up in INI
;+++ can VBL work in either screen orientation?
DPYTBL	(VT10DT)
DPYV52				; VT52 superset
DP.CAP	<TC$CRT+TC%LID+TC%VBL>
DP.MVL	<DPROUT VT1SCV>		; Scroll region
DP.VBL	<DPSTR	<<[?5l[?5h[?2l>> ; ]]]> Leaves screen reversed
DPYEND

VT1SCV:	MOVEI T3,"<"		; > Go into ANSI mode
	CALL VTSESC
	CALL VT1SCR		; Do the job
	HRROI T3,[ASCIZ |[?2l|] ; ] Back to VT52 mode
	CALLRET VTSSTR

; VT100 ANSI
DPYTBL	(VT1ADT)		; Same terminal, different mode
DPYGLS
DP.SIZ	<^D24,,^D80>
DP.CAP	<TC$CRT+TC%LID+TC%VBL>
DP.UP	<DPBYTE	.CHESC,"[","A">	; ] 
DP.FWD	<DPBYTE	.CHESC,"[","C">	; ]
DP.TAB	<DPBYTE	.CHTAB>
DP.HOM	<DPBYTE	.CHESC,"[","H">	; ]
DP.ABS	<DPROUT	VT1ABS,10>
DP.CEL	<DPBYTE	.CHESC,"[","K">	; ]
DP.CES	<DPBYTE	.CHESC,"[","J">	; ]
DP.CLS	<DPSTR <>>		;
DP.MVL	<DPROUT VT1SCR>
DP.VBL	<DPSTR	<[?5l[?5h>>	; ]] Leaves screen reversed
DPYEND

VT1ABS:	MOVEI T3,"["		; ]
	CALL VTSESC
	HLRZ T3,Q1		; Line
	AOJ T3,
	CALL VTSDEC
	MOVEI T3,";"
	CALL VTSCHR
	MOVEI T3,1(Q1)		; Col
	CALL VTSDEC
	MOVEI T3,"H"
	CALLRET VTSCHR

; Scroll region
VT1SCR:	MOVEI T3,"["		; ] Set up scroll region
	CALL VTSESC		
	HLRZ T3,Q2
	AOJ T3,
	CALL VTSDEC
	MOVEI T3,";"
	CALL VTSCHR
	HRRZI T3,1(Q2)
	CALL VTSDEC
	MOVEI T3,"r"
	CALL VTSCHR
	SKIPG FX,Q1		; Move to top or bottom of region
	 SKIPA Q1,Q2
	 HLRZ Q1,Q2
	MOVEI T3,"["
	CALL VTSESC
	HRRZI T3,1(Q1)
	CALL VTSDEC
	MOVEI T3,"H"
	CALL VTSCHR
	MOVE T3,Q1		; Inform new cursor pos
	CALL VTSPOS
	SKIPG FX		; Decide which way to index
	 SKIPA Q1,["D"]
	 MOVEI Q1,"M"
	MOVM FX,FX		; Do the moves
VT1SC1:	MOVEI T3,(Q1)
	CALL VTSESC
	MOVEI T3,^D12		; Pad 12msec
	CALL VTSPAD
	SOJG FX,VT1SC1
	HRROI T3,[ASCIZ ||]	; ] Unset scroll region
	CALL VTSSTR		;265
	SETZ	T3,		;265
	CALLRET	VTSPOS		;265 leaves cursor at 0,0 on vt100!
	
; ANN ARBOR AMBASSADOR 
; Much like an ANSI VT-100 with insert/delete line/char
DPYTBL	(AAADT)
DPYGLS
DP.SIZ	<^D48,,^D80>		; 48 is best guess at standard screen size
DP.CAP	<TC$CRT+TC$FID>
DP.UP	<DPBYTE	.CHESC,"[","A">	; ] 
DP.FWD	<DPBYTE	.CHESC,"[","C">	; ]
DP.TAB	<DPBYTE	.CHTAB>
DP.HOM	<DPBYTE	.CHESC,"[","H">	; ]
DP.ABS	<DPROUT	VT1ABS,10>
DP.CLS	<DPSTR	<>>	; ]]
DP.CEL	<DPBYTE	.CHESC,"[","K">	; ]
DP.CES	<DPBYTE	.CHESC,"[","J">	; ]
DP.INC	<DPBYTE .CHESC,"[","@">	; ]
DP.DLC	<DPBYTE .CHESC,"[","P">	; ]
DP.INL	<DPBYTE .CHESC,"[","L">	; ]
DP.DLL	<DPBYTE .CHESC,"[","M">	; ]
DPYEND

; TELERAY 1061
DPYTBL	(T106DT)
DPYV52				; VT52 superset
DP.CAP	<TC$CRT+TC$FID+TC%MET>	; Meta key, full I/D
DP.INC	<DPESC	"P">		; Insert char
DP.DLC	<DPESC	"Q">		; Delete char
DP.INL	<DPESC	"L">		; Insert line (+++ padding)
DP.DLL	<DPESC	"M">		; Delete line (+++ padding)
DPYEND

; HEATH 19
DPYTBL	(H19DT)
DPYV52				; VT52 superset
DP.CAP	<TC$CRT+TC$FID+TC%VBL>
DP.PAD	<.CHDEL>		; Must pad with rubouts
DP.INL  <DPROUT H19PD1,^d20>
DP.DLL  <DPROUT H19PD2,^d20>
DP.DLC	<DPESC	"N">
DP.INC 	<DPSTR	<@ O>>	; +++ should be parameterized routine
DP.VBL	<DPSTR	<x1jY8Dp FEEP q        
DPYEND

H19PD2:	SKIPA	T3,["M"]
H19PD1:	MOVEI	t3,"L"
	CALL	VTSESC
	MOVEI	T3,^D18
	CALLRET	VTSPAD

; CONCEPT 100
DPYTBL	(C100DT)
DPYGLS
DP.CAP	<TC$CRT!TC%LID!TC%WRP>	; Autowraps
DP.SIZ	<^D24,,^D80>
DP.UP	<DPESC	";">
DP.FWD	<DPESC	"=">
DP.DWN	<DPROUT  C10DWN,1>	; Needs padding when scrolling, sigh
DP.NL	<DPROUT  C10NL,2>
DP.TAB	<DPBYTE	 .CHTAB>	; Probably needs intialization
DP.HOM	<DPESC	"?">
DP.ABS	<DPROUT  C10ABS,4>
DP.CLS	<DPROUT C10PD1>
DP.CEL	<DPROUT C10PD2>
DP.CES	<DPROUT C10PD3>
DP.MVL	<DPROUT	C10MVL>		; Use windows for region scrolling
;+++ insert character (see CRTSTY, hairy)
DPYEND

c10pd1:	movei	t3,.chffd	;270
	call	vtschr		;270
	movei	t3,^d48		;270 pad time
	callret	vtspad		;270 and pad it

c10pd2:	hrroi	t3,[byte (7) 33,.chcnu] ;270
	call	vtsstr		;270
	movei	t3,^d16		;pad time
	callret	vtspad

c10pd3:	hrroi	t3,[byte (7) 33,.chcne] ;270 clear eos
	call	vtsstr		;270 send it
	movei	t3,^d85		;270 then lots of
	callret	vtspad		;270 padding

C10ABS:	MOVEI T3,"a"
	CALL VTSESC
	HLRZ T3,Q1
	ADDI T3,40
	CALL VTSCHR
	HRRZI T3,40(Q1)
	CALLRET VTSCHR

C10NL:	MOVEI T3,.CHCRT
	CALL VTSCHR
C10DWN:	MOVEI T3,.CHLFD
	CALL VTSCHR
	HLRZ T1,TTLPOS(T2)
	MOVEI T3,5		; ???
	CAIN T1,^D23		; at bottom?
	 CALL VTSPAD		; Yes, will need padding
	RET

; Scroll region
; Q1/ number of lines, Q2/ first,,last
C10MVL:	MOVEI T3,"v"
	CALL VTSESC		; Send start of define window command
	HLRZ T3,Q2
	SUB Q2,T3
	ADDI T3,40
	CALL VTSCHR		; Send first line of window
	MOVEI T3,40
	CALL VTSCHR		; Send first column of window
	MOVEI T3,41(Q2)
	CALL VTSCHR		; Send number of lines in window
	MOVEI T3,40+^D80
	CALL VTSCHR		; Send number of columns in window
	HLRZ T3,Q2
	CALL VTSPOS		; Indicate that setting window homed cursor
	MOVEI FX,""		; Insert line if positive
	SKIPG Q1
	 MOVEI FX,""		; Delete line if negative
	MOVM Q1,Q1		; Do the moves
C10ML1:	MOVEI T3,(FX)
	CALL VTSESC
	MOVEI T3,(Q2)
	IMULI T3,3
	CALL VTSPAD		; Pad 3msec per line moved
	SOJG Q1,C10ML1
	HRROI T3,[ASCIZ |v  8p|] ; Set window to full screen
	CALLRET VTSSTR

; Debugging table
DPYTBL	(DBGDT)
DP.CAP	<TC$CRT+TC$FID>
DP.SIZ	<^D24,,^D80>
DP.DWN	<DPSTR < DWN>,1>
DP.BCK	<DPSTR < BCK>,1>
DP.CRT	<DPSTR <
CRT>,1>
DP.NL	<DPSTR <
NL>,2>
DP.UP	<DPSTR < UP>,2>
DP.FWD	<DPSTR < FWD>,2>
DP.TAB 	<DPSTR < TAB>,1>
DP.CLS	<DPSTR < CLS>,2>
DP.CES	<DPSTR < CES>,2>
DP.CEL	<DPSTR < CEL>,2>
DP.HOM	<DPSTR <
HOM>,2>
DP.ABS	<DPSTR < ABS>,4>
DP.INL	<DPSTR < INL>,2>
DP.DLL	<DPSTR < DLL>,2>
DP.DLC	<DPSTR < DLC>,2>
DP.INC	<DPSTR < INC>,2>
DPYEND

DPYTBL	<SUPDT>			; SUPDUP VT
DP.CAP	<-1>			; SET BY SERVER
DP.ABS	<DPROUT	SUPABS,5>
DP.CES	<DPSTRX <%TDEOF>,8>
DP.CEL	<DPSTRX <%TDEOL>,8>
DP.FWD	<DPSTRX <%TDFS>,8,1>
DP.CLS	<DPSTRX <%TDCLR>,8>
DP.VBL	<DPSTRX <%TDBEL>,8>	; Forced into visible-bell
DP.ERC	<DPSTRX <%TDDLF>,8>
; DP.MVL <DPROUT SUPMVL,6,1>	; can't be done yet
DP.INL	<DPROUT	SUPINL,2,1>	; I/D stuff is parameterized
DP.DLL	<DPROUT	SUPDLL,2,1>
DP.INC	<DPROUT	SUPINC,2,1>
DP.DLC	<DPROUT SUPDLC,2,1>
DP.NL	<DPSTRX <%TDCRL>,8>	;Knows Newline, but no down function!
DPYEND

SUPABS:	MOVEI T3,%TDMV0
	CALL VTSCHR
	HLRZ T3,Q1		; Vertical
	CALL VTSCHR
	HRRZI T3,(Q1)		; Horizontal
	CALLRET VTSCHR

SUPDLC:	SKIPA T3,[%TDDCP]
SUPINC:	 MOVEI T3,%TDICP
	JRST SUPIN0	

SUPDLL:	SKIPA T3,[%TDDLP]
SUPINL:	 MOVEI T3,%TDILP
SUPIN0:	CALL VTSCHR
	MOVEI T3,(Q1)		; Count
	CALLRET VTSCHR

REPEAT 0,<
; Q1/ distance to scroll, Q2/ first,,last
SUPMVL:	MOVEI T3,%TDMV0
	CALL VTSCHR
	HLRZ T3,Q2
	CALL VTSCHR
	MOVEI T3,0
	CALL VTSCHR
	MOVEI T3,%TDRSD
	CAIG Q1,0
	 MOVEI T3,%TDRSU
	CALL VTSCHR
	HLRZ T3,Q2
	SUBM Q2,T3
	HRRZ T3,T3
	ADDI T3,1
	CALL VTSCHR
	MOVM T3,Q1
	CALL VTSCHR
	HLLZ T3,Q2
	CALLRET VTSPOS
>; REPEAT 0

; PTV
; A  VT52 modulo LFD screw, size, and wrap mode
DPYTBL	(PTVDT)
DPYV52
DP.SIZ	<^D50,,^D84>
DP.CAP	<TC$CRT&^-TC%SCR>	; Can't scroll
DP.DWN	<DPESC	"B">
DP.NL	<DPBYTE .CHCRT,.CHESC,"B">
DPYEND

; BBN BITGRAPH
DPYTBL (BBNDT)
DP.SIZ	<^D63,,^D84>
DP.CAP	<TC$CRT!TC%LID>
DP.UP	<DPBYTE .CHESC,"[","A">
DP.DWN	<DPBYTE .CHLFD>
DP.NL	<DPBYTE .CHCRT,.CHLFD>
DP.FWD	<DPBYTE .CHESC,"[","C">
DP.BCK	<DPBYTE .CHESC,"[","D">
DP.CRT	<DPBYTE .CHCRT>
DP.TAB	<DPBYTE .CHTAB>
DP.CLS	<DPSTR <>>
DP.CES	<DPBYTE .CHESC,"[","J">
DP.CEL	<DPBYTE .CHESC,"[","K">
DP.HOM	<DPBYTE .CHESC,"[","H">
DP.ABS	<DPROUT VT1ABS,10>
DP.INL	<DPROUT BBNINL,5,1>	;+++ padding?
DP.DLL	<DPROUT BBNDLL,5,1>
DPYEND

BBNINL:	MOVEI T3,"["		;] INSERT LINE ROUTINE
	CALL VTSESC
	MOVE T3,Q1		;GET NUMBER OF LINES
	CALL VTSDEC
	MOVEI T3,"L"
	CALLRET VTSCHR

BBNDLL:	MOVEI T3,"["		;] DELETE LINE ROUTINE
	CALL VTSESC
	MOVE T3,Q1		;GET NUMBER OF LINES
	CALL VTSDEC
	MOVEI T3,"M"
	CALLRET VTSCHR

	SWAPCD