Google
 

Trailing-Edge - PDP-10 Archives - dec-10-omona-u-mc9 - vbcser.mac
There are 8 other files named vbcser.mac in the archive. Click here to see a list.
TITLE	VBCSER - SERVICE ROUTINE FOR DEC VB10C (5.02 OR LATER) - V025
SUBTTL	P. M. HURLEY/DAL	11 JAN 77
	SEARCH	F,S
;***COPYRIGHT 1973,1974,1975,1976,1977 DIGITAL EQUIPMENT CORP., MAYNARD, MASS.***
XP VVBCSR,025
ENTRY	VBCSER
VBCSER:
	INTERN PENINT,PENDDB



;THIS SERVICE ROUTINE ALLOWS THE DISPLAY TO BE USED AS A STANDARD DEVICE

;THE I/O INSTRUCTIONS ARE AS FOLLOWS:

;	INIT	D,15	;INITIALIZE DISPLAY ON SOFTWARE CHANNEL D 
;			;IN DUMP MODE (ONLY DUMP MODE IS ALLOWED ON DISPLAY)
;	SIXBIT	/DIS/
;	0		;NO BUFFERS
;	ERROR RETURN
;	NORMAL RETURN

;	CLOSE	D,	;STOPS THE DISPLAY
;	   OR		; AND
;	RELEASE	D,	;RELEASES THE DEVICE

;	INPUT	D,ADR	;RECEIVE LIGHT PEN AND ERROR CONDITIONS
;		SERVICE ROUTINE RETURNS WITH:
;		ADR/	Y,X COORDINATES OF LAST LIGHT PEN HIT
;		ADR+1/	DISPLAY ADDRESS COUNTER OF LAST LIGHT PEN HIT
;		ADR+2/	Y,X COORDINATES OF FIRST ERROR SINCE LAST INPUT INSTRUCTION
;		ADR+3/	ERROR BITS, ADDRESS OF DISPLAY INSTRUCTION CAUSING ERROR

;	OUTPUT	D,ADR	;START THE DISPLAY
;		WHERE:
;		ADR/	USER ERROR FLAG ADDRESS, STARTING ADDRESS OF DISPLAY PROGRAM
;		ADR+1/	0 OR DESIRED VIRTUAL PROTECTION AND VIRTUAL RELOCATION
;		PROTECTION AND RELOCATION FORMAT IS SIMILAR TO THAT USED BY THE SYSTEM
;		I.E. 	HIGH ORDER 8 PROTECTION BITS ARE LEFT JUSTIFIED IN LEFT HALF
;			HIGH ORDER 8 RELOCATION BITS ARE LEFT JUSTIFIED IN RIGHT HALF
;		IF 0 IS USED THE PROTECTION AND RELOCATION IS THAT OF THE USER'S JOB

;THE USER ERROR FLAG IS SET TO -1 IF AN ERROR OR A LIGHT PEN HIT OCCURS ON THE DISPLAY
;THE SERVICE ROUTINE HANDLES DISPLAY INTERRUPTS AS FOLLOWS:

;	STOP INTERRUPT	RESTART AT BEGINING OF DISPLAY PROGRAM AFTER TWO
;			JIFFIES HAVE ELAPSED SINCE LAST START OF PICTURE

;	ILLEGAL ADDRESS	LET THE DISPLAY HANG.
;			IT IS UP TO THE USER TO REMEDY THE SITUATION.

;	EDGE VIOLATION  TREAT AS STOP FLAG, BUT SET USER ERROR FLAG

;	LIGHT PEN	RESUME DISPLAYING
;DEVICE DATA BLOCK

	ENTRY	VBCDDB
PENDDB:
VBCDDB:
DISDDB:	SIXBIT	/DIS/		;DEVNAM
	XWD	^D60*HUNGST,0	;DEVCHR
DISIOS:	0			;DEVIOS
	EXP	VBCDSP		;DEVSER
	XWD	DVOUT+DVIN+DVLNG,20000  ;DEVMOD
	0			;DEVLOG
	0			;DEVBUF
	XWD	R,0		;DEVIAD
	0			;DEVOAD
	0			;DEVSTS
	XWD	.TYDIS,0	;DEVSTA
	BLOCK 3			;OTHER DDB LOCATIONS
	0			;(16) DEVESE
	0			;(17) DEVHCW
	0			;(20) DEVJOB
	BLOCK 1			;MSGE DDB LOCATIONS


;DISPLAY DISPATCH TABLE
	ENTRY	VBCDSP

	POPJ	P,		;SPECIAL ERROR STATUS
	JRST	REGSIZ##	;GET BUFFER SIZE
	JRST	DISINI		;INITIALIZATION
	POPJ	P,		;HUNG DEVICE - STOP JOB AND PRINT ERROR
VBCDSP: JRST	DISRLS    	;RELEASE
	JRST	DISOFF		;CLOSE
	JSP	U,UUOERR##	;OUTPUT
	JSP	U,UUOERR##	;INPUT
	JRST	CPOPJ1		;ENTER
	JRST	CPOPJ1		;LOOKUP
	JRST	DISOUT		;DUMP OUTPUT
	JRST	DISIN		;DUMP INPUT (LITE PEN AND ERRORS)
	POPJ	P,		;SETO
	POPJ	P,		;SETI
	POPJ	P,		;GETF
	JRST	CPOPJ1		;RENAME
	POPJ	P,		;CLOSE INPUT
	POPJ	P,		;DIRECTORY CLEAR
	POPJ	P,		;MTAPE
;  	CONSTANTS AND VARIABLES FOR THE NIH DISPLAY SERVICE ROUTINE



IFNDEF FTFBX,<FTFBX==0>
IFNDEF FTGFN,<FTGFN==0>

IFN FTGFN,<EXTERN GFNFLG, GFNGO>
IFN FTFBX,<EXTERN FBXFLG, FBXGO, FBXCON, FBXDST, FBXSTP>
	EXTERN UUOERR
	EXTERN	CPOPJ1, UADCK1
	EXTERN	VBCCHL, VBCCHN, VBCSAV, VBCRET
	EXTERN	PIOFF, PION, PJOBN
	EXTERN	CLOCK, SLEEP
	EXTERN	JBTADR, JBTSTS, JOB

	ENTRY	VBCINT


	DIS==130		;DISPLAY DEVICE NUMBER
	DISCKR==100		;DISPLAY CLOCK REQUEST PENDING
	DISTAR==400		;CLOCK REQUEST SERVICED BEFORE PICTURE FINISHED
	DISTPR==400000		;DISPLAY STOPED, DISIOS NEGATIVE
	DISWAT==2000		;DISPLAY IS WAITING FOR CLOCK REQUEST TO BE SERVICED


DISAV:	Z			;AC STORAGE AT INTERRUPT LEVEL
DISBEG:	Z			;LH=PROTECT AND RELOCATE FOR THE DISPLAY
				;RH=STARTING ADDRESS OF DISPLAY PROGRAM
DISCON:	EXP VBCCHN		;DISPLAY GO WORD FOR CONO INSTRUCTION
DISPRT:	Z			;DISPLAY PROTECTION LIMIT
DISREL:	Z			;RELATIVE DISPLAY RELOCATION AMOUNT
FLAG:	Z			;RELATIVE ERROR FLAG ADDRESS
FLGADR:	Z			;ABSOLUTE ERROR FLAG ADDRESS
PPRT:	POINT 8,DISBEG,8	;BYTE POINTER FOR PROTECTION
PREL:	POINT 8,DISBEG,17	;BYTE POINTER FOR RELOCATION



PENLOC:	Z			;X,Y COORDINATE OF LAST PEN HIT
PENADR:	Z			;PROGRAM ADDRESS WHERE HIT OCCURED
ERRLOC:	Z			; X,Y COORDINATE OF FIRST ERROR REACHED
ERRADR:	Z			; DISPLAY PROGRAM ADDRESS AND ERROR BITS OF ERROR
;DISINI	IS CALLED DURING SYSTEM INITIALIZATION TIME OR AFTER
;	A 140 RESTART.  IT FIRST STOPS THE DISPLAY, PROTECTS AGAINST
;	THE DISPLAY BEING RESTARTED AT CLOCK LEVEL, AND CLEARS
;	THE LITE PEN AND ERROR LOCATIONS.

DISINI:	CONO	DIS,20000	;LOCK DISPLAY OUT OF MEMORY
	MOVEI	T1,1000	;LOOP UNTIL DISPLAY HAS STOPPED
	SOJGE	T1,.		;LOOP...
	CONO	DIS,40		;CLEAR FLAGS
	MOVEI	T1,VBCCHN	;SET UP DISCON
	ADDI	T1,20		;RESUME=20+VBCCHN
	HRRM	T1,DISIN4	;STORE IN DISINT
	ADDI	T1,120		;DISCON=VBCCHN+140
	MOVEM	T1,DISCON	;STORE IT IN DISCON
	JRST	DISIN1


DISRLS:
;DISOFF	IS CALLED WHENEVER A CLOSE OR A RELEASE IS DONE.  THIS ROUTINE
;	ALLOWS THE JOB TO BE SWAPPED OR SHUFFLED, AND CLEARS
;	THE LITE PEN AND ERROR LOCATIONS.

DISOFF:	MOVE	J,JOB	;PICK UP CURRENT JOB #
	PUSHJ	P,DISSTP	;TURN DISPLAY OFF
IFN FTFBX,<	SKIPN FBXCON		;IS FUNCTION BOX ON?
	JRST .+3		;NO,CONTINUE
	PUSHJ P,FBXSTP	;YES,STOP THE BOX
	JRST UUOERR		;PRINT ERROR MESSAGE>

DISIN1:	MOVSI	T1,DISWAT+DISTAR	;IGNOR FURTHER TRAPS BY CLOCK LEVEL
	ANDCAM	T1,DISIOS	;CLEAR DISPLAY WAIT BIT IN DISIOS
DISIN2:	SETOM	PENLOC		;INITIALIZE LITE PEN AREA
	SETZM	PENADR
	SETOM	ERRLOC		;INITIALIZE ERROR AREA
	SETZM	ERRADR
	POPJ	P,		;RETURN
;DISSTP	IS CALLED TO STOP THE DISPLAY.  IT IS CALLED WITH A 
;	PUSHJ	P,DISSTP
;	RETURN HERE AFTER DISPLAY IS STOPPED
;	THE DISPLAY IS STOPPED BY SETTING THE LOCK OUT BIT ON THE DISPLAY
;	THE JOB THEN GOES INTO A WAIT TO INSURE THAT THE DISPLAY HAS
;	COMPLETELY FINISHED

DISSTP:	MOVSI	S,DISTPR	;FLAG THAT DISPLAY IS BEING STOPPED
	IORM	S,DISIOS	;FLAG IT IN DISIOS
	CONO	DIS,20000	;LOCK DISPLAY OUT OF MEMORY
	MOVSI	T1,CLKR	;DOES JOB HAVE CLK REQ IN
	TDNE	T1,JBTSTS(J)	;I.E. IS IT ALREADY SLEEPING?
	POPJ	P,	;YES, DON'T SLEEP IT AGAIN
	MOVEI	T1,^D751		;SET UP FOR SLEEP ROUTINE
	JRST	SLEEP		;SLEEP 4 JIFFIES, RETURN TO CALLER


DISLOK:	MOVSI T1,NSHF!NSWP	;CHECK IF JOB LOCKED
	TDNE T1,JBTSTS(J)
	JRST CPOPJ1		;YES IT IS
	MOVEI	S,IOIMPM	;NO, SET THE IMPROPER MODE BIT
	IORB	S,DISIOS
	POPJ	P,		;GIVE ERROR RETURN
				;USER IS REQUIRED TO LOCK HIS JOB FIRST
;DISINT	RECEIVES CONTROL WHENEVER THE DISPLAY INITIATES AN
;	INTERRUPT ON THE P-10.  IT INTERPRETS THE INTERRUPT AND
;	PERFORMS THE NECESSARY ACTIONS.
;	STOP CONDITION - CHECKS TO SEE IF THE DISPLAY SHOULD BE RESTARTED
;		IF TWO JIFFIES HAVE ELAPSED SINCE THE START OF THE PICTURE
;		THE DISPLAY WILL BE RESTARTED AT THE BEGINING  I.E. THE
;		ADDRESS GIVEN AT THE LAST OUTPUT COMMAND
;	LITE PEN HIT - SAVE THE X AND Y COORDINATES AND THE ADDRESS COUNTER
;	ERROR CONDITION - SAVE THE X AND Y COORDINATES AND ADDRESS COUNTER
;		IF THE ERROR IS NOT AN ILLEGAL ADDRESS, CLEAR THE FLAGS
;		AND RESUME, OTHERWISE JUST DISMISS THE INTERUPT LEAVING
;		THE DISPLAY STOPPED.


PENINT:
VBCINT:
DISINT:	CONSO	DIS,47400	;WAS THIS A DISPLAY INTERRUPT
	JRST	DISINT		;NO, MOVE ON TO NEXT ROUTINE IN CHAIN
	CONI	DIS,DISAV	;PICK UP ERROR BITS
	EXCH	T1,DISAV	;SAVE T1
	TRNE	T1,2000	;LIGHT PEN HIT?
	JRST	LPHIT		;YES
	CONO	DIS,40		;CLEAR FLAGS
	TRNE  	T1,400		;STOP FLAG?
	JRST	STPFLG		;YES
	SKIPL	ERRLOC		;HAS THERE BEEN AN ERROR SINCE THE LAST INPUT
	JRST	DISIN3		;YES, DONT STORE THIS ERROR
	DATAI	DIS,ERRLOC	;GET THE X AND Y COORDINATES
	DATAI	134,ERRADR	;GET THE ADDRESS COUNTER
	SOS	ERRADR		;MAKE IT POINT TO CORRECT LOCATION
	HRLM	T1,ERRADR	;STORE ERROR BITS
DISIN3:	SKIPE	FLAG		;WAS AN ERROR FLAG SPECIFIED
	SETOM	@FLGADR		;YES, SET ERROR FLAG IN USER AREA
	SKIPL	DISIOS		;DISPLAY BEING STOPPED?
	TRNE	T1,45000	;ILLEGAL ADDRESSOR EDGE FLAG
	JRST	DISIN6		;YES, DO NOT RESUME
DISIN4:	CONO	DIS,VBCCHN	;RESUME
DISIN5:	MOVE	T1,DISAV	;RESTORE T1
	JEN	@VBCCHL		;DISMISS THE INTERRUPT

DISIN6:	TRNN	T1,40000	;ILLEGAL ADDR
	JRST	STPFLG		;NO, GO TREAT EDGE FLAG LIKE A STOP FLAG
	CONO	DIS,40		;CLEAR FLAGS
	JRST	DISIN5		;DO NOT RESUME

LPHIT:	DATAI	DIS,PENLOC	;PICK UP X AND Y COORDINATES
	DATAI	134,PENADR	;GET ADDRESS COUNTER
	SOS	PENADR		;DECREMENT ADDRESS COUNTER
	HRRZS	PENADR		;MASK OUT PROTECTION AND RELOCATION BITS
	JRST	DISIN3		;RESUME DISPLAY AND DISMISS INTERRUPT
;STPFLG	IS CALLED WHENEVER A STOP CONDITION IS DETECTED.
;	THE PURPOSE OF THIS ROUTINE IS TO RESTART THE DISPLAY IF THE CLOCK
;	HAS RUN OUT OR TO MARK THAT THE DISPLAY NEEDS TO BE STARTED
;	AS SOON AS THE THE CLOCK REQUEST DOES RUN OUT.  IF THE MONITOR HAS
;	REQUESTED THAT THIS JOB BE SHUFFLED THIS ROUTINE WILL TURN OFF
;	THE NSHF BIT AND GO BACK TO SLEEP, ALLOWING THE JOB TO BE MOVED.


STPFLG:	EXCH	T1,DISAV	;RESTORE T1
	JSR	VBCSAV		;SAVE THE AC'S AND SET UP P
	MOVSI	S,DISWAT	;INDICATE THAT THE DISPLAY IS WAITING
	IORB	S,DISIOS	;PICK UP DISIOS
	TLNE	S,DISTPR	;IS DISPLAY BEING STOPPED?
	JRST	VBCRET		;YES, DO NOT RESTART IT
	TLNE	S,DISTAR	;HAS CLOCK TRIGGERED YET
	PUSHJ	P,DISTR1	;YES, RESTART THE DISPLAY
	JRST	VBCRET		;RESTORE AC'S AND DISMISS THE INTERRUPT

;DISIN	IS CALLED ON AN INPUT UUO.  IT RETURNS TO THE USER
;	THE COORDINATES AND ADDRESS OF THE LAST LIGHT PEN HIT AND
;	THE ADDRESS, COORDINATES AND ERROR BITS OF THE FIRST ERROR
;	ENCOUNTERED SINCE THE LAST INPUT COMMAND.
;	THE USER COMMAND IS AS FOLLOWS:
;		INPUT	D,ADDRESS
;	THE SERVICE ROUTINE RETURNS THE FOLLOWING INFORMATION IN ADDRESS
;		ADDRESS/	XWD X,Y  OF LAST LITE PEN HIT
;		ADDRESS+1/	ADDRESS COUNTER
;		ADDRESS+2/	XWD X,Y  OF FIRST ERROR SINCE LAST INPUT
;		ADDRESS+3/	XWD ERROR BITS,ADDRESS COUNTER


DISIN:	SOS	M		;PUTWD1 WILL INCREMENT M
	MOVE	T2,[XWD -4,PENLOC]
	MOVE	T1,(T2)		;GET ADR OF NEXT DATA WORD TO BE STORED
	PUSHJ	P,PUTWD1##	;STORE WORD IN USER'S AREA
	AOBJN	T2,.-2		;LOOP FOR ALL 4 ARGUMENTS
	JRST	DISIN2		;INITIALIZE THE INPUT AREA AND RETURN

;DISOUT	IS CALLED WHEN AN OUTPUT COMMAND IS EXECUTED.  IT SETS
;	UP THE PROTECTION AND RELOCATION REGISTER AND STARTS THE
;	DISPLAY AT THE SPECIFIED ADDRESS
;	IT ALSO SETS UP THE ADDRESS OF THE ERROR FLAG IN THE USER AREA
;	THE FORMAT OF THE CALL IS THE FOLLOWING:
;		OUTPUT	D,ADDRESS
;	WHERE,
;		ADDRESS/	XWD FLAG ADDRESS, DISPLAY STARTING ADDRESS
;		ADDRESS+1/	XWD PROTECTION, RELOCATION (RELATIVE)


DISOUT:	MOVE	J,JOB		;PICK UP JOB NUMBER
	PUSHJ	P,DISSTP	;STOP DISPLAY
	PUSHJ	P,GETWDU##	;GET FIRST ARGUMENT
	HRRM	T1,DISBEG	;STORE STARTING ADDRESS
	HLRZS	T1		;GET FLAG ADDRESS
	SKIPE	T1		;IF ZERO THEN NO FLAG ADDRESS
	PUSHJ	P,UADRCK##	;CHECK THE FLAG ADDRESS
	MOVEM	T1,FLGADR	;STORE ADDRESS OF FLAG
	MOVEM	T1,FLAG		;SAVE RELATIVE ADDRESS OF FLAG
	PUSHJ	P,GETWD1##	;GET SECOND ARGUMENT
	SKIPN	T1		;ZERO?
DISOU1:	HLLZ	T1,R	;SUBSTITUTE JOBS PROTECTION AND RELOCATION
	HLRZM	T1,DISPRT	;SAVE PROTECTION
	HRRZM	T1,DISREL	;SAVE RELOCATION
	HLRZ	T1,R	;GET JOBS PROTECTION
	SUB	T1,DISREL	;SUBTRACT RELATIVE RELOCATION
	SUB	T1,DISPRT	;SUBTRACT PROTECTION
	JUMPL	T1,DISOU1	;IF NOT, USE JOB'S PROTECTION AND RELOCATION
	HRRZ	T1,R	;PICK UP JOB'S RELOCATION
	ADDM	T1,FLGADR	;RELOCATE FLAG ADDRESS
	ADD	T1,DISREL	;DISREL HAS RELATIVE RELOCATION OF JOB
	ASH	T1,-12		;SHIFT OUT LOW ORDER 10 BITS
	DPB	T1,PREL	;DEPOSIT RELOCATION BYTE
	MOVE	T1,DISPRT	;GET PROTECTION
	ASH	T1,-12		;SHIFT OUT LOW ORDER 10 BITS
	DPB	T1,PPRT	;DEPOSIT PROTECTION BYTE

DISTRT:	PUSHJ	P,DISLOK	;GO SEE IF USER IS LOCKED IN CORE
	JRST	DISRLS		;NOT LOCKED, GO RELEASE DEVICE
DISTR1:	MOVSI	S,DISTAR+DISWAT+DISTPR	;INDICATE FRESH PICTURE
	ANDCAM	S,DISIOS	;IN DISIOS WORD
	CONO	DIS,20140
	CONO	DIS,20040
	DATAO	134,DISBEG	;LOAD PROT, RELOC, AND STARTING ADDRESS
	CONO	DIS,@DISCON	;START THE DISPLAY
;CLKREQ	IS CALLED TO PUT A TWO JIFFY WAIT REQUEST IN THE
;	CLOCK QUEUE.  IF THERE IS ALREADY ONE THERE IT JUST RETURNS


CLKREQ:	CONO	PI,PION		;CAN ARRIVE HERE WITH PI OFF
	MOVSI	S,DISCKR	;CHECK FOR PREVIOUS REQUEST
	MOVE	T1,CLOKRT	;PICK UP CLOCK RQUEST WORD
	CONO	PI,PIOFF	;INHIBIT INTERRUPTS
	TDOE	S,DISIOS	;ENTER ONLY A SINGLE CLOCK REQUEST
	JRST	CLKRQ1
	IDPB	T1,CLOCK	;PLACE REQUEST IN QUEUE
	IBP	CLOCK		;2 WORDS/ENTRY
CLKRQ1:	IORM	S,DISIOS	;PROTECT AGAINST DUPLICATE REQUEST
	CONO	PI,PION		;UNINHIBIT INTERRUPTS
	POPJ	P,		;RETURN

CLOKRT:	XWD	CLOK,1		;CONTROL FOR CLOCK QUEUE, 1 JIFFY


;CLOK	IS ENTERED AT CLOCK LEVEL IN RESPONSE TO A CLOCK REQUEST IN THE
;	CLOCK QUEUE.  A BIT IS SET TO INDICATE THAT THE CLOCK PERIOD HAS
;	ELAPSED.  IF THE DISPLAY IS STILL IN PROGRESS CLOK DOES NOTHING
;	OTHERWISE IT RESTARTS THE JOB




CLOK:	MOVSI S,DISCKR	;INDICATE CLOK REQ SERVICED
	ANDCAB S,DISIOS	;AND SET UP S
	TLNE S,DISTPR		;TRYING TO STOP DIS (RELEASE?)
	POPJ P,		;YES,EXIT
	MOVSI	S,DISTAR	;MARK THAT DISPLAY IS READY
	CONO	PI,PIOFF	;TURN OFF PI SYSTEM FOR CHECK
	IORM	S,DISIOS	;  TO BE RESTARTED
	MOVSI	S,DISWAT	;IS DISPLAY WAITING ALREADY
	TDNN	S,DISIOS	;  TO BE RESTARTED?
	JRST	CLKREQ		;NO, JUST PUT IN A CLOCK REQUEST
	CONO	PI,PION		;TURN INTERUPTS BACK ON
	JRST	DISTR1		;YES, GO RESTART IT
	END