/ 
/
/ COPYRIGHT (C) 1975
/ DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/ THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/ THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/ SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/ VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/ EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/ THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/ SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/ WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/ MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/ DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/ OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY
/ DEC.
/
	.EJECT
/
/ EDIT #16	OCT 25 74	M. HEBENSTREIT
/		JUL 16 75	M. HEBENSRTEIT
/		NOV 6  75	M. HEBENSTREIT
/		DEC 31 75	M. HEBENSTREIT
/ 
/ 
/ THIS PROGRAM IS REQUESTED EACH TIME AN 'EXECUTE' DIRECTIVE IS
/ PROCESSED BY THE EXECUTIVE. FININS GRABS A NODE OFF THE EXECUTE
/ DEQUE AND ESSENTIALLY FINISHES THE JOB OF TASK INSTALLATION.
/ THEN FININS REQUESTS THE TASK NAMED IN THE NODE.
/ 
/ NOTE WELL: THE EXECUTE DIRECTIVE CAN'T WORK UNLESS FININS IS IN
/	THE SYSTEM AND CAN RUN!
/ 
	.TITLE *** FININS ***
	.IFUND DEPRIO
	.DEC
DEPRIO=400
	.OCT
	.ENDC
X10=10
X11=11
R1=101
R2=102
STL=242
POOL=240
PBDL=250
EXELH=276
NADD=107
SNAM=123
PICK=120
DUFD1=306
LUFD1=304
SYSDSK=301
ECLA=641000
IDX=ISZ
.INH=705522
.ENB=705521
/ 
	LAC	(START		/CALC. THE XR ADJUSTMENT
	AND	(070000
	TCA
	DAC	XRADJ
START	.INH			/INHIBIT INTERRUPTS
	LAC	(EXELH		/PICK A NODE OFF THE EXECUTE LIST
	DAC*	(R1
	JMS*	(PICK
	JMP	EXIT		/RETURN HERE IF LIST IS EMPTY -- AND EXIT
	.ENB			/RETURN HERE WITH NODE ADDR IN AC
	DAC	NODADR		/SAVE THE ADDR OF THE NODE
	JMS	SETXR		/SET THE XR TO ACCESS THE NODE
	LAC	2,X		/GET THE TASK NAME
	DAC	TSKNM1
	LAC	3,X
	DAC	TSKNM2
	LAC	4,X		/GET THE RUN PRIORITY
	DAC	PRIO
	LAC	5,X		/GET THE LUN NUMBER
	AND	(377777		/AND OFF THE ALIAS EXECUTE BIT
	DAC	LUN
	LAC	5,X		/GET THE LUN WORD AGAIN
	AND	(400000		/MASK OFF TO GET THE STATUS OF ALIAS EXECUTE
	DAC	ALIAS
	LAC	6,X		/GET THE PARTITION NAME
	DAC	PARNM1
	LAC	7,X
	DAC	PARNM2
	LAC	10,X		/STORE THE SECONDARY TASK NAME
	DAC	SECN1
	LAC	11,X
	DAC	SECN2
	LAC	(STL		/IS THIS TASK IN THE STL ALREADY?
	DAC*	(R1
	LAC	ALIAS		/GET THE ALIAS EXECUTE BIT
	SMA			/IS IT SET?
	JMP	.+3		/NO -- SCAN STL USING PRIMARY TASK NAME
	LAC	(SECN1		/YES -- SCAN STL USING SECONDARY TASK NAME
	SKP
	LAC	(TSKNM1
	DAC*	(R2
	JMS*	(SNAM
	SKP			/RETURN HERE IF NOT -- ITS OK
	JMP	REQIT		/RETURN HERE IF IT IS -- GO REQUEST IT
	LAC	LUN		/CHECK THAT THE LUN IS OK
	SAD	(1		/IF LUN=1 THAT'S ILLEGAL
	JMP	ERR1		/ON THIS ERROR GO LOOK FOR ANOTHER NODE
				/BUT 1ST RETURN THE NODE TO THE POOL
	CAL	HINF		/DO A HINF TO MAKE SURE THE DEVICE IS A
	CAL	WAIT		/DISK FILES HANDLER
	LAC	EV
	SPA			/WERE THERE ANY ERRORS?
	JMP	ERR2		/YES -- RETURN THE NODE
	AND	(77		/GET THE DEVICE CODE
	SAD	(2		/RF?
	SKP			/YES
	SAD	(3		/NO -- RP?
	SKP			/YES
	SAD	(24		/NO -- RK?
	SKP			/YES
	JMP	ERR3		/NO -- RETURN THE NODE
	DAC	DEVICE		/SAVE THE DEVICE CODE
	LAC	EV		/GET THE UNIT NO.
	AND	(700
	CLL
	ALS	11
	DAC	UNIT		/AND SAVE IT
/ 
/ HERE WE MUST GET THE STARTING BLOCK OF THE UFD NAMED
/ IN THE LUN-UFD TABLE FOR THE LUN SPECIFIED.  THIS
/ ALGORITHM WAS TAKEN FROM RFOPEN 075.
/
	LAC*	(LUFD1		/(MJH-16) CALC ADDR OF LUN-UFD ENTRY
	AAC	-1		/(MJH-16) FOR THIS REQUEST
	TAD	LUN		/(MJH-16)
	DAC	TEMP		/(MJH-16) AC=ADDRESS OF UFD NAME
	LAC*	TEMP		/(MJH-16) GET UFD NAME
	SNA			/(MJH-16) IS DISK MOUNTED?
	JMP	ERR4		/(MJH-16) NO ERROR
	DAC	TEMP		/(MJH-16) YES -- SAVE THE UFD NAME
	LAC	DEVICE		/(MJH-16) GET THE BLOCK NUMBER OF THE MFD
	SAD	(3		/(MJH-16) IS DISK THE RP?
	JMP	.+3		/(MJH-16)
	LAC	(1777		/(MJH-16) NO THEN MFD STARTS AT 1777
	SKP			/(MJH-16)
	LAC	(47040		/(MJH-16) YES
RFMFD1	DAC	BLOCK		/(MJH-16) SAVE THE BLOCK NUMBER
	JMS	CONVRT		/(MJH-16) CONVERT BLK NO. TO DISK ADDR
	TAD	UNIT		/(MJH-16) ADD IN UNIT NUMBER
	DAC	GETCTA		/(MJH-16)
	LACQ			/(MJH-16)
	DAC	GETCTA+1	/(MJH-16)
	CAL	GET		/(MJH-16) GET THE BLOCK
	CAL	WAIT		/(MJH-16) WAIT FOR COMPLETION
	LAC	EV		/(MJH-16) ANY ERRORS?
	SPA			/(MJH-16)
	JMP	ERR5		/(MJH-16) YES
	LAC	(BUFF-1		/(MJH-16) NO -- SETUP X10 TO SCAN THE MFD BLOCK
	DAC*	(X10		/(MJH-16)
	AAC	370		/(MJH-16) CALC ADDR OF LAST ENTRY IN BLOCK
	DAC	TEMPX		/(MJH-16) SAVE THIS ADDR
RFMFD2	LAC*	X10		/(MJH-16) GET MFD ENTRY
	SAD	TEMP		/(MJH-16) DOES IT MATCH?
	JMP	RFMFD3		/(MJH-16) YES
	LAC*	(X10		/(MJH-16) NO -- END OF BLOCK?
	SAD	TEMPX		/(MJH-16)
	JMP	RFMFD4		/(MJH-16) YES -- PREPARE TO SWITCH MFD BLOCKS
	AAC	3		/(MJH-16) NO -- INCREMENT X10
	DAC*	(X10		/(MJH-16)
	JMP	RFMFD2		/(MJH-16) GO LOOK AT NEXT ENTRY
RFMFD4	LAC	BUFF+377	/(MJH-16) IS THIS LAST MFD BLOCK?
	SAD	(-1		/(MJH-16)
	JMP	ERR4		/(MJH-16) YES -- ERROR
	JMP	RFMFD1		/(MJH-16) NO -- PREPARE TO READIN NEXT BLOCK
RFMFD3	LAC*	X10		/(MJH-16) GET STARTING BLOCK OF UFD
	SAD	(-1		/(MJH-16) IS IT INITIALIZED?
	JMP	ERR4		/(MJH-16) NO -- ERROR
				/(MJH-16) YES -- OK
/ 
/ HERE WE NEED TO LOOK FOR A FILE CALLED 'TSKNAM IMG'. WHEN WE FINALLY
/ ARRIVE HERE, THE AC HAS THE STARTING BLOCK OF THE UFD WHERE THE FILE
/ SHOULD BE. DEVICE AND UNIT ARE SET UP CORRECTLY BY THIS TIME.
/ 
GOTUFD	JMS	CONVRT		/CONVERT THE BLOCK NO. TO DISK ADDR.
	TAD	UNIT		/ADD IN THE UNIT NO. (TO PLATTER)
	DAC	GETCTA
	LACQ
	DAC	GETCTA+1
	CAL	GET		/GET THE UFD BLOCK
	CAL	WAIT
	LAC	EV
	SPA
	JMP	ERR5		/GET ERROR -- GO RETURN THE NODE
	LAC	(BUFF		/PREPARE TO SCAN THE BLOCK FOR FILNAM
	DAC	TEMP
	AAC	-1
	DAC*	(X10
NEXTEN	LAC*	X10		/GET 1ST HALF OF FILE NAME FROM UFD
	SAD	TSKNM1		/DOES 1ST HALF OF NAME MATCH?
	SKP
	JMP	NOTFIL		/NO -- PREPARE TO EXAMINE NEXT ENTRY
	LAC*	X10		/YES -- HOW ABOUNT THE 2ND HALF?
	SAD	TSKNM2
	SKP
	JMP	NOTFIL		/NO -- EXAMINE NEXT ENTRY
	LAC*	X10		/YES -- HOW ABOUT THE EXTENSION?
	SAD	TSKEXT
	SKP
	JMP	NOTFIL		/NO
	LAC*	X10		/YES -- THIS IS THE RIGHT FILE!
	DAC	BLOCK		/SAVE THE STARTING BLOCK OF THE FILE
	LAC*	X10		/GET THE FILE SIZE
	SMA			/THIS BETTER BE A 'CREATED' FILE
	JMP	ERR6		/IT'S NOT SO GO RETURN THE NODE
	AND	(377777		/IT IS SO SAVE THE REAL NO. OF BLOCKS
	DAC	SIZE
	JMP	GOTFIL
/ 
NOTFIL	LAC	TEMP		/THIS ISN'T THE RIGHT FILE SO UPDATE
	AAC	10		/THE POINTERS.
	SAD	(BUFF+370	/IS THIS THE END OF THIS UFD BLOCK?
	JMP	NEXTB		/YES -- PREPARE TO READIN ANOTHER
	DAC	TEMP		/NO -- CONTINUE THE SCAN
	AAC	-1
	DAC*	(X10
	JMP	NEXTEN
/ 
NEXTB	LAC	BUFF+377	/GET THE POINTER TO THE NEXT UFD BLOCK
	SAD	(-1		/IS THIS THE LAST BLOCK IN THE UFD?
	JMP	ERR7		/YES -- FILE WAS NOT FOUND
	JMP	GOTUFD		/NO -- PREPARE TO GET THE NEXT ONE.
/ 
/ WE NOW KNOW WHERE THE CREATED FILE IS AND HOW MUCH SPACE IT
/ OCCUPIES. THEREFORE LET'S ALLOCATE ENOUGH SPACE ON THE SYSTEM
/ DISK AND TRANSFER THE TASK IMAGE FROM THE CREATED FILE TO THE
/ ALLOCATED SPACE ON THE SYSTEM DISK.
/ 
GOTFIL	LAC	BLOCK		/PREPARE TO GET THE 1ST 2 BLOCKS OF
	JMS	CONVRT		/THE FILE -- 2 ARE GUARANTEED
	TAD	UNIT
	DAC	GETCTA
	LACQ
	DAC	GETCTA+1
	LAC	(1000
	DAC	GETCTA+3
	CAL	GET		/GET THE 2 BLOCKS
	CAL	WAIT
	LAC	EV		/WHERE THERE ANY ERRORS?
	SPA
	JMP	ERR5		/YES -- RETURN THE NODE
	LAC	(BUFF-1		/NO -- PREPARE TO READ INFO
	DAC*	(X10
	LAC	(INFO-1
	DAC*	(X11
	LAW	-16
	DAC	TEMP
	LAC*	X10		/TRANSFER THE 1ST FEW WORDS OF THE
	DAC*	X11		/HEADER BLOCK INTO THE 'INFO' TABLE
	ISZ	TEMP
	JMP	.-3
	LAC	INFO+10		/CONVERT CONST'D FILE DISK ADDR. TO A BLOCK
	CLL
	AND	(777400
	LMQ
	LAC	INFO+10
	AND	(377
	LRSS	10
	LACQ			/NOW NEGATE SO BLOCK NO. CAN BE USED TO UPDATE
	TCA			/THE LINK TABLE
	DAC	OFFSET
	LAC	INFO+6		/WAS A PRIO GIVEN TO TKB?
	SZA
	JMP	.+3		/YES
	LAC	(DEPRIO		/NO -- SET ONE
	DAC	INFO+6
	LAC	SIZE		/PREPARE TO ALLOCATE ENOUGH SPACE ON THE
	CLL
	ALS	10
	DAC	ALCTA
	CAL	ALLO		/ALLOCATE
	CAL	WAIT
	LAC	EV		/WHERE THERE ANY ERRORS?
	SPA
	JMP	ERR8		/YES -- RETURN THE NODE
	LAC	ALCTA+1		/NO -- PREPARE TO TRANSFER THE FILE
	DAC	PUTCTA
	LAC	ALCTA+2
	DAC	PUTCTA+1
	CLL			/PUT THE CORRECT DISK ADDRESS INTO
	LAC	ALCTA+2		/THE INFO TABLE. THIS MUST BE ONE BLK
	TAD	(400		/ADDRESS MORE THAN THE ALLO. AREA.
	SZL
	IDX	ALCTA+1
	TAD	ALCTA+1
	DAC	INFO+10		/SAVE THE CORRECT ADDR. FOR STL NODE
	LAC	INFO+6		/SET THE 'REMOVE ON EXIT' BIT
	AND	(577777
	XOR	(200000		/IN THE INFO TABLE SO LATER THE
	DAC	INFO+6		/BIT WILL BE SET IN THE STL.
	LAC	SIZE		/NOTE THAT SIZE>=2 BLOCKS
	TCA
	DAC	TEMP		/USE TEMP AS A COUNTER FOR BLOCKS TRANS.
/ 
/ HERE WE NEED TO TRANSFER THE BLOCKS. BLOCKS WILL BE TRANSFERRED
/ TWO AT A TIME UNTIL WE'RE ALL DONE OR UNTIL ONLY ONE BLOCK REMAINS.
/ IF ONLY ONE BLOCK REMAINS USE 400 IN GET AND PUT CONTROL TABLES
/ SO WE WON'T GO OVER THE ALLOCATED AREA OR OFF THE END OF THE DISK.
/ 
CONTTR	CAL	PUT		/PUT THE BLOCK(S)
	CAL	WAIT
	LAC	EV		/WHERE THERE ERRORS?
	SPA
	JMP	ERR9		/YES -- DEAL BLOCKS AND RETURN NODE
	JMS	UPDATE		/UPDATE THE DISK ADDR AND PLATTER
	JMS	UPDATE		/DO IT 2 TIMES BECAUSE 2 BLOCKS TRANSFERRED
	ISZ	TEMP		/ARE WE DONE TRANSFERRING BLOCKS?
	SKP			/NOT YET
	JMP	TRANDN		/YES
	ISZ	TEMP		/DONE NOW?
	SKP
	JMP	TRANDN		/YES
	LAC	TEMP		/NO -- IS THERE ONLY 1 BLK LEFT?
	SAD	(-1
	SKP
	JMP	CONTIN		/NO -- CONTINUE TRANSFERRING 2 AT A TIME
	LAC	(400		/YES -- THEN TRANSFER ONLY 1 BLOCK
	DAC	GETCTA+3
	DAC	PUTCTA+3
	JMP	CONTIN
/ 
UPDATE	0
	CLL
	LAC	(400
	TAD	PUTCTA+1	/UPDATE THE PUT CONTROL TABLE
	DAC	PUTCTA+1
	SZL			/SHOULD THE PLATTER BE UPDATED?
	IDX	PUTCTA		/YES -- UPDATE IT
	CLL			/NO
	LAC	(400
	TAD	GETCTA+1	/UPDATE THE GET CONTROL TABLE
	DAC	GETCTA+1
	SZL			/SHOULD THE PLATTER BE UPDATED?
	IDX	GETCTA		/YES -- THEN DO SO
	JMP*	UPDATE		/NO -- RETURN
/ 
CONTIN	CAL	GET		/GET SOME BLOCKS
	CAL	WAIT
	LAC	EV		/GET ERRORS?
	SPA
	JMP	ERR10		/YES -- DEAL AND RETURN NODE
	JMP	CONTTR		/NO -- CONTINUE
/ 
/ THE TRANSFER IS ALL DONE SO WE CAN BEGIN TO CONSTRUCT THE STL NODE.
/ WE MUST BE SURE THAT THE TASK CAN RUN IN THE PARTITION THAT WAS
/ SPECIFIED IN THE CPB OR THE PARTITION GIVEN TO THE TASK BUILDER.
/ 
/ BEFORE SETTING UP THE STL NODE HOWEVER, TRY TO UPDATE THE LINK
/ TABLE IF ONE EXISTS. AT THIS TIME THE ADDRESSES FOR THE START OF
/ THE LINKS ARE WRONG. THEY ARE PROPERLY SET UP FOR THE 'USER' DISK
/ BUT NOT FOR THE SYSTEM DISK.
/
TRANDN	LAW	-1		/SUBTRACT 1 TO GET THE NUMBER OF EXTERNAL LINKS
	TAD	INFO+14
	SNA			/ARE THERE ANY LINKS?
	JMP	TRANX		/NO -- GO SET UP THE STL NODE
	DZM	TEMPX		/YES -- CLEAR FLAG SAYING LINKS WERE COUNTED
	LAC	INFO+15		/GET THE BASE OF THE LINK TABLE
	AND	(77		/USE ONLY THE LOW BITS FOR THE POINTER
	TAD	(BUFF		/ADD START OF BLOCK BUFFER
	AAC	10		/ADD OFFSET SO POINTER POINTS TO 1ST LINK DISK 
	DAC	POINT		/ADDRESS
	LAC	INFO+10		/PICK UP DSIK ADDR. TO BE USED IN STL NODE
	AND	(377		/MASK OFF ALL BUT THE PLATTER NO.
	DAC	GETCTA+0	/STORE IN GET CTA
	LAC	INFO+10		/GET THE DISK ADDR.
	AND	(777400
	DAC	GETCTA+1
	LAC	(GETCTA		/MAKE THE PUT CPB USE SAME CTA AS FOR GET
	DAC	PUT+3
	DZM	DEVICE		/CLEAR THE DEVICE -- INDICATE SYSDSK
	LAC	(400		/SET UP SO GETS AND PUTS USE ONLY 400 WDS.
	DAC	GETCTA+3
TRAND1	CAL	GET		/GET THE BLOCK WITH THE LINK TABLE
	CAL	WAIT
	LAC	EV		/WERE THERE ANY ERRORS?
	SPA
	JMP	ERR10		/YES -- REPORT IT
	LAC	TEMPX		/HAVE LINK TAB ENTRIES BEEN COUNTED?
	SZA
	JMP	TRAND3		/YES -- CONTINUE
	CLA!IAC			/NO -- SET FLAG SAYING LINK TABLE ENTRIES
	DAC	TEMPX		/HAVE BEEN COUNTED
	LAC	INFO+13		/GET TASK ENTRY POINT SO THE PAGE/BANK MASK
	RAL			/CAN BE CALCULATED
	SPA!CLA			/THIS MASK IS 17777 FOR BANK, 7777 FOR PAGE
	LAC	(10000
	TAD	(7777
	DAC	BPMASK		/SAVE THE MASK
	LAC	INFO+15		/GET THE BASE ADDR OF LINK TABLE
	AND	BPMASK		/MASK OFF ANY UNNEEDED BITS
	TCA			/NEGATE FOR FUTURE SUBTRACTION
	DAC	TEMPX2		/SAVE BASE OF LINK TABLE NEGATED
	LAC	POINT		/PREPARE TO GET THE JMS* (EXU INSTRUCTION
	AAC	-6		/IN THE 1ST LINK
	DAC	TEMPX1		/(THIS IS WORD 2 OF THE ENTRY)
	LAC*	TEMPX1		/GET THE INSTRUCTION
	AND	BPMASK		/GET THE ADDRESS IN THAT INSTRUCTION
	TAD	TEMPX2		/SUBTRACT THE BASE OF LINK TABLE
	LMQ			/PREPARE TO DIVIDE BY 13(8)
	CLA!CLL			/TO GET NUMBER OF TABLE ENTRIES
	DIV
	13
	LACQ			/AC NOW HAS NUMBER OF LINK TABLE ENTRIES
	TCA			/NEGATE FOR USE AS AN ISZ COUNTER
	DAC	TEMP
TRAND3	LAC*	POINT		/GET THE OLD DISK ADDR. FOR THIS LINK
	CLL			/CONVERT TO A BLOCK NUMBER
	AND	(777400
	LMQ
	LAC*	POINT
	AND	(377
	LRSS	10
	LACQ
	TAD	OFFSET		/SUBTRACT THE OLD BASE DISK BLOCK NO.
	CLL
	ALS	10		/MULTIPLY BY 400 TO GET THE NO. OF WDS.
	TAD	INFO+10		/ADD THE NEW DISK BASE ADDR.
	SZL
	IAC
	DAC*	POINT		/STORE THE ADDR. OF THE LINK IN LINK TABLE
	ISZ	TEMP		/LAST LINK?
	SKP
	JMP	TRAND2		/YES -- WRITE OUT THE LAST UPDATED BLOCK
	LAC	POINT		/NO -- INCREMENT THE POINTER
	AAC	13
	DAC	POINT
	AAC	-377		/HAS THE POINTER GONE PAST END OF BLOCK?
	LMQ
	LAC	(BUFF
	TCA
	DAC	EV
	LACQ
	TAD	EV
	SPA!SNA
	JMP	TRAND3		/NO -- CONTINUE TO UPDATE LINK ADDRESSES
	AAC	-1		/YES -- SET POINTER TO ACCESSS NEXT BLOCK
	TAD	(BUFF
	DAC	POINT
	CAL	PUT		/WRITE OUT THIS BLOCK
	CAL	WAIT
	LAC	EV		/WERE THERE ANY ERRORS?
	SPA
	JMP	ERR9		/YES -- REPORT IT
	CLL			/NO -- PREPARE TO ACCESS NEXT BLOCK
	LAC	GETCTA+1
	TAD	(400
	DAC	GETCTA+1
	SZL
	IDX	GETCTA
	JMP	TRAND1		/GO UPDATE THE LINKS IN THIS BLOCK
TRAND2	CAL	PUT		/WRITE OUT THE LAST BLOCK HAVING LINK TABLE ENTRY
	CAL	WAIT
	LAC	EV		/WERE THERE ANY ERRORS?
	SPA
	JMP	ERR9		/YES -- REPORT IT
/
/ NOW SET UP THE STL NODE -- THE LINK TABLE HAS BEEN UPDATED FOR SYSDSK
/
TRANX	LAC	NODADR		/PICK UP THE ADDR. OF THE NODE
	AAC	6
	DAC	TEMP		/GET THE PARTITION NAME IN NODE
	LAC*	TEMP
	SZA			/WAS A PART. NAME GIVEN?
	JMP	.+4		/YES
	LAC	(INFO+1		/NO -- THEN USE NAME IN IMAGE
	DAC	TEMP
	SKP
	LAC	TEMP
	DAC*	(R2		/TEMP NOW POINTS TO PART. NAME
	LAC	(PBDL		/SET UP TO LOOK FOR PART. IN PBDL
	DAC*	(R1
	JMS*	(SNAM
	JMP	ERR11		/CAN'T FIND PART. IN PBDL
	DAC	INFO+7		/SAVE THE ADDR. OF PBDL NODE
	AAC	4		/USE TEMP AS A POINTER TO THE BASE OF
	DAC	TEMP		/PART. GIVEN IN THE PBDL NODE
	LAC	INFO+13		/IS THIS A NRM MODE TASK?
	AND	(100000
	SZA
	JMP	NORM		/YES -- THEN BASE CHECK IS NOT NEEDED
	LAC*	TEMP		/NO -- CHECK PARTITION BASE
	SAD	INFO+3		/SAME BASE ADDR?
	SKP
	JMP	ERR11		/NO -- DEAL AND RETURN NODE
NORM	IDX	TEMP		/YES -- MAKE TEMP POINT TO PART. SIZE
	LAC	INFO+13		/(MJH-16) DETERMIN IF TASK WILL FIT IN PART.
	RTL			/(MJH-16)
	SPA!CLA!CMA		/(MJH-16)
	LAW	-400		/(MJH-16)
	AND	INFO+12		/(MJH-16)
	TCA
	TAD*	TEMP
	SPA
	JMP	ERR11		/NO -- DEAL AND RETURN NODE
	LAC	NODADR		/YES -- PREPARE TO SET UP STL NODE
	AAC	1
	DAC*	(X11
	LAC	(INFO+3
	DAC*	(X10
	LAW	-10
	DAC	TEMP
	LAC*	X10		/TRANFER INFO INTO NODE FROM EXECUTE LIST
	DAC*	X11
	ISZ	TEMP
	JMP	.-3
	LAC	ALIAS		/PICK UP THE ALIAS EXECUTE BIT
	SMA			/IS IT SET?
	JMP	INSERT		/NO -- INSERT THE NODE AS IT IS
	LAC	NODADR		/YES -- CHANGE THE TASK NAME
	JMS	SETXR		/PREPARE TO ACCESS THE NODE
	LAC	SECN1		/PUT IN THE SECONDARY TSK NAME
	DAC	2,X
	DAC	TSKNM1		/SAVE IT ALSO IN THE REQUEST CPB
	LAC	SECN2
	DAC	3,X
	DAC	TSKNM2
INSERT	.INH			/INHIBIT INTERRUPTS
	LAC	NODADR		/PREPARE TO ENTER NODE INTO STL
	DAC*	(R2
	LAC	(STL
	DAC*	(R1
	JMS*	(NADD
	.ENB			/ENABLE INTERRUPTS
	CAL	REQ		/REQUEST THE TASK
	LAC	(400
	DAC	GETCTA+3
	LAC	(1000
	DAC	PUTCTA+3
	LAC	(PUTCTA
	DAC	PUT+3
	LAC	(GETCTA
	DAC	GET+3
	JMP	START		/GO SEE IF THERE'S ANY MORE TO DO.
/
/ THE TASK SPECIFIED IN THE EXECUTE NODE IS ALREADY IN THE SYSTEM.
/ THEREFORE IF NO PARTITION IS SPECIFIED JUST REQUEST IT AT THE
/ PRIORITY GIVEN IN THE EXECUTE NODE. IF A PARTITION IS
/ SPECIFIED AND ITS AN EXEC MODE TASK JUST REQUEST IT.
/ IF A PARTITION IS GIVEN AND ITS A NORMAL MODE TASK TRY TO FIT
/ THE TASK INTO THE PARTITION GIVEN , CHANGING THE STL NODE, AND
/ THEN REQUEST IT. IN EFFECT THIS PROCEDURE IS SIMILAR TO THE
/ MCR FUNCTION ASP.
/
/ NOTE: IF THE TASK BEING XQT'D IS ACTIVE FININS WILL PRINT AN ERROR
/ 
REQIT	DAC	STLND		/SAVE THE ADDRESS OF THE STL NODE
	JMS	SETXR		/(MJH-16)SET UP TO ACCESS THE TASK'S STL NODE
	LAC	4,X		/(MJH-16) IS THE TASK ACTIVE ALREADY?
	SPA			/(MJH-16) SKIP IF NOT
	JMP	ERR13		/(MJH-16) YES -- DECLARE ERROR
	LAC	ALIAS		/IS THE ALIAS EXECUTE BIT SET?
	SMA
	JMP	.+5		/NO -- CONTINUE
	LAC	SECN1		/YES -- PUT SECONDARY TASK NAME 
	DAC	TSKNM1		/INTO REQUEST CPB
	LAC	SECN2
	DAC	TSKNM2
	LAC	PARNM1		/WAS A PARTITION GIVEN?
	SNA
	JMP	REQIT1		/NO -- REQUEST THE TASK
	.INH
	LAC	STLND		/IS THIS AN EXEC MODE TASK?
	JMS	SETXR
	LAC	11,X
	AND	(100000
	SNA
	JMP	REQIT1		/YES -- IGNORE PART. AND REQUEST IT
	.ENB			/NO -- CHECK PART. ASSIGNMENT
	LAC	(PBDL		/YES -- FIND OUT IF PART. IN SYSTEM
	DAC*	(R1
	LAC	(PARNM1
	DAC*	(R2
	JMS*	(SNAM
	JMP	ERR12		/PART. NO IN SYSTEM -- RETURN NODE
	DAC	PARND		/PART. IN SYSTEM -- SAVE NODE ADDR.
	.INH			/INHIBIT INTERRUPTS
	LAC	STLND		/GET SET TO ACCESS STL NODE
	JMS	SETXR
	LAC	4,X		/GET THE STATUS
	DAC	STATUS
	LAC	11,X		/(MJH-16) GET THE TASK SIZE
	RTL			/(MJH-16)
	SPA!CLA!CMA		/(MJH-16)
	LAW	-400		/(MJH-16)
	AND	10,X		/(MJH-16)
	DAC	SIZE
	.ENB			/ENABLE INTERRUPTS
	LAC	STATUS		/ IS TASK FIXED IN CORE?
	AND	(040000
	SZA
	JMP	REQIT1		/YES -- JUST REQUEST IT
	LAC	PARND		/NO -- SEE IF IT CAN RUN IN PART.
	JMS	SETXR
	LAC	SIZE
	TCA
	TAD	5,X
	SPA
	JMP	RET1		/NO -- RETURN THE NODE
	LAC	STLND		/YES -- FIX STL NODE
	JMS	SETXR
	.INH			/INHIBIT INTERRUPTS
	LAC	PARND
	DAC	5,X		/FIX PTR TO PBDL
	LAC	4,X		/CLEAR RCF DISABLED BIT
	AND	(757777
	DAC	4,X
REQIT1	.ENB			/ENABLE INTERRUPTS
	CAL	REQ		/REQUEST THE TASK
	JMP	RETURN		/RETURN THE EXECUTE NODE
RET1	.ENB
	JMP	ERR12
/
CONVRT	0
	LMQ
	LLSS!ECLA 10
	JMP*	CONVRT
/ 
SETXR	0
	TAD	XRADJ
	PAX
	JMP*	SETXR
/
EXIT	.ENB			/ENABLE INTERRUPTS
	CAL	(10		/EXIT
/
ERREX	CAL	DEAL		/DEALLOCATE THE BLKS ON THE SYS-DISK
RETURN	LAC	NODADR		/RETURN THE NODE TO THE POOL
	DAC*	(R2
	LAC	(POOL
	DAC*	(R1
	JMS*	(NADD
	JMP	START		/GO SEE IF THERE ARE MORE NODES IN LIST
/
TSKEXT	.SIXBT "IMG"		/TASK EXTENSION
XRADJ	0
NODADR	0
PARNM1	0
PARNM2	0
UNIT	0
TEMP	0
BLOCK	0
SIZE	0
EV	0
POINT	0
OFFSET	0
STATUS	0
STLND	0
PARND	0
INFO	.BLOCK 16
BUFF	.BLOCK 1000
SECN1	0
SECN2	0
ALIAS	0
TEMPX	0
TEMPX1	0
TEMPX2	0
BPMASK	0
/
REQ	1
	0
TSKNM1	0
TSKNM2	0
PRIO	0
/
HINF	3600
	EV
LUN	0
/
WAIT	20
	EV
/
ALLO	1500
	EV
	1
	ALCTA
ALCTA	00
	00
	00
DEAL	1600
	0
	1
	ALCTA
/
GET	13000
	EV
	1
	GETCTA
DEVICE	0
GETCTA	0
	0
	BUFF
	400
/
PUT	3100
	EV
	1
	PUTCTA
PUTCTA	0
	0
	BUFF
	1000
PRINT	2700
	EV
	4
	3
	PRNTBF
PRNTBF	TYPE-PRNTBF/2*1000
	0
	.BLOCK 6
	15
	12
TYPE	2700
	EV
	4
	2
	XX
MSG1	MSG2-MSG1/2*1000
	0
	.ASCII "FININS -- ILLEGAL LUN -- "<175>
MSG2	MSG3-MSG2/2*1000
	0
	.ASCII "FININS -- HINF ERROR -- "<175>
MSG3	MSG4-MSG3/2*1000
	0
	.ASCII "FININS -- ILLEGAL DEVICE -- "<175>
MSG4	MSG5-MSG4/2*1000
	0
	.ASCII "FININS -- DISK DISMOUNTED -- "<175>
MSG5	MSG6-MSG5/2*1000
	0
	.ASCII "FININS -- GET ERROR -- "<175>
MSG6	MSG7-MSG6/2*1000
	0
	.ASCII "FININS -- FILE NOT 'CREATED' -- "<175>
MSG7	MSG8-MSG7/2*1000
	0
	.ASCII "FININS -- FILE NOT FOUND -- "<175>
MSG8	MSG9-MSG8/2*1000
	0
	.ASCII "FININS -- ALLOCATE ERROR -- "<175>
MSG9	MSG10-MSG9/2*1000
	0
	.ASCII "FININS -- PUT ERROR -- "<175>
MSG10	MSG12-MSG10/2*1000
	0
	.ASCII "FININS -- PARTITION CONFLICT -- "<175>
MSG12	MSG11-MSG12/2*1000
	0
	.ASCII "FININS -- TASK ALREADY ACTIVE -- "<175>
MSG11=.
/
ERR1	LAC	(MSG1
	SKP
ERR2	LAC	(MSG2
	SKP
ERR3	LAC	(MSG3
	SKP
ERR4	LAC	(MSG4
	SKP
ERR5	LAC	(MSG5
	SKP
ERR6	LAC	(MSG6
	SKP
ERR7	LAC	(MSG7
	SKP
ERR8	LAC	(MSG8
	SKP
ERR12	LAC	(MSG10
	JMS	NAME
	JMP	RETURN
ERR9	LAC	(MSG9
	SKP
ERR10	LAC	(MSG5
	SKP
ERR11	LAC	(MSG10
	JMS	NAME
	JMP	ERREX
ERR13	LAC	(MSG12
	JMS	NAME
	JMP	START
/ 
/ SUBROUTINE NAME -- TYPE ERROR MESSAGE AND TASK NAME
/
NAME	0
	DAC	TYPE+4		/PREPARE TO PRINT ERROR MESSAGE
	CAL	TYPE		/PRINT MESSAGE
	CAL	WAIT
	LAC	ALIAS		/SHOULD SECONDARY NAME BE PRINTED?
	SMA
	JMP	NAME1		/NO
	LAC	SECN1		/YES -- SWITCH SECONDARY NAME FOR PRIMARY
	DAC	TSKNM1
	LAC	SECN2
	DAC	TSKNM2
NAME1	LAC	(PRNTBF+1		/INIT. X10 SO NAME OF TASK
	DAC*	(X10		/CAN BE PRINTED IN IMAGE ASCII
	LAC	TSKNM1
	LMQ
	CLA
	JMS	SIXASC
	JMS	SIXASC
	JMS	SIXASC
	LAC	TSKNM2
	LMQ
	CLA
	JMS	SIXASC
	JMS	SIXASC
	JMS	SIXASC
	CAL	PRINT		/PRINT THE TASK NAME
	CAL	WAIT
	JMP*	NAME
/
/ SUBROUTINE SIXASC -- STORE AN ASCII CHAR IN IMAGE ASCII
/			PRINT BUFFER.
/
SIXASC	0
	CLA
	LLS	6
	DAC	TEMP
	AAC	-33		/IS SIXBIT CHAR A NUMBER?
	SPA
	JMP	.+4
	LAC	TEMP		/YES -- THEN JUST STORE IT
	DAC*	X10
	JMP*	SIXASC
	LAC	TEMP		/NO -- ADD 100
	AAC	100
	DAC*	X10
	JMP*	SIXASC
/
	.END
