Google
 

Trailing-Edge - PDP-10 Archives - AP-4172F-BM - 3a-sources/qsrt20.mac
There are 36 other files named qsrt20.mac in the archive. Click here to see a list.
TITLE	QSRT20  --  Operating System Interface for QUASAR-20
SUBTTL	Larry Samberg   Chuck O'Toole /CER  13 Nov 77




;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1974, 1975, 1976, 1977, 1978 BY
;	DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

	SEARCH	QSRMAC		;PARAMETER FILE

	PROLOGUE(QSRT20)	;GENERATE THE NECESSARY SYMBOLS




;
;NOTES:
;
;ALL GLOBAL ROUTINES IN THIS MODULE USE "ONLY" ACS S1 AND S2.
;	CALLERS ARE GUARANTEED THAT ALL OTHER ACS WILL BE
;	RETURNED INTACT.

;THE LAST PAGE IN THIS MODULE (I$STCD ROUTINE) CONTAINS INFORMATION
;	ON QUASAR DEBUGGING AIDS.
COMMENT\

	STOPCDs found in QSRT20

BSD	BAD SPOOL DATA
CAP	CANNOT ACQUIRE A PID
CDD	CANT DEFAULT DIRECTORY
CDU	CANT DEFAULT USER
CGJ	CAN'T GET JOB NUMBER
CGP	CAN'T GET PACKET SIZE
CGU	CANT GET USER
COP	CANT OPEN PRIME QUEUE
CSQ	CANNOT SET IPCF QUOTAS
CUF	CANT UPDATE FILE
CUI	CANT UPDATE INDEX
DIF	DEBRK OF INTERRUPT FAILED
FSP	FAILURE TO SET SYSTEM PID TABLE
MRF	MESSAGE RECEIVE FAILURE
NSD	NO SPOOLING DIRECTORY
NXU	NON-EXISTANT USER
ODE	OWNER DOESNT EXIST
PIC	PID TO INTERRUPT FAILED
PQI	PRIME QUEUE INTERLOCKED

\
COMMENT \
	TOPS20 Field Interpretation

1)  External Owner ID is a User Name
2)  Owner ID (Internal) is a User Number

\
SUBTTL	Module Storage

SLPVAL:	EXP	^D60000			;SLEEP INTERVAL
CENSTA:	EXP	0			;STATION # OF CENTRAL SITE
MEMFLG:	EXP	0			;ZERO = ALLOW IPCF INTERRUPTS
AWOKEN:	EXP	0			;INTERRUPTED OUT OF DISMS IF SET
BLOKED:	EXP	0			;WE HAVE DONE A DISMS
IPCPC:	BLOCK	1			;PC AT IPCF INTERRUPT
FILJFN:	BLOCK	1			;JFN OF MASTER QUEUE FILE
FSPAGN:	BLOCK	1			;SCRATCH PAGE FOR I$READ/I$WRIT
FSADDR:	BLOCK	1			; SAME AS FSPAGN BUT AS AN ADDRESS

UNIDIR:	BLOCK	INPNUM*12		;BLOCK FOR STORING CONNECTED
					; DIRECTORY FOR /UNIQUE CHECK

;LEVTAB AND CHNTAB MUST BE CONTIGUOUS AND IN THE FOLLOWING ORDER
;	THEY ARE CLEARED BY A SINGLE BLT

LEVTAB:	BLOCK	3			;OLD PC ADDRESS POINTERS
CHNTAB:	BLOCK	^D36			;INTERRUPT DISPATCH ADDRESS
SUBTTL	Initialization Routine

;ROUTINE TO INITIALIZE THE WORLD.  I$INIT INITIALIZES THE I/O
;	SYSTEM, AND ENABLES THE INTERRUPT SYSTEM.
;

I$INIT:: RESET				;RESET THE WORLD
	CIS				;CLEAR THE INTERRUPT SYSTEM
	PUSHJ	P,.SAVET##		;SAVE T REGS
	MOVE	S1,[LEVTAB,,LEVTAB+1]	;SETUPT BLT POINTER
	ZERO	LEVTAB			;CLEAR FIRST WORD
	BLT	S1,CHNTAB+^D35		;BLT LEVEL AND CHANNEL TABLES TO ZERO
	MOVE	S1,[INT.PL,,C$INT##]	;LEVEL,,ADR OF IPCF INT RTN
	MOVEM	S1,CHNTAB+INT.PI	;AND STORE IT
	MOVEI	S1,IPCPC		;WHERE TO STORE INTERRUPT PC
	MOVEM	S1,LEVTAB+INT.PL-1	;STORE IN LEVTAB (NO ZERO'TH ENTRY)
	MOVX	S1,.FHSLF		;MY RELATIVE FORK HANDLE
	MOVE	S2,[LEVTAB,,CHNTAB]	;SET UP ADDRESS WORDS
	SIR				;TO SETUP INTERRUPT SYSTEM
	MOVX	S1,.FHSLF		;SETUP MY FORK HANDLE
	MOVX	S2,1B<INT.PI>		;SETUP A MASK
	AIC				;ACTIVATE THE CHANNEL
	MOVEI	S1,.MUMPS		;FUNCTION FOR MAX PACKET SIZE
	MOVEM	S1,INIT.B		;STORE AWAY
	ZERO	INIT.B+1		;CLEAR SECOND WORD
	MOVEI	S1,2			;GET BLOCK SIZE
	MOVEI	S2,INIT.B		;AND ADDRESS OF BLOCK
	MUTIL				;GET THE INFO
	  STOPCD(CGP,FATAL)		;++CAN'T GET PACKET SIZE
	MOVE	S1,INIT.B+1		;GET THE ANSWER
	MOVEM	S1,G$MPS##		;SAVE IT
	MOVX	S1,RC%EMO		;EXACT MATCH ONLY
	HRROI	S2,[ASCIZ /PS:<SPOOL>/]	;DIRECTORY OF SPOOL
	RCDIR				;RECOGNIZE IT
	TXNE	S1,RC%NOM		;MATCH?
	STOPCD	(NSD,FATAL)		;++NO SPOOLING DIRECTORY
	MOVE	S1,T1			;COPY DIR NUMBER INTO S1
	MOVEI	S2,INIT.C		;LOAD ADDR OF BLOCK
	ZERO	T1			;DON'T WANT THE PASSWORD
	GTDIR				;GET DIRECTORY INFO
	HRRZ	S1,INIT.C+7		;GET DEFAULT PROTECTION
	MOVEM	S1,G$SPRT##		;AND STORE IT
	ZERO	G$MCOR##		;THERE IS NO SYSTEM MINIMUM
	SETO	S1,			;-1 = MY JOB
	HRROI	S2,T2			;POINT TO ARG BLOCK
	SETZ	T1,			;WORD 0
	GETJI				;GET MY JOB NUMBER
	  STOPCD(CGJ,FATAL)		;++CANT GET JOB NUMBER
	$SITEM	T2,QJOB			;AND STORE IT
	PJRST	I$ION			;ENABLE INTERRUPTS AND RETURN


INIT.B:	BLOCK	2		;MUTIL BLOCK
INIT.C:	BLOCK	^D14		;GTDIR BLOCK
SUBTTL	Information

;ENTRY POINTS

	INTERN	I$WHEEL		;CHECK IF CURRENT SENDER IS SOME FLAVOR OF OPERATOR
	INTERN	I$KSYS		;RETURN SECONDS UNTIL SYSTEM SHUTDOWN
	INTERN	I$NOW		;RETURN CURRENT DATE/TIME IN INTERNAL FORMAT
	INTERN	I$AGE		;COMPUTE AGE USING INTERNAL FORMAT DATE/TIME
	INTERN	I$AFT		;MODIFY AN INTERNAL TIME BY ADDITION
	INTERN	I$CHAC		;CHECK ACCESS
	INTERN	I$MIDS		;MAKE AN INTERNAL DEVICE SPECIFIER
	INTERN	I$MSDN		;MAKE A SIXBIT DEVICE NAME
	INTERN	I$LOGN		;CHECK IF OPERATOR ALLOWS LOGINS
	INTERN	I$OPER		;CHECK IF AN OPERATOR IS ON DUTY
	INTERN	I$VSTR		;VERIFY THAT A FILE STRUCTURE IS ONLINE
SUBTTL	I$WHEEL  --  Determine of the caller is an Operator

;ROUTINE CALLED TO CHECK IF THE CURRENT SENDER IS AN OPERATOR PERSON.
;	USED TO PREVENT UNAUTHORIZED PERSONS FROM BECOMING
;	KNONW COMPONENTS OR CREATE REQUESTS FOR ANOTHER DIRECTORY.

;CALL	PUSHJ	P,I$WHEEL
;	  ALWAYS RETURNS HERE WITH S1 = .FALSE. IF NOT AN OPERATOR
;				   S1 = .TRUE.  IF ONE
;DESTROYS S1, S2

I$WHEEL: MOVE	S1,G$PRVS##		;GET ENABLED CAPABILITIES WORD
	TXNE	S1,SC%WHL!SC%OPR	;IS HE A WHEEL OR AN OPR?
	  PJRST	.TRUE##			;YES!!
	PJRST	.FALSE##		;NO, HE LOSES
SUBTTL	I$KSYS  --  Routine to get KSYS time

;ROUTINE TO RETURN THE NUMBER OF SECONDS UNTIL SYSTEM SHUTDOWN
;CALL:
;	PUSHJ P,I$KSYS
;	  RETURN HERE WITH RESULT IN S1
;
;S1 =  +NN  SECONDS TO KSYS
;	00  NO KSYS
;	-1  TIMESHARING IS OVER

;THE TIME RETURNED IS ACTUALLY BACKED OFF BY 1 MINUTE FOR NOTHING IS
;	SAFE FROM THE "CEASE" COMMAND

I$KSYS:	MOVE	S1,[SIXBIT/DWNTIM/]	;THE SYSTEM TABLE NAME
	SYSGT				;GET THE TABLE NUMBER AND ENTRY 0
	JUMPL	S2,KSYS.1		;JUMP IF THE TABLE EXISTS
	ZERO	S1			;ELSE RETURN A ZERO
KSYS.1:	PJUMPE	S1,.POPJ##		;EXIT IF NONE PENDING
	PUSH	P,S1			;SAVE TIME FOR NOW
	MOVEI	S1,1			;FIND NOW PLUS 1 MINUTE
	PUSHJ	P,I$AFT			;COMPUTE IT
	POP	P,S2			;NOW GET WHEN SCHEDULED
	CAMLE	S2,S1			;IS SCHEDULED SHUTDOWN PAST
	  PJRST	I$AGE			;NO, COMPUTE DIFFERENCE AND RETURN
	SETO	S1,			;YES, RETURN -1
	POPJ	P,			;RETURN IT
SUBTTL	I$NOW  --  Routine to return time in internal format

;ROUTINE TO RETURN THE CURRENT DATE/TIME IN INTERNAL FORMAT
;CALL:
;	PUSHJ	P,I$NOW
;	  RETURN HERE WITH S1 = DATE/TIME IN INTERNAL FORMAT
;
;GLOBAL LOCATION G$NOW IS ALSO FILLED IN.

I$NOW:	GTAD			;GET THE TIME AND DATE
	MOVEM	S1,G$NOW##	;STORE IN GLOBAL LOCATION
	POPJ	P,		;RETURN
SUBTTL	I$AGE  --  Routine to compare two times in internal format

;ROUTINE TO COMPUTE THE AGE IN SECONDS BASED ON THE INTERNAL DATE/TIME FORMAT
;
;CALL:
;	S1 AND S2 ARE THE TIMES TO COMPUTE AGES
;	PUSHJ	P,I$AGE
;	  RETURNS HERE WITH AGE IN SECONDS IN S1
;DESTROYS S1,S2,TEMP IN THE PROCESS

I$AGE:	CAMGE	S1,S2		;ORDERING CHECK
	EXCH	S1,S2		;WANT THE LARGEST IN S1
	SUB	S1,S2		;SUBTRACT THEM
	IDIVI	S1,3		;RESOLUTION IS APPROX. 1/3 SEC
	POPJ	P,		;AND RETURN
SUBTTL	I$AFT  --  Routine to modify an internal time

;ROUTINE TO RETURN G$NOW + A SPECIFIED INTERVAL.
;
;CALL:
;	S1 CONTAINS INTERVAL IN MINUTES
;	PUSHJ P,I$AFT
;	  RETURN HERE WITH S1=G$NOW+SPECIFIED INTERVAL

I$AFT:	ZERO	S2			;ZERO FOR A SHIFT
	ASHC	S1,-^D17		;GENERATE DOUBLE CONSTANT
					; = ARG*2^18
	DIVI	S1,^D1440		;DIVIDE BY MIN/DAY
	ADD	S1,G$NOW##		;ADD IN NOWTIM
	POPJ	P,			;AND RETURN
SUBTTL	I$CHAC  --  Routine to Check File Access

;ROUTINE TO CHECK FILE AND QUEUE REQUEST ACCESS
;
;CALL:
;	MOVE	S1,[ACCESS CODE,,PROTECTION]
;	MOVE	S2,DIRECTORY OF FILE OR REQUEST
;	PUSHJ	P,I$CHAC
;	  RETURN HERE ALWAYS
;
;CHECK IS MADE AGAINST SENDER OF CURRENT REQUEST
;RETURN	S1 = .TRUE. = ACCESS ALLOWED
;	S1 = .FALSE. = ACCESS NOT ALLOWED

I$CHAC:	LOAD	S1,G$SID##		;GET SENDER'S ID
	CAME	S1,S2			;IS HE THE OWNER
	PJRST	I$WHEEL			;NO, WIN ONLY IF WHEEL
	PJRST	.TRUE##			;YES, LET HIM DO IT
SUBTTL	I$MIDS  --  Routine to generate an IDS

;CALL WITH S1 CONTAINING A SIXBIT DEVICE NAME, AND S2 CONTAINING
;	THE DEFAULT STATION NUMBER.  RETURN WITH S1 CONTAINING
;	THE IDS FOR THE SPECIFIED DEVICE.  IF THE ORIGINAL DEVICE
;	SPECIFICATION IS ILLEGAL, S1 IS RETURNED 0.

I$MIDS:	TLNN	S1,007777		;MUST BE AT LEAST 2 CHARACTERS
	  PJRST	.FALSE##		;ISN'T, GIVE BAD RETURN
	PUSHJ	P,.SAVE3##		;SAVE P1 - P3
	MOVE	P1,S1			;COPY THE ARGUMENT
	MOVEI	P2,6			;LOOP COUNTER
MIDS.0:	LSH	P1,6			;NOW CHECK FOR IMBEDDED NULLS
	TLNE	P1,770000		;NULL CHARACTER AT THE TOP
	  SOJG	P2,MIDS.0		;NO, KEEP GOING
	PJUMPN	P1,.FALSE##		;YES, GIVE ERROR IF MORE REMAINS
	LOAD	P1,S1,DV.GDN		;GET THE DEVICE REQUESTED
	TRZ	P1,77			;CLEAR THE 3RD CHARACTER
	CAIN	P1,'LU '		;REQUEST FOR UPPER CASE ONLY PRINTER
	  JRST	MIDS.7			;YES, GO PROCESS THAT
	CAIN	P1,'LL '		;OR FOR LOWER CASE ONLY
	  JRST	MIDS.8			;THEY NEED SOME SPECIAL PROCESSING
	LDB	P3,[POINT 6,S1,35]	;SPLIT THE CHARACTERS FOR EASIER CHECKS
	LDB	P2,[POINT 6,S1,29]	;  ...
	LDB	P1,[POINT 6,S1,23]	;  ...
	ZERO	S1,DV.DMD		;CLEAR RESULTANT DEVICE MODIFIERS
MIDS.1:	CAIE	P1,'S'			;REQUEST FOR 'DEVSnn'
	  JRST	MIDS.4			;NO, LOOK FOR OTHER FORMS
	JUMPN	P3,MIDS.2		;YES, JUMP IF TWO DIGITS
	MOVEI	P1,'0'			;CONVERT TO STANDARD NAMES
	JRST	MIDS.3			; P2 IS ALREADY CORRECT
MIDS.2:	MOVE	P1,P2			;'SHIFT' OUT THE 'S'
	MOVE	P2,P3			;EVERYTHING UP ONE DIGIT
MIDS.3:	ZERO	P3			;NOW IS STATION GENERIC
MIDS.4:	JUMPN	P2,MIDS.5		;NOW DETERMINE IF UNIT AT DEFAULT STATION
	JUMPN	P3,MIDS.5		;IS THAT IF BOTH WERE NULL
	MOVE	P3,P1			;GET UNIT NUMBER (MAY ALSO BE NULL)
	LDB	P1,[POINT 3,S2,32]	;FIRST DIGIT OF DEFAULT STATION
	TRO	P1,'0'			;MAKE IT SIXBIT TOO
	LDB	P2,[POINT 3,S2,35]	;GET THE SECOND DIGIT
	TRO	P2,'0'			;AGAIN, TO SIXBIT

;   FALL INTO FINAL ASSEMBLY STAGE (ON THE NEXT PAGE)


; I$MIDS IS CONTINUED ON THE NEXT PAGE
; HERE TO ASSEMBLE THE STATION AND UNIT FROM THE CHARACTERS IN P1,P2, AND P3

MIDS.5:	SKIPN	P3			;GENERIC STATION
	  TXO	S1,DV.NUL		;YES, SET 'UNIT WAS NULL'
	CAIG	P1,'7'			;STATION NUMBERS ARE OCTAL
	 CAIGE	P1,'0'			;SO NOW LOOK FOR BAD DIGITS
	  PJRST	.FALSE##		;GIVE BAD RETURN
	CAIG	P2,'7'			;SAME CHECK FOR THE OTHERS
	 CAIGE	P2,'0'			; THIS PREVENTS 'LPTFOO'
	  PJRST	.FALSE##		;WHICH WILL BE THE FIRST TEST OF THIS
	LSH	P1,3			;MAKE ROOM FOR THE OTHER DIGIT
	ADDI	P1,-'0'(P2)		;ADD THEM TOGETHER FOR BINARY STATION NUMBER
	ANDI	P1,77			;IGNORE SIXBIT OVERFLOW
	JUMPE	P3,MIDS.6		;SKIP THIS IF UNIT NOT SPECIFIED
	CAIG	P3,'7'			;ANOTHER SET OF CHECKS FOR THAT DIGIT
	 CAIGE	P3,'0'			;SINCE UNIT NUMBERS ARE OCTAL AS WELL
	  PJRST	.FALSE##		;ILLEGALLY FORMATTED DEVICE SPEC
	STORE	P3,S1,DV.UTN		;STORE THE UNIT NUMBER
MIDS.6:	TLNN	S1,000077		;END UP LESS THAN 3 CHARACTERS
	  PJRST	.FALSE##		;YES, CAN DETECT ILLEGALITY NOW
	STORE	P1,S1,DV.STN		;STORE FULL STATION NUMBER
	JUMPN	P1,.POPJ##		;ALL DONE IF IT WAS A NUMBER
	LOAD	P1,CENSTA		;DIDN'T, GET THE CENTRAL SITE
	STORE	P1,S1,DV.STN		;STORE THAT INSTEAD
	POPJ	P,			;AND RETURN

; HERE TO PARSE THE ALLOWABLE FORMS FOR LL: AND LU:

MIDS.7:	PUSHJ	P,MIDS.9		;PREPARE THE FIELDS
	PJUMPE	S1,.POPJ##		;ILLEGAL SPEC
	TXO	S1