Google
 

Trailing-Edge - PDP-10 Archives - tops10and20_integ_tools_v9_3-aug-86 - tools/crc/browse/vtsubs.mac
There are no other files named vtsubs.mac in the archive.
;<KEVIN>VTSUBS.MAC.100037,  3-Aug-83 11:00:31, EDIT BY KEVIN
;	Make VTEND reset Tops-20's idea of cursor position to 0,0
;<KEVIN>VTSUBS.MAC.100037,  2-Aug-83 11:31:31, EDIT BY KEVIN
;	Allow for output to be redirected to a terminal which is not .PRIOU
;<CRC-SUBS>VTSUBS.MAC.?, 9-May-83 15:15, EDIT BY Geoff
;	allow for fortran v7 characters in vtbig and vtwid
;<CRC-SUBS>VTSUBS.MAC.?, 22-Apr-83 18:00, EDIT BY KEVIN
;	Make VT132 and VT80 pause for a second to allow terminal recovery.
;<ACCOUNTS>VTSUBS.MAC.100018,  9-Nov-82 13:54:52, EDIT BY KEVIN
;	VTEND should ignore failure to call VTINIT.
;<KEVIN>VTSUBS.MAC.100009, 23-Aug-82 13:48:24, EDIT BY KEVIN
;	SCRRG would not accept a one line region
;	Correct incorrect argument counting in VTATR
;<CRC-SUBS>VTSUBS.MAC.6, 16-Jul-82 12:14:21, EDIT BY KEVIN
;	Inserta dummy VTDAT to solve problem of all routines containing
;	EXTERNAL VTDAT. This is easier than updating the entire CRC
;	subroutine library.
;<CRC-SUBS>VTSUBS.MAC.5, 16-Jul-82 10:48:58, EDIT BY KEVIN
;	Add support for user error traps
;	move vtgon and vtgoff to the end as that is the order in the library
;<KEVIN>VTSUBS.MAC.68, 18-Dec-81 15:03:09, EDIT BY KEVIN
;	Must set TERMINAL NO RAISE in VTINIT to read ANSI keypad
;<KEVIN>VTSUBS.MAC.67, 14-Dec-81 21:25:16, EDIT BY KEVIN
;	Correct bugs in PUTCRS concerning VT52
;<KEVIN>VTSUBS.MAC.64, 14-Dec-81 21:12:53, EDIT BY KEVIN
;	Add graphics on/off routine (vtgon, vtgof)
;<KEVIN>VTSUBS.MAC.63, 28-Oct-81 11:36:49, EDIT BY KEVIN
;	Add echo on/off routine (crsil)
;<KEVIN>VTSUBS.MAC.61, 27-Oct-81 16:52:23, EDIT BY KEVIN
;	Add error checking to cursor movement routines
;<KEVIN>VTSUBS.MAC.57, 27-Oct-81 14:36:45, EDIT BY KEVIN
;	Change way VTSTOR is defined for FORTRAN programs
;<KEVIN>VTSUBS.MAC.56, 27-Oct-81 14:26:17, EDIT BY KEVIN
;	Fix bug with FORTRAN vtatr argument counting
;<KEVIN>VTSUBS.MAC.55, 27-Oct-81 14:02:27, EDIT BY KEVIN
;	Fix CURUP - was sending VT52 sequence for VT100
;<KEVIN>VTSUBS.MAC.54, 27-Oct-81 13:16:46, EDIT BY KEVIN
;	Add VTZAP to reset to power up settings. Clean up parameter passing
;	from macro.
;<KEVIN>VTSUBS.MAC.48, 26-Oct-81 15:04:10, EDIT BY KEVIN
;	Add yet more routines, and produce primitive documentation
;<KEVIN>VTSUBS.MAC.47, 26-Oct-81 13:27:13, EDIT BY KEVIN
;<KEVIN>VTSUBS.MAC.46, 26-Oct-81 11:47:36, EDIT BY KEVIN
;	Add new SEQ macro to VTMAC for generating fixed and parametrised escape
;	sequences - add new routines to use support
;<G-GIBBS>VTSUBS.MAC.10,  6-Oct-81 14:48:31, EDIT BY KEVIN
;	Add VTEND for resetting the JFN mode word on program exit
;<G-GIBBS>VTSUBS.MAC.5, 23-Sep-81 11:08:41, EDIT BY G-GIBBS
;add tabset & tabclr for setting & clearing tab stops
SUBTTL	VT100 - ROUTINES FOR THE VT100 (FROM MACRO AND FORTRAN)
;
;	VTDEF$ IS A MACRO DEFINED IN VTMAC WHICH TAKES ONE ARGUMENT.
;	THIS ARGUMENT IS USED IN A TITLE STATEMENT FOR THE MODULE NAME,
;	AND AN ENTRY STATEMENT IS ALSO GENERATED. IT ALSO GENERATES
;	USEFUL EXTERNAL REFERENCES AND ABSOLUTE SYMBOL DEFINITIONS.
;
;
;	All subroutines should place their impure storage in in the one
;	area vtimp$ - this area is created by the macro VTSTOR,
;	defined in VTMAC. Thus, imputre storage should be declared external
;
;	For FORTRAN programs, vtinit loads the common block.
;	For MACRO programs, they should load the common block themselves.
	title	vtinit - fortran version
	SEARCH	VTMAC
