Google
 

Trailing-Edge - PDP-10 Archives - AP-D483B-SB_1978 - cspqsr.mac
There are 5 other files named cspqsr.mac in the archive. Click here to see a list.
TITLE	CSPQSR  --  Known Component Interface for QUASAR
SUBTTL	Chuck O'Toole - Larry Samberg  7 Nov 76

;***Copyright (C) 1974, 1975, 1976, 1977, Digital Equipment Corp., Maynard, MA.***

	SEARCH	QSRMAC		;GET QUASAR SYMBOLS

	PROLOGUE(CSPQSR)	;GENERATE THE NECESSARY SYMBOLS

OPDEF	COMPT.	[047000,,147]	;COMPT. UUO -- CALLI 147

IFN FTUUOS,<
OPDEF	PSOUT	[OUTSTR 0(S1)]	;TOPS10 STRING TO PRIMARY OUTPUT
OPDEF	HALTF	[MONRT.]	;RETURN TO THE MONITOR
>  ;END OF IFN FTUUOS


;THIS MODULE HAS BEEN DEVELOPED TO AID IN THE CONVERSION OF BATCON AND LPTSPL,
;	AND IN THE DEVELOPMENT OF SPROUT-10.  ALTHOUGH THIS MODULE PERFORMS THE
;	FUNCTIONS REQUIRED BY THOSE PROGRAMS, IT IS NOT INTENDED TO BE
;	A COMPLETELY GENERAL IPCF OR PROGRAM-QUASAR INTERFACE.


;AC USAGE IN THIS MODULE
;	ALL ROUTINES MAY DESTROY S1, S2, & TEMP AS WELL AS ANY AC'S
;	EXPECTED TO CONTAIN ARGUMENTS (T1, T2, ...)

;EXCEPTION: INITIALIZATION (CSPINI) HAS FULL USE OF ALL THE REGISTERS
SUBTTL	CSPINI  --  CUSP Initialization

;CSPINI SHOULD BE CALLED BY THE CUSP UPON PROGRAM INITIALIZATION.
;IF AT THE CALL, S1 = 0, THEN CSPQSR WILL HANDLE THE INTERRUPT SYSTEM
;	IF S1 = -1, THEN THE CALLER WILL TAKE THE RESPONSIBILITY
;RETURNS S1 = THE PID ACQUIRED FOR THE CALLER
;	 S2 = THE ADDRESS OF THE IPCF INTERRUPT FLAG (AN INTERRESTING LOCATION)

IFN FTUUOS,<

CSPINI:: MOVEM	S1,INTWRD	;SAVE FLAG WORD
	MOVX	S1,%CNST2	;SECOND STATES WORD
	GETTAB	S1,		;FIND OUT IF THERE IS GALAXY-10 SUPPORT
	  ZERO	S1		;WHAT!!!
	TXNN	S1,ST%GAL	;IS THERE ?
	  JRST	NOGALX		;NO GALAXY-10 SUPPORT (WHY ARE YOU RUNNING THIS)
	SKIPE	INTWRD		;CALLER WANT TO DO THIS
	  JRST	CSPI.0		;YES, SKIP THE WORK
	MOVEI	S1,INTBLK	;VECTOR BASE FOR PI SYSTEM
	PIINI.	S1,		;INIT THE PI SYSTEM
	  JRST	NOCINT		;WHAT !!
	ZERO	INTBLK		;CLEAR THE VECTORS
	MOVE	S1,[INTBLK,,INTBLK+1]
	BLT	S1,CUROFS	;GET THEM ALL AND THE CURRENT OFFSET
	MOVX	T1,.PCIPC	;WANT IPCF INTERRUPTS
	ZERO	T2		;NOT AN I/O CONDITION
	MOVEI	T3,CSPINT	;WHERE TO GO ON THE INTERRUPT
	PUSHJ	P,CSPPSI	;ADD THE CONDITION
	MOVX	S1,PS.FON	;FLAGS
	PISYS.	S1,		;TURN ON THE INTERRUPT SYSTEM
	  JRST	NOCINT		;WHAT !!
