	.TITLE XVM/RSX RECONFIGURATOR
/
/ 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 #27	7/8/76		SCR	GRAB SOME SPACE FOR NODES
/ EDIT #26	7/7/76		SCR	NODES/PARTITION PROBLEM; SYNTX ERROR FIX
/ EDIT #25	12/7/75		SCR	FIX PART/SYCOM AMBIGUITY
/ EDIT #24	11/24/75	SCR	MODIFY EDIT #23
/ EDIT #23	11/22/75	MJH+SR SYSCOM TO PART BOMB
/ EDIT #22	8/1/75		M. HEBENSTREIT (XVM CHANGES)
/ EDIT #16	6/13/75		M. HEBENSTREIT
/ EDIT #15	1/2/74		S. ROOT AND MORE SYS. COM.
/ EDIT #14	12/16/73	S. ROOT MORE ON SYS. COM.
/ EDIT #13	12/26/73	S. ROOT
/				M. HEBENSTREIT
/ EDIT #12	10/24/73	S. ROOT SYSTEM COMMON NODES
/  ARE WRONG IN PREVIOUS EDIT, BASE-SIZE SHOULD BE IN +5,+6
/  RATHER THAN +4,+5. HOWEVER, WE ASSUME ORDERED LISTS, MADE
/  WITH SPRI, WHICH WORKS ON +4. AS A QUICKIE FIX WE WILL PUT
/  BASE IN +4,+5 AND SIZE IN +6. IF A USER TRIES TO USE +4
/  HE IS LIKELY TO LOSE BIG.
/
/
/	IF RCP IS DEFINED, A SHORT DIALOGUE VERSION THAT WILL
/  ALLOW ONLY PARTITION CHANGES WILL RESULT.
/
/
/  SYSTEM CALLS/
/
/  NADD  R1 DEQUE,R2 NODE
/  NDEL  R1 NODE
/  PENP  RETURN IN AC
/  PICK  R1 DEQUE, RETURN IN AC
/
/
/
/
/  EQUATES FOR BITS IN STL NODE FLAGS WORD
/
PRTFL=20000		/BIT SAYS TASK LOST PARTITION
PRTFLM=757777		/MASK FOR BIT TWIDDLING ON IT
RCINP=10000		/BIT SAYS RECONFIGURATION IN PROGRESS IN PARTITION
RCINPM=767777		/MASK FOR IT
/
/ RANDOM EQUATES
/
S.DA=6		/DISK ADDRESS+PLATTER
S.DP=4		/FLAGS AND PRIORITY
S.EP=11		/TASK ENTRY POINT
S.PB=5		/PBDL ADDR
S.TS=10		/TASK SIZE
X10=10		/AUTOINCREMENT REG
X11=11
X12=12
X13=13
X14=14
X15=15
X16=16
X17=17
CSIZE=136	/CORE SIZE
FAC=174		/FETCH A CHAR
IFAC=172	/INIT FAC
MCRRI=171	/MCR INHIBIT FLAG
XSIZE=231	/SIZE OF EXEC
FPHDWE=236	/FPP HARDWARE FLAG
LPOOL=264	/POOL OF LARGE NODE
SNDL=266	/SMALL NODE DESC. LIST
LNDL=270	/LARGE NODE DESC. LIST
POOL=240	/POOL OF EMPTY NODES
PBDL=250	/PARTITION BLOCK LIST
SCDL=254	/SYSTEM COMMON BLOCK LIST
STKL=242	/SYSTEM TASK LIST
NADD=107	/ADD A NODE S.R.
NDEL=112	/DELETE A NODE S.R.
PENP=115	/PICK A NODE FROM POOL S.R.
PICK=120	/PCIK A NODE FROM A DEQUE S.R.
R1=101		/RE-ENTRANT REGISTERS
R2=102
SAVE=131	/REGISTER SAVE ROUTINE
SPRI=126	/INSERT A NODE S.R.
.INH=705522	/INHIBIT INTERRUPTS
.ENB=705521	/ENABLE INTERRUPTS
/
RCNDSZ=11		/SIZE OF 'OUR' NODES
RCNDM2=RCNDSZ-2
/
/
T.FP=0		/FORWARD LINKAGE
T.BP=1		/BACKWARD LINKAGE
T.N1=2		/NAME (FIRST HALF) IN SIXBIT
T.N2=3		/SECOND HALF
T.BA=4		/BASE OF 'UNIT'
T.SZ=5		/SIZE
T.TI=6		/WHAT KIND OF UNIT
T.SY=7		/ZERO, OR POINTER TO EXISTING NODE FOR UNIT SAME NAME
T.AC=10		/SHARED ACCESS CHARACTERISTICS
/
	.DBREL
/
/
/
/  DEQUE HEADS FOR STORAGE AND MANIPULATIONS OF INFORMATION
/
RCMT	RCMT0	/POOL OF EMPTY NODES OF OUR SIZE FOR OUR USE
	RCIPL	/LAST NODE AT END OF OUR CORE (ASSUMED 2760(8))
/
RCWRK	RCWRK	/A 'PUSH-DOWN STACK' DEQUE BUILT ON PBDL+20 OF
	RCWRK	/THOSE  THAT WE CATCH (TEMPORARILY)
/
RCOLL	RCOLL	/DEQUE OF NODES DESCRIBING PARTITIONS OR SYSTEM COMMON
	RCOLL	/IN PRESENT SYSTEM THAT HAVE BEEN OVERLAPPED BY TYPED
/		/IN UNITS, AND WHOSE NAMES DO NOT APPEAR IN TYPED UNITS.
/
RCBSL	RCBSLL	/DEQUE OF USER PROVIDED UNITS(LATER ALSO INCLUDS
	RCBSUL	/FRAGMENTS OF UNITS FROM RCOLL IF ANY)
/
RCBSLL	RCBSUL	/DUMMY NODE FOR EXEC SPACE
	RCBSL
RCBSL3	777773	/ANY NAME WILL DO
RCAC	CSIZE	/POINT TO SYSTEM SIZE; THEN SAVE AC FOR SAVE-RESTOR
	0	/BASE=0
RCBSL1	XSIZE	/TOP OF EXEC, POINTER, THEN VALUE
	-3	/TYPE INDICATOR FOR UNUSABLE SPACE
/
RCBSUL	RCBSL	/DUMMY NODE FOR ILLEGAL CORE ADDRESSES
	RCBSLL
RCSYSS	12	/SIZE OF SYSTEM SMALL NODE
RCSYSL	57	/SIZE OF SYSTEM LARGE NODE (TO 51 IF NO FPP)
RCSIZL	0	/CORE SIZE+1
RCNXM	400000	/LITERAL 400000, THEN 'SIZE' OF ILLEGAL NODE
	-3	/ILLEGAL SPACE
/
/  DEQUES WHERE WE HOLD SYSTEM LARGE AND SMALL NODES FOR OUR USE.
/  FEFORE ACTUAL RECONFIGURATION COLLECT WHAT WE WILL NEED. GIVE
/  BACK ANY XTRA AT END. IF WE RUN OUT DURING !!DISASTER!! AS WE
/  CAN'T HAVE EITHER OLD OR NEW SYSTEM.
/
RCLRG	RCLRG
	RCLRG
/
RCSML	RCSML
	RCSML
/
/
/
/
/
RCSIZ	FPHDWE		/POINTER TO FPP SWITCH/LATER USED BY RCNOD
	.EJECT
/
/    BEGINNING OF INITIALIZATION CODE: ALSO USED FOR STORAGE ETC.
/
RCR5	LAC*	RCBSL1	/FIND TOP OF EXEC
RCTMP	DAC	RCBSL1	/SAVE IT;RCTMP VOLATILE TEMPORARY
/
/			/NEXT TWO LOC'S ARG. PASSERS FR NODE PUSHERS
/
RC0	LAC	RCSYSL	/FIRST JOB, SET UP RCSYSL, DEFAULT 57 LONG
RC1	XCT*	RCSIZ	/SKIP IF FPP HARDWARE
RCTERM	AAC	-6	/NO FPP, ADJUST NODE SIZE
/
/
/			/NEXT FIVE HOLDING REG' FOR OUTSIDE LEVEL
/
RCR0	DAC	RCSYSL	/PLACE
RCR1	JMS	FACSV	/FETCH CHAR, LINK ON IFTERMINATOR
RCR2	DAC	RCTERM	/SAVE INCASE IT IS A TERMINATOR
RCR3	SNL!CLL!CLA!IAC	/SKIP ON TERM, DONE HERE, SET UP +1 IN AC
RCR4	JMP	.-3	/KEEP LOOKING FOR TERMINATOR
/
/
/  NEXT FIVE TEMPORARIES FOR THE NODE PUSHERS ET. AL.
/
/
RCT0	TAD*	RCAC	/FIRST LOC OF ILLEGAL MEMORY
RCT1	DAC	RCSIZL	/FOR NODE FOR ILLEGAL MEMORY
RCT2	CMA!IAC		/CREATE SIZE FOR THIS NODE
RCT3	TAD	RCNXM	/LITERAL 400000
RCT4	DAC	RCNXM
/
RCTEV	LAC	(RCMT	/MAKE XR CORRECTION; RCTEV EVENT VARIABLE
RCXRCR	AND	LMTT	/AND 770000; RCXRCR WHERE CORRECTION GOES
RCHLL	CMA!IAC		/MINUS; RCHLL USED BY RCNOD
RCHUL	DAC	RCXRCR	/PLACING INDEX CORRECTION;RCHUL USED BY RCNOD
	.EJECT
RCXR	JMP	RCSHUN	/#27 JUMP OVER NODE HEADER; SAVE XR LATER
RCMT0	RCMT1		/#27 NODE HEADER
	RCMT		/#27 BACKWARD POINTER
RCSHUN	JMS	CRTN	/#27 7 LOC'S OF INIT CODE IN NODE BODY
	JMS	RCTYP	/DIALOGUE
	MES504
	JMS	CRTN
	JMS	RCTYP
	MES505
	CLA!IAC		/CODE FOR RCBS FOR PARTITIONS
RCBST	JMS	RCBS	/CALL FOR PARTITIONS TYPIN
/
/			/IF SHORT VERSION, JUMP OVER SYS COMM, NODES.
/
	.IFDEF	RCP
RCPSND	JMP	RCST0
	.ENDC
/
/			/IF LONG VERSION, CONTINUE
/
	.IFUND	RCP
RCPSND	JMS	CRTN	/PSUEDO-NODE FOR NAME-BASE FROM DISK
	.ENDC
/
RCDSKP	JMS	RCTYP	/DISK READ STARTS HERE
RCDSKN	MES506		/NAME
	CLA		/CALL RCBS FOR SYSTEM COMMON
RCDSKB	JMS	RCBS	/BASE OF INSTALLED TASK
RCSCN0	JMS	CRTN	/THREE LOC'S FOR RCSCN
RCSCN1	JMS	RCTYP
RCSCN2	MES507
	LAW	-1
	JMS	RCBS	/CALL FOR SMALL NODE BLOCKS
	JMS	CRTN	/FOR BLOCKS OF LARGE NODES

	JMS	RCTYP

	MES508
	LAW	-2
	JMS	RCBS
	.EJECT
/

/  USE OF COMMON REGISTERS RCR0-RCR4 (RCST0 THRU RCST1)

/

/  RCR0  POINTS TO PRESENT NODE IN RCOLL

/  RCR1  -BASE OF 'UNIT' DESCRIBED BY NODE

/  RCR2  -TOP-1 OF 'UNIT'. THIS IS UPDATED AS WE EXAMINE

/             OVERLAPPED SPACE FROM TOP DOWN!

/  RCR3  BASE OF LARGEST PARTITION !NOT! STARTING AT ORIGINAL BASE

/              THAT IS AVAILABEL BETWEEN OVERLAP

/  RCR4  SIZE OF SAME PARTITION.

/

/     IF ANY SPACE AT ALL IS LEFT WITHIN THE ORIGINAL LIMITS

/  OF THIS 'UNIT' (PARTITION OR SYSTEM COMMON) A NEW UNIT WILL

/  BE CONSTRUCTED HAVING THE SAME NAME. IF THERE IS SPACE

/  INCLUDING THE ORIGINAL BASE, THAT WILL BE USED. OTHERWISE

/  THE LARGEST AVAILABLE SPACE WILL BE USED.

/
RCST0	LAC	(RCOLL	/SCAN THIS DEQUE
	JMS	RCSCN	/SCANNER
	JMP	RCST1	/WHEN NO MORE
LITNOP	NOP		/PARTITION JOINS SYSCOM; LITERAL
/			/NODES -1,-2 IMPOSSIBLE
/
	LAC	T.BA,X	/BASE OF ORIGINAL PARTITION

	CMA!IAC

	DAC	RCR1	/SAVE AS - FOR TESTING

	LAC	T.SZ,X	/SIZE

	CMA!IAC

	TAD	RCR1
	DAC	RCR2	/-(TOP+1) FOR TESTING

	DZM	RCR3

	DZM	RCR4	/0 'LARGEST PARTITION' PAIR
	LAC	(RCBSL	/SCAN NODE OF NEW UNITS FOR SPACE CONFLICT
	DAC	RC0
	DAC	RC1
RCST02	LAC	RCR0	/WITH THIS NODE

	JMS	RCSPC

	JMP	RCST08	/NO MORE CONFLICTS, BASE INTACT!

	JMS	SETXR	/POINT TO CONFLICTING NODE. NOTE RCSPC

/			/SCANS BACKWARDS!

	LAC	T.BA,X

	TAD	T.SZ,X	/TOP+! OF CONFLICT

	TAD	RCR2

	SMA		/ON MINUS, A SPACE I LEFT

	JMP	RCST03	/NO SPACE LEFT

	TAD	RCR4	/IS SPACE LEFT BIGGER THAN STORED ONE

	SMA!CMA!IAC	/IF MINUS, IT IS

	JMP	RCST03	/NOPE

	TAD	RCR4	/WATCH IT! THIS IS SIZE OF NEW SPACE

	DAC	RCR4

	TAD	RCR2	/AND THIS IS MINUS NEW BASE

	CMA!IAC

	DAC	RCR3

RCST03	LAC	T.BA,X	/CHECK IF ANY LEFT AT BOTTOM

	TAD	RCR1

	SPA!SNA

	JMP	RCST09	/OVERLAPS BOTTOM, GO FINISH UP

	LAC	T.BA,X	/MAKE NEW 'TOP' OF OUR DWINDLING UNIT

	CMA!IAC

	DAC	RCR2

	JMP	RCST02	/LOOK FOR FURTHER OVERLAPS

/

RCST08	LAC	RCR0	/BRING BACK NODE FROM RCOLL TO XR

	JMS	SETXR

	LAC	RCR2	/BASE IS INTACT, MAKE NEW SIZE

	TAD	T.BA,X
	CMA!IAC
	DAC	T.SZ,X	/NEW SIZE

	JMP	RCST07	/MOVE NODE FROM RCOLL TO RCBSL

RCST09	LAC	RCR0

	JMS	SETXR	/XR NOW WITH RCOLL NODE

	LAC	RCR3	/DO WE HAVE A PIECE LEFT?

	SNA!SPA
	JMP	RCSCNR	/RETURN TO SCANNER FOR NEXT!!
	DAC	T.BA,X	/YES BASE

	LAC	RCR4

	DAC	T.SZ,X	/SIZE

/

RCST07	LAC	(RCBSL	/DEQUE FOR LATER INSERTION

	DAC	RC0

	LAC	RCR0	/THIS NODE OUT OF DEQUE

	JMS	RCDEL

	JMS	RCPRI	/AND INTO RCBSL IN ORDER OF BASE
	JMP	RCSCNR	/RETURN TO SCANNER

/

/
RCST1	JMS	CRTN	/DOES USER WANT TO RECONFIGURE
	JMS	RCTYP
	MES511
	JMS	SCIFAC
	JMS	FACSV
	SAD	(116	/AN 'N'?
	JMP	RCGO42	/YES, JUST CLEAN UP AND EXIT!
/
RCGO	LAC	(RCSML	/CATCH SMALL NODES WE NEED FIRST!

	DAC	RC0	/FOR RCADD LATER
	LAC	(RCBSL
	JMS	RCSCN
	JMP	RCGO4	/NO MO
	JMP	RCSCNR	/NO ACTION OF PARTITIONS
	SKP		/SYS COM, SKIPS TO JOIN LARGE
	JMP	RCGO4	/SMALL ONE, NEED NO NODES, EXIT
	SZA		/NO PREVIOUS POINTER, NEED A NODE SKIP
	JMP	RCSCNR	/NO NEED, SCAN NEXT
RCGO2	JMS*	(PENP	/GET A NODE
	JMP	RCRER1	/RESOURCE ERROR #1

	JMS	RCADD	/STICK IN RCSML
	JMP	RCSCNR	/BACK FOR MORE

/
/
RCGO4	LAC	(RCLRG	/SIMILARLY PRECALCULATE LARGE NODE NEEDS

	DAC	RC0	/DEQUE OF OUR LARGE HOLDER

	DZM	RCR1	/COUNTER
	LAC	(RCOLL	/FIRST DEAD PARTITIONS GIVE US ONE EACH
	JMS	RCSCN
	JMP	RCGO6
	ISZ	RCR1	/PARTITION, COUT IT
	JMP	RCSCNR
/
/
RCGO6	LAC	(RCBSL	/TYPED UNITS (PLUS FITS OF OCCLUED PARTITIONS
	JMS	RCSCN
	JMP	RCGO9	/NO MO
	JMP	RCGO8	/GO DO PARTITION
	JMP	RCSCNR	/SYS COM NO ACTION
	JMP	RCSCNR	/SMALL, NO ACTION
/			/AND SYSTEM COMMON BLOCKS
	LAC	T.SZ,X	/GET SIZE OF BLK TO CONVERT INTO LARGE NODES
	MUL		/MULTIPLY BY NO. NODES PER 400 WDS
	5		/#27 ASSUME CAN ONLY GET FIVE; EVEN THE 'SIX'
/			/#27 CASE GIVES FIVE IF STARTING OF PAGE BOUND !!
	LLS	12	/#27 SHIFT NUMBER INTO AC (MUL ALREADY BY 400)
	JMP	RCGO71
RCGO8	SZA!CLA!CMA	/SKIP IF NEW ONE, WHICH NEEDS ONE
	JMP	RCSCNR	/OLD ONE DOESN'NEED ONE
RCGO71	TAD	RCR1

	DAC	RCR1
	JMP	RCSCNR
/
RCGO9	LAC	RCR1

	SMA		/NOT ENOUGH INTERNALLY, GRAB SOME
	JMP	RCGO11	/ENUF ALREADY

	LAC	(RCLRG	/FOR RCADD

	DAC	RC0

RCGO10	LAC	(LPOOL

	DAC*	(R1

	JMS*	(PICK	/GET A LARGE ONE

	JMP	RCRER2	/RAN OUT, RESOURCE ERROR #2

	JMS	RCADD	/KEEP IT

	ISZ	RCR1	/COUNT # NEEDED

	JMP	RCGO10

/

/  AT THIS POINT, WE'RE ASSUMING THAT ALL MUST GO WELL. IF IT

/  DOESN'T, THIS SYSTEM IS LIKELY TO HAVE BEEN FLAKY, AND CERTAINLY
/  WILL ATTAIN GREATER HEIGHTS THEREOF.

/
RCGO11	LAC	(RCBSL	/JOB 1; MAKE SMALL NODES, WE MAY NEED
	JMS	RCSCN
	JMP	RCGO99	/NO MO
	JMP	RCSCNR	/NO PARTITION ACTION
	JMP	RCSCNR	/NO SMALL ACTIN
	SKP!CLL		/WANT SMALL NODES, LINK0 FOR THAT
	JMP	RCSCNR	/NO ON LARGE
	LAC	(RCSML	/WHERE TO PUT CREATED NODES
	JMS	RCNOD	/THIS DOES ALL WORK

	LAC	(RCSML	/GET ONE TO SYSTEM LIST 'SNDL'

/			/TO DESCRIBED CREATED PARITITON

	JMS	RCPIK	/PICKER FOR OUR DEQUES
	JMP	DOOM	/NONE!! CRASH

	DAC*	(R2	/FOR SYSTEM DEQUE 'PUTTER'

	LAC	(SNDL	/DEQUE INTO WHICH TO GO
	JMS	RCGO15	/SUBROUTINE TO CREATE THE SYSTEM NODE
	JMP	RCSCNR	/GO CHECK OUT NEXT ONE

/

/
RCGO99	LAC	(RCOLL	/NEXT.DELETE SYSTEM NODES FROM
/			/ 'SCDL' DEQUE FOR DELETED SYSTEM COMMON
	JMS	RCSCN
	JMP	RCGO97	/DONE
	JMP	RCSCNR	/NOT ON PARTITIONS
	DAC	RCR1	/HOLD

	DAC*	(R1	/SYSTEM NODE DELETER

	JMS*	(NDEL

	LAC	(RCSML	/OUR SMALL NODE HOLDER DEQUE

	DAC	RC0	/FOR RCADD

	LAC	RCR1	/NODE ADDR.

	JMS	RCADD

	JMS	RCGO16	/OUR SIZE NODE FROM RCOLL, WHERE NO

/			/LONGER NEEDED , TO RCMT.
	JMP	RCSCNR

/

/
RCGO97	LAC	(RCOLL	/ 'PBDL' NODES FOR TOTALLY
/			/ZAPPED PARTITIONS INTO RCLRG, OUR LARGE
/			/NODE HOLDER. LEAVE ENTRIES IN RCOLL FOR
/			/LATER STL NODE DEACTIVATION.
	JMS	RCSCN
	JMP	RCGO13	/NO MORE. NOTE ONLY PARTITIONS LEFT!!!
	DAC	RCR1	/SAVE IT

	DAC*	(R1	/SYSTEM DELETER

	JMS*	(NDEL

	LAC	(RCLRG	/DEQUE HEAD OF OUR LARGE NODE HOLDER

	DAC	RC0

	LAC	RCR1	/BRING BACK NODE ADDR

	JMS	RCADD	/OUR NODE 'PUTTER'
	JMP	RCSCNR

/

/
RCGO13	LAC	(RCBSL	/MAKE LARGE NODE PARTITIONS, IF ANY.
	JMS	RCSCN
	JMP	RCGO17
	JMP	RCSCNR
	JMP	RCSCNR
	JMP	RCSCNR
	CML!CLL		/FOR LARGE ONES
	LAC	(RCLRG	/WHERE TO PUT THEM
	JMS	RCNOD

	LAC	(RCSML	/SMALL NODES FOR SYSTEM LIST 'LNDL'

	JMS	RCPIK	/BETTER BE ONE
	JMP	DOOM	/WRONG
	DAC*	(R2	/FOR SYSTEM PUTTER

	LAC	(LNDL	/SYSTEM LIST
	JMS	RCGO15	/SUBROUTINE TO MAKE SYSTEM NODE
	JMP	RCSCNR
	.EJECT

/

/
/  RCGO15  CREATE  A SMALL NODE  NAME,NAME,BASE,SIZE,0,0,ACCESS CHAR,0

/

/     AND ENTER INTO SYSTEM LIST CONTAINED IN AC. R2 HAS NODE ADDR.

/    XR IS SET UP FOR RCBSL OR RCOLL ENTRY WITH NAME ETC. UNTHREAD

/   RCBSL OR RCOLL ENTRY (POINTER IN RCR0) AND RETURN TO RCMT WHEN

/  DONE WITH FIRST JOB.

/

/
RCGO15	0

	DAC*	(R1	/DEQUE HEAD FOR SYSTEM PUTTER

	LAC*	(R2	/GET BACK NODE ADDR

	IAC

	DAC*	(X17	/AUTO-INCR FOR FILLING

	LAC	T.N1,X	/NAME

	DAC*	X17

	LAC	T.N2,X	/NAME

	DAC*	X17

	LAC	T.BA,X

	DAC*	X17	/BASE

	LAC	T.SZ,X

	DAC*	X17	/SIZE
	DZM*	X17	/ZERO NEST TWO ENTRIES FOR NOW
	DZM*	X17
	LAC	T.AC,X	/ACCESS CHAR
	DAC*	X17
	DZM*	X17	/ZERO LAST ENTRY
	JMS*	(SPRI	/PLACE IN DEQUE

	JMS	RCGO16	/SUBROUTINE TO UNTHREAD NODE IN RCR0

	JMP*	RCGO15

/

/

/   RCGO16  UNTHREAD NODE WHOSE ADDR IN RCR0, PLACE IN DEQUE RCMT.

/

RCGO16	0

	LAC	(RCMT

	DAC	RC0

	LAC	RCR0

	JMS	RCDEL

	JMS	RCADD

	JMP*	RCGO16

/

/
RCGO17	LAC	(RCBSL	/HANDLE SYSTEM COMMON. IF ALREADY EXIST,
	JMS	RCSCN
	JMP	RCGO20
	JMP	RCGO18	/ONLY PART+ SYSCOM LEFT!
/			/CHANGE BASE SIZE;IF NOT MAKE NEW NODE.
/			/TAKE NODE FROM RCBSL WHEN DONE.
	SNA		/SKIP IF POINTER TO EXIST NODE
	JMP	RCGO19	/NOPE, A NEW ONE
	DAC*	(R1	/T.SY SCDL NODE ADDR IN AC.SAVE FOR UNTHREAD
	DAC	RCR3	/RETHREAD IN CASE REPOISITIONED IN CORE
	AAC	T.BA-1	/POINTER TO BASE,BASE,SIZE IN SYS. COM.
	DAC*	(X17
	LAC	T.BA,X	/FROM STORAGE IN RCBSL NODE
	.INH		/LOCK OUT SYSTEM
	DAC*	X17	/BASE
	DAC*	X17	/BASE AGAIN!
	LAC	T.SZ,X
	DAC*	X17	/SIZE
	LAC*	X17	/SKIP WD 7
	LAC	T.AC,X	/ACCESS CHAR
	.ENB
	DAC*	X17
	JMS	RCGO16	/TAKE NODE FROM RCBSL
	JMS*	(NDEL	/PULL SCDL NODE
	LAC	RCR3	/RETHREAD IN CASE IN DIFFERENT PLACE
	DAC*	(R2
	LAC	(SCDL
	DAC*	(R1
	JMS*	(SPRI
	JMP	RCSCNR
/
RCGO18	SZA		/SKIP IF PARTITION WITHOUT PBDL (I.E. NEW)
	JMP	RCSCNR	/ONES WITH PBDL ARE LEFT ALONE
/
/  WE AR NOW GOING TO DO A NASTY. SYSTEM COMMON NODES ARE BEING YANDKED
/  FROM RCBSL. WE ARE NOW GOING TO ASSIGN T.TI=0 TO MEAN A PARTITION
/  THAT DIDN'T HAVE AN ASSOCIATED PBDL. WE ARE GOING TO RCLRG TO GET
/  A LARGE NODE FOR IT(BUT NOT THREAD) FOR BENEFIT OF CODE
/  FOLLOWING RCGO32. POINTER TO LARGE NODE TO T.SY, WHICH IS WHY
/  WE HAVE TO DISTINGUISH THRU T.TI.
/
	LAC	(RCLRG	/PIK A NODE FROM OUR LARGE HOLDER
	JMS	RCPIK
	JMP	DOOM	/NONE, DIE
	DAC	T.SY,X	/SAVE POINTER TO NODE
	DZM	T.TI,X	/PRETEND WE ARE SYSCOM
	JMP	RCSCNR	/CONTINUE SCAN OF RCBSL
/
/
RCGO19	LAC	(RCSML	/GET SMALL NODE FROM OUR SUPPLY

	JMS	RCPIK
	JMP	DOOM
	DAC	RCR4	/#EDIT 12# SAVE NODE POINTR TO ADJ BA,SZ
	DAC*	(R2	/SYSTEM PUTTER
	LAC	(SCDL	/SYSTEM COMMON DESCRIPTOR DEQUE
	JMS	RCGO15	/NODE MAKER SUBROUTINE
/
/  EDIT #12 NEXT SIX INSTRUCTIONS, BASE IN +4,+5, SIZE IN +6.
/  RCGO15 PUT BASE IN +4 AND SIZE IN +5
/
	LAC	RCR4	/BRING BACK POINTER TO NODE
	JMS	SETXR	/ADJUSTED VALUE TO XR
	LAC	T.SZ,X	/SIZE FROM 5
	DAC	T.SZ+1,X /TO 6
	LAC	T.BA,X	/BASE FROM 4
	DAC	T.SZ,X	/TO 5
/
/  RCSCNR  ESTABLISHES XR FROM ITS STORAGE, WE JUST GO THERE
/
/  END OF EDIT #12
/
	JMP	RCSCNR
/
/
/
RCGO20	LAC*	(STKL

	DAC	RCR4
RCGO21	LAC	RCR4

	SAD	(STKL
	JMP	RCGO95

	DAC	RCR0

	JMS	SETXR

	LAC	0,X

	DAC	RCR4

	LAC	S.DP,X

	AND	(RCINP+PRTFL

	SNA

	JMP	RCGO21

	AND	(PRTFL

	SZA
	JMP	RCGO30
	LAC	S.PB,X
	JMS	SETXR
	LAC	(RCBSL
	JMS	RCSNM
	JMP	RCGO24	/DISABLE. IF INPROGRESS SET AND NOT IN RCBSL, IN RCOLL!!
	AAC	T.BA-1
	DAC*	(X17
	LAC	RCR0
	JMS	SETXR
	LAC	S.EP,X	/GET TASK SIZE (REMOVE MM BITS)
	RTL
	SPA!CLA!CMA
LM400	LAW	-400	/LITERAL
	AND	S.TS,X
	CMA!IAC

	DAC	RCR2

	LAC	S.EP,X

	RTL

	SPA

	JMP	RCGO22
	LAC	S.PB,X
	JMS	SETXR
	LAC	T.BA,X

	SAD*	X17
	JMP	RCGO23

	JMP	RCGO24

RCGO22	ISZ*	(X17
RCGO23	LAC	RCR2

	TAD*	X17
	SMA

	JMP	RCGO21

RCGO24	LAC	RCR0
	JMS	SETXR
	.INH

	LAC	S.DP,X

	AND	(PRTFLM

	TAD	(PRTFL

	.ENB

	DAC	S.DP,X

	JMP	RCGO21

/
RCGO30	.INH

	LAC	S.DP,X

	AND	(RCINPM

	TAD	(RCINP

	.ENB
	DAC	S.DP,X
	LAC	S.DA,X	/DISK ADDR OF IMAGE
	AND	(377	/KEEP PLATTER PART
	DAC	RCDSKC	/AND PLACE IN CAL
	XOR	S.DA,X	/GET ADDR PART
	TAD	LM400	/TOUGH!ADD 777400 TO BACK UP ONE BLOCK TO
/			/EXTAR BLOCK IN FRONT OF IMAGE HAVING
/			/NAME-BASE INFO
/
	DAC	RCDSKA	/PLACE IN CAL
	CAL	RCDSK
	CAL	RCTWT
	LAC	RCTEV

	SPA
	JMP	RCGO21	/THIS ONE DEAD ON DISK, DO OTHERS!
	LAC	(RCPSND	/KLUDGE, RCSNM WANTS NODE IN XR
	JMS	SETXR
	LAC	(RCBSL	/THIS DQ
	JMS	RCSNM

	JMP	RCGO21
	AAC	T.BA-1
	DAC*	(X17
	LAC	RCR0	/RESTORE XR
	JMS	SETXR
	LAC	S.EP,X	/GET TASK SIZE
	RTL
	SPA!CLA!CMA
	LAW	-400
	AND	S.TS,X
	CMA!IAC

	DAC	RCR2

	LAC	S.EP,X

	RTL

	SPA
	JMP	RCGO31

	LAC	RCDSKB	/BASE FROM DISK

	SAD*	X17

	JMP	RCGO32

	JMP	RCGO21

RCGO31	ISZ*	(X17
RCGO32	LAC	RCR2
	TAD*	X17
	SPA
	JMP	RCGO21
	LAC	RCR0

	JMS	SETXR

	.INH

	LAC	S.DP,X

	AND	(PRTFLM

	.ENB

	DAC	S.DP,X

	ISZ*	(X17

	LAC*	X17

	DAC	S.PB,X
	JMP	RCGO21
/
RCGO95	LAC	(RCBSL
	JMS	RCSCN
	JMP	RCGO41	
	JMP	RCGO94	/DIRTY! RCGO18 MADE PARTITION WITH NO PRIOR
/			/HISTORY LOOK LIKE COMMON BLOK. WE HAVE TO
	JMS	RCMAK	/MAKE UP A PBDL NODE AND THREAD IT
	JMP	RCSCNR	/AND CONTINUE SCAN
/
/  NOW DO ONE THAT USED TO HAVE A PBDL
/
RCGO94	DAC*	(R1	/FOR LATER SYSTEM CALLS
	DAC	RCR3
	AAC	T.BA-1
	DAC*	(X17
	LAC	T.BA,X
	.INH
	DAC*	X17
	LAC	T.SZ,X
	DAC*	X17
	LAC*	X17	/SKIP WDS 6 AND 7
	LAC*	X17
	LAC	T.AC,X	/ENTER ACCESS CHAR
	.ENB
	DAC*	X17
	JMS*	(NDEL	/PULL PBDL NODE FROM DEQUE, IT MAY HAVE TO
/			/GO BACK IN DIFFERENT PLACE
	LAC	RCR3	/GET BACK HEADER ADDR
	DAC*	(R2
	LAC	(PBDL	/INTO THIS DEQUE
	DAC*	(R1
	JMS*	(SPRI	/ORDER IN PBDL LIST BY BASE ADDR
	JMP	RCSCNR
/
/
RCGO41	JMS	CRTN
	JMS	RCTYP	/TELL WORL D IT WORKED
	MES513
/
	.EJECT
/
RCGO42	LAC	(POOL
	DAC*	(R1	/SET UP LISTHEAD
	LAC	(RCSML	/OUR HOLDING DEQUE
	JMS	RCPIK
	JMP	RCEX2	/ALL DONE
	DAC*	(R2	/SAVE NODE ADDR
	JMS*	(NADD	/RETURN NODE
	JMP	RCGO42	/CONTINUE
RCEX2	LAC	(LPOOL	/SAME THING FOR LARGE NODES
	DAC*	(R1
	LAC	(RCLRG
	JMS	RCPIK
	JMP	RCEX3
	DAC*	(R2
	JMS*	(NADD	/RETURN NODE
	JMP	RCEX2
/
RCEX3	CLL!CLA		/CLEAR BIT ON ALL PART POINTERS
	JMS	RCLOK
RCEX4	LAC	RCTERM	/DID CALLER GIVE ALT-MODE OR CARRIAGE RETURN
	SAD	(15	/CARRIAGE RETURN
	CAL	RCZOT	/YES, CALL MCR
	SAD	(175	/ALT-MODE
	DZM*	(MCRRI	/YES, ZERO FLAG
	CAL	(10
RCZOT	1
	RCTEV
	.SIXBT '...'
	.SIXBT 'MCR'
	0
/
RCRER1	JMS	RCTYP
	MES581
	JMP	RCGO42
RCRER2	JMS	RCTYP
	MES580
	JMP	RCGO42
	.EJECT
/
/
/    GENERALIZE NODE SCANNER. CALL FIRST TIME WITH JMS AT RCSCN.
/  CALL WITH ADDR OF DEQUE HEAD IN AC.
/
/  THE SECOND TIME THRU N, JUMP TO RCSCNR.
/
/  WARNING, THE NODES REFERENCED MUST HAVE VALUES -3 TO +1 IN T.TI
/
/
/  RCSCN WILL MAINTAIN THE ADDR OF THE PRESENT NODE IN RCR0.
/  THE XR WILL BE SET UP WITH SAME NODE ADDR. IT WILL EXIT,
/  EXCEPT ON EMPTY EXIT, WITH T.SY,X IN AC.
/
/  THE FOLLOWING SKIP RETURNS ARE GENERATED.
/
/	JMS	RCSCN
/	NO MORE
/	PARTITION BLOCK		1
/	SYSTEM COMMON		0
/	SMALL NODE BLOCK	-1
/	LARGE NODE BLOCK	-2
/
/  WARNING, THE CODE THAT CALLS IT CAN 'KNOW' THAT THERE ARE
/  NO MORE OF SOME ITEMS TO SHORTEN ITS CALLING SEQUENCE
/
/  RCSCN USES THREE TEMPORARIES
/
/RCSCN0  KEEPS THE DEQUE ADDR FOR A DONE COMPARE
/RCSCN1  IS THE ADDR OF THE !NEXT! NODE TO BE DONE. THE PRESENT
/	  ONE MAY BE DETHREADED!!!!
/RCSCN2   IS A TEMPORARY FOR RETURN ADDR CALCULATION
/
/
RCSCN	0
	DAC	RCSCN0	/SAVE HEAD
	LAC*	RCSCN0	/GET 'NEXT' TO JOIN LOOP
	SKP
RCSCNR	LAC	RCSCN1	/OTHER THAN FIRST TIME ENTRY GET NEXT ONE.
	SAD	RCSCN0	/DONE
	JMP*	RCSCN	/YES, NO SKIPS
	DAC	RCR0	/KEEP NODE FOR CALLER
	JMS	SETXR	/SET UP IN XR FOR HIM
	LAC	0,X	/GET NEW NEXT ONE
	DAC	RCSCN1	/SAVE IT
	LAC	T.TI,X	/OK, WHAT KIND IS IT 1 TO -2 LEGAL
	AAC	3	/CHECK FOR -3, AND FOR SMALLER
	SNA		/SKIP IF NOT -3
	JMP	RCSCNR	/-3 NEGLECT, GET NEXT
	SPA!CMA!IAC	/SKIP IF LEGAL
	JMP	DOOM
	AAC	5	/CALCULATE SKIPS
	SNA!SPA		/ORGINAL >1 NO SKIP
	JMP	DOOM	/BECAUSE IT IS DEATH
	TAD	RCSCN	/BASE OF SKIP LIST
	DAC	RCSCN2	/FOR JMP*
	LAC	T.SY,X	/USER MOST OF TIME WANTS THIS IN AC!!
	JMP*	RCSCN2
	.EJECT
/
/
/

/
/
/RCBS - SUBROUTINE TO READ LINE(S) TO FORM NAME-BASE-SIZE

/ DESCRIPTION NODES FOR PARTITION, COMMON, AND NODE BLOCKS BY 

/ ACCEPTING INPUT OF FOLLOWING FORMAT UNTIL A ZERO LENGTH LINE :

/

/  SYNTAX = <NAME>"("<BASE>","<SIZE>")" <CR>/<AM>

/

/  CALL WITH THE NODE TYPE IN THE AC

/

/

/ THE NODES ARE INSERTED INTO A DEQUE BY ORDER OF BASE ADDRESS.

/ INVALID INPUT IS RE-REQUESTED.

/
/

/		TEMPORARIES FOR 'OUTSIDE' LEVEL CODE, NOT TOUCHED

/		BY SUBROUTINES.

/

/  USE IN RCBS

/
/RCR0	0		/TEMPORARY
/RCR1	0		/DEL THIS NODE FROM RCOLL
/RCR2	0		/ADDR OF PDBL NODE IN PART. MATCH CASE
/RCR3	0		/ADDR OF PDBL NODE IN COMMON MATCH CASE
/RCR4	0		/SET IF PRESENT NAME PBDL OVERLAPS
/			/EXISTING PBDL OF SAME NAME!

/
RCBS	0
	DAC	RCBST	/SAVE TYPE OF 'UNITS' BEING INPUT
RCBS1	JMS	SCIFAC	/#27 READ NEXT INPUT LINE
	LAC	RCBSN	/DO WE HAVE A NODE
	DZM	RCR1	/ZERO SPECIAL CASE REG'S
	DZM	RCR2
	DZM	RCR3
	DZM	RCR4
	SZA		/SKIP IF NOT
	JMP	RCBS11	/GOT ONE, GO GET A USER TYPED LINE

	LAC	(RCMT	/MT NODE DEQUE FOR 'OUR' NODES
	JMS	RCPIK	/PICK A NODE FROM THIS DEQUE
	JMP	RCRER1	/RESOURCE ERROR 1
	DAC	RCBSN	/SAVE NODE ADDRESS
RCBS11	JMS	SETXR	/########  EDIT #27 THRU LABEL RCBS32
	AAC	7	/LIMIT REG RELATIVE TO XR
	PAL
	JMS	FACSV	/FETCH CHAR, LINK=1 FOR TERMINATE
	SZL		/SKIP ON DATA CHAR
	JMP*	RCBS	/NULL LINE, ALL DATA IN FOR THIS TYPE
	SAD	(50	/LEADING ( IS ILLEGAL
	JMP	RCBSSE	/SYNTAX ERROR
	SKP		/JOIN REGULAR LOOP
RCBS2	JMS	FACSV	/FETCH NEXT CHAR
	SAD	(50	/( TERMINATES NAME
	JMP	RCBS3	/NULL FILL REST
	DAC	2,X	/WE ARE USE 7 LOC'S OF NODE BODY AS TEMPORARY
	AXS	1	/STILL SPACE
	JMP	RCBS2	/YES
	JMP	RCBSSE	/SYNTAX ERROR, NAME TOO LONG
RCBS3	DZM	2,X	/NULL FILL THR 7 LOC'S
	AXS	1
	JMP	RCBS3	/KEEP NULLING IT OUT
	AXR	-5	/NASTY, BACK UP TO FETCH SIXBIT
RCBS31	LAC	2,X	/COMES IN IN ASCII, PLACE 6 BITS IN MQ
	LRS	6
	LAC	1,X
	LRS	6
	LAC	0,X
	LLS	14	/NOW HAVE SIXBIT IN AC
	DAC	0,X	/CORRECT FOR FIRST NAME WORD; IRREL FOR SECOND
	AXS	3	/STILL TO DO SECOND WORD?
	JMP	RCBS31	/YES
	AXR	-10	/XR BACK TO POINT TO START OF NODE
	DAC	T.N2,X	/SECOND NAME WORD IN RIGHT PLACE
RCBS32	DZM	T.SY,X	/ZERO NODE INFO (T.AC,X ZEROED AT RCBS3!)
	LAC	(RCBSL	/ADDR OF OUR DEQUE. DID THIS NAME ALREADY
	JMS	RCSNM	/CHECK NAME MATCH OF NODE ADDR. IN AC

/			/WITH DEQUE WHOSE HEADR ADDR. IS IN RC0
	JMP	RCBS34	/NAME NOT FOUND, THAT'S FINE, CONTINUE

	JMS	RCTYP	/NAME ALREADY USED, TYPE MESSAGE ARE RETYR

	MES594

	JMP	RCBS1

/
RCBS34	LAC	(SNDL	/NOW SEE IF A SMALL NODE BLOCK HAS THIS NAME
	JMS	RCSNM

	JMP	RCBS36	/NAME NOT USED, OK

RCBS35	JMS	RCTYP	/ERROR MESSAGE

	MES595

	JMP	RCBS1	/TO TOP OF LINE GET LOOP

/
RCBS36	LAC	(LNDL	/LARGE NODE NAME CHECK
	JMS	RCSNM
	JMP	RCBS4
	JMP	RCBS35
/
/
RCBS4	JMS	AOCTK	/MAKE OCTAL NUMBER FROM INPUT STREAM

	SAD	(54	/NUMBER ENDED BY A COMMA?

	SKP		/YES, IT SHOULD BE, KEEP GOING
	JMP	RCBSSE	/SYNTAX ERROR IF NOT SO TERMINATED
	PLA		/GET BACK QUANTITY TO AC
	DAC	T.BA,X	/STORE IN NODE IN CASE TURNS OUT TO BE OK
	AND	LM400	/FOR MULT OF 400 OCTAL CHECK (777400
	SAD	T.BA,X	/IF THESE SAME, IT IS A MULTIPLE OF 400
	SPA		/MUST ALSO BE POSITIVE BASE
	JMP	RCBSZE	/TYPE SIZE ERR
	JMS	AOCTK	/ASSEMBLE SIZE AS OCTAL CONSTANT

	SAD	(51	/TERMINATED BY RIGHT PAREN

	SKP		/YES, OK

	JMP	RCBSSE	/NO, SYTAX ERROR

	PLA		/GET BACK SIZE
	SPA!SNA
	JMP	RCBSZE	/NO, SIZE ERROR
	DAC	T.SZ,X	/YES, PLACE IN NODE
	CLQ!LLS!12	/MULTIPLE OF 256, SIMILAR TO AND (377
	SZA		/SKIP IF YES
	JMP	RCBSZE	/NO, SIZE ERROR
	LAC	RCBST	/TYPE INDICATOR TO NODE
	DAC	T.TI,X
	SPA!CLA!CMA	/SKIP IF A PARTITION OR SYSCOM, SET UP -1
	TAD	(300000	/ALL OTHERS ILLEGAL AT 32K, BOOST AC FOR TEST
	TAD	T.BA,X	/BASE+SIZE-1 FOR TOP ADDR
	TAD	T.SZ,X
	SPA		/ALL RIGHT UNLESS CHANGED ALL WAY TO -
	JMP	RCBSO3	/OVERFLOW ERROR, IT DOES
/
/
RCBS7	LAC	(RCBSL	/CHECK NEW UNITS FOR SPACE CONFLICT
	JMS	RCCHEK	/WITH UNIT JUST TYPED
	MES590
	LAC	(SNDL	/CHECK NEW UNITS AND SNDL
	JMS	RCCHEK
	MES596
	LAC	(LNDL	/SAME THING FOR LNDL
	JMS	RCCHEK
	MES596
RCBS9	LAC	(PBDL	/CHECK FOR NEW UNIT MATCH ON PBDL
	CLL
	JMS	RCCONF
	LAC	(SCDL	/CHECK FOR NEW UNIT MATCH ON SCDL
	CLL!CML
	JMS	RCCONF
/
RCBT2	LAC	(PBDL	/CHECK FOR OVERLAP ON PBDL
	CLL
	JMS	SPACE
	LAC	(SCDL	/CHECK FOR OVERLAP ON SCDL
	CLL!CML
	JMS	SPACE
	LAC	(RCBSL	/PREPARE TO INSERT A NODE
	DAC	RC0
	LAC	RCBSN
	JMS	RCPRI	/INSERT THE NODE
	JMS	SETXR
	DZM	RCBSN	/SHOW WE NO LONGER HAVE A NODE
RCBT41	LAC	(RCMT
	DAC	RC0
	LAC	RCR1	/WAS NODE FLAGGED FOR DELETION?
	SNA
	JMP	RCBT42	/NO
	SPA		/YES -- IF SCDL DO A CMA ON NEG ADDR
	CMA
	JMS	RCDEL	/DELETE THE NODE
	JMS	RCADD	/RETURN NODE
RCBT42	JMS	RCPOP	/GET ADDR OF NODE TO ADD
	JMP	RCBS1	/DONE , DO NEXT TYPED UNIT
	JMS	RCMOLL
	JMP	RCBT42
/
RCBSSE	JMS	RCTYP
	MES591
	JMP	RCBS1

/

RCBSZE	JMS	RCTYP

	MES592		/INVALID SIZE

	JMP	RCBS1

/
RCBSO3	JMS	RCTYP
	MES589
	JMP	RCBS1
/
RCERB	JMS	RCTYP
	MES597
	JMP	RCBS1
/
RCMT2=RCMT1+RCNDSZ	/ADDR OF FIRST DETHREADED MT NODE

/
RCBSN	RCMT2		/ADDRESS OF THE NODE WE ARE CREATING
/			/A 'NODE' MADE FROM FRIST TYPEOUT.
/			/1 PARTITION BLOCK, BUT NAME IS NEW

/			/0 COMMON BLOCK

/			/-1 BOCK OF SMALL NODES

/			/-2 BLOCK OF LARGE NODES
/			/-3 UNUSABLE SPACE (EXISTING SYSTEM OR ILLEGAL

/			/CORE)
/
	.EJECT
/
/ RCCHEK -- CHECK UNITS FOR SPACE CONFLICT
/
/ AC=LISTHEAD ON ENTRY
/ RETURN AT JMS+2 IF OK
/ PRINT MESSAGE AT JMS+1 IF NO GOOD AND GO TO RCBS1
/
RCCHEK	0
	DAC	RC0	/SAVE LISTHEAD
	DAC	RC1
	LAC*	RCCHEK	/GET THE ERROR MESSAGE
	DAC	RCCHE1	/POSITION IT IN CASE OF ERROR
	ISZ	RCCHEK	/PREPARE FOR RETURN AT JMS+2
	LAC	RCBSN	/IS THER A CONFLICT?
	JMS	RCSPC
	JMP*	RCCHEK	/NO -- RETURN
	JMS	RCTYP	/YES -- TELL USER OF ERROR
RCCHE1	XX
	JMP	RCBS1
	.EJECT
/
/ RCCONF -- CHECK IF TYPED UNIT MATCHES EXISTING UNIT
/
/ ENTER WITH LISTHEAD IN AC (PBDL OR SCDL)
/ SET LINK FOR SCDL, CLEAR LINK FOR PBDL
/
/ RETURN AT JMS+1 UNLESS ERROR
/
/ MODIFIED REG:RCTMP,AC,L,RCR5,RCR0,RCR2,XR,RCR1,RCR4,RCT0,RCT1,RCT2
/ RC0,X15,X16,X17
/
RCCONF	0
	DAC	RCTMP	/SAVE AC
	CLA!RAL		/MAKE RCR5 A NOP IF PBDL OR A CMA IF SCDL
	TAD	LITNOP
	DAC	RCR5
	LAC	RCTMP	/IS PRESENT UNIT IN SYSTEM LIST?
	JMS	RCSNM
	JMP*	RCCONF	/NBO -- RETURN
	DAC	T.SY,X	/YES -- SAVE POINTER TO SYSTEM NODE
	DAC	RCR0	/SAVE ADDR OF NODE
	DAC	RCR2
	AAC	10	/PREPARE TO GET ACCESS CHAR
	DAC	RCTMP
	LAC*	RCTMP	/GET ACCESS CHAR FORM SYSTEM NODE
	DAC	T.AC,X	/SAVE IT
	LAC	RCR5	/IS THIS THE SCDL OR PBDL?
	SAD	LITNOP
	JMP	RCCON1	/PBDL
	LAC	RCBST	/SCDL -- IS MATCHED UNIT OF SAME TYPE?
	SZA
	JMP	RCBS35	/NO -- ERROR
	JMS	RCTYP	/YES -- PRINT WARNING MESSAGE (SYSCOM CHANGE)
	MES512
	LAC	RCBSN	/RESET XR
	JMS	SETXR
	JMP	RCCON2	/GO REJOIN PBDL CODE
RCCON1	LAC	RCBST	/IS MATCHED UNIT OF SAME TYPE?
	SPA!SNA
	JMP	RCBS35	/NO -- ERROR
RCCON2	LAC	(RCOLL	/YES -- NAME IN RCOLL ALREADY?
	JMS	RCSNM
	JMP	RCCON3	/NO 
	DAC	RCR1	/YES -- SAVE ADDR FOR LATER DELETE
	JMP*	RCCONF	/RETURN
RCCON3	LAC	RCR0	/GET NODE ADDR
	XCT	RCR5	/IF SCDL CMA THE ADDR
	JMS	RCHLD	/TRY TO LOCK UP PART OR SYSCOM
	JMP	RCERB	/CAN'T GET MEM BLK -- ERROR
	DAC	RCR4	/GOT IT -- SAVE ADDR OR CMA OF ADDR AS FLAG
	JMP*	RCCONF	/RETURN
	.EJECT
/
/SPACE -- CHECK IF PRESENT UNIT HAS OVERLAPPED A SYSTEM BLOCK
/
/ ENTER WITH LISTHEAD IN AC, L=1 FOR SYSCOM AND L=0 FOR PART.
/ RCR4  AND RCR2 ARE USED AS FLAGS
/
/ RETURN AT JMS+1 IF OK
/
/ MODIFEED REG:L,AC,RC1,RCR3,RC0,RCT0,RCT1,RCT2,X15,X16,X17
/ RCR0,XR,RCSIZ,RCHLL,RCHUL
/
/
SPACE	0
	DAC	RC1	/SAVE LISTHEAD FOR CALL TO RCSPC
	DAC	RCR3	/ALSO SAME AC TEMPORARILY
	CLA!RAL		/MAKE RCR5 A NOP IF PBDL OR A CMA IF SCDL
	TAD	LITNOP
	DAC	RCR5
SPAC1	LAC	RCR3	/GET LISTHEAD
	DAC	RC0	/SETUP FOR CALL TO RCSPC
	LAC	RCBSN	/GET NODE ADDR
	XCT	RCR5	/DO A CMA IF SCDL
	JMS	RCSPC	/ANY CONFLICTS?
	JMP*	SPACE	/NO -- RETURN
	DAC	RCR0	/YES -- SAVE NODE ADDR 
	SAD	RCR2	/ALREADY PICKED UP BY MATCH ON PRESENT UNIT?
	JMP	SPAC1	/YES -- OK
	JMS	SETXR	/NO -- PREPARE TO ACCESS NODE
	LAC	(RCBSL	/SCAN RCBSL FOR CONFLICTING NODE NAME
	JMS	RCSNM
	SKP
	JMP	SPAC1	/FOUND -- CONTINUE
	LAC	(RCOLL	/NOT FOUND -- SCAN RCOLL
	JMS	RCSNM
	SKP
	JMP	SPAC1	/FOUND -- CONTINUE
	LAC	RCR0	/NOT FOUND -- CAN IT BE LOCKED UP?
	XCT	RCR5
	JMS	RCHLD
	JMP	RCUNDO	/NO -- UNLOCK
	LAC	RCR5	/YES -- IS THIS SYSCOM?
	SAD	LITNOP
	JMP	SPAC2	/NO
	JMS	RCSAV	/YES -- SAVE AC AND XR
	JMS	RCTYP	/TYPE WARNING MESSAGE
	MES512
	JMS	RCRST	/RESTORE REGISTERS
	AXR	1	/#23 INCREMENT XR SO RCNOD GETS CORRECT BASE+SIZE FOR SYSCOM
SPAC2	LAC	RCBST	/#26 NO NODE FILL IF PRESENT IS L/S NODE BLOCK
	RAL		/#26 SAVE SIGN
	LAC	(RCMT	/#26CONVERT SPACE INTO SMALL NODES
	SNL!CLL		/#26 ONLY IF PRESENT UNIT PARTI. OR SYS COM
	JMS	RCNOD
/			/#24JMS RSRCT WRONG FOR PARTITION CASE. LEAVE
/			/#24XR 'FLOATING'. ITS VALUE IS NOT ASSUMED!
	LAC	(RCWRK	/GET A NODE FROM RCWRK
	DAC	RC0
	LAC	(RCMT
	JMS	RCPIK
	JMP	RCRER1	/LIST EMPTY -- ERROR
	JMS	RCADD	/ADD TO LIST
	IAC
	DAC*	(X17	/PREPARE TO DO A PUSH
	LAC	RCR0	/PUSH THE ADDR OR CMA OF NODE
	XCT	RCR5	/(25)COMPLEMENT IF SYS COM 
	DAC*	X17
	JMP	SPAC1	/CONTINUE
RCUNDO	LAC	RCR4	/IS BLK IN RCOLL AND LOCKED UP?
	SZA
	JMP	RCUNDP	/NO
RCUNDQ	JMS	RCPOP	/YES
	JMP	RCERB	/TELL USER OF ERROR
RCUNDP	CLL
	JMS	RCLOK
	JMP	RCUNDQ
	.EJECT
/

/
/  SETXR  TAKE ADDRESS IN AC, SUBTRACT CURRENT PAGE BITS,
/  AND PLACE INTO THE INDEX REGISTER

/
/

SETXR	0
	TAD	RCXRCR

	PAX

	JMP*	SETXR

/
/
/
/
/  SCIFAC  - SUBROUTINE TO TYPE A PROMPTING CHARACTER AND
/  INITIALIZE THE FETCH-A-CHARACTER ROUTINE
/
/ ALL REGISTERS MODIFIED
/ RETURN AT JMS+1

/
SCIFAC	0

	JMS	RCTYP

	MES400

	JMS*	(IFAC
	JMP*	SCIFAC
/
MES400	2002
	0
	201757
	500000
/

/
/  AOCTK - FETCH CHARACTERS THRU A NON-OCTAL CHAR. MAKE THE OCTAL

/  CONSTANT IN LIMIT REGISTER, AND LEAVE THE TERMINATING
/  CHARACTER IN THE AC.
/
/ MODIFIED REGISTERS:  LR,AC, LINK, MQ
/ RETURN AT JMS+1

/
AOCTK	0

	CLLR		/CLEAR OUT ASSEMBLY REG.

/

AOCTKL	JMS	FACSV	/LOOP, GET NEXT CHARACTER

	JMS	COMP	/COMPARE LIMITS
	60		/OCTAL 0
	67		/OCTAL 7

	JMP*	AOCTK	/NON-COMPARE EXIT, CORRECT REGISTERS FILLED

	LRS	3	/OCTAL OFF TO MQ

	PLA		/WHAT WE HAVE ALREADY

	LLS	3	/PUSH IN THE NEW 3 BITS

	PAL		/SAVE IT

	JMP	AOCTKL	/KEEP GOING

/
/ ADECK - SUBROUTINE TO GET CHAR.'S THRU A NON-DECIMAL TERMINATOR

/  ASSEMBLE DECIMAL CONSTANT IN LIMIT REGISTER, AND RETURN
/  THE TERMINATOR IN THE AC.
/
/ MODIFIED REGISTERS: LR,AC,LINK,RCTEMP
/ RETURN AT JMS+1

/
ADECK	0

	CLLR		/CLEAR ASSEMBLY REGISTER

/
ADECKL	JMS	FACSV	/MAIN LOOP, GET NEXT CHAR.

	JMS	COMP	/DECIMAL DIGIT?
	60
	71
	JMP*	ADECK	/NO, LEAVE TERMINATOR IN AC, EXIT. LR ALL SET.
	AND	(17	/MAKE DIGIT DECIAML FROM ASCII
	DAC	RCTMP	/SAVE FOR ADDITION
	PLA		/GET BACK WHAT WE HAVE, MUL BY 10
	MUL
	12		/10 
	LACQ		/LOW HALF OF TWO WORD RESULT
	TAD	RCTMP	/ADD IN LOW (PRESENTLY) DIGIT

	PAL		/SAVE ANSWER BACK IN LIMIT I N CASE NEXT CHAR

	JMP	ADECKL	/IS THE EXIT/TERMINATOR CHAR.

/
/
/ FACSV - FETCHES THE NEXT CHAR. IF BLANK, GET THE FOLLOWING ONE.
/  SAVE CHAR IN GENERAL ERROR MESSAGE UNLESS <CR> OR <AM>
/  RETURN LINK=1 IF <CR> OR <AM> ; OTHERWISE LINK=0
/
/ MODIFIED REGISTERS: AC, LINK, MQ
/ RETURN AT JMS+1

/
FACSV	0

FACSV1	JMS*	(FAC	/MONITOR GET A CHAR ROUTINE
	CLL!CML		/#27 DEFAULT, SET LINK
	SAD	(15	/#27 CARRIAGE RETURN
	JMP*	FACSV	/#27 YUP, JUST GO AWAY
	SAD	(175	/#27 ALT
	JMP*	FACSV	/#27 GO AWAY
	SAD	(40	/BLANK
	JMP	FACSV1	/IT WAS, GET FOLLOWING CHAR.
	CLQ!LLSS!13	/#27 GOOD CHAR, LEFT JUSTIFY, CLEAR LINK
	XOR	(1041	/#26REST OF ASCII WORD
	DAC	MES591+10 /#26PLACE IN 'SYNTAX ERR AT "X" OVER THE X
	LRS	13	/#26RESTORE CHAR FOR CALLER.
	JMP*	FACSV

/
/
/
/
/ CRTN  -  MAKE A CARRIAGE RETURN

/
CRTN	0
	JMS	RCTYP
	MES2
	JMP*	CRTN
/
MES2	2002
	0
	64000
/  COMP - SUBROUTINE TO COMPARE AC WITH LIMITS (INCLUSIVELY)

/

/  CALLING SEQUENCE

/

/	JMS	COMP	/CALL
/	MIN		/LOWER LIMIT
/	MAX		/UPPER LIMIT

/	JMP	OUT	/RETURN IF AC NOT WITHIN RANGE
/	--		/RETURN IF WITHIN RANGE
/
/ MODIFIED REGISTERS: LINK, RCTMP
/

/
COMP	0
	DAC	RCTMP	/SAVE NUMBER FROM AC TO BE CHECKED
	CMA!IAC		/COMPLEMENT FOR CHECKING
	TAD*	COMP	/ADD IN MINIMUM LIMIT
	ISZ	COMP	/MOVE POINTER TO MAXIMUM
	SMA!SZA!CLA!CMA	/MINIMUM-TEST IS OK IF <=0
	JMP	COMPOR	/MISSED, KICK TO FAIL EXIT. RESTORE AC
	XOR*	COMP	/TRICKY, MAKES -MAX-1
	TAD	RCTMP	/UPPER LIMIT TEST. OK IF -
	SPA		/SKIP ON MISS, SO GET FAIL EXIT
	ISZ	COMP	/WITHIN LIMITS, RETURN CALL+4
COMPOR	ISZ	COMP	/NOT WITHIN, RETURN AT CALL+3
	LAC	RCTMP	/RETURN AC FOR CALLER'S CONVENIENCE
	JMP*	COMP
	.EJECT
/
/
/
/	W  A  R  N  I  N  G
/
/FROM HERE TO MES506 WE ARE PLAYING GAMES TO SET UP NODES FOR RCMT.
/THE NODES ARE ASSUMED TO BE 9(10) LONG. MESS504 TURNS IN TO 2 NODES
/MES505 TO 1 NODE.
/BE VERY CAREFUL ABOUT CHANGING THIS AREA.
/
RCMT1	RCMT3		/FIRST NODE IN FIRST PART NEXT TYPOUT
	RCMT0		/NODE RCMT2 ALREADY DETHREADED
/
MES504=.
	M.504-MES504*400+2
	0
	.ASCII :TYPE UNITS "NAME(BASE,SIZE)":<15>
M.504=.
	0
	0
RCMT3	RCFILL		/NEXT MESS. ENTRIELY IN THIS NODE'S BODY.
	RCMT1
/
MES505=.
	M.505-MES505*400+2
	0
	.ASCII :PARTITION:<15>
M.505=.
	0
/
MES506=.

	M.506-MES506*400+2
	0
	.ASCII :SYS COM:<15>

M.506=.

MES507=.

	M.507-MES507*400+2
	0
	.ASCII :SMALL NODE:<15>

M.507=.

MES508=.

	M.508-MES508*400+2
	0
	.ASCII :LARGE NODE:<15>
M.508=.
MES511=.
	M.511-MES511*400+2
	0
	.ASCII :TYPE N TO EXIT:<15>
M.511=.
MES512=.

	M.512-MES512*400+2

	0
	.ASCII :SYS COM CHANGE:<15>
M.512=.
MES513=.
	M.513-MES513*400+2
	0
	.ASCII :RCF OK!:<15>
M.513=.
MES589=.

	M.589-MES589*400+2

	0
	.ASCII :SYS BLK >32K:<15>

M.589=.

MES590=.

	M.590-MES590*400+2

	0
	.ASCII :OVERFLOW:<15>

M.590=.
MES591=.

	M.591-MES591*400+2

	0
	.ASCII :SYNTAX ERR AT "X":<15>
M.591=.

MES592=.

	M.592-MES592*400+2

	0
	.ASCII :INVALID SIZE:<15>

M.592=.
MES594=.

	M.594-MES594*400+2

	0
	.ASCII :NAME USED:<15>

M.594=.

MES595=.

	M595-MES595*400+2

	0
	.ASCII :SYS NAME:<15>

M595=.

MES596=.

	M596-MES596*400+2

	0
	.ASCII :SYS SPACE:<15>

M596=.

MES597=.

	M597-MES597*400+2

	0
	.ASCII :CORE IN USE:<15>

M597=.

MES580=.

	M580-MES580*400+2

	0
	.ASCII :OUT OF LARGE NODES:<15>

M580=.

MES581=.

	M581-MES581*400+2

	0
	.ASCII :OUT OF SMALL NODES:<15>
M581=.
/
MES999=.
	M.999-MES999*400+2
	0
	.ASCII :FATAL SYS ERR:<15>
M.999=.
	.EJECT
/

/

/

/  THERE FOLLOW A SERIES OF NODE MANIPULATION ROUTINES

/  PATTERNED AFTER THOSE INT THE EXEC. THE DIFFERENCE IS

/  PRIMARILY IN THAT THE NODES SO MANIPULATED MAY BE LOCATED

/  HIGHER THAN 32K. IN ADDITION THERE WILL BE SOME CALLING

/  SEQUENCE DIFFERENCES.

/

/  REGISTERS FOR PASSING ARGUMENTS TO NODE ROUTINES, USUALLY

/  UNMODIFIED.

/
/RC0	0
/RC1	0

/

/  WORK REGISTERS FOR THE NODE MANIPULATION ROUTINES

/
/RCT0	0
/RCT1	0
/RCT2	0
/RCT3	0
/RCT4	0
/
/
/  SAVE AND RESTORE ROUTINES FOR XR AND AC
/
/  USE LOCATIONS RCAC AND RCXR
/
RCSAV	0
	DAC	RCAC
	PXA
	DAC	RCXR
	LAC	RCAC	/IN CASE EXPECTED
	JMP*	RCSAV
/
RCRST	0
	LAC	RCXR
	PAX
	LAC	RCAC
	JMP*	RCRST
	.EJECT
/

/

/  RCADD - INSERT A NODE AFTER A GIVEN NODE OR DEQUE-HEAD.

/

/  CALL WITH THE ADDRESS OF THE NODE TO BE INSERTED IN AC.

/  AC IS UNCHANGED UPON EXIT. RC0 CONTAINS THE ADDRESS OF THE

/  DEQUE-HEAD, OR NODE ADDRESS AT WHICH THE INSERTION IS TO OCCUR.

/
/  MODIFIED REGISTERS, X16,X17,RCT1,LINK
/  RETURN AT JMS+1

/
RCADD	0

	DAC	RCT1	/ADDRESS OF NEW NODE

	AAC	-1	/-1 SO WE CAN AUTO-INCREMENT

	DAC*	(X16	/TO PLACE POINTERS IN NEW NODE
	LAC	RC0
	AAC	-1

	DAC*	(X17	/

	LAC*	X17	/ADDRESS OF FOLLOWING NODE

	DAC*	X16	/INTO FORWARD POINTER OF NEW NODE

	DAC*	(X17	/TO PLACE BACKWARD POINTER

/			/IN FOLLOWING NODE

	LAC	RC0	/DEQUE-HEAD ADDR. INTO

	DAC*	X16	/BACKWARD POINTER NEW NODE

	AAC	-1	/TO PLACE FORWARD POINTER IN DEQUE-HEAD

	DAC*	(X16	/

	LAC	RCT1	/NEW NODE ADDR

	DAC*	X16	/FORWARD POINTER PREVIOUS NODE

	DAC*	X17	/BACKWARD POINTER FOLLOWING ONE

	JMP*	RCADD	/THIS LEAVES NEW NODE ADDR IN AC FOR EXIT.

/

/

/  RCDEL - DELETE A NODE FROM A DEQUE

/

/  CALL WITH THE ADDRESS OF THE NODE IN THE AC. AC UNCHANGED ON EXIT.

/
/  MODIFIED REGISTERS, X16,X17,RCT0,RCT1,LINK
/  RETURN AT JMS+1

/
RCDEL	0

	DAC	RCT0	/ADDRESS OF NODE TO BE DELETED

	AAC	-1	/-1 FOR AUTO-INCR CORRECTIONS

	DAC*	(X16	/TO GET POINTERS FROM NODE BEING REMOVED

	LAC*	X16	/FORWARD POINTER

	DAC	RCT1	/HOLD IT .. . .

	DAC*	(X17	/TO PLACE BACKWARD POINTER IN FOLLOWING NODE

	LAC*	X16	/ADDRESS OF PREVIOUS NODE

	DAC*	X17	/IN BACK POINTER OF FOLLWING

	AAC	-1	/FOR AUTO. 

	DAC*	(X16	/TO PLACE FORWARD POINTER OF PREVIOUS NODE

	LAC	RCT1	/ADDR OF FOLLOWING NODE

	DAC*	X16	/IN PLACE IN PREVIOUS

	LAC	RCT0	/RESTORE AC FOR EXIT

	JMP*	RCDEL

/

/

/  RCPIK - PICK A NODE FROM A DEQUE (OR FOLLOWING A NODE)

/

/  CALL WITH THE ADDR OF THE DEQUE IN AC. RETURN WITH THE NODE

/  ADDRESS IN THE AC.  RETURN AT CALL+1 IF DEQUE EMPTY. RETURN

/  AT CALL+2 IF NODE OBTAINED.

/
/  MODIFIED REGISTERS, X16,X17,RCT0,RCT1 (USES RCDEL),AC,LINK
/

RCPIK	0

	DAC*	(X17	/TO OBTAIN BACKWARD POINTER FOR MT CHECK

	SAD*	X17	/IF POINTS TO SELF, MT

	JMP*	RCPIK	/EMPTY, RETURN TO CALL+1

	AAC	-1	/NOW BACK UP FOR AUTO INCR TO GET FORWARD

	DAC*	(X17

	LAC*	X17	/ADDR OF NODE TO BE PIK'ED

	JMS	RCDEL	/REMOVE FROM THREAD (ITS ADDR REMAINS IN AC)

	ISZ	RCPIK	/MOVE RETURN TO CALL+2 WHEN SUCCESSFUL

	JMP*	RCPIK

/

/
/  RCSNM - SEARCH A DEQUE FOR A NAME MATCH (NODE+2,NODE+3 ASSUMED)
/
/  CALL WITH DEQUE HEAD IN AC. CALL WITH THE
/  ADDRESS (CORR) OF THE NODE CONTAINING THE NAME IN XR. RETURN AT

/  CALL+1 IF NO MATCH. RETURN AT CALL+2 IF A MATCH - AC HAS ADDRESS

/  OF MATCHING NODE.

/
/  MODIFIED REGISTERS, X17,RC0,RCT0,AC,LINK

/
RCSNM	0
	DAC	RC0	/HOLD TOP
	DAC*	(X17
	LAC*	X17	/FIRST BACKWARDS POINTER
RCSKP	SKP		/JOIN LOOP
RCSNM1	LAC	RCT0	/POINTER TO NEXT (BACKWARDS) NODE
	SAD	RC0	/ALL WAY BACK TO DEQUE-HEAD

	JMP*	RCSNM	/YES, NO MATCH, EXIT CALL+1

	DAC*	(X17	/TO GET NEXT POINTER, NAME, NAME

	LAC*	X17	/NEXT POINTER, HOLD..
	DAC	RCT0	/FOR NEXT LOOP PASS

	LAC*	X17	/FIRST HALF NAME
	SAD	T.N1,X

	SKP		/THIS OK, KEEP CHECKING

	JMP	RCSNM1	/MISSED, TRY NEXT

	LAC*	X17	/SECOND HALF NAME
	SAD	T.N2,X

	SKP		/SKIP, FOUND A MATCH

	JMP	RCSNM1	/MISSED, TRY NEXT

	LAW	-3	/CALCULATE NODE ADDR FROM POINTER IN

	TAD*	(X17	/AUTO-INCR. REGISTER

	ISZ	RCSNM	/MOVE RETURN TO CALL+2
	JMP*	RCSNM	/CALLER GETS NODE ADDR IN AC.
/
/  RCPRI - SEARCH DEQUE TO INSERT NODE IN ASCENDING ORDER OF T.BA (4)
/
/  AC CONSAINS ADDR OF NODE TO BE INSERTED IN DEQUE IN RC0
/
/  MODFIED REGISTERS  RC0,X16,X17,RCT1,RCT4,LINK
/  RETURN AT JMS+1
/
RCPRI	0
	JMS	RCSAV	/SAVE OLD XR SO WE CAN USE
	JMS	SETXR	/NODE ADDR TO XR
	LAC	T.BA,X	/GET ORDERING WORD
	CMA!IAC		/FOR COMPARE
	DAC	RCT4
	LAC	RC0	/FIRST ITEM
	JMS	SETXR
RCPR1	LAC	0,X	/NEXT
	SAD	RC0	/DONE
	JMP	RCPR3	/YES, INSERT AT END
	JMS	SETXR	/SET UP TO POINT TO NEXT
	LAC	T.BA,X
	TAD	RCT4
	SPA		/IF NEW, >=, INSERT AFTER !!LAST!! NODE
	JMP	RCPR1	/KEEP LOOKING
	SKP
RCPR3	JMS	SETXR	/COUNTERACT 1,X
	LAC	1,X	/FOR RCADD
	DAC	RC0
	LAC	RCAC	/THIS HAS NODE TO INSERT
	JMS	RCADD
	JMS	RCRST	/RESTORE XR
	JMP*	RCPRI
	.EJECT
/

/
/  RCNOD - CONVERTS A BLOCK A CORE INTO NODES. THE NODES ARE
/    INSERTED INTO A DEQUE. NODES MAY NOT STRADDLE 0-17 OF A PAGE.
/
/  CALL WITH DEQUE IN AC INTO WHICH NODES ARE TO BE PUT
/  CALL WITH LINK 0 FOR SYSTEM SMALL NODES AND 1 FOR LARGE
/  CALL WITH XR POINTING TO T.BA,T.SZ DESCRIBING CORE TO BE CONVERTED
/
/
/  MODIFIED REGISTERS X16,X17,RCT0,RCT1,RCSIZ,RCHLL,RCHUL (RCADD CALLD),AC,LINK
/			RCTMP, MQ
/  RETURN AT JMS+1

/
RCNOD	0
	DAC	RC0	/SAVE DEQUE HEAD TO PUT THEM IN
	LAC	RCSYSS	/DEFAULT, MALL
	SZL
	LAC	RCSYSL	/WHOOPS, WAS LARGE
	DAC	RCSIZ
	LAC	T.BA,X
	DAC	RCHLL
	TAD	T.SZ,X
	CMA!IAC
	DAC	RCHUL	/SAVE - OF UPPER FOR TEST CONVENIENCE
	LAC	RCHLL	/########REST OF ROUTINE EDIT #27
	CLQ!LLS!6	/CHECK IF ON PAGE BOUNDARY TO START
	SNA!CLA		/SKIP IF NOT
	AAC	20	/ADJUST LOWEST BY 20 SO NO AUTONIINCR TROUBLES
	TAD	RCHLL	/TAD NO-OP FOR NO ADJUST CASE
	DAC	RCHLL
RCNOD1	TAD	RCSIZ	/ENTER WITH RCHLL IN AC; MAKE PROPOSED BASE NEXT NODE
	DAC	RCTMP	/HOLD FOR LATER TESTING
	TAD	RCHUL	/FIT WITHIN CORE BOUNDARIES
	SMA!CLL!CML!CLA!CMA /SKIP IF OK, AD AND LINK TO 1'S
	JMP*	RCNOD	/DONE
	TAD	RCTMP	/WILL NODE STRADDLE PAGE
	XOR	RCHLL
	TAD	LMTT	/TAD 770000, IF PAGE BITS LEFT ON, SET LINK
LMTT	770000		/LITERAL 770000 AS WELL AS LAW
	AND	RCTMP	/MAKE UP STRADDLE PAGE ADDR IN CASE NEEDED
	AAC	20	/KICK OVER AUTO INCR
	SZL		/SKIP IF PAGE ADDR NOT NEEDED
	DAC	RCHLL	/UPDATE LOWER LIMIT
	LAC	RCHLL	/LOWER LIMIT IS ADDR OF NODE TO CREATE
	JMS	RCADD	/PLACE IN DEQUE, RC0 HAD HEADER ADDR
	TAD	RCSIZ	/
	DAC	RCHLL
	JMP	RCNOD1
/
/
/  RCSPC - CHECKS CONFLICT IN CORE SPACE BETWEEN NODE AND DEQUE.

/
/ CALL WTIH DEQUE HEAD IN RC0.
/ CALL WITH PBDL NODE ADDR OR CMA OF SCDL NODE ADDR IN AC. FIRST CALL
/  RC1 MUST HAVE DEQUEHEAD. SUBSEQUENT CALLS FOR MORE THAN ONE

/  SPACE CONFLICT FOR DEQUE, RC1 WILL BE AUTOMATICALLY UPDATED, CALLER

/  DOES NOT HAVE TO CHANGE IT. RETURN AT CALL+1 IF NO CONFLICT.
/  RETURN AT CALL+2 IF CONFLICT ; AC HAS ADDRESS OF NODE IN CONFLICT.
/
/  MODIFIED REGISTERS, X16,X17,RC1,RCT0,RCT1,RCT2,AC,LINK
/
RCSPC	0
	SPA!CLL		/EDIT #13 ADJUST FOR SYSCOM IF MINUS
	CMA!CML		/SAVE LINK =1 IF SYSCOM
RCSPLT	AAC	T.BA-1	/ASSUME BASE,SIZE PAIR AT T.BA,T.SZ
	DAC*	(X17	/GET BASE SIZE FROM TEST NODE
	CLA!RAL		/LINK TO AC 17 TO ADJUST AAC INST.
	TAD	RCSPLT	/MAKES AAC T.BA IF SYSCOM
	DAC	RCSPSW	/MAKES AAC T.BA-1 IF NOT
/			/END OF #13
	LAC*	X17	/BASE
	CMA!IAC		/CONVENIENT TO SAVE AS -BASE

	DAC	RCT0

	LAC*	X17	/SIZE

	CMA!IAC		/SAVE AS -BASE-SIZE

	TAD	RCT0

	DAC	RCT1

	LAC	RC1	/BACKWARD POINTER FROM RC1, THE WHERE ARE

	DAC*	(X17	/WE REMEMBERER.

	LAC*	X17

	DAC	RC1	/SO WE CAN ENTER LOOP
RCSPC1	LAC	RC1	/NEXT NODE CHECK

	SAD	RC0	/BACK AROUND TO TOP

	JMP*	RCSPC	/YUP, ALL DONE, NON-SKIP EXIT
	DAC*	(X17	/TO GET POINTER TO NEXT
RCSPSW	AAC	T.BA-1	/TO GET BASE-SIZE PAIR FROM THIS
/			/NOTE EDIT #13 USES AS LITERAL!

	DAC*	(X16
	LAC*	X17	/NEXT FOR RC1

	DAC	RC1

	LAC*	X16	/BASE OF THIS 'UNIT'

	DAC	RCT2	/SAVE FOR TOP OF UNIT CALCULATION

	TAD	RCT1	/IF BASE THIS >=SIZE+BASE TEST UNIT, OK!

	SMA

	JMP	RCSPC1	/IS OK, GO DO NEXT NODE

	LAC*	X16	/NOT OK YET, GET SIZE OF UNIT

	TAD	RCT2	/ADD BASE TO GIVE TOP

	TAD	RCT0	/IF BASE TEST >=SIZE+BASE THIS, IS OK!

	SPA!SNA

	JMP	RCSPC1	/IS OK, KEEP SEARCHING

	LAW	-1	/RECONSTRUCT TOP ADDR OF THIS NODE FORCALLER

	TAD*	(X17	/LEAVING IN AC

	DAC	RC1	/TOUGH! IF WE RECALL RCSPC FOR THIS DEQUE

/			/INIT'ING CODE WILL BE RE-EXECUTED. MUST

/			/COMPENSATE

	ISZ	RCSPC	/KICK TO CONFLICT EXIT

	JMP*	RCSPC

/

/
/  RCBSY - CHECK IF PARTITION OR SYSCOM WHOSE ADDR IS IN AC IS BUSY
/
/ CALL WITH PBDL NODE ADDR OR CMA OF SCDL NODE ADDR IN AC.
/ AC AND XR ARE RESTORED
/  RETURN AT CALL+1 IF BUSY, RETURN AT CALL+2 IF NOT.

/
/  MODIFIED RESIGTERS,  RCT0,X15

/
RCBSY	0
	DAC	RCT0	/SAVE AC
	SMA		/IS THIS A SYSCOM?
	JMP	RCBSY1	/NO
	CMA		/YES -- GET NODE ADDR
	AAC	10	/PREPARE TO GET IN USE FLAG
	SKP
RCBSY1	AAC	46	/GET IN USE FLAG
	DAC*	(X15
	LAC*	X15	/AC=IN USE FLAG
	SNA		/BUSY?
	ISZ	RCBSY	/NO -- PREPAZRE TO RET AT JMS+2
	LAC	RCT0	/RESTORE AC
	JMP*	RCBSY	/RETURN

/
/

/  RCTYP - TYPE A MESSAGE ON MCR CONSOLE

/

/  CALL WITH ADDRESS OF MESSAGE AT CALL+1, RETURN AT CALL+2

/  THE WORLD IS DESTROYED BY THIS CALL.

/
RCTYP	0

	LAC*	RCTYP	/ADDRESS OF MESSAGE

	DAC	RCTYPA	/INTO CAL

	CAL	RCTPP	/TYPE MESSAGE

	CAL	RCTWT	/WAIT FOR COMPLETION

	ISZ	RCTYP	/RETURN AT CALL+2
	JMP*	RCTYP
/
/  CAL PARAMTER BLOCK FOR TYPING

/

RCTPP	2700		/OP CODE FOR WRITE
	RCTEV		/EVENT VARIABLE

	3		/LUN

	2		/ASCII DATA MODE

RCTYPA	0		/ADDRESS OF STRING PLACED HERE

/

/  CAL PARAMTER BLOCK FOR WAITING

/

RCTWT	20		/OP CODE FOR WAIT

	RCTEV		/EVENT VARIABLE

/
/
/
/
/  CAL TO GET VESTIGIAL BLOCK BY INSTALL FROM DISK!!

/
/
RCDSK	3000
	RCTEV
	1
	RCDSKC
RCDSKC	0		/??
RCDSKA	0		/??
	RCDSKP
	4		/#WORDS
/
/
/
	.EJECT
/
/
/
/  RCLOK - CALL TO SET/CLEAR THE RCINP OF ALL STL NODES
/   CORRESPONDING TO A GIVEN PDBL NODE. MAKE PBDL OR SCDL NODE UNSHARABLE.

/
/  CALL WITH THE PBDL NODE ADDR IN AC (OR CMA IF SCDL). 
/ IF AC=0 ALL STL NODES ARE TREATED. WHEN LINK IS ZERO, THE
/  BIT IN QUESTION IS CLEARED FOR THOSE STL NODE FLAGS WORDS THAT
/  SATISFY THE PBDL MATCH CRITERIA. WHEN THE LINK IS 1, THE  SAME
/  BIT IS SET. IN ALL CASES, THE PREVIOUS STATE OF THE BIT IS
/  IGNORED ENTIRELY. SETTING BIT LOCKS OUT STL NODES, CLEARING BIT ALLOWS EXECUTION.
/
/  MODIFIED REGISTERS, X16,X17,RCT0,RCT1,RCT2
/  RETURN AT JMS+1
/
RCLOK	0
	DAC	RCT0	/SAVE AC PBDL ADDR.
	SPA
	JMP	RCLOKE
	SZL!CLA		/SKIP IF BIT OFF, SET UP 0
	LAC	(RCINP	/GET ONE BIT
	DAC	RCT1	/SAVE FOR PLACEMENT IN STL FLAGS WORD
	LAC	(STKL	/DEQUEHEAD OF STL LIST

	DAC*	(X17	/GET BACK POINTER

	LAC*	X17	/AND SAVE SO CAN ENTER LOOP

	DAC	RCT2	/NEXT NODE SAVED HERE
RCLOK1	LAC	RCT2	/NEXT NODE TO LOOK AT

	SAD	(STKL	/BACK AROUND TO TOP OF DEQUE

	JMP	RCLOKE	/YES, GO EXIT

	DAC*	(X17	/TO GET BACK POINTER FOR NEXT TIME

	AAC	4	/TO GET PDBL POINTER

	DAC*	(X16

	LAC*	X17	/NEXT NODE

	DAC	RCT2

	LAC	RCT0	/ADDR TO CHECK FOR

	SZA		/IF ZERO, CIRCUMVENT TEST SO ALWAYS 'CHECKS'

	SAD*	X16	/IS ONE WE WANT IN STL NODE

	SKP		/SKIP IF YES

	JMP	RCLOK1	/NO, DO NEXT NODE

	LAC*	(X17	/MAKE POINTERS TO FLAGS WORV

	AAC	2

	DAC*	(X16

	DAC*	(X17	/ONE FOR UP, ONE FOR DOWN (WHY NOT XR?)
	LAC	(RCINPM	/MASK FOR SET CLEAR OF BIT
	.INH		/SHUT OFF STEM WHILE WE CHANGE IT
	AND*	X16	/CLEAR RCINP BIT
	XOR	RCT1	/SET/CLEAR ACCORDING TO CALLER
	.ENB
	DAC*	X17	/PUT BACK FLAGS WORD
	JMP	RCLOK1	/CONTINUE IN LOOP

/
RCLOKE	LAC	RCT0	/RESTORE AC FOR ECIT
	SNA		/SHOULD ALL PBDL AND SCDL NODES BE TREATED?
	JMP	RCLOK3	/YES
	SPA		/NO
	CMA
	JMS	SHRBIT	/GO TO SET/CLEAR SHARE BIT (RCF IN PROGRESS)
RCLOK2	LAC	RCT0
	JMP*	RCLOK
RCLOK3	LAC	(SCDL	/MAKE ALL SCDL NODE SHAREABLE OR NOT
	JMS	SHARE
	LAC	(PBDL	/DO SAME FOR PBDL
	JMS	SHARE
	JMP	RCLOK2	/PREPARE TO EXIT
/
/ SHRBIT -- SET CLEAR BIT INDICATING RCF IN PROGRESS NO SHARING
/
/ ENTER WITH AC= NODE ADDRESS
/ LINK IS 1 TO SET BIT, 0 TO CLEAR BIT
/
/ RETURN AT JMS+1
/ AC AND RCTMP ARE MODIFIED
/
SHRBIT	0
	.INH
	AAC	10	/GET ADDRESS OF FLAGS WORD
	DAC	RCTMP
	LAC*	RCTMP	/GET FLAGS WORD
	AND	RCBSL3	/AND OFF RCF IN PROG. BIT
	SZL		/SKIP IF BIT SHOULD BE CLEARED
	AAC	4
	.ENB
	DAC*	RCTMP
	JMP*	SHRBIT
/
/ SHARE -- SET OR CLEAR RCF IN PROG BIT FOR ALL NODES IN A LIST
/
/ ENTER WITH LISTHEAD IN AC
/ LINK IS 0 TO CLEAR BIT, 1 TO SET BIT
/
/ AC,RCT1 AND RCT2 ARE MODIFIED
/
SHARE	0
	DAC	RCT2	/SAVE THE LISTHEAD
	DAC	RCT1	/SHOW WERE FORWARD POINTER IS LOCATED
SHARE1	LAC*	RCT1	/GET FORWARD POINTER -- AC= NODE ADDRESS
	SAD	RCT2	/END OF LIST?
	JMP*	SHARE	/YES -- RETURN
	DAC	RCT1	/NO -- SAVE ADDR OF FORWARD POINTER
	JMS	SHRBIT	/GO SET OR CLEAR BIT FOR THIS NODE
	JMP	SHARE1	/GO DO NEXT NODE

/

/
/  RCMAK - CREATE A FRESH PDBL NODE
/

/  CALL WITH AC HAVING ADDR OF LARGE NODE TO BE INSERTED

/  INTHE SYSTEM LIST 'PBDL'. XR ISSET UP TO REFERENCE A NODE

/  IN RCOLL OR RCBSL HAVING NAME AND BASE INFO. NODE IS PLACED
/  INTO 'PBDL' AND INDEX AND AC ARE RESTORED.
/
/ MODIFIED REGISTERS: R1,R2,X16,X17,RCT4,LINK
/ RETURN AT JMS+1

/
RCMAK	0
	JMS	RCSAV
	DAC*	(R2	/FOR LATER
	AAC	-1
	DAC*	(X17
	AAC	2
	DAC*	(X16
	LAC	RCSYSL
	CMA!IAC
	DAC	RCT4
	DZM*	X17
	ISZ	RCT4
	JMP	.-2
	LAC	T.N1,X
	DAC*	X16
	LAC	T.N2,X
	DAC*	X16
	LAC	T.BA,X
	DAC*	X16
	LAC	T.SZ,X
	DAC*	X16
	LAC*	X16
	LAC*	X16
	LAC	T.AC,X
	DAC*	X16
	LAC	RCAC
	JMS	SETXR
	AAC	13
	AND	(7777
	TAD	(120000
	DAC	16,X
	LAC	RCSKP
	DAC	43,X
	LAC	(SAVE
	DAC	13,X
	LAC	(DBA
	DAC	15,X
	LAC	(PBDL
	DAC*	(R1
	JMS*	(SPRI
	JMS	RCRST
	JMP*	RCMAK
/
/  RCHLD -- ATTEMPT TO LOCK UP A BLOCK OF MEMORY
/
/  CALL WITH PBDL ADDR OR CMA OF SCDL NODE IN AC
/  XR AND AC RESTORED. SKIP
/  RETURN WHEN ABLE TO LOCK OUT.
/  NON-SKIP IF WE LOST.
/
/
/  MODIFIED REGISTERS: RCT0-RCT2,X15-X17,LINK

/
RCHLD	0

	JMS	RCBSY	/ALREADY BUSY

	JMP*	RCHLD	/YES, NON-SKIP EXIT

	CLL!CML		/NO, TRY TO LOCK OUT STL JOBS

	JMS	RCLOK	/AC STILL POINTS TO PDBL NODE

	JMS	RCBSY	/ANY COME IN WHILE WE WERE BUSY

	JMP	.+3	/YES, GO UNLOCK THEM AGAIN

	ISZ	RCHLD	/NO, WE WON, SKIP EXIT, AC STILL OK

	JMP*	RCHLD

	CLL		/NOW TURN OFF THE RCINP BITS

	JMS	RCLOK

	JMP*	RCHLD

/

/

/

/  RCMOLL - MAKE A NODE FOR THE RCOLL DEQUE

/
/  CALL WITH ADDR OF PBDL NODE OR CMA OF ADDR OF SCDL NODE IN AC.
/   AC AND XR SAVED AND RESTORED. LINK,

/  AS USUAL, DESTROYRED. +2,+3=NAME.+4,+5=BASE-SIZE;+6TYPE;+7 POINTER
/  TO EXCLIPSED NODE.
/  EDIT #14, A MINUS AC IN CALLING SAYS WE MUST ACCESS
/  A SYS. COM. NODE FOR INPUT INFO, ADJUST POINTERS.
/  NOTE THAT THIS PARTICULAR CALL DOESN'T NEED IT'S
/  AC RESTORED.
/
/  MODIFIED REGIESTERS RC0,RCT0-RCT4,X16,X17,AC,LINK
/  RETURN AT JMS+1
/
RCMOLL	0
	SPA!CLL!CML
	CMA!SKP!CLL
	ISZ	RCMOLX	/PLUS, MOVE XCT SO IT IS A NOP
	JMS	RCSAV	/SAVE AC(CONVERTED TO BE POSITIVE) AND XR
	CLA!RAL		/LINK TO AC
	DAC	RCT4	/SAVE TYPE
	LAC	(RCMT	/GET ONE OF OUR NODES TO MAKE RCOLL ENTRY

	JMS	RCPIK	
	JMP	RCRER1	/RESOURCE FAILURE, GIVE BACK ORIG. SYSTEM
	DAC	RCT1	/HOLD NODE ADDR

	JMS	SETXR
	LAC	RCAC	/SYS NODE ADDR

	IAC

	DAC*	(X17	/TO RETREIVE

	LAC*	X17	/NAME
	DAC	T.N1,X
RCMOLC	LAC*	X17	/INST AT RCMOLX XCT'S THIS FOR
/			/ADJUST FOR SYS. COM.
	DAC	T.N2,X	/AND XCT'S THIS FOR REGULAR, IS A NOP
RCMOLX	XCT	RCMOLC	/XCT .-1 OR .-2
	LAC*	X17
	DAC	T.BA,X
	LAC*	X17
	DAC	T.SZ,X
	LAC*	X17
	LAC	RCT4
	DAC	T.TI,X
	SZA
	LAC*	X17
	LAC*	X17
	DAC	T.AC,X
	LAC	RCAC	/SYSTM POINTER
	DAC	T.SY,X
	LAC	RCMOLF	/EDIT #14 REFILL RCMOLX
	DAC	RCMOLX	/SO OK FOR NEXT TIME
	LAC	(RCOLL

	DAC	RC0	/PLACE IN THIS DEQUE

	LAC	RCT1	/THIS NODE
	JMS	RCPRI	/BANG!
	JMS	RCRST
	JMP*	RCMOLL
/
RCMOLF	XCT	RCMOLC	/FINIL FOR #14
/			/SORRY ABOUT THAT.
/
/
/  RCPOP - SIMULATE POP INST. N+2 OF NODE IN RCWRK TO AC
/  I.E. REMOVE A NODE FROM RCWRK AND ENTER CONTENTS OF WORD 2
/  (NODE WORDS NUMBERED 0,1,2,....) INTO AC

/

/  AC RETURNED WITH QUANTITY. XR NOT USED.

/  SKIP RETURN IF QUANTITY FOUND, NON-SKIP IF DEQUE EMPTY.

/
/  MODIFIED REGISTERS X16,X17,RCT0-2,RC0,AC,LINK

/
RCPOP	0
	LAC	(RCMT	/#27 GIVE BACK NODE
	DAC	RC0	/#27 FOR RCADD
	LAC	(RCWRK	/GET NODE FROM 'WORKING' DEQUE
	JMS	RCPIK
	JMP*	RCPOP	/AREN'T ANY LEFT
	JMS	RCADD	/#27 NODE BACK TO EMPTY, AC OK
	IAC		/TO USE X17

	DAC*	(X17

	LAC*	X17	/QUANTITY IN AC
	ISZ	RCPOP	/KICK TO 'GOT' EXIT
	JMP*	RCPOP
/
/  DISASTER EXIT
/  PRINT FATAL ERROR MESSAGE AND EXIT
/
/ ALL REGISTERS ARE MODIFIED
/
DOOM	JMS	CRTN
	JMS	RCTYP	/TYPE FATAL MESSAGE
	MES999
	JMP	RCEX4	/EXIT THIS TASK
/
/   DUMP LITERALS SO WE CAN SET UP A NODE POOL
/
	.LTORG
/
/  SET UP MACRO TO MAKE NODES UP TO 2760(8)
/
	.DEFIN RC
	.IFPOZ 2760-RCNDSZ-RCNDSZ-.
	.+RCNDSZ
	.-1-RCNDSZ
	.REPT RCNDM2
	0
	.ENDC
	.ENDM
/
/  FIRST NODE OF STRING NOT FROM MACRO
/
RCFILL	.+RCNDSZ
	RCMT3		/LAST NODE IN MESSAGES
	.REPT RCNDM2
	0
/
/  NOW MACROS FOR LOTS OF NODES
/
	RC
	RC
	RC
	RC
	RC
	RC
	RC
	RC
	RC
	RC
	RC
	RC
	RC
	RC
	RC
	RC
RCIPL	RCMT		/BACK AROUND TO DEQUE-HEAD
	.-1-RCNDSZ
	.REPT RCNDM2
	0
/
/
/
/
	.END	RCR5