;	VTDEF$	VTINIT		;MACRO ENTRY POINT
	regdef
	vtedef
	entry	vtinit
	external	$vtinit
	$titl==0
	vtstor

VTINIT::	efort
	call	$vtinit			;call the real thing
	ret				;return
	prgend
;
	title	$vtinit - macro version
	search	vtmac
	regdef
	vtedef
	entry	$vtinit
	external	jobn,vtver$,term$,$vter,$vtme,trmjfn

	esc==^d27
	lf==^d10
	VTVER==^D29		;VERSION NUMBER (IN VTSTOR)

$VTINIT::	PUSH	P,T1
	PUSH	P,T2
	PUSH	P,T3
	MOVE	T1,VTVER$	;GET VERSION NUMBER IN IMPURE STORE
	CAIE	T1,VTVER	;IS IT EQUAL TO OUR VERSION NUMBER ?
	 VTERR	VT$VER		;ERROR - OUT OF DATE
	move	t1,trmjfn	;Point to output TTY
	RFCOC%			;READ TERMINAL CONTROL WORDS
	TRO	T3,2B19		;SET ESCAPE TO NO TRANSLATION
	TRZ	T3,1B19		;AND TURN OF SET BIT
	SFCOC%			;SET CONTROL WORDS
	 ERJMP	$VTME
;
;	NOW DETERMINE IF A VT100 OR A VQ12
;
	move	t1,trmjfn	;Look at output JFN
	caie	t1,.priou	;writing to .PRIOU ?
	 jrst	set2		;no, assume VT100
	SETOM	T1		;CURRENT JOB SPECIFIER
	HRROI	T2,JOBN		;RETREIVE ONE WORD OF JOB INFO
	MOVEI	T3,.JITNO	;JOB TERMINAL NUMBER DESIRED
	GETJI%			;GET JOB INFO
	 ERJMP	$VTME		;OOOPS !
	MOVE	T1,JOBN		;GET JOB NUM IN AC 1
	ADD	T1,[.TTDES]	;MAKE IT A TERMINAL DESIGNATOR
	GTTYP%			;AND FIND IT'S TERMINAL TYPE
	SETZM	TERM$		;ZERO TYPE
	CAIN	T2,.TTV52	; ARE WE A VQ12 ?
	JRST	SET1		;YES , SET TYPE
	CAIN	T2,.TT100	;ARE WE A VT100 ?
	JRST	SET2		;YES !
	 VTERR	VT$NST		;TERMINAL NOT SUPPORTED
SET1:	MOVEI	T1,1
	MOVEM	T1,TERM$	;VQ12
	JRST	BACK
SET2:	SETOM	TERM$		;VT100
;
;	turn wrap-round off - done due to an obscure bug found in the VT100
;	microcode while writing VERF. It is manifested by spurious wraprounds
;	occurring when one is at or near end of line, and attempts to perform
;	multiple cleols/cleos 's .
;
	move	t1,trmjfn	;Point to terminal
	hrroi	t2,[byte (7) esc,"[","?","7","l",0]
	setzb	t3,t4
	sout%			;wrapround off
;
;	now set terminal width to 0
;
back:	move	t1,trmjfn	;output TTY desig
	rfmod%			;read it's mode word
	 erjmp	$vtme
	txz	t2,tt%wid+TT%LEN+tt%lic ;set zero length,width,erminal no raise
	txo	t2,tt%pgm		;pause on command
	move	t1,trmjfn
	stpar%			;set these things
	 erjmp	$vtme
	POP	P,T3
	POP	P,T2
	POP	P,T1
	RET
	PRGEND
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;
;	ACCEPTS NUMBER OF PLACES TO MOVE CURSOR UP IN AC1
;
	SEARCH	VTMAC
	VTDEF$	CURUP
	external	scdt$
curup:	efort
	move	t1,@(cx)		;get argument
$CURUP:	skipn	t1			;equal to 0 ?
	 ret				;yes
	skipg	t1			;positive ?
	 vterr	vt$neg			;nope
	vtchk			;check initialised
	movem	t1,t2
	move	t1,term$		;what are we ?
	jumpl	t1,curup1		;a VT100 ?
	push	p,q1			;no, save extra ac
	movem	t2,q1			;store loop count
	hrroi	t2,[byte (7) esc,"A"]	;no, use the VT52 cursor up stuff
	move	t1,trmjfn		;point to output
	setzb	t3,t4			;write ASCIZ
curup2:	sout%				;up one line
	sojg	q1,curup2		;and loop the appropriate no. of times
	pop	p,q1			;restore saved ac
	ret				;back to our caller

curup1:	seq	scdt$,<esc,lsqb>,t2,"A"	;define sequence
	ret				;return

	PRGEND
;
;	CURSOR HOME (NO ARGS, NO ERROR POSS)
;
	SEARCH	VTMAC
	VTDEF$	CURHOM
	EXTERNAL	CURSH$
ptr:	POINT	7,CURSH$
CURHOM::	efort
$CURHOM::	vtchk			;check intialised
	PUSH	P,T1
	PUSH	P,T2
	MOVE	T1,ptr
	MOVEI	T2,ESC
	IDPB	T2,T1		;PUT ESCAPE
	MOVEI	T2,LSQB		;CSI
	SKIPG	TERM$		;DO NOT LOAD THIS CHAR IF VQ12
	IDPB	T2,T1
	MOVEI	T2,"H"
	IDPB	T2,T1
	SETZ	T2,
	IDPB	T2,T1
	move	t1,trmjfn	;Point to output
	hrroi	t2,cursh$
	setzb	t3,t4
	SOUT%
	 ERJMP	$VTME
	POP	P,T2
	POP	P,T1
	RET
	PRGEND

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
;	CLEAR TO END OF SCREEN
;
	SEARCH	VTMAC
	VTDEF$	CLEOS
	EXTERNAL	CLEOS$
ptr:	POINT	7,CLEOS$
CLEOS::	efort
$CLEOS::	vtchk
	PUSH	P,T1
	PUSH	P,T2
	MOVE	T1,ptr
	MOVEI	T2,ESC
	IDPB	T2,T1
	MOVEI	T2,LSQB
	SKIPG	TERM$
	IDPB	T2,T1
	MOVEI	T2,"J"
	IDPB	T2,T1
	SETZ	T2,
	IDPB	T2,T1
	move	t1,trmjfn
	setzb	t3,t4
	hrroi	t2,cleos$
	SOUT%
	 ERJMP	$VTME
	POP	P,T2
	POP	P,T1
	RET
	PRGEND

;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
;	SET SCROLLING REGION - TOP OF SCROLLING REGION IN t1, BOTTOM IN t2
;	SETS VTER TO (HALFWORD) -2 IF BAD PARAMS
;
	SEARCH	VTMAC
	VTDEF$	SCRRG
	EXTERNAL	SCDT$
ptr:	POINT 7,SCDT$	  ;POINT TO ESC SEQUENCE
SCRRG::	efort
	MOVE	t1,@0(CX)	;GET FIRST FORTRAN ARG
	MOVE	t2,@1(CX)	;AND SECOND...
$SCRRG::	vtchk
	movem	t2,t4
	movem	t1,t3
	CAIGE	T3,1		;IS TOP > 0?
	JRST	$SCRER		;NO
	CAIGE	T4,1		;BOTTOM > 0?
	 JRST	$SCRER		;NO
	CAILE	T4,^d24		;BOTTOM <= 24 ?
	 JRST	$SCRER		;NOPE
	CAMLe	T3,T4		;TOP < BOTTOM ?
	 JRST	$SCRER		;NOPE
	SKIPL	TERM$		;CONTINUE IF A VT100
	JRST	$N100		;THIS AIN'T A VT100 !
;
;	THE PARAMS SEEM TO BE OK, NOW LET'S DO SOMETHING WITH THEM
;
	PUSH	P,Q1
	PUSH	P,Q2
	MOVE	Q1,ptr
	MOVEI	Q2,ESC
		IDPB	Q2,Q1
	MOVEI	Q2,LSQB
	IDPB	Q2,Q1
	PUSH	P,T1
	PUSH	P,T2
	MOVE	T2,T3		;GET THE TOP PARAM
	MOVEI	T3,^D10		;RAD 10 OUTPUT
	MOVE	T1,Q1
	NOUT%			;OUTPUT NUMBER IN ASCII
	 JRST	$VTME
	MOVEI	Q2,SEMIC
	IDPB	Q2,T1
	PUSH	P,T2
	MOVE	T2,T4
	NOUT%
	 JRST	$VTME
	POP	P,T3
	MOVEI	Q2,LITLR
	IDPB	Q2,T1
	setz	t2,
	idpb	t2,t1
	move	t1,trmjfn	;Point to output terminal
	setzb	t3,t4		;write ASCIZ
	hrroi	t2,scdt$
	SOUT%
	 ERJMP	$VTME
	POP	P,T2
	POP	P,T1
	POP	P,Q2
	POP	P,Q1
	RET
$N100:		VTERR	VT$N10			;NOT A VT100
$screr:	vterr	vt$scr			;bad scroll region parameters
	prgend

;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
;	$putcrs - put cursor at row,column position specified by t1,t2
;	(start at row 1, col 1)
;	(not affected by origin mode)
;
	search vtmac
	vtdef$	putcrs
	EXTERNAL	PUT$
ptr:	point	7,put$	 ;byte pointer to escape sequence
PUTCRS::		;FORTRAN ENTRY POINT
	efort
	move	t1,@(cx)
	move	t2,@1(cx)
$putcrs::	vtchk
	push	p,t3
	push	p,t4		;save appropriate accs
	push	p,t1
	push	p,t2
	move	t1,ptr
	movei	t2,esc
	idpb	t2,t1
	skipg	term$		;if vt52, skip next
	jrst	csi		;go to vt100 code
	movei	t2,"Y"		;vt52 cursor seq flag
	idpb	t2,t1		;deposit
	pop	p,t2		;get col
	pop	p,t3		;get row
	addi	t3,37		;add offset (space)
	addi	t2,37
	idpb	t3,t1
	idpb	t2,t1
	setzm	t2
	idpb	t2,t1		;put null byte terminator
	move	t1,trmjfn	;point to output
	setzb	t3,t4		;write ASCIZ
	hrroi	t2,put$
	sout%
	 erjmp	$vtme
	pop	p,t4
	pop	p,t3
	ret
csi:
	movei	t2,"["
	idpb	t2,t1		;place csi char.
	pop	p,t3		;get column address ( we don't want it yet)
	pop	p,t2		;get row address
	push	p,t3		;save column again
	movei	t3,^d10		;radix
	nout%
	 erjmp	$vtme
	movei	t2,";"
	idpb	t2,t1		;stick parameter separator in string
	pop	p,t2	;column number
	movei	t3,^d10
	nout%
	 erjmp	$vtme
	movei	t2,"H"
	idpb	t2,t1		;deposit terminator
	setz	t2,		;put null byte terminator
	idpb	t2,t1
	move	t1,trmjfn	;Point to output TTY
	setzb	t3,t4
	hrroi	t2,put$		;get byte pointer again
	sout%
	 erjmp	$vtme

	pop	p,t4
	pop	p,t3
	ret
	prgend

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
;	CLEAR TO END OF line
;
	SEARCH	VTMAC
	VTDEF$	CLEOL
	EXTERNAL	CLEOL$
CLEOL::	efort
$CLEOL::	vtchk
	skipl	term$		;vq12 ?
	 jrst	cl52		;yes do it.
	seq	cleol$,<esc,lsqb,"K">	;define sequence
	ret
cl52:	seq	cleol$,<esc,"K">	;define sequence
	ret
	PRGEND

;===============================================================
;
;	VTLED - lights led number in t1 - clears all leds
;	if t1 contains zero
;
	search	vtmac
	vtdef$	vtled
	EXTERNAL	VTLED$
vtled:	efort
	move	t1,@(cx)	;get first arg
$vtled:	vtchk
	seq	vtled$,<esc,lsqb>,t1,"q"
	ret
	prgend

;===============================================================
;
;	TABCLR - clears all tabs
;
;
	search	vtmac
	vtdef$	tabclr
	EXTERNAL	tbclr$
tabclr:	efort
$tabclr:	vtchk
	skipl	term$		;vq12 ? can't do anything
	 ret			;so return instead
	seq	tbclr$,<esc,"[","3","g">
	ret			;back to friendly caller
	prgend

;===============================================================
;
;	TABSET - sets tab in column specified
;		 in t1 or in argument 1
;
	search	vtmac
	vtdef$	tabset
	EXTERNAL	tbset$,$putcrs
tabset:	efort
	move	t1,@(cx)	;get first arg
$tabset:	vtchk
	skipl	term$		;vq12 ? can't do anything
	 ret			;so return instead
	exch	t1,t3		;save arg in t3
	push	p,t3		;stack arg(trashed by seq)
;
;save cursor position
;
	setzm	tbset$		;clear area for storage of asciz string
	seq	tbset$,<esc,"7">
;
;send cursor to row 1 and column selected
;
	movei	t1,1		;row 1 selected
	pop	p,t2		;column selected
	call	$putcrs		;move cursor
;
;set tab in current column
;
	seq	tbset$,<esc,"H">
;
;restore cursor position
;
	seq	tbset$,<esc,"8">
	ret			;back to friendly caller
	prgend

;======================================================================
;
;	VTCBL - clear from start of line
;
	search	vtmac
	vtdef$	vtcbl
vtcbl:	efort
$vtcbl:	vtchk		;initialized ?
	skipl	term$		;vq12 ? can't do anything
	 ret			;so return instead
	seq	0,<esc,"[","1","K">	;sequence
	ret				;back to caller
	prgend
;========================================================================
;
;	VTCLIN - clear entire line with cursor
;
	search	vtmac
	vtdef$	vtclin
vtclin:	efort
$vtclin:	vtchk
	skipl	term$		;vq12 ? can't do anything
	 ret			;so return instead
	seq	0,<esc,"[","2","K">
	ret
	prgend
;=========================================================================
;
;	VTCBS - clear from start of screen to cursor
;
	search	vtmac
	vtdef$	vtcbs
vtcbs:	efort
$vtcbs:	vtchk
	skipl	term$		;vq12 ? can't do anything
	 ret			;so return instead
	seq	0,<esc,"[","1","J">
	ret
	prgend
;======================================================================
;
;	VTCLS - clear entire screen
;
	search	vtmac
	vtdef$	vtcls
vtcls:	efort
$vtcls:	vtchk
	skipl	term$		;vq12 ? can't do anything
	 ret			;so return instead
	seq	0,<esc,"[","2","J">
	ret
	prgend
;=====================================================================
;
;	vtlft - cursor left
;
	search	vtmac
	vtdef$	vtlft
	external	scdt$
vtlft:	efort
	move	t1,@(cx)		;get parm
$vtlft:	vtchk
	skipn	t1		;movement required ?
	 ret			;no, but VT100 interprets 0 badly
	skipg	t1			;+ve ?
	 vterr	vt$neg			;nope
	seq	scdt$,<esc,"[">,t1,"D"
	ret
	prgend
;===================================================================
;
;	vtrit - cursor right
;
	search	vtmac
	vtdef$	vtrit
	external	scdt$
vtrit:	efort
	move	t1,@(cx)
$vtrit:	vtchk
	skipn	t1			;movement required?
	 ret			;no, but VT100 interprets 0 as 1
	skipg	t1			;+ve ?
	 vterr	vt$neg			;nope
	seq	scdt$,<esc,"[">,t1,"C"
	ret
	prgend
;=====================================================================
;
;	vtdwn - cursor down (1 arg)
;
	search	vtmac
	vtdef$	vtdwn
	external	scdt$
vtdwn:	efort
	move	t1,@(cx)
$vtdwn:	vtchk
	skipn	t1		;equal to 0 ?
	 ret
	skipg	t1		;+ve ?
	 vterr	vt$neg		;nope
	seq	scdt$,<esc,"[">,t1,"B"
	ret
	prgend
;==============================================================
;
;	vtsav - save cursor position
;
	search	vtmac
	vtdef$	vtsav
vtsav:	efort
$vtsav:	vtchk
	seq	0,<esc,"7">
	ret
	prgend
;===================================================================
;
;	vtres - restore cursor position
;
	search	vtmac
	vtdef$	vtres
vtres:	efort
$vtres:	vtchk
	seq	0,<esc,"8">
	ret
	prgend
;===================================================================
;
;	vtiup - reverse index (ie move up and scroll down if necessary)
;
	search	vtmac
	vtdef$	vtiup
vtiup:	efort
$vtiup:	vtchk
	seq	0,<esc,"M">
	ret
	prgend
;=====================================================================
;
;	vt80 - set to 80 column mode
;
	search	vtmac
	vtdef$	vt80
	lf==^d10
vt80:	efort
$vt80:	vtchk
	seq	0,<lf,esc,"[","?","3","l">
	movei	t1,1000		;now pause...
	disms%			;for one second, otherwise terminal can be odd
	ret
	prgend
;========================================================================
;
;	vt132 - seq to 132 column mode
;
	search	vtmac
	vtdef$	vt132
vt132:	efort
$vt132:	vtchk
	seq	0,<esc,"[","?","3","h">
	movei	t1,1000		;Then pause....
	disms%			;For one second to let the terminal behave
	ret
	prgend
;============================================================================
;
;	vtscrn - set screen background - 0 is reverse, 1 is normal
;
	search	vtmac
	vtdef$	vtscrn
vtscrn:	efort
	move	t1,@(cx)
$vtscrn:	vtchk
	jumpe	t1,$1		;reverse ?
	seq	0,<esc,"[","?","5","l">	;no
	ret
$1:	seq	0,<esc,"[","?","5","h">	;yes
	ret
	prgend
;=========================================================================
;
;	vtorg - set origin mode (0 is off, 1 is on)
;
	search	vtmac
	vtdef$	vtorg
vtorg:	efort
	move	t1,@(cx)
$vtorg:	vtchk
	jumpn	t1,$1			;absolute mode ?
	seq	0,<esc,"[","?","6","l">	;yes
	ret
$1:	seq	0,<esc,"[","?","6","h">	;no
	ret
	prgend
;=================================================================
;
;	vtjmp	 - set scroll jump
;
	search	vtmac
	vtdef$	vtjmp
vtjmp:	efort
$vtjmp:	vtchk
	seq	0,<esc,"[","?","4","l">
	ret
	prgend
;============================================================
;
;	vtsmth - smooth scrolling mode
;
	search	vtmac
	vtdef$	vtsmth
vtsmth:	efort
$vtsmth:	vtchk
	seq	0,<esc,"[","?","4","h">
	ret
	prgend
;================================================================
;
;	vtatr - set attribute on (1 for bold, 4 for underscore, 5 blink
;				7 for reverse video, 0 is off)
;	Note: From FORTRAN, any number of arguments may be specified to
;	set up appropriate stuff.
;
	search	vtmac
	vtdef$	vtatr
	external	scdt$
vtatr:	efort
	move	t1,cx
	soj	t1,		;point to word before table
	hlre	t4,(t1)		;and grab number of arguments
	movns	t4,t4		;negate
	move	t2,cx		;get pointer
$1:	move	t1,@(t2)	;get arg
	push	p,t4		;save number of args left
	push	p,t2		;save arg pointer
	call	$vtatr		;do the right thing
	pop	p,t2
	aoj	t2,		;bump argument pointer
	pop	p,t4		;and number of args
	sojg	t4,$1		;if there are more, go back for them
	ret			;return to caller
$vtatr:	vtchk
	seq	scdt$,<esc,"[">,t1,"m" ;send sequence
	ret
	prgend
;===============================================================
;
;	vtwid - display text as wide stuff
;	From FORTRAN - call VTWID ('ASCIZ STRING')
;	From MACRO - hrroi	t1,[asciz/string/]
;			call	vtwide
;
	search	vtmac
	vtdef$	vtwid
vtwid:	efort
	setz	t1,			;pointer to argument
	call	gtbypt##			;may be fortran v7
;*	hrroi	t1,@(cx)		;point to string
$vtwid:	vtchk
	push	p,t1			;save pointer
	seq	0,<esc,"#","6">		;double width
	move	t1,trmjfn		;Point to TTY
	setzb	t3,t4			;ASCIZ string
	pop	p,t2
	sout%				;type string
	fmsg	<
>					;move to next line
	ret
	prgend
;======================================================================
;
;	vtbig - type text as double height,double width : call as vtwid
;
	search	vtmac
	vtdef$	vtbig
vtbig:	efort
	setz	t1,			;pointer to argument
	call	gtbypt##			;may be fortran v7
;*	hrroi	t1,@(cx)
$vtbig:	vtchk
	push	p,t1			;make one copy of string
	push	p,t1			;and another copy
	seq	0,<esc,"#","3">		;top half of line
	move	t1,trmjfn
	pop	p,t2			;with string
	setzb	t3,t4			;in ASCIZ
	sout%				;output on it
	fmsg	<
>					;move to next line
	seq	0,<esc,"#","4">		;bottom half of line
	move	t1,trmjfn
	pop	p,t2			;with string
	setzb	t3,t4			;in ASCIZ
	sout%				;output on it
	fmsg	<
>					;to next line
	ret
	prgend
;====================================================================
;
;	VTZAP - reset to power-up state
;
	search	vtmac
	vtdef$	vtzap
vtzap:	efort
$vtzap:	vtchk
	seq	0,<esc,"c">
	movei	t1,^d2000		;wait 2 seconds
	disms%
	ret
	prgend
;=======================================================
;<CRC.2>SILENT.MAC.4,  8-Apr-81 09:58:26, EDIT BY CRC.2
;<CRC.2>SILENT.MAC.2,  8-Apr-81 09:50:16, EDIT BY CRC.2
;
; SILENT - A FORTRAN-CALLABLE SUBROUTINE TO TURN INPUT ECHOING ON OR OFF
;	WHEN CALLED WITH THE ARGUMENT EQUAL TO1, IT TURNS OFF ECHOING.
;	WHEN EQUAL TO 0, IT TURNS IT ON AGAIN
;
	search	vtmac
	vtdef$	crsil
crsil:	efort
	MOVE	t1,@(CX)	;GET FIRST ARGUMENT
$crsil:	movem	t1,t3
	MOVE	T1,trmjfn		;DESIGNATOR OF OUR TERMINAL
	RFMOD%		;GET TERMINAL MODEWORD, LET EXEC HANDLE ERRORS
	 erjmp	$vtme
	JUMPE	T3,OFF		;IS IT 0 ?
	TRZ	T2,TT%ECO	;NO, TURN ECHO OFF
	SKIPA			;SKIP
OFF:	TRO	T2,TT%ECO	;TURN ECHO ON
	SFMOD%			;SET MODE WORD, EXEC HANDLES ERRORS
	 erjmp	$vtme
	RET			;RETURN
	prgend
;=====================================================================
;
;	VTEND - reset JFN mode word on program exit
;		Also set pseudo-cursor position to 0,0
;
	search	vtmac
	vtdef$	vtend
vtend:	efort
$vtend:	move	t1,trmjfn
	rfmod%
	 ercal	$vtme
	txo	t2,fld(^d24,tt%len)+fld(^d80,tt%wid)
	stpar%
	 ercal	$vtme
	setz	t2,
	sfpos%		;indicate 0,0
	ret		;back to caller
	prgend
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
;	This is the internal error processing modules for non-JSYS errors, i.e.
;	generally for bad parameters
;
	search	vtmac
	.common vterr[2]
	vted$=vterr+1
	vtdef$	$VTER

$vter::	skipn	vted$			;test the error disposition
	 jrst	$vter1			;= 0 so we bomb out
	movem	t1,vterr		;set the error code
	ret				;return to caller
$vter1:	movem	t1,t4			;save error number
	tmsg	<
?VTSUBS - >
	hrroi	t1,@ermes(t4)		;get pointer to error message
	psout%
	tmsg	<
>
	haltf%
;
;	NOW REDEFINE THE $VERR MACRO SO THAT IT GENERATES THE TEXT STORAGE
;	RATHER THAN THE SYMBOL DEFINITIONS (A LA MONSYM AND .ERR.)
;

	DEFINE $VERR (ERNUM,ERSYM,ERTXT) ,<

	[ASCIZ/ERTXT/]		;;STORE TEXT FOR ERROR IN LIT POOL
	>

ERMES:	$VERRS			; NOW REGENERATE THE ERRORS - THIS IS DONE
				;ONCE IN VTMAC, BUT IT ONLY DEFINES THE SYMBOLS
				; THAT TIME
	prgend

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;	Created by KEVIN
;	this code processes errors that occur as a result of monitor
;	calls made by the vt100 stuff - it just prints the message and stops
;
	search	vtmac
	vtdef$	$VTME
;	.require ersub
;	external error

$vtme::	tmsg	<
?Monitor error from VTSUBS -
>
	movei	t1,.priou
	hrloi	t2,.fhslf
	setz	t3,
	erstr%
	 trn
	 trn
;	jrst	error		;call standard error routine
	haltf%
	prgend
;======================================================================
;
;	VTGON - turn graphics mode on
;
	search	vtmac
	vtdef$	vtgon
vtgon:	efort				;fortran entry stuff
$vtgon:	vtchk			;check initialized
	SEQ	,<esc,"(","0">
	ret
	prgend
;======================================================================
;
;	VTGOf - turn graphics mode off
;
	search	vtmac
	vtdef$	vtgof
vtgof:	efort				;fortran entry stuff
$vtgof:	vtchk			;check initialized
	seq	,<esc,"(","B">
	ret
	prgend
;=====================================================================
;
;	VTTY - set output TTY for VTSUBS stuff
;	Macro routines just set TRMJFN, to be declared external.
;	Fortran calls with CALL VTTY('TTY56:'), or whatever. Use no
;	argument, or a blank one, to set back to .PRIOU.
;	Must call VTINIT AFTER this.
;
	search	vtmac
	vtdef$	vtty
vtty:	efort
$vtty:	move	t1,trmjfn		;First, look at old tty output
	caie	t1,.priou		;Primary output ?
	 closf%				;no, so close it
	erjmp	.+1			;ignoring errors
	hlre	t1,-1(cx)		;Get number of args
	jumpe	t1,vttrst		;If zero, reset output to .PRIOU
	setz	t1,			;else get byte pointer to first arg
	call	gtbypt##		;with library routine
	move	t2,t1			;copy byte pointer
	ildb	t3,t1			;get first byte of string
	cain	t3," "			;space ?
	 jrst	vttrst			;yes, reset to .PRIOU
	jumpe	t3,vttrst		;or also if null
	movx	t1,gj%sht!gj%old	;file should exist
	gtjfn%				;try for a JFN on it
	 erjmp	$vtme			;failed
	movx	t2,fld(8,of%bsz)!of%wr	;open for write with 8-bit bytes
	openf%				;do it
	 erjmp	$vtme			;failed
	movem	t1,trmjfn		;store new jfn
	ret				;all done
vttrst:	movei	t1,.priou		;here to reset to normal .PRIOU
	movem	t1,trmjfn
	ret				;done
	end