CSPI.0:	MOVX	S1,%IPCML	;GET SMALL MESSAGE SIZE
	GETTAB	S1,		;FROM THE MONITOR
	  JRST	NOIPCG		;NO IPCF GETTABS
	CAILE	S1,MSGLEN	;DO I HAVE ROOM
	  JRST	NOTENF		;NO, GIVE AN ERROR
	MOVEM	S1,MINMSG	;LARGEST MESSAGE SEND VIA SHORT FORM
	MOVX	S2,<HB.RTL!1>	;GET SOME BITS
CSPI.1:	MOVX	S1,%SIQSR	;GET GETTAB FOR QUASAR'S PID
	GETTAB	S1,		;GET IT
	  JRST	NOQSRG		;NO QUASAR GETTAB
	MOVEM	S1,QSRPID	;SAVE IT
	JUMPN	S1,CSPI.2	;JUMP IF WE REALLY GOT IT
	SKIPE	S2		;HIBERNATE BITS SET
	 HIBER	S2,		;THIS IS FOR OPSER
	  JFCL			;OH WELL!!!
	SETZ	S2,		;DO THAT ONLY ONCE
	MOVEI	S1,^D3		;ELSE, LOAD A SLEEP TIME
	SLEEP	S1,		;AND SLEEP
	JRST	CSPI.1		;AND LOOP
CSPI.2:	PUSHJ	P,M$INIT##	;INITIALIZE THE MEMORY MANAGER
	SETOM	QRYFLG		;FORCE AT LEAST 1 QUERRY

;INITIALIZATION IS CONTINUED ON THE NEXT PAGE AND STILL UNDER FTUUOS
;;;CONTINUED FROM THE PREVIOUS PAGE

	ZERO	MYPID			;CLEAR ANY OLD PID
	MOVE	T1,[CSPINI,,.IPCSC]	;GET CODE WORD
	MOVEM	T1,SNDBLK		;STORE
	PJOB	T1,			;NEED MY JOB NUMBER
	TXO	T1,1B0			;KEEP PID TILL RESET
	MOVEM	T1,SNDBLK+1		;INTO THE MESSAGE
	SETZM	SNDBLK+2		;THIS WILL BE THE ANSWER
	MOVE	T4,[3,,SNDBLK]		;LENGTH,,ADDR
	MOVX	T1,IP.CFP		;INVOKE PRIVS
	SETZ	T2,			;DON'T HAVE A PID YET
	MOVX	T3,%SIIPC		;FIND PID OF SYSTEM IPCC
	GETTAB	T3,			;FROM THE SYSTEM PID TABLE
	  JRST	NOIPCG			;NO IPCF GETTABS
	MOVE	S1,[4,,T1]		;ANOTHER FOR SEND
	IPCFS.	S1,			;SEND TO [SYSTEM]IPCC
	 SKIPA				;FAILED, SEE WHY
	  JRST	CSPI.3			;OK, GO GET THE ANSWER
	CAIE	S1,IPCPI%		;IS IT NO PRIVS
	  JRST	NOSINF			;CANNOT SEND TO SYSTEM IPCC
	JRST	NOGPID			;YES, GIVE A DIFFERENT ERROR
CSPI.3:	MOVX	S1,<HB.IPC+^D1000>	;ENABLE FOR IPC WAKEUP
	HIBER	S1,			;AND SLEEP FOREVER
	  JFCL				;OR TRY TO
	PUSHJ	P,DORECV		;GET A PACKET
	JUMPE	S1,CSPI.3		;NOTHING, TRY AGAIN
	MOVE	S1,RCVBLK+.IPCFL	;GET FLAG WORD
	TXNN	S1,IP.CFC		;A SYSTEM MESSAGE?
	  JRST	CSPI.4			;NO, IGNORE IT
	TXNE	S1,IP.CFE		;YES, AN ERROR?
	  JRST	NOGPID			;CANNOT GET A PID
	MOVE	S1,RCVSMS		;GET SYSTEM CODE WORD
	CAME	S1,[CSPINI,,.IPCSC]	;SAME AS SENT
	  JRST	CSPI.3			;NO, WAIT FOR MY RESPONSE
	MOVE	S1,RCVSMS+2		;YES, GET MY PID
	MOVEM	S1,MYPID		;SAVE IT
	JRST	CSPXIT			;RETURN VALUES
CSPI.4:	TXNN	S1,IP.CFV		;A PAGE RECEIVE
	  JRST	CSPI.3			;NO, IGNORE JUNK MESSAGE
	PUSH	P,AP			;SAVE CALLERS AP
	HRRZ	AP,RCVBLK+.IPCFP	;GET THE PAGE NUMBER
	PUSHJ	P,M$RELP##		;DON'T NEED TO CLUTTER OUR SPACE
	POP	P,AP			;RESTORE
	JRST	CSPI.3			;GET ANOTHER

>  ;END OF IFN FTUUOS FROM SEVERAL PAGES AGO


;;;THE TOPS20 COUNTERPART OF THIS ROUTINE IS ON THE NEXT PAGE
;;; INITIALIZATION CONTINUED FROM THE PREVIOUS PAGE (OR 2 PAGES AGO)

IFN FTJSYS,<

CSPINI:: MOVEM	S1,INTWRD	;SAVE CALLERS INDICATOR
	MOVEI	S1,2		;TWO WORDS
	MOVEI	S2,T1		;USE T1 AND T2
	MOVEI	T1,.MUMPS	;FIND MAXIMUM PACKET SIZE
	MUTIL			;EXECUTE THE UTILITY
	  JRST	NOIPCG		;NO IPCF INFORMATION
	CAILE	T2,MSGLEN	;DO I HAVE ENOUGH ROOM
	  JRST	NOTENF		;NO, GIVE AN ERROR
	MOVEM	T2,MINMSG	;SAVE THE SIZE
CSPI.1:	MOVEI	S1,3		;THREE WORDS
	MOVEI	S2,T1		;USE T1-T3
	MOVEI	T1,.MURSP	;READ SYSTEM PID TABLE
	MOVX	T2,.SPQSR	;PID OF SYSTEM QUASAR
	MUTIL			;EXECUTE THE UTILITY
	  PUSHJ	P,[CAIE S1,IPCF27 ;TABLE CONTAIN AN INVALID PID
		     JRST NOQSRG  ;NO, GIVE UP
		   SETZ T3,	  ;WAIT FOR IT TO BECOME VALID
		   POPJ P,]	  ;RETURN TO MAIN LINE CODE
	MOVEM	T3,QSRPID	;SAVE QUASAR'S PID
	JUMPN	T3,CSPI.2	;DID WE REALLY GET IT
	MOVEI	S1,^D3000	;NO, WAIT FOR QUASAR TO GET STARTED
	DISMS			;TAKE A NAP
	JRST	CSPI.1		;AND LOOK AGAIN


;;;CODE IS CONTINUED ON THE NEXT PAGE AND STILL UNDEF FTJSYS CONDITIONAL
;;;CONTINUED FROM THE PREVIOUS PAGE

CSPI.2:	PUSHJ	P,M$INIT##	;INITIALIZE THE MEMORY MANAGER
	SETOM	QRYFLG		;FORCE AT LEAST 1 QUERRY
	MOVEI	S1,3		;THREE WORDS
	MOVEI	S2,T1		;USE T1-T3 AGAIN
	MOVEI	T1,.MUCRE	;CREATE A PID
	MOVX	T2,.FHSLF	;FOR THIS FORK
	MUTIL			;EXECUTE IT
	  JRST	NOGPID		;CANNOT GET A PID
	MOVEM	T3,MYPID	;SAVE FOR LATER SENDS
	SKIPE	INTWRD		;CALLER WANT CONTROL
	  JRST	CSPXIT		;YES, JUST RETURN VALUES NOW
	MOVEI	S1,377777	;LARGEST LOW SEG ADDRESS
	CORE	S1,		;FAKE OUT THE COMPATABILITY PACKAGE
	  JFCL			;WILL BOMB OUT LATER

>  ;END OF IFN FTJSYS

CSPXIT:	MOVE	S1,MYPID	;GET THE PID OF THIS JOB
	MOVEI	S2,QRYFLG	;ADDRESS OF INTERRUPT FLAG
	POPJ	P,		;AND RETURN
SUBTTL	CSPINT  --  IPCF Interrupt Routine

IFN FTUUOS,<

CSPINT:	SETOM	QRYFLG		;MUST DO A QUERRY
	DEBRK.			;DISMISS THE INTERRUPT
	  HALT	.		;WHAT !!
	  HALT	.		;WHAT AGAIN !!

>  ;END OF IFN FTUUOS
SUBTTL	CSPQRY  --  QUERRY THE RECEIVE QUEUE

IFN FTUUOS,<

CSPQRY:: ZERO	S1		;CLEAR MESSAGE AVAILABLE
	EXCH	S1,QRYFLG	;CLEAR THAT, SHOULD I DO A QUERRY
	PJUMPE	S1,.POPJ##	;NO, AN INTERRUPT DID NOT OCCUR
	ZERO	QRYBLK+.IPCFL	;BEGIN TO CLEAR THE BLOCK
	ZERO	QRYBLK+.IPCFS	;SENDERS PID
	ZERO	QRYBLK+.IPCFR	;RECEIVERS PID
	ZERO	QRYBLK+.IPCFP	;POINTERS
	MOVE	S1,[4,,QRYBLK]	;ARGUMENT FOR UUO
	IPCFQ.	S1,		;DO THE QUERRY
	  PJRST	.FALSE##	;RETURN S1 = 0
	HLL	S1,QRYBLK+.IPCFP  ;GET THE LENGTH
	HRR	S1,QRYBLK+.IPCFL  ;AND FLAGS
	SKIPE	S1		;A MESSAGE THERE
	  SETOM	QRYFLG		;YES, LOOK FOR ANOTHER ONE NEXT TIME
	POPJ	P,		;AND RETURN

>  ;END OF IFN FTUUOS

IFN FTJSYS,<

CSPQRY:: ZERO	S1		;CLEAR MESSAGE AVAILABLE
	EXCH	S1,QRYFLG	;CLEAR THAT, SHOULD I DO A QUERRY
	PJUMPE	S1,.POPJ##	;NO, AN INTERRUPT DID NOT OCCUR
	MOVE	S1,MYPID	;NEED MY PID FOR QUERRY
	MOVEM	S1,IPCQRY+1	;STORE INTO BLOCK
	MOVEI	S1,5		;NUMBER OF WORDS
	MOVEI	S2,IPCQRY	;INTO PRESET BLOCK
	MUTIL			;DO THE QUERRY
	  JRST	[SKIPN INTWRD	;CALLER HANDLING INTERRUPTS
		 SETOM QRYFLG	;NO, FORCE ANOTHER LOOK LATER
		 PJRST .FALSE##] ;RETURN S1 = 0
	HLL	S1,QRYBLK+.IPCFP  ;GET LENGTH
	HRR	S1,QRYBLK+.IPCFL  ;AND FLAGS
	SKIPE	INTWRD		;CALLER HANDLING INTERRUPTS
	 SKIPE	S1		;YES, A MESSAGE THERE
	  SETOM	QRYFLG		;YES, LOOK FOR ANOTHER ONE NEXT TIME
	POPJ	P,		;RETURN

>  ;END OF IFN FTJSYS
SUBTTL	SNDQSR  --  SEND A MESSAGE TO QUASAR

;	CALLED WITH T1 POINTING TO A MESSAGE FOR QUASAR

SNDQSR:: MOVEM	T1,SNDBLK+.IPCFP  ;STORE ADDRESS OF MESSAGE
	LOAD	T1,.MSTYP(T1),MS.CNT  ;GET THE LENGTH
	CAMLE	T1,MINMSG	;A SHORT MESSAGE
	  JRST	SNDPAG		;NO, MUST PAGE MODE IT
	ZERO	SNDBLK+.IPCFL	;CLEAR THE FLAGS
SNDQ.1:	HRLM	T1,SNDBLK+.IPCFP  ;STORE THE COUNT
	MOVE	T1,MYPID	;NEED TO SPECIFY PID
	MOVEM	T1,SNDBLK+.IPCFS  ;STORE
	MOVE	T1,QSRPID	;GET PID OF [SYSETM]QUASAR
	MOVEM	T1,SNDBLK+.IPCFR  ;AS THE RECEIVER

SNDQ.2:

IFN FTUUOS,<
	MOVE	S1,[4,,SNDBLK]	;UUO ARGUMENT
	IPCFS.	S1,		;SEND THE MESSAGE
	  JRST	FAILED		;EXAMINE THE ERROR CODE
	POPJ	P,		;RETURN AFTER SUCCESSFUL SEND

RETRY:	MOVEI	T1,2		;WAIT BEFORE ANOTHER TRY
	SLEEP	T1,		;TAKE A QUICK NAP
	JRST	SNDQ.2		;TRY IT NOW

>  ;END OF IFN FTUUOS

IFN FTJSYS,<
	MOVEI	S1,4		;NUMBER OF WORDS
	MOVEI	S2,SNDBLK	;IN THE BLOCK
	MSEND			;SEND IT
	  JRST	FAILED		;EXAMINE THE ERROR CODE
	POPJ	P,		;RETURN AFTER SUCCESSFUL SEND

RETRY:	MOVEI	S1,^D2000	;TAKE A 2 SECOND NAP
	DISMS			;WAIT
	JRST	SNDQ.2		;NOW TRY IT

>  ;END OF IFN FTJSYS

FAILED:	CAIE	S1,IPE.SQ	;MY SEND QUOTA EXHAUSTED
	 CAIN	S1,IPE.RQ	;OR QUASAR RECEIVE QUOTA EXHAUSTED
	  JRST	RETRY		;YES, RETRY THE SEND
	CAIE	S1,IPE.SF	;SYSTEM FREE SPACE EXHAUSTED
	 CAIN	S1,IPE.DD	;RECEIVER DISABLED
	  JRST	RETRY		;CAN RETRY THESE TOO
	HRROI	S1,[ASCIZ/SQF Send to [SYSTEM]QUASAR failed/]
	JRST	FAILUR		;INDICATE FAILURE AND DIE
; HERE WHEN THE MESSAGE TO SEND SHOULD BE PAGED

SNDPAG:	CAILE	T1,1000		;FIRST CHECK PAGE SIZE
	  JRST	SIZERR		;ILLEGAL SIZE
	SAVE	AP		;SAVE CALLERS AP
	PUSHJ	P,M$ACQP##	;GET A PAGE FOR THE SEND
	HRL	S1,SNDBLK+.IPCFP  ;WHERE MESSAGE IS
	MOVEM	AP,SNDBLK+.IPCFP  ;FROM LOCATION IN THE PAGE
	PG2ADR	AP		;MAKE AN ADDRESS
	HRRI	S1,(AP)		;MAKE A COPY
	MOVEI	S2,(AP)		;MAKE 2
	ADDI	S2,-1(T1)	;S1 = BLT OF ORIGINAL, S2 = LAST LOC
	BLT	S1,(S2)		;COPY THE MESSAGE
	MOVX	T1,IP.CFV	;PAGE MODE BIT
	MOVEM	T1,SNDBLK+.IPCFL  ;SET THE FLAG
	ADR2PG	AP		;BACK TO A PAGE NUMBER
	PUSH	P,AP		;SAVE IT
	PUSHJ	P,M$IPSN##	;ABOUT TO SEND A PAGE
	MOVEI	T1,1000		;LENGTH OF A PAGE MODE SEND
	PUSHJ	P,SNDQ.1	;REENTER SNDQSR
	POP	P,AP		;RESTORE THE PAGE NUMBER
	PJRST	M$RELP##	;THAT PAGE IS NOW GONE
SUBTTL	CSPRCV  --  RECEIVE A MESSAGE FROM THE QUEUE

;RETURNS S1 = THE ADDRESS OF THE RECEIVED MESSAGE OR 0 IF NONE
;		(1B0 IN S1 IS ON IF THE MESSAGE WAS PAGED)

CSPRCV:: PUSHJ	P,DORECV		;ACTUALLY DO THE RECEIVE OVER THERE
	JUMPE	S1,.POPJ##		;NOTHING THERE
	MOVE	S2,RCVBLK+.IPCFS	;GET THE SENDERS PID
	CAME	S2,QSRPID		;WAS IT QUASAR
	  SETZM	.MSTYP(S1)		;NO, MAKE IT LOOK INVALID TO GET IGNORED
	LOAD	S2,.MSTYP(S1),MS.TYP	;CHECK TYPE OF MESSAGE
	CAIE	S2,.QOTEX		;MESSAGE FROM QUASAR
	  POPJ	P,			;NO, RETURN
	MOVX	S2,TX.NMS		;IS THERE A MESSAGE ASSOCIATED
	TDNE	S2,TEX.ST(S1)		;IF NOT, THEN JUST QUASAR KEEPING TABS
	  POPJ	P,			;ON EVERYONE
	MOVE	S2,S1			;SAVE ADDRESS
	HRROI	S1,[ASCIZ/%CTQMFQ Message From QUASAR - /]
	PSOUT				;ANNOUNCE THE MESSAGE
	HRROI	S1,TEX.MS(S2)		;THE MESSAGE PROPER
	PSOUT				;OUTPUT THAT
	HRROI	S1,[BYTE (7).CHCRT,.CHLFD,0]
	PSOUT				;END THE LINE
	MOVE	S1,S2			;RESTORE THE POINTER
	POPJ	P,			;RETURN TO CALLER
DORECV:	PUSHJ	P,CSPQRY		;GET DESCRIPTION OF TOP ITEM
	PJUMPE	S1,.POPJ##		;NOTHING THERE, RETURN
	TXNE	S1,IP.CFV		;A PAGE MODE MESSAGE
	  JRST	RCVPAG			;YES, RECEIVE IT
	MOVX	S2,IP.TTL		;GET TRUNCATE BIT
	MOVEM	S2,RCVBLK+.IPCFL	;AND STORE IT
	HRRI	S1,RCVSMS		;WHERE SHORT MESSAGES GO
CSPR.1:	MOVEM	S1,RCVBLK+.IPCFP	;STORE LENGTH,, ADDR
	ZERO	RCVBLK+.IPCFS		;CLEAR SENDERS FIELD
	MOVE	S1,MYPID		;GET MY PID FOR RECEIVE
	MOVEM	S1,RCVBLK+.IPCFR	;STORE IT

IFN FTUUOS,<
CSPR.2:	MOVE	S1,[4,,RCVBLK]		;UUO ARGUMENT
	IPCFR.	S1,			;DO THE RECEIVE
	  JRST	[CAIE S1,IPCUP%		;FAILED BECAUSE OF SPACE PROBLEMS
		   JRST NOIPCR		;NO, REPORT FAILURE
		 PUSHJ P,M$IPRM##	;ASK CSPMEM TO MAKE ROOM FOR THE MESSAGE
		 JRST CSPR.2]		;RETRY THE RECEIVE NOW
	MOVEI	S1,RCVSMS		;POINT TO THE SHORT MESSAGE
	POPJ	P,			;AND RETURN
>  ;END OF IFN FTUUOS

IFN FTJSYS,<
	MOVEI	S1,4			;NUMBER OF WORDS
	MOVEI	S2,RCVBLK		;AT THE BLOCK
	MRECV				;DO THE RECEIVE
	  JRST	NOIPCR			;CANNOT DO THE RECEIVE
	MOVEI	S1,RCVSMS		;POINT TO THE SHORT MESSAGE
	POPJ	P,			;AND RETURN
>  ;END OF IFN FTJSYS

RCVPAG:	MOVX	S1,IP.CFV		;THE PAGE MODE BIT
	MOVEM	S1,RCVBLK+.IPCFL	;SET THE FLAG
	SAVE	AP			;SAVE CALLERS AP
	PUSHJ	P,M$NXPG##		;GET A PAGE TO RECEIVE INTO
	JUMPE	AP,NOMEML		;NO MEMORY LEFT
	MOVE	S1,AP			;COPY IT
	HRLI	S1,1000			;LENGTH OF A PAGE RECEIVE
	PUSHJ	P,CSPR.1		;RECURSE A LITTLE
	HRRZ	AP,RCVBLK+.IPCFP	;GET THE PAGE NUMBER AGAIN
	PUSHJ	P,M$IPRC##		;NOTIFY THAT IT IS IN NOW
	HRRZ	S1,RCVBLK+.IPCFP	;GET IT AGAIN
	PG2ADR	S1			;CONVERT TO ADDRESS
	TXO	S1,1B0			;INDICATE THAT IT WAS A PAGED REQUEST
	POPJ	P,			;RETURN WITH POINTER TO MESSAGE
SUBTTL	CSPPSI  --  Add Software Interrupt Conditions

; CALLED WITH:
;	T1 = CONDITION WANTED
;	T2 = I/O REASON
;	T3 = ADDRESS OF INTERRUPT ROUTINE
; RETURNS:
;	T1 = THE ADDRESS OF THE 4 WORD INTERRUPT BLOCK

IFN FTUUOS,<

CSPPSI:: SKIPE	INTWRD		;CALLER HANDLING THE INTERRUPT SYSTEM
	  JRST	ILLPSI		;YES, THEN THIS IS A BAD REQUEST
 	MOVEM	T1,CSPSET	;STORE CONDITION
	HRRM	T2,CSPSET+1	;STORE I/O REASON
	ZERO	CSPSET+2	;CLEAR THE RESERVED WORD
	MOVE	T1,CUROFS	;NOW COMPUTE THE OFFSET INTO THE BASE
	HRLM	T1,CSPSET+1	;EASY, BUT NOW SET FOR NEXT CALL
	ADDI	T1,4		;BLOCK LENGTH
	MOVEM	T1,CUROFS	;FOR THE NEXT TIME
	ADDI	T1,INTBLK-4	;FIND ADDRESS FOR THE CALLER
	CAIL	T1,CUROFS	;OFF THE END OF THE VECTOR
	  JRST	TOMINY		;YES, TOO MANY CONDITIONS
	MOVEM	T3,(T1)		;SET UP NEW PC FOR THE INTERRUPT
	MOVE	T2,[PS.FAC+CSPSET]
	PISYS.	T2,		;ADD THE NEW CONDITION
	  JRST	NOCINT		;WHAT !!
	POPJ	P,		;RETURN WITH T1 = BLOCK ADDRESS

CSPSET:	BLOCK	3		;FOR PISYS. UUO

>  ;END OF IFN FTUUOS

IFN FTJSYS,<

CSPPSI:: SKIPE	INTWRD		;CALLER HANDLING THE INTERRUPT SYSTEM
	  JRST	ILLPSI		;YES, THEN THIS IS A BAD REQUEST
	ZERO	T1		;RETURN NO ADDRESS
	POPJ	P,		;NOT IMPLEMENTED

>  ;END OF IFN FTJSYS
SUBTTL	Failure Reporting

IFN FTUUOS,<		;TOPS10 ONLY ERRORS

NOSINF:	HRROI	S1,[ASCIZ/SIF Send to [SYSTEM]IPCC failed/]
	JRST	FAILUR		;REPORT THE FAILURE
NOGALX:	HRROI	S1,[ASCIZ/NGS No GALAXY-10 Support in this monitor/]
	JRST	FAILUR		;REPORT THE FAILURE
TOMINY:	HRROI	S1,[ASCIZ/TMC Too Many Conditions Requested/]
	JRST	FAILUR		;REPORT THE FAILURE
NOCINT:	HRROI	S1,[ASCIZ/FCI Failure to Connect to the Interrupt System/]
	JRST	FAILUR		;REPORT THE FAILURE

>  ;END OF IFN FTUUOS

SIZERR:	HRROI	S1,[ASCIZ/ILS Illegal Length Specified/]
	JRST	FAILUR		;REPORT THE FAILURE
ILLPSI:	HRROI	S1,[ASCIZ/ICC Illegal Call to CSPPSI/]
	JRST	FAILUR		;REPORT THE FAILURE
NOTENF:	HRROI	S1,[ASCIZ/NER Not Enough Room for possible messages/]
	JRST	FAILUR		;REPORT THE FAILURE
NOIPCG:	HRROI	S1,[ASCIZ/CGI Cannot Get IPCF data/]
	JRST	FAILUR		;REPORT THE FAILURE
NOQSRG:	HRROI	S1,[ASCIZ/CDQ Cannot Determine PID of [SYSTEM]QUASAR/]
	JRST	FAILUR		;REPORT THE FAILURE
NOMEML:	HRROI	S1,[ASCIZ/ASE Addressing Space Exhausted/]
	JRST	FAILUR		;REPORT THE FAILURE
NOGPID:	HRROI	S1,[ASCIZ/CAP Cannot Acquire a PID/]
	JRST	FAILUR		;REPORT THE FAILURE
NOIPCR:	HRROI	S1,[ASCIZ/IRF IPCF Receive Failure/]
	JRST	FAILUR		;REPORT THE FAILURE

FAILUR:	PUSH	P,S1		;SAVE ADDR OF MESSAGE
	HRROI	S1,[ASCIZ/?CTQ/]
	PSOUT			;OUTPUT THE ?CTQ HEADING
	POP	P,S1		;RESTORE
	PSOUT			;OUTPUT THE REAL ERROR MESSAGE
	HALTF			;AND RETURN TO THE MONITOR
	JRST	.-1		;NOT CONTINUABLE
SUBTTL	Storage and Things

	XLIST			;FORCED OUT LITERALS HERE
	LIT
	VAR
	LIST
	SALL			;CLEAN UP THE LISTING AGAIN


INTWRD:	BLOCK	1		;FLAG SET BY CALLER FOR WHO USES INTERRUPT SYSTEM
QRYFLG:	BLOCK	1		;FLAG INDICATING A QUERRY IS NECESSARY
MINMSG:	BLOCK	1		;LARGEST "SHORT" MESSAGE
QSRPID:	BLOCK	1		;PID OF [SYSTEM]QUASAR
MYPID:	BLOCK	1		;MY PID

;;;DON'T MOVE OR REARRANGE THE FOLLOWING

IFN FTUUOS,<
INTBLK:				;BASE ADDRESS OF INTERRUPT VECTORS
	BLOCK	^D10*^D4	;RESERVE SPACE FOR 10 PSI CONDITIONS
CUROFS:	BLOCK	1		;OFFSET INTO INTBLK FOR THE NEXT TO ADD
>  ;END OF IFN FTUUOS
IFN FTJSYS,<
IPCQRY:	EXP	.MUQRY		;FUNCTION QUERRY
>  ;END OF IFN FTJSYS
QRYBLK:
SNDBLK:
RCVBLK:	BLOCK	4		;HEADER
RCVSMS:	BLOCK	^D40		;ROOM FOR "SHORT" MESSAGE
MSGLEN==.-RCVSMS		;SYMBOLIZE THE SPACE RESERVED

;;; END OF SPECIAL ORDER

	END