	.SYSID <	.TITLE *******CHAIN >,< 000>

/

/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 #148	E.MARISON	19-JUL-71

/EDIT #151	XXXX	19-JAN-73

/EDIT #152	S.KRISH			BUG FIX TO ENABLE RESCAN OF USER LIBRARY

/					FOR UNRESOLVED GLOBALS.

/EDIT #153	B.RUBINSON		FIX BOSS ERROR EXIT AND CHANGE VERSION # TO

/EDIT #154	E.KATZ			CHANGE SIGNON NUMBER

/ 155	27-JUN-75 (RCHM)	REMOVE ALL UNNECESSARY CONDITIONALS

/ 156	27-JUN-75 (RCHM)	MAKE IT POSSIBLE FOR CHAIN TO RUN UNDER

/				DDT AND THE LINKING LOADER.

/ 157	27-JUN-75 (RCHM)	REMOVE TWC AND REPLACE ALL CALLS TO IT WITH CMA!IAC.

/ 158	30-JUN-75 (RCHM)	FIX NEW OPTIONS PROCESSING AND ALL SIDE EFFECTS

/				OF SAME.

/ 159	01-AUG-75 (RCHM)	FIX RESIDENT COMMON BLOCK LISTING SO THAT IT

/				ONLY COMES OUT WHEN A RESIDENT BLOCK OTHER THAN

/				BLANK COMMON (.XX) EXISTS.

/				FIX SIZE OPTION PRINTING.

/				IMPLEMENT THE FOLLOWING NEW OPTIONS:

/				UL:XXXXXX

/				SL:XXXXXX

/				AS PER RSX TASK BUILDER.

/ 160	04-AUG-75 (RCHM)	FIX BOTTOM UP LOADING.

/ 161	04-AUG-75 (RCHM)	MARK XVM/DOS VERSUS NON-XVM/DOS CHAINED MODULES.

/ 162	05-AUG-75 (RCHM)	OPTIONS PROCESSING CLEANUP.

/ 163	05-AUG-75 (RCHM)	CORAL CHANGES. (005)

/				FIX MAPPER TO PRINT EXTENSIONS. (5.1)

/				FIX INFORMATION FOR EXECUTE TO MODIFY

/				CORE LIMITS. (5.2)

/ 164	14-AUG-75 (RCHM)	MESSAGE CLEANUP. MAKE IT NO LONGER POSSIBLE TO

/				HAVE NON-FILE ORIENTED DEVICE INPUT.

/ 165	19-AUG-75 (RCHM)	BUG FIXES IN CODE 12 (LC 14) PROCESSOR.

/ 166	22-AUG-75 (RCHM)	FIX PROBLEM WITH BLOCK DATA PRINTING.

/				FIX PROBLEM WITH UNRESOLVED GLOBAL PRINTING.

/				FIX CR PROBLEM WITH LIBRARY ERROR MESSAGE.

/ 167	18-SEP-75 GAR		CHANGE THE LIBRARY LOADING SEQUENCE.

/				(THE CHANGE IS DOCUMENTED A FEW LINES BELOW

/				THE LINE WITH THE LABEL 'RAOSSL'.)

/				FIX SO THAT 'GM' IS A RECOGNIZED OPTION.

/ 168	19-SEP-75 (RCHM)	FIX GM OPTION.

/ 169	09-OCT-75 (RCHM)	MINOR PROBLEM IN COMMON BLOCK PROCESSOR.

/ 170	23-OCT-75	(RCHM)	MINOR PROBLEM IN NCL SCANNER ROUTINE.

/ 171	06-NOV-75	(RCHM)	FIX PROBLEM # 5 IN QA BUG FIX:

/				END ADDRESS IS THE LAST ADDRESS OF CORE

/				REGARDLESS OF WHAT PART OF CORE IS USED

/				FOR COMMON BLOCKS.

/ 172	06-NOV-75	(RCHM)	FIX PROBLEM #2 IN QA BUG FIX:

/				IN CHAIN, THE RES SWITCH WITH NO PARA-

/				METERS DOES NOT MAKE RESIDENT ANY

/				LABLED COMMON BLOCKS WITHIN LINKS.
/ 173	06-NOV-75	(RCHM)	FIX PROBLEM #3 IN QA BUG FIX:
/				RESIDENT COMMON BLOCKS FIRST OCCURING
/				IN THE LAST DEFINED LINK AND MADE
/				RESIDENT BY THE RES SWITCH ARE NOT
/				INCLUDED IN THE LISTING OF THE
/				RESIDENT COMMON BLOCKS.
/ 174	06-NOV-75	(RCHM)	FIX PROBLEM NOT IN QA REPORT. DO NOT
/				PRINT RESIDENT COMMON BLOCKS LIST IF
/				ONLY RESIDENT CODE IS BEING RELOCATED.
/ 175	06-NOV-75	(RCHM)	FIX PROBLEM #6 IN QA BUG FIX:
/				USING THE RES SWITCH TO LOCATE COMMON BLOCKS
/				ABOVE 32K WILL NOT ALWAYS GIVE AN ERROR
/				IF THE COMMON BLOCK IS INITIALIZED.
/ 176	06-NOV-75	(RCHM)	FIX PROBLEM #1 IN QA BUG FIX:
/				IF A GLOBL IS DEFINED SO THAT IT'S RELOCATED VALUE
/				IS 100000 (8) OR BIGGER THE ERROR MESSAGE
/				UNRESOLVED .GLOBLS IS GIVEN INSTEAD OF
/				GLOBL DEF. TOO BIG.
/ 177	06-NOV-75	(RCHM)	FIX PROBLEM #7 IN QA BUG FIX:
/				IF TWO RESIDENT MACRO PROGRAMS ATTEMPT
/				BY MEANS OF .CBS, .CBC, AND .CBE'S TO INITIALIZE
/				THE SAME COMMON BLOCK, A .GLOBL
/				SYMBOL TOO BIG ERROR IS GIVEN.
/ 178	06-NOV-75	(RCHM)	FIX PROBLEM #4 IN QA BUG FIX:
/				CORE REQUIRED STARTING ADDRESS IS ONE LESS
/				THAN THE FIRST USED ADDRESS EXCEPT WHEN THE LINK
/				TABLE STARTS AT THE BEGINNING OF USED LOW CORE.
/ 179	07-NOV-75	(RCHM)	SUPPRESS SPURIOUS PRINTING OF EXTENSION WITH
/				COMMON BLOCK NAMES.

/

/ COMMAND INPUT -- ALL KEYED IN INFORMATION IS ACCEPTED IN LOGICAL

/ LINES.  A CARRIAGE RETURN IS USED TO CONTINUE A LOGICAL LINE

/ ONTO THE NEXT PHYSICAL LINE.  AN ALTMODE IS USED TO TERMINATE

/ A LOGICAL LINE.  A LINE CONSISTS OF NAMES (ROUTINES, OPTIONS,

/ PARAMETERS), LIBRARY INDICATORS, AND BREAK CHARACTERS (NAME

/ TERMINATORS).  BLANKS ARE IGNORED.  NAMES MAY CONSIST OF 1-6

/ ALPHANUMERIC CHARACTERS.  A LIBRARY INDICATOR (#) MAY APPEAR ANY

/ WHERE WITHIN A NAME TO INDICATE THAT THE BINARY UNIT OF

/ A ROUTINE IS NOT TO BE FOUND ON THE USER'S DEVICE, BUT RATHER

/ WITHIN A LIBRARY.

/ THE FOLLOWING CHARACTERS ARE RECOGNIZED AS BREAK CHARACTERS,

/ BUT ONLY ACCEPTED AS VALID BREAK CHARACTERS WHEN APPROPRIATE:

/ EQUAL SIGN, COLON, COMMA, SLASH, & ALTMODE.  WHEN A COMMAND

/ INPUT ERROR IS DETECTED, THE ENTIRE LOGICAL LINE IS REJECTED.

/ IOPS ASCII EDITING (RUBOUT AND ^U) APPLY ONLY TO PHYSICAL LINES.

/

/ ^P USES:

/ TO RESTART CHAIN DURING COMMAND INPUT

/ TO RESTART A READ OPERATION AFTER EOM

/ TO READ A FILE FROM A NON-FILE-ORIENTED DEVICE

/ (THE REQ'D FILE NAME IS TYPED OUT BEFORE READING)

/ TO CONTINUE AFTER A PAUSE

/ AT ANY OTHER TIME, ^P WILL EXIT TO MONITOR.

/

/ INDICATOR WORDS -- INDICATOR WORDS USED IN TABLES (RCL, LDT, ODT, 

/ & TTL'S) HAVE THE FOLLOWING BIT DESIGNATIONS:

/    BIT 17 -- THIS ENTRY DEFINES A LINK NAME

/    BIT 16 -- THIS ENTRY DEFINES AN EXTERNAL LINK COMPONENT

/    BIT 15 -- THIS ENTRY DEFINES AN INTERNAL LINK COMPONENT

/    BIT 14 -- ROUTINE IS ON USER'S DEVICE

/    BIT 13 -- ROUTINE IS IN A LIBRARY

/    BIT 11 -- ROUTINE IS RESIDENT (RCL ENTRY)

/

/ CHAIN IS WRITTEN TO RUN AS AN ABSOLUTE SYSTEM PROGRAM (BANK

/ ADDRESSING) ON A PDP-15 UNDER THE XVM/DOS MONITOR.

/ DEFINING THE "%BIN" PARAMETER WILL ALLOW CHAIN TO BE USED WITH DDT

/ AND THE LINKING LOADER. IF %BIN IS DEFINED, CHAIN WILL USE POSITIVE

/ .DAT SLOTS FOR I/O RATHER THAN THE NEGATIVE .DAT SLOTS.

/

/ DEFINING THE %DEBUG PARAMETER WILL CAUSE CHAIN TO HALT BEFORE ISSUING A

/ .EXIT TO THE MONITOR TO RETURN CONTROL TO DOSNRM.

/

/ REVISION                 4 JUL 70                   H. KREJCI

/

/ CHAIN WILL REOLCATE THRU AN EOF (INSTEAD OF THE FIRST BINARY UNIT)

/ IF RELOCATING FROM THE USER'S DEVICE [LDPROG: NXUN & CODE23].  THUS,

/ THE NAMES IN COMMAND INPUT, WITHOUT LIBRARY INDICATORS, ARE FILE

/ NAMES RATHER THAN PROGRAM NAMES.

/ LIBRARY INDICATORS ARE ONLY ACCEPTED ON RESIDENT ROUTINE NAMES (NO

/ LONGER ON LINK COMPONENT NAMES) [COMMAND INPUT].

/ THE RESIDENT CODE MAY BE EXCLUSIVELY LIBRARY ROUTINES.  INITIAL CONTROL

/ IS TRANSFERRED TO THE FIRST ROUTINE RELOCATED [COMMAND INPUT].

/ THE NAMES OF FILES CONTAINING RESIDENT ROUTINES OR INTERNAL LINK

/ COMPONENTS NEED NOT CORESPOND TO PROGRAM OR GLOBAL SYMBOL NAMES. 

/ EXTERNAL LINK COMPONENTS ARE ONLY ACCEPTED FROM FILES WITH FILE NAMES

/ CORESPONDING TO THE COMPONENT NAMES (GLOBAL SYMBOL DEFS).  [LDPROG,

/ CODE10, LTBCHK].  ANY OTHER ROUTINES IN A FILE WITH AN EXTERNAL

/ COMPONENT ARE CONSIDERED INTERNAL COMPONENTS.

/ THE PROGRAM ANNOTATION STILL REFERS TO ROUTINE NAMES RATHER THAN FILE

/ NAMES.

/

/

/

/ *** REVISION		12 JULY 71		E. MARISON ***

/

/

/ CHAIN WILL NOW ACCEPT LIBRARY INDICATORS ON INTERNAL AND EXTERNAL

/ LINK COMPONENTS. THIS ELIMINATES THE RESTRICTION INTRODUCED

/ IN REVISION DATED JULY 4,1970 BY H. KREJCI.

/

/

/ A NEW OPTION HAS BEEN ADDED TO CHAIN WHICH ALLOWS THE USER

/ TO RESTRICT COMMON AREAS TO 8K BANKS. THIS IS USEFULL TO THE VT15

/ USER WHO BUILDS DISPLAY FILES IN COMMON DATA AREAS SINCE THE

/ VT15 CAN NOT CROSS BANK BOUNDRIES DIRECTLY (IE 13 BIT ADDRESSING)

/ THERE ARE TWO FORMS OF THE OPTION AND THEY ARE AS FOLLOWS:

/

/	VTC ----- OPTION WITHOUT NAMES.  ALL COMMON AREAS

/	    ARE RESTRICTED TO 8K BANKS *!

/

/	VTC/NAM1,NAM2,NAM3,-----/   OPTION WITH NAMES.  ONLY

/	    THOSE COMMON AREAS NAMED ARE RESTRICTED. *!

/

/ * THIS EXCLUDES COMMON AREAS DECLARED IN BLOCK DATA

/   SUBPROGRAMS WHICH ARE NEVER RESTRICTED.

/

/ ! COMMON IS RESTRICTED TO BANK BOUNDRIES EVEN IF RUNNING

/   IN PAGE RELOCATION MODE.

/

/

/

	.TITLE *** CHAIN GLOSSARY AND DEFINITIONS.

/+

/

/CLT	CORE LIMITS TABLE (EXECUTABLE CODE)

/

/	HIGHEST FREE ADDRESS IN ANY GIVEN PAGE OR BANK. EXECUTABLE

/	CODE SPACE IS ALLOCATED ONLY THROUGH THIS TABLE. THE TABLE IS

/	TERMINATED BY A -1. CLTX1 IS THE POINTER TO THE END OF THE TABLE

/	I.E TO THE -1.

/

/

/CORE MAP	GENERAL INFORMATION

/

/	SC.FRL	->	**********

/	NCL.BS		*  NCL   *

/			*        *

/	RCL.BS	->	**********

/			*   RCL  *

/	LDT.BS	->	**********

/			*   LDT  *

/	ODT.BS	->	**********

/			*   ODT  *

/			**********

/			*        *

/			* SYMBOL *

/			* TABLE  *

/	SYMPTR	->	**********

/			* TTL    *

/	TTLBSE	->	**********

/			*        *

/			* CHAIN  *

/			*        *

/			**********

/

/ECLT	EXTENDED CORE LIMIT TABLE (COMMON BLOCKS)

/

/	HIGHEST FREE ADDRESS IN ANY GIVEN PAGE OR BANK. ONLY UNINITIALIZED

/	COMMON BLOCKS CAN BE PLACED IN THE HIGH MEMORY AND SPACE FOR THEM

/	IS ALLOCATED ONLY THROUGH THIS TABLE. THE TABLE IS TERMINATED BY

/	A -1. ECLTX1 IS THE POINTER TO THE END OF THE TABLE, I.E

/	TO THE -1.

/

/GST	GLOBAL SYMBOL TABLE

/

/	CONSTRUCTED INITIALLY IMMEDIATELY AFTER THE LTB. THE FORMAT IS

/	AS FOLLOWS:

/

/	WORD 1	IXXXXX	I=INDICATOR

/			XXXXX="NAME" OF ENTRY.

/	WORD 2	IXXXXX	I=1BIT INDICATOR SET=>ENTRY IS 3 WORD LONG.

/	WORD 3	3 RAD 50 CHARACTERS.

/

/	WORD 1 - I=3 => ENTRY IS A DEFINED COMMON BLOCK. XXXXX IS THE

/			SIZE OF THE BLOCK.

/

/	WORD 1 - I=5 =>	ENTRY IS DEFINED IN THE LTB AND IS A LINK

/			"NAME". XXXXX IN WORD 1 IS A POINTER

/			TO THE LTB ENTRY FOR THIS PARTICULAR LINK COMPONENT.

/

/	WORD 1 - I=7 => ENTRY IS AN UNDEFINED COMMON BLOCK, I.E. NOT THE

/			TARGET OF A BLOCK DATA SUBROUTINE. THIS ENTRY IS

/			5 WORDS LONG AS IS THE ENTRY SIZE FOR I=3. THE

/			EXTRA INFORMATION IS 1) A WORD POINTING TO A

/			CHAIN OF ADDRESS CONTAINING TRANSFER VECTORS TO

/			THE CONTENTS OF THE BLOCK AND 2) A BASE ADDRESS

/			FOR THE COMMON BLOCK.

/

/LDT	LINK DESCRIPTOR TABLE

/

/	SAME FORMAT AS RCL.

/	WORD 1	INDICATOR WORD:

/		BIT 17 - SET INDICATES THAT NAME IS THE NAME OF A LINK.

/		BIT 16 - SET INDICATES THAT NAME IS KNOWN EXTERNALLY.

/		BIT 15 - SET INDICATES THAT NAME IS KNOWN INTERNALLY.

/	WORD 2	6BIT NAME

/	WORD 3	6BIT NAME

/

/	LINK TABLE - PRELIMINARY CONSTRUCTION

/

/	THE LINK TABLE IS THE MECHANISM WHICH ALLOWS TRANSFER OF CONTROL

/	BETWEEN RESIDENT AND NON-RESIDENT LINKS. THIS TABLE CONTAINS AN

/	ENTRY FOR EACH EXTERNAL COMPONENT OF EVERY LINK. THE TABLE IS

/	BUILT FROM THE TTL AND THE LDT. THE LTB ENTRY FORMAT DURING

/	PRELIMINARY CONSTRUCTION IS AS FOLLOWS:

/

/	WORD	0	INDICATOR	FROM TTL.

/		1	3-6BIT CHARACTER

/		2	3-6BIT CHARACTER

/		3	RELOCATION FLAG

/		4	0

/		5	0

/		6	LINK NUMBER

/		7	INDEX		LDT INDEX WHICH REPRESENTS

/					THIS LINK. 0 IF THIS IS AN SCL

/		8	0

/

/NCL	NAMED COMMON LIST

/

/	ANY COMMON BLOCK NAMED IN THE VTC OR RES COMMANDS IS PLACED INTO

/	THIS LIST. THE HEAD OF THE LIST IS ALWAYS POINTED TO BY "NCL.BS"

/	AND THE TAIL IS ALWAYS POINTED TO BY "RCL.BS". THE LIST HAS THE

/	FOLLOWING FORMAT:

/

/	EACH LIST ELEMENT IS EXACTLY TWO WORDS LONG.

/

/	WORD 1	BIT 0		SET IF THE SECOND WORD OF THE ELEMENT IS

/				USED FOR NAMES.

/	WORD 1	BIT 1		SET IF THE BLOCK NAMED IS TO BE WITHIN

/				A BANK (VTC OPTION).

/	WORD 1	BIT 2-17	RAD50 REPRESENTATION OF THE FIRST THREE

/				CHARACTERS OF THE COMMON BLOCK NAME.

/	WORD 2	BIT 0		SET IF THE COMMON BLOCK IS TO BE FORCED

/				INTO HIGH MEMORY (RES OPTION).

/	WORD 2	BIT 1		CURRENTLY UNUSED.

/	WORD 2	BIT 2-17	RAD50 REPRESENTATION OF THE LAST THREE

/				CHARACTERS OF THE COMMON BLOCK NAME.

/

/RCL	RESIDENT CODE LIST

/

/	ANY CODE WHICH GETS PLACED IN THE RESIDENT AREA IS FLAGGED IN

/	THIS LIST. THE LIST FORMAT IS:

/

/	WORD 2	6BIT NAME OF RESIDENT CODE

/	WORD 3	6BIT NAME OF RESIDENT CODE

/	WORD 1	INDICATOR WORD:

/		BIT 11 - SET BY RCL SET UP CODE, MEANING UNKNOWN.

/		BIT 12 - CODE IN THE SYSTEM LIBRARY.

/		BIT 13 - CODE IN THE USER LIBRARY.

/		BIT 14 - CODE COMES FROM THE USER.

/

/SCL	SINGLE COMPONENT LINK

/

/	DEFINITION: A LINK WITH NO CORRESPONDING ENTRY IN THE LINK

/		    DESCRIPTION TABLE. THE NAME OF THE LINK IS THE

/		    NAME OF THE COMPONENT.

/

/TTL	TRUNK TO TWIG LIST

/

/	THE TTL CONSISTS OF A SERIES OF LISTS. EACH LIST BEGINS WITH

/	A LINK NAME WHICH DOES NOT OVERLAY ANYTHING ELSE. IT ENDS WITH

/	A LINK NAME WHICH IS NOT OVERLAYED BY ANYTHING ELSE. THE REST

/	OF THE ITEMS IN THE LIST 2,3,...,N-1 MAY OR MAY NOT OVERLAY EACH

/	OTHER BUT THEY DO OVERLAY THE FIRST ELEMENT IN THE LIST.

/	EXAMPLE:

/	>SUB1:SUB2

/	>SUB2:SUB3,SUB4

/	PRODUCES THE TTL:

/	SUB1->SUB2->SUB3

/		AND

/	SUB1->SUB2->SUB4

/	THE TTL IS BUILT FROM THE ODT WHICH IS DESTROYED IN THE PROCESS.

/	EACH TTL ELEMENT IS DELIMITED BY A -1 AND EACH TTL ENTRY ITEM

/	CONSISTS OF A 3 WORD ENTRY.

/

/	WORD 1	INDICATOR WORD, AS IN THE ODT.

/	WORD 2	6BIT NAME

/	WORD 3	6BIT NAME

/-

	.TITLE *** SET UP CHAIN EQUATES AND .DAT SLOTS.

/+

/ SCOM TABLE REGISTERS USED BY CHAIN.

/-

.SCOM=100

SC.COR=.SCOM			/(RCHM-158) SCOM ADDRESS OF END OF MEMORY

				/(RCHM-158)  USABLE BY PROGRAMS.

SC.FRL=.SCOM+2			/(RCHM-158) FREE CORE LIMITS IN LOW MEMORY.

SC.MOD=.SCOM+4			/(RCHM-158) ADDRESS OF OPTIONS WORD IN .SCOM.

SC.FRH=.SCOM+76			/(RCHM-158) ADDRESS OF POINTER TO HIGH

				/(RCHM-158) FREE MEMORY.

/+

/ VARIOUS AND SUNDRY EQUATES.

/-

ODTESZ=5			/(RCHM-158) ODT ENTRY SIZE

TTLESZ=3			/(RCHM-158) TTL ENTRY SIZE

LDTESZ=3			/(RCHM-158) LDT AND RCL ENTRY SIZE

LTBESZ=13			/(RCHM-158) LTB ENTRY SIZE

/

/ INDEX REGISTER EQUATES.

/

X10=10				/(RCHM-158)

X11=11				/(RCHM-158)

/

/ TABLE OF SIX BIT EQUIVALENTS OF OPTION NAMES.

/-

VTC=262403			/(RCHM-158)

RES=220523			/(RCHM-158)

BOT=021724			/(RCHM-158)

PAR=200122			/(RCHM-158)

PAL=200114			/(RCHM-158)

BKR=021322			/(RCHM-158)

PGR=200722			/(RCHM-158)

SAC=230103			/(RCHM-158)

XVM=302615			/(RCHM-158)

NOX=161730			/(RCHM-158)

BOO=021717			/(RCHM-158)

NM=161500			/(RCHM-158)

GM=071500			/(RCHM-158)(GAR:167)

SZ=233200			/(RCHM-158)

ULO=251400			/(RCHM-159)

SLO=231400			/(RCHM-159)

K=13				/(RCHM-158)

/

/ TABLE OF RAD50 EQUIVALENTS OF NAMES.

/

.XX=131330			/(RCHM-158) INTERNAL NAME OF BLANK COMMON.

CI=-2	/COMMAND INPUT

TO=-3	/TYPED OUTPUT

	.IFUND %BIN		/(RCHM-156)

SL=-1	/SYSTEM LIBRARY

UD=-4	/USER PROGRAM DEVICE

UL=-5	/USER'S LIBRARY

RO=-6	/RELOCATED OUTPUT

	.ENDC

	.IFDEF %BIN		/(RCHM-156)

SL=1				/(RCHM-156) SYSTEM LIBRARY

UD=4				/(RCHM-156) USER PROGRAM DEVICE

UL=5				/(RCHM-156) USER'S LIBRARY

RO=6				/(RCHM-156) RELOCATED OUTPUT

	.ENDC			/(RCHM-156)

/

	.EBREL			/(RCHM-156)

	.IODEV SL,CI,TO,UD,UL,RO /(RCHM-156)

 .TITLE *** TYPE PGM NAME AND GET XCT FILE NAME

/

START	LAC*	(.SCOM+52		/(RCHM-156) ARE WE IN BOSS MODE

	SMA

	JMP	SETMOD		/NO!

	LAC	(NOP		/SET BOSS MODE SW

	DAC	BOSSW

SETMOD	LAC*	(.SCOM+4		/WHAT TYPE OF SYSTEM

	AND	(100		/IS THIS PG OR BANK

	SNA!CLA

	SKP

	LAC	(010000		/BANK ADDR MASK = 017777

	XOR	(007777		/PAGE ADDR MASK=007777

MSKSET	DAC	ADRMSK

	CMA

	DAC	OPCMSK		/OP-CODE MASK

	DZM	MAX.XX	/INITIALIZE MAX BLANK COMMON BLOCK SIZE

	LAC*	(.SCOM+52		/BOSS-15 MODE?

	SMA

	JMP	ICIZ		/NO, DO INIT

	XOR	(20000		/YES, ENABLE TTY

	AND	(20000		/FOR ^P

	XOR*	(.SCOM+52

	DAC*	(.SCOM+52

ICIZ	.INIT TO,0,CPTYPD /SETUP ^P TRANSFER ADDRESS

	XCT	BOSSW

	JMP	BOSS1

	JMS	TYPE	/TYPE PROGRAM NAME AND VERSION

	MES1

/

/ DETERMINE XCT FILE NAME AND .ENTER IN OUTPUT DEVICE DIRECTORY

/

BOSS1	JMS	CRTN	/REQUEST XCT FILE NAME

	JMS	TYPE1

	MES20

/

DXNSNL	JMS	RFAN	/READ A LINE AND FETCH FIRST NAME

	LAC	FANM	/ERR 101 IF 0 OR 7 CHAR NAME

	SZA

	JMP	.+4

	JMS	ERR1

	MES101

	JMP	DXNSNL

	DAC	ROFNAM

	LAC	FANM+1

	DAC	ROFNAM+1

	LAC	FANB	/ERR 103 IF OTHER THAN ALTMODE BREAK

	SAD	(175)

	JMP	.+4

	JMS	ERR3

	MES103

	JMP	DXNSNL

	JMS	CRTN

IROD	.INIT	RO,1,0	/OPEN XCU OR DUMMY XCT FILE

ERO1Z	.ENTER	RO,ROFNAM

 .TITLE *** FETCH AND RECORD OPTIONS & PARAMETERS

/ FETCH AND RECORD OPTIONS AND PARAMETERS

/

	JMS	TYPE1	/REQUEST OPTIONS & PARAMETERS

	MES30

FROSNL	LAC*	(SC.COR)	/(RCHM-158) USE SIZE OF CURRENT SYSTEM

	DAC	LDLMT

	DAC MEM.SZ		/(RCHM-158) SET UP DEFAULT MEMORY SIZE.

	LAC* (SC.MOD)		/(RCHM-158) FETCH STATE OF XVM MODE.

	RAR			/(RCHM-158) SAVE IN LINK.

	SZL!CLA			/(RCHM-158) CLEAR BIT IF NO-XVM.

	LAC (4)			/(RCHM-158) SET BIT IN XVM.EV IF XVM.

	DAC XVM.EV		/(RCHM-158) XVM.EV WILL BE OR'ED WITH ENVIND.

	SZA			/(RCHM-158) XVM ON?

	JMS CMEMSZ		/(RCHM-158) GO CALCULATE MEMSIZ.

	JMS RV.INT		/(RCHM-158) INITIALIZE NCL.

	LAC (SKP)		/(RCHM-158) SET TOP DOWN LOADING SWITCH.

	DAC SIFTOP		/(RCHM-158)

	DZM	SZFLAG

	DZM	GMFLAG

	DZM	PSFLAG

	DZM	SAFLAG

	DZM IN.HMS		/(RCHM-160) CLEAR ANYTHING SET IN HIGH MEMORY SWITCH.

	LAC	(+1)

	DAC	LMFLAG

	LAW	-1

	DAC BOT.AD		/(RCHM-158) CLEAR BOTTOM UP LOADING ADDRESS.

	LAW	-2		/SET LIBRARY PASS COUNTER

	DAC	LIBSCT

	JMS BOO.TY		/(RCHM-158) SET BOOTSTRAP TYPE FOR ENVIND.

	LAC DULNM		/(RCHM-159) SET

	DAC ULNM		/(RCHM-159) UP

	LAC DULNM+1		/(RCHM-159) DEFAULT

	DAC ULNM+1		/(RCHM-159) USER

	LAC DSLNM		/(RCHM-159) AND

	DAC SLNM			/(RCHM-159) SYSTEM

	LAC DSLNM+1		/(RCHM-159) LIBRARY

	DAC SLNM+1		/(RCHM-159) NAMES.

/

	JMS	RFAN	/READ LINE AND FETCH FIRST NAME

	JMS	ZLLX	/ZERO LENGTH LINE?

	JMP	FROINT	/YES -- NO OPTIONS OR PARAMETERS SPECIFIED

FRONX	LAC	FANM	/NO -- ERR 101 IF 0 OR 7 CHAR NAME

	SZA

	JMP	.+4

NAMERR	JMS	ERR1

	MES101

	JMP	FROSNL

	LAC	FANB	/ERR 103 IF BREAK CHAR IS NOT A

	SAD	(054)	/COMMA, ALTMODE, SLASH, OR COLON

	JMP	FRONC

	SAD	(175)

	JMP	FRONC

	SAD	(072)

	JMP	FROFD1	/COLON BREAK, ACCEPT ONLY IF FGD OPTION

	SAD	(57	/SLAH BREAK

	SKP		/ACCEPT ONLY IF VTC OPTION

	JMP	FRO103

	LAC	FANM

	SAD (VTC)		/(RCHM-158)

	JMP	FROVTN

	SAD (RES)		/(RCHM-158) RES WITH NAME LIST?

	JMP FROREN		/(RCHM-158) YES.

	JMP	FRO103	

FROFD1	LAC	FANM

	SAD (BOT)		/(RCHM-158)

	JMP	FROFFB

	SAD (BOO)		/(RCHM-158) BOOT ADDRESS OPTION?

	JMP FROBOO		/(RCHM-158) YES, GO SET UP ADDRESS.

	SAD (ULO)		/(RCHM-159) CHANG THE USER LIBRARY NAME?

	JMP FROUL		/(RCHM-159) YES.

	SAD (SLO)		/(RCHM-159) CHANGE THE SYSTEM LIBRARY NAME?

	JMP FROSL		/(RCHM-159) YES.

FRO103	JMS	ERR3

	MES103

	JMP	FROSNL

/

FROUL	LAC (ULNM)		/(RCHM-159) SET UP PTR TO USER LIBRARY NAME.

	SKP			/(RCHM-159)

FROSL	LAC (SLNM)		/(RCHM-159) SET UP PTR TO SYSTEM LIBRARY NAME.

	DAC TEMP1		/(RCHM-159) POINTER TO OUTPUT AREA.

	JMS FAN			/(RCHM-159) FETCH LIBRARY NAME.

	LAC FANM		/(RCHM-159) CHECK LIBRARY NAME LENGTH.

	SNA			/(RCHM-159)

	JMP FROLNL		/(RCHM-159) BAD LIBRARY NAME LENGTH.

	DAC* TEMP1		/(RCHM-159) SET UP FIRST HALF OF NAME.

	ISZ TEMP1		/(RCHM-159) POINT TO LAST HALF OF NAME.

	LAC FANM+1		/(RCHM-159) FETCH NEXT HALF OF NAME.

	DAC* TEMP1		/(RCHM-159) NAME IS NOW SET UP COMPLETELY.

	JMP FROLNX		/(RCHM-159) GO CONTINUE OPTIONS PROCESSING.

FROLNL	JMS CRTN		/(RCHM-166) FEED A NEW LINE.

	JMS TYPE		/(RCHM-159) PRINT ERROR MESSAGE.

	MES120			/(RCHM-159)

	JMP FROSNL		/(RCHM-159) START OPTIONS OVER.

/

FROBOO	LAC FANM		/(RCHM-158) SAVE CURRENT OPTION FOR LATER.

	DAC LDLMT		/(RCHM-158)

	JMS FAN			/(RCHM-158) FETCH XXK FROM COMMAND LINE.

	LAC FANM+1		/(RCHM-158) COMMAND ONLY 3 CHARACTERS LONG.

	SZA			/(RCHM-158)

	JMP FROBO1		/(RCHM-158) GO PRINT ERROR.

	LAC FANM		/(RCHM-158) FETCH OPTION.

	SAD (626413)		/(RCHM-158) 24K

	LAC (50000)		/(RCHM-158)

	SAD (636213)		/(RCHM-158) 32K

	LAC (70000)		/(RCHM-158)

	ALS 3			/(RCHM-158) CHECK IF OPTION SELECTED.

	SMA!CLL			/(RCHM-158) -AC INDICATES YES.

	JMP FROBO1		/(RCHM-158)

	LRS 3			/(RCHM-158) SHIFT ADDRESS BACK

	XOR* (SC.COR)		/(RCHM-158) SET UP BOOT ADDRESS.

	AND (70000)		/(RCHM-158)

	XOR* (SC.COR)		/(RCHM-158) NEW BOOT ADDRESS CALCULATED.

	DAC LDLMT		/(RCHM-158) LOAD LIMIT NOW OK.

	JMS BOO.TY		/(RCHM-158) SET NEW BOOT TYPE FOR ENVIND.

	JMP FROLNX		/(RCHM-158) GO PROCESS NEXT OPTION.

/

FROBO1	LAC LDLMT		/(RCHM-158) FETCH FIRST HALF OF OPTION.

	DAC FANM		/(RCHM-158)

	LAC (727777)		/(RCHM-158) FETCH ":??"

	DAC FANM+1		/(RCHM-158)

	JMP FRO32		/(RCHM-158) GO PRINT ERROR.

/

FROFFB	DZM BOT.AD		/(RCHM-158) SPECIAL CASE -- FGD:XXX -- ACCEPT

FROFB1	JMS	FAC	/OCTAL CHARACTERS (0-7) TERMINATED BY A

	SAD	(054)	/COMMA OR ALTMODE.  IF MORE THAN 

	JMP	FROFB2	/FIVE OCTAL CHARACTERS, ACCEPT ONLY 

	SAD	(175)	/THE LAST FIVE.  ERR 32 IF A NON-OCTAL

	JMP	FROFB2	/CHARACTER IS FOUND.

	AND	(077)

	XOR	(060)

	DAC	TEMP11

	AND	(070)

	SZA

	JMP	FROFB3

	LAC BOT.AD		/(RCHM-158)

	RCL

	RTL

	AND	(077770)

	XOR	TEMP11

	DAC BOT.AD		/(RCHM-158)

	JMP	FROFB1

/

FROFB2	DAC	FANB	/SET BREAK CHAR AS IF FOUND BY SUB 'FAN'

	JMP FROLNX		/(RCHM-158)

/

FROFB3	LAC	(727777)/NON-OCTAL CHAR FOUND, TYPE:

	DAC	FANM+1	/   UNRECOGNIZED SYMBOL -- FGD:??

	JMP	FRO32

/

FRONC	LAC	FANM+1	/COMPARE NAME WITH RECOGNIZED OPTION

	SZA		/AND PARAMETER SYMBOLS, ERR 32 IF MATCH 

	JMP FRO33		/(RCHM-158) CHECK FOR 128K LIKE OPTION.

	LAC	FANM

	SAD	(PAR) 		/(RCHM-158) PAR

	JMP	FROPAR

	SAD (PAL)		 /(RCHM-158) PAL

	JMP	FROPAL

	SAD (BKR) 		/(RCHM-158) BKR

	JMP	FROBKR

	SAD (PGR) 		/(RCHM-158) PGR

	JMP	FROPGR

	SAD (VTC)		/(RCHM-158) VTC OPTION

	JMP	FROVTC	/WITHOUT NAMES

	SAD (RES)		/(RCHM-158) RES OPTION, WITHOUT NAMES?

	JMP FRORES		/(RCHM-158) YES.

	SAD (SAC) 		/(RCHM-158) SAC

	JMP	FROSAC

	SAD (XVM)		/(RCHM-158) XVM MODE NECESSARY?

	JMP FROXVM		/(RCHM-158) YES.

	SAD (NOX)		/(RCHM-158) XVM MODE UNNECESSARY?

	JMP FRONOX		/(RCHM-158) YES.

	SAD (NM) 		/(RCHM-158) NM

	JMP	FRONM

	SAD (GM) 		/(RCHM-158) GM

	JMP	FROGM

	SAD (SZ) 		/(RCHM-158) SZ

	JMP	FROSZ

	AND (77)		/(RCHM-158) EXTRACT 6BIT CHARACTER.

	SAD (K)			/(RCHM-158) IS IT THE LETTER K?

	JMP FROCOR		/(RCHM-158) YES, GO SET UP MEM.SZ,ETC.

FRO32	JMS	ERR2	/SYMBOL NOT RECOGNIZED

	MES32

	JMP	FROSNL

/+

/ ROUTINE WHICH CALCULATES MEM.SZ FROM VALUES IN .SCOM.

/ IF MEM.SZ IS CURRENTLY THE DEFAULT.

/-

CMEMSZ	XX			/(RCHM-158)

	LAC MEM.SZ		/(RCHM-158) FETCH CURRENT MEMORY SIZE.

	SAD* (SC.COR)		/(RCHM-156) CHECK AGAINST DEFAULT.

	SKP			/(RCHM-156) THE SAME.

	JMP* CMEMSZ		/(RCHM-158)

	LAC* (SC.FRH)		/(RCHM-158) FETCH ADDRESS OF EXTENDED MEM.

	RAL

	LAC* (SC.FRH+1)		/(RCHM-158) FETCH HIGH ADDRESS OF EXTENDED

				/(RCHM-158)  MEMORY.

	SNL			/(RCHM-158) ANY EXTENDED MEMORY?

	DAC MEM.SZ		/(RCHM-158) SET UP PROPER MEMORY SIZE.

	JMP* CMEMSZ		/(RCHM-158)

/

/ WHEN THE KEYWORD "XVM" IS RECOGNIZED, ONLY THE XVM ENVIRONMENT BIT IS SET

/ UP. THIS IS BECAUSE EITHER XVM IS ALREADY ON AND DEFAULTS FOR MEM.SZ ARE

/ ALREADY AVAILABLE OR THE USER WILL BE SPECIFING THEM BY HIMSELF.

/

FROXVM	LAC (4)			/(RCHM-162) FETCH XVM ENVIRONMENT BIT.

	DAC XVM.EV		/(RCHM-162) TELL EXECUTE ABOUT XVM ON.

	JMP FROLNX		/(RCHM-162) GO PROCESS NEXT OPTION.

/

/ WHEN "NOX" IS PROCESSED CHAIN MAY ASSUME THAT NO MEMORY ABOVE THE

/ BOOT STRAP IS AVAILABLE FOR PLACING COMMON BLOCKS. THEREFORE MEM.SZ IS SET

/ EQUAL TO LDLMT. THE USER MAY SPECIFY AS MUCH AS 32K OF MEMORY SEPARATELY AN

/ NOT HAVE TO HAVE XVM ON. FOR EXAMPLE, BOO:24K,32K WOULD CAUSE CHAIN TO TREATT

/ THE UPPER 8K OF MEMORY AS EXTENDED MEMORY.

/

FRONOX	DZM XVM.EV		/(RCHM-162) CLEAR XVM ENVIRONMENT BIT.

	LAC LDLMT		/(RCHM-162) MAKE MEMSIZE THE SAME AS

	DAC MEM.SZ		/(RCHM-162) LDLMT.

	JMP FROLNX		/(RCHM-162) GO PROCESS NEXT OPTION.

/

FRO33	SAD (K*10000)		/(RCHM-158) CHECK FOR 100+ K OF MEMORY.

	JMP FROCOR		/(RCHM-158) ACCEPT THE OPTION.

	JMP FRO32		/(RCHM-158) OTHERWISE GIVE AN ERROR.

/

FROCOR	LAC (FANBF-1)		/(RCHM-158) GET DIGITS OUT OF UNPACKED

	DAC* (X10)		/(RCHM-158) BUFFER AREA THROUGH AR10.

	LAW -3			/(RCHM-158) SET UP MAXIMUM DIGITS.

	DAC TEMP1		/(RCHM-158) FOR LOOP CONTROL.

	DZM MEM.SZ		/(RCHM-158) CLEAR CURRENT MEMORY SIZE.

FROCR1	LAC* X10		/(RCHM-158) FETCH DIGIT.

	SAD (K)			/(RCHM-158) END OF DIGITS?

	JMP FROCR2		/(RCHM-158) YES, LEAVE PROCESS.

	XOR (60)		/(RCHM-158) STRIP BITS.

	DAC TEMP3		/(RCHM-158) SAVE FOR LATER.

	AND (60)		/(RCHM-158) IS IT A DIGIT?

	SZA			/(RCHM-158)

	JMP FRO32		/(RCHM-158) NO, GIVE ERROR.

	LAC TEMP3		/(RCHM-158) FETCH DIGIT.

	AAC -12			/(RCHM-158) DIGIT OUT OF RANGE?

	SMA			/(RCHM-158)

	JMP FRO32		/(RCHM-158) YES.

	LAC MEM.SZ		/(RCHM-158) FETCH EMEMORY SIZE.

	RTL!CLL			/(RCHM-158) *4

	TAD MEM.SZ		/(RCHM-158) *5

	RAL!CLL			/(RCHM-158) *10

	TAD TEMP3		/(RCHM-158) +LOW ORDER DIGIT.

	DAC MEM.SZ		/(RCHM-158) SAVE UPDATED EMEMORY SIZE.

	ISZ TEMP1		/(RCHM-158) DONE WITH DIGITS YET?

	JMP FROCR1		/(RCHM-158) NO.

FROCR2	LAC MEM.SZ		/(RCHM-158)

	AND (7)			/(RCHM-158) MEMORY MUST BE IN BANKS OF 8K.

	SZA			/(RCHM-158) OK?

	JMP FROCR4		/(RCHM-158) NO, ERROR.

FROCR3	LAC MEM.SZ		/(RCHM-158)

	AAC -30			/(RCHM-158) MEMORY IN BOUNDS? >=24K

	SPA			/(RCHM-158)

	JMP FRO32		/(RCHM-158) NO.

	LAC MEM.SZ		/(RCHM-158)

	AAC -200		/(RCHM-158) CHECK FOR MORE THAN 128K.

	SMA!SZA			/(RCHM-158) CORE LIMITS OK?

	JMP FRO32		/(RCHM-158) NO, ERROR.

	LAC MEM.SZ		/(RCHM-158)

	AAC -41			/(RCHM-158) CHECK FOR AUTO XVM MODE.

	SPA			/(RCHM-158) BIGGER THAN 32K?

	JMP FROCR5		/(RCHM-158) NO.

	LAC (4)			/(RCHM-158) FETCH ENVIRONMENT FLAG.

	DAC XVM.EV		/(RCHM-158)

FROCR5	LAC MEM.SZ		/(RCHM-158) CONVERT TO REAL NUMBER OF WORDS.

	ALS 12			/(RCHM-158) NUMBER OF WORDS IN MEMORY.

	AAC -1			/(RCHM-158) LAST USABLE WORD.

	DAC MEM.SZ		/(RCHM-158) MEMORY ALL SET UP.

	JMP FROLNX		/(RCHM-158) GET NEXT PARAMETER.

/

FROCR4	JMS ERR2		/(RCHM-158) TELL USER ABOUT DOUBTFUL MEMORY.

	MES119			/(RCHM-158)

	JMP FROCR3		/(RCHM-158) RETURN TO INLINE CODE.

/

FROPAR	LAW	-1	/SETUP TO 'PAUSE AFTER RESIDENT'

	SKP

FROPAL	LAC	(+1)	/SETUP TO 'PAUSE AFTER LINK' (INCLUDING 

	DAC	PSFLAG	/RESIDENT CODE)

	JMP	FROLNX

FROBKR	LAC	(017777)/SET ADDRESS AND OPCODE MASKS FOR BANK RELOCATION

	SKP

FROPGR	LAC	(007777)/SET ADDRESS AND OPCODE MASKS FOR PAGE RELOCATION

	DAC	ADRMSK

	CMA

	DAC	OPCMSK

/SETUP UFDT -1 TO READ

/CORRECT LIBRARY

	AND	(10000	/PAGE OR BANK

	SNA

	JMP	BNKUIC

	LAC	PAG

	SKP

BNKUIC	LAC	BNK

	DAC	UIC

UIC=.+2				/(RCHM-158) SET UP .USER MACRO.

	.USER SL,XX		/(RCHM-158) ADJUST SYSTEM LIBRARY UIC.

	JMP	FROLNX

/

PAG	.SIXBT	'PAG'

BNK	.SIXBT	'BNK'

/

/

/VT NAMED COMMON OPTION (VTC) WITHOUT NAMES

/

FROVTC	LAC (SKP)		/(RCHM-158) SET ALL COMMON VTC SWITCH.

	DAC VTC.ALL		/(RCHM-158)

	JMP	FROLNX	/GET NEXT OPTION

/

/ RES NAMED COMMON OPTION (RES) WITHOUT NAMES.

/

FRORES	LAC (SKP)		/(RCHM-158) FETCH RES ON SWITCH.

	DAC RES.ALL		/(RCHM-158)

	JMP FROLNX		/(RCHM-158)

/

/VT NAMED COMMON OPTION (VTC/NM1,NM2,.../) WITH NAMES

/RES NAMED COMMON OPTION (RES/NM1,NM2,.../) WITH NAMES.

/

FROREN	JMS RES.ON		/(RCHM-158) TURN ON RES SWITCH.

	SKP

FROVTN	JMS VTC.ON		/(RCHM-158) TURN ON VTC SWITCH.

FROVTB	JMS	FAN	/GET NAME OF COMMON AREA

	LAC	FANM	/CHECK FOR LENGHT ERROR

	SNA

	JMP	NAMERR

/

/MAKE ENTRY IN NAMED COMMON LIST (NCL) FOR THIS NAME

/ FORMAT FOR NCL IS GIVEN IN THE GLOSSARY (SEE ABOVE).

/

	JMS NCL.CM		/(RCHM-158) GO INSERT NAME IN NCL.

/

/CHECK TERMINATOR---OPTION ENDED BY A SLASH. A COMMA

/IS USED TO SPERATE THE NAMES ALL OTHER TERMINATORS ARE ILLEGAL

/

	LAC	FANB

	SAD	(57	/SLASH

	JMP	VTCEXT	/EXIT FROM OPTION

	SAD	(54	/COMMA

	JMP	FROVTB	/GET NEXT NAME

	JMP	FRO103	/IMPROPER BREAK CHAR

/

/EXIT FROM VTC/---/ OR RES/---/ OPTION--MAKE SURE

/NEXT ELEMENT IN COMMAND LINE IS NOT JUST AN

/ALTMORE (IE) END OF OPTIONS

/

VTCEXT	JMS VTC.OFF		/(RCHM-158) TURN OFF VTC SWITCH.

	JMS RES.OFF		/(RCHM-158) TURN OFF RES SWITCH.

	JMS	FAN	/GET NEXT OPTION

	SAD	(175	/IS THIS END OF OPTIONS

	SKP

	JMP	FRONX	/NO--GO SERVICE OPTION

	LAC	FANM	/MAYBE--FANM=FANM+1=0

	SZA		/IF IT IS

	JMP	FRONX	/NO--GO SERVICE OPTION

	SAD	FANM+1

	JMP	FROINT	/YES---INITIALIZE PER OPTION & PARAMETERS

	JMP	FRONX	/NO--GO SERVICE OPTION--WILL BE AN ERROR

/

FROSAC	ISZ	SAFLAG	/SET SINGLE-ALLOCATION-OF-COMMONS FLAG

	JMP	FROLNX

FRONM	DZM	LMFLAG	/CLEAR LOAD MAP FLAG

	JMP	FROLNX

FROGM	ISZ	GMFLAG	/SET GLOBAL MAP FLAG

	ISZ LMFLAG		/(RCHM-168) SET LMFLAG ALSO.

	JMP	FROLNX

FROSZ	ISZ	SZFLAG	/SET SIZE FLAG

/

FROLNX	LAC	FANB	/LAST NAME TEST

	SAD	(175)	/ALTMODE BREAK?

	JMP	FROINT	/YES -- INITIALIZE PER ACCEPTED OPTIONS & PARAMS

	JMS	FAN	/NO -- FETCH ANOTHER NAME

	JMP	FRONX

/

	.TITLE *** (RCHM-158) NAMED COMMON LIST (NCL) BUILD AND ALTER ROUTINES

/+

/ COMMON CODE USED FROM FROVTC AND FRORES TO BUILD NEW AND MODIFY OLD

/ ENTRIES IN THE NCL. THE FORMAT OF THE NCL IS GIVEN IN THE GLOSSARY.

/ THIS ROUTINE ASSUMES THAT THE NAME TO BE SEARCHED FOR IS IN SIXBIT

/ FORMAT RESIDING IN CELLS FANM AND FANM+1.

/

/ CALL:

/

/	...			/SET UP FANM AND FANM+1

/	JMS NCL.CM		/SET UP NCL ACCORDING TO VTC.AL, RES.AL

/				/VTC.SW, AND RES.SW.

/-

NCL.CM	XX			/ ENTRY POINT FOR NCL PROCESSOR.

	DZM SYM2		/ PREPARE FOR COMPARISON LOOP.

	LAC FANM		/ FETCH THREE CHARACTERS OF COMMON NAME.

	JMS CTR50		/ CONVERT TO RAD50 FORMAT.

	DAC SYM1		/ SAVE IN SYM1 FOR COMPARISON.

	LAC FANM+1		/ FETCH NEXT THREE CHARACTERS.

	SNA			/ IS THE SECOND PART OF THE SYMBOL IMPORTANT?

	JMP NCL.C1		/ NOW, GO CALL NCL SCANNER.

	JMS CTR50		/(RCHM-158) CONVERT TO RAD50.

	DAC SYM2		/ SAVE SECOND HALF OF COMMON BLOCK NAME.

	LAC SYM1		/ SET UP FIRST HALF OF GLOBAL NAME.

	XOR (400000)		/ FLAG 2WORD NAME.

	DAC SYM1		/ FINISH NCL SCANNER SETUP

NCL.C1	JMS NCL.SC		/ CALL NCL SCANNER.

	JMP NCL.C2		/ SCANNER INDICATES NAME NOT FOUND.

NCL.C6	XCT VTC.ALL		/ CHECK TO SEE IF VTC WAS SELECTED.

	SKP			/ NO, IT WASN'T.

	JMP NCL.C3		/ YES, ALL COMMONS NAMED ARE TO BE VTC.

	XCT VTC.SW		/ CHECK TO SEE IF JUST THIS NAME IS VTC.

	JMP NCL.C4		/ NO, GO CHECK RES OPTIONS.

NCL.C3	LAC* NCL.PT		/ FETCH WORD WITH VTC FLAG.

	AND (577777)		/ TURN OFF VTC FLAG.

	XOR (200000)		/ REENABLE VTC FLAG.

	DAC* NCL.PT		/ RESTORE NEW VALUE OF VTC FLAG.

NCL.C4	ISZ NCL.PT		/ POINT TO WORD WITH RES FLAG.

	XCT RES.ALL		/ RES OPTION SELECTED?

	SKP			/ NO, GO CHECK THIS COMMON ONLY SWITCH.

	JMP NCL.C5		/ YES, GO SET RES SWITCH.

	XCT RES.SW		/ IS THIS PARTICULAR COMMON TO BE RES?

	JMP* NCL.CM		/ NO, RETURN TO CALLER.

NCL.C5	LAC* NCL.PT		/ FETCH LIST ENTRY FROM LIST.

	AND (377777)		/ TURN OFF RES SWITCH.

	XOR (400000)		/ TURN ON RES SWITCH.

	DAC* NCL.PT		/ RESTORE NEW SWITCH IN LIST.

	JMP* NCL.CM		/ RETURN TO USER, ALL DONE.

/+

/ THE NAMED COMMON DID NOT OCCUR IN THE NCL. MAKE A NEW ENTRY AND

/ REENTER NCL.CM CODE ABOVE.

/-

NCL.C2	LAC RCL.BS		/ FETCH POINTER TO NEXT AVAILABLE LIST

				/ ENTRY.

	DAC NCL.PT		/ SET UP POINTER TO IT.

	LAC SYM1		/ FETCH 1ST HALF OF COMMON NAME.

	DAC* RCL.BS		/ PUT IN LIST.

	ISZ RCL.BS		/ BUMP LAST ADDRESS.

	LAC SYM2		/ FETCH 2ND HALF OF COMMON NAME.

	DAC* RCL.BS		/ PUT IN LIST.

	ISZ RCL.BS		/ BUMP LAST ADDRESS.

	JMP NCL.C6		/ GO SET SWITCHES APPROPRIATELY.

	.TITLE *** (RCHM-158) ROUTINES TO MANIPULATE VTC AND RES SWITCHES.

RV.INT	XX			/ INITIALIZE NCL.

	JMS RES.OFF		/ TURN RES OFF.

	JMS VTC.OFF		/ TURN VTC OFF.

	LAC* (SC.FRL)		/ FETCH START OF TABLE SPACE.

	DAC NCL.BS		/ SET UP BASE OF NCL.

	DAC RCL.BS		/ SET UP BASE OF RCL (LAST ADDRESS OF

				/ NCL).

	JMP* RV.INT		/ RETURN TO CALLER.

	.TITLE *** SET BOOTSTRAP TYPE

/

BOO.TY	XX			/(RCHM-158)

	LAC LDLMT		/(RCHM-158) FETCH NEW LOAD LIMIT.

	ALS 4			/(RCHM-158) DIFFERENTIATE BETWEEN 50000

	RAL			/(RCHM-158) AND 700000

	SZL!CLA			/(RCHM-158) 24K BOOT ADDRESS?

	LAC (10)		/(RCHM-158) NO, 32K BOOT ADDRESS.

	DAC BOO.EV		/(RCHM-158) SET UP ENVIRONMENT FLAG.

	JMP* BOO.TY		/(RCHM-158) RETURN TO CALLER.

	.TITLE *** INITIALZE CHAIN PROCESSING PER SELECTED OPTIONS.

FROINT	LAC	SZFLAG	/INCREASE MAP LINE LENGTH IF SIZE OPTION

	SNA

	JMP	FROENV

	LAC (022000)		/(RCHM-163)

	DAC	MAPBUF

	LAC	(040)

	DAC	MAPFAD+13

FROENV	LAC	ADRMSK	/SAVE ADR MASK FOR RESTORATION (LDR CODE 23)

	DAC	AMREST	/AND FIT TEST, AND SET ENVIRONMENT INDICATOR:

	AND	(010000)/  BIT-16 FOR BANK RELOCATION

	RCL

	JMS	LCS7

	XOR (20)		/(RCHM-161) SET XVM/DOS COMPATABILITY BIT.

	DAC	ENVIND

	XCT RES.ALL		/(RCHM-158) CHECK TO SEE IF WE MAINTAIN

	JMP FROCT		/(RCHM-158) THE NCL.

	XCT VTC.ALL		/(RCHM-158) WE DON'T IF BOTH RES AND VTC

	SKP			/(RCHM-158) HAVE BEEN SELECTED.

	JMS RV.INT		/(RCHM-158) RESET NCL POINTERS.

FROCT	LAC (CLT)		/(RCHM-156) SETUP CORE-LIMITS-TABLE (CLT) CONSISTING

	DAC CLTX1		/OF UPPER LIMITS OF EACH EXITSING CORE

	LAC	LDLMT	/BANK OR PAGE TERMINATED BY

FROCT1	DAC*	CLTX1	/A -1 (MAX 9 WORDS)

	SAD	(-1)

	JMP FROEC		/(RCHM-158) END OF LOOP, EXIT.

	AND	OPCMSK

	AAC -1			/(RCHM-158)

	ISZ	CLTX1

	JMP	FROCT1

/+

/ SET UP EXTENDED MEMORY CORE LIMITS TABLE.

/-

FROEC	LAC (ECLT)		/(RCHM-158) FETCH STARTING ADDRESS OF TABLE POINTER.

	DAC ECLTX1		/(RCHM-158) INITIALIZE TABLE POINTER.

	LAC MEM.SZ		/(RCHM-158) FETCH EXTENDED MEMORY SIZE.

	JMP .+4			/(RCHM-158) MISS FIRST INSTRUCTION OF LOOP.

FROEC1	AND OPCMSK		/(RCHM-158) SET UP FOR HIGHEST OF NEXT BANK.

	AAC -1			/(RCHM-158) SUB 1 FOR HIGHEXT IN BANK.

	ISZ ECLTX1		/(RCHM-158) POINT TO NEXT ENTRY IN TABLE.

	DAC TEMP1		/(RCHM-158) SAVE ADDRESS FOR LATER.

	AND OPCMSK		/(RCHM-158) EXTRACT HIGH ADDR BITS.

	DAC TEMP2		/(RCHM-158) SAVE FOR LATER.

	LAC CLT			/(RCHM-158) FETCH HIGHEST BANK OF LOW CORE.

	AND OPCMSK		/(RCHM-158) SEE IF WE ARE IN SAME BANK OR PAGE.

	SAD TEMP2		/(RCHM-156) CHECK AGAINST CURRENT ADDRESS.

	SKP			/(RCHM-156) TABLE DONE, EXIT.

	JMP FROEC2		/(RCHM-158) TABLE NOT DONE.

	LAW -1			/(RCHM-158) FETCH END OF TABLE FLAG.

	SKP			/(RCHM-158)

FROEC2	LAC TEMP1		/(RCHM-158) FETCH HIGH ADDRESS.

	DAC* ECLTX1		/(RCHM-158) STORE IN TABLE

	SAD (-1)		/(RCHM-158) DONE WITH TABLE?

	SKP			/(RCHM-158) YES.

	JMP FROEC1		/(RCHM-156) NO, CONTINUE LOOP.

/

	LAC (NOP)		/(RCHM-158) SET UP EXTENDED MEMORY SKIP.

	DAC SIF.EM		/(RCHM-158)

	LAC ECLTX1		/(RCHM-158) CHECK TO SEE IF ANY EXTENDED

	SAD (ECLT)		/(RCHM-158) MEMORY EXISTS AT ALL.

	JMP FROLMT		/(RCHM-158) NO EXTENDED MEMORY.

	LAC (SKP)		/(RCHM-158) FETCH SKIP TO TURN ON

	DAC SIF.EM		/(RCHM-158) SWITCH.

	LAC ECLT		/(RCHM-158) DO ONCE ONLY INITIALIZATION

	DAC ELDLM2		/(RCHM-158) OF EXTENDED EMORY LOAD LIMITS

FROLMT	LAC BOT.AD		/(RCHM-158)

	SPA

	JMP FRORCL		/(RCHM-158) NO BOTTOM ADDRESS SET.

	LAC (NOP)		/(RCHM-158)

	DAC SIFTOP		/(RCHM-158)

	LAC BOT.AD		/(RCHM-158) CONTINUE PROCESSING.

	DAC	LDLMT

	AND	ADRMSK	/IF LDLMT IS WITHIN THE FIRST 20 REGISTERS,

	AND	(777760)/SET TO 21 ST.

	SZA

	JMP FROLM1		/(RCHM-162) CHECK TO SEE IF ELDLM2 SHOULD BE SET UP.

	LAC	LDLMT

	AND	OPCMSK

	XOR	(000020)

	DAC LDLMT

FROLM1	XCT SIF.EM		/(RCHM-162) EXTENDED MEMORY ON THE SYSTEM

	JMP FRORCL		/(RCHM-158) NO.

	LAC CLT			/(RCHM-160) FETCH TOP OF EXECUTABLE MEMORY.

	AND OPCMSK		/(RCHM-160) STRIP OUT PAG AND BANK BITS.

	TAD ADRMSK		/(RCHM-160) ADD 7777 OR 17777

	AAC 1			/(RCHM-160) ADD 10000 OR 20000

	DAC ELDLM2		/(RCHM-160) ELDLM2 NOW SET UP PROPERLY.

/

 .TITLE *** BUILD RESIDENT CODE LIST (RCL)

/ READ ONE LINE OF RESIDENT CODE NAMES (MINIMUN, ONE NAME) AND

/ CONSTRUCT THE RESIDENT-CODE-LIST (RCL).

/ RCL ENTRY FORMAT:

/    INDICATOR WORD

/    ROUTINE NAME (TWO WORDS

/    .SIXBT RT FILLED WITH ZEROS)

/

FRORCL	JMS	CRTN		/REQUEST RESIDENT CODE LIST

	JMS	TYPE1

	MES50

/

RCLSNL	LAC RCL.BS		/(RCHM-158) START NEW LINE -- SET ENTRY

	DAC RL.LA		/(RCHM-158) INDEX.

	JMS	RFAN		/READ A LINE AND FETCH AN NAME

	LAC	FANM

	SZA			/ ERR 51 IF ZERO LENGTH LINE

	JMP	RCLBX		/ OTHERWISE, ERR 101 IF 0 OR 7 CHARACTER NAME

	LAC	FANM+1		/

	SNA			/ OTHERWISE, ACCEPT NAME

	JMP	.+4		/ AS NAME OF MAIN PROGRAM

RCL101	JMS	ERR1		/ IF COMMA OR ALTMODE BREAK

	MES101			/ CHARACTER

	JMP	RCLSNL

	LAC	FANB

	SAD	(175)

	SKP

	JMP	RCL101

	JMS	ERR1

	MES51

	JMP	RCLSNL

RCLBX	LAC	FANB		/BREAK CHARACTER TEST --

	SAD	(054)		/ERR 103 IF OTHER THAN

	JMP	RCLNX		/COMMA OR ALTMODE.

	SAD	(175)

	JMP	RCLNX

	JMS	ERR3

	MES103

	JMP	RCLSNL

RCLNX	LAC RCL.BS		/(RCHM-158) ERR 118 IF NAME HAS

	JMS	LDTSCN		/ALREADY BEEN ENTERED IN RCL

	JMP	.+4		/ CONTINUE IF NOT FOUND.

	JMS	ERR2

	MES118

	JMP	RCLSNL

	LAC	FANI		/MAKE RCL ENTRY

	AND	(070)

	XOR	(100)		/ SET RESIDENT CODE BIT.

	DAC	FANI

	JMS	LDTENT

/

	LAC	FANB		/ALTMODE BREAK CHARACTER?

	SAD	(175)

	JMP	RCLLDT		/YES -- END OF LIST

/

	JMS	FAN		/NO -- FETCH ANOTHER NAME

	LAC	FANM		/ ERR 101 IF 0 OR 7 CHARS

	SZA

	JMP	RCLBX

	JMP	RCL101

/

 .TITLE *** BUILD LINK DEFINITION TABLE (LDT)

RCLLDT	LAC RL.LA		/(RCHM-158) END RCL AND START LDT.  RCL WILL BE

	DAC LDTBSE		/FOLLOWED BY AN INDICATOR FOR A LINK DEFINITION

	DAC	LDTLSX	/(001) EVEN IF THERE ARE NO LINK DEFINITIONS.

			/THIS IS NECESSARY WHEN RELOCATING THE RESIDENT

			/CODE (TERMINATES LIST SCAN IN SUBROUTINE RAO).

/

/ READ LINK DEFINITIONS (IF ANY) AND CONSTRUCT THE

/ LINK-DEFINITION-TABLE (LDT) FOLLOWING THE RCL.

/ LDT ENTRY FORMAT

/    INDICATOR -- SAME AS RCL

/    NAME -- SAME AS RCL

/

	JMS	CRTN

	JMS	TYPE1		/TYPE --

	MES60			/"DESCRIBE LINKS & STRUCTURE"

/

LDTSNL	LAC (NOP)		/(RCHM-158) START NEW LINE, SET E/I FLAG TO EXT.

	DAC LDTEIF		/(RCHM-158)

	JMS	RFAN		/READ LINE AND FETCH FIRST NAME

	LAC	FANM		/ERR 101 IF 0 OR 7 CHAR NAME

	SZA

	JMP	LDTECX

	LAC	FANM+1	/INTERPRET ZERO LENGTH LINE AS 'RESIDENT ONLY' 

	SNA

	JMP	RCO

	JMS	ERR1

	MES101

	JMP	LDTRSL

/

/ DETERMINE TYPE OF DESCRIPTION THAT HAS BEEN ENTERED.

/

/	NAME=....	IS A LINK DEFINITION.

/	NAME:....	IS AN OVERLAY DEFINITION.

/

LDTECX	LAC	FANB		/TEST FOR EQUALS OR COLON BREAK CHAR

	SAD	(075)		/ IF EQUAL SIGN -- LINK DEFINITION

	JMP	LDTSN1		/ IF COLON -- END LINK DEFINITIONS

	SAD	(072)		/ AND START OVERLAY DESCRIPTION

	JMP	LDTODT		/ IF OTHER -- ERR 103

	JMS	ERR3

	MES103

	JMP	LDTRSL

LDTSN1	LAC RCL.BS		/(RCHM-158) SCAN RCL & LDT FOR NAME

	JMS	LDTSCN		/JUST FETCHED FROM COMMAND STRING

	JMP	.+4		/ CONTINUE IF NAME NOT FOUND.

	JMS	ERR2

	MES102

	JMP	LDTRSL

	LAC	FANI		/TEST FETCHED NAME INDICATOR FOR

	AND	(020)		/BIT-13. ERR 113 IF 

	SNA			/SET. OTHERWISE, SET INDICATOR

	JMP	.+4		/FOR A LINK NAME LDT ENTRY.

	JMS	ERR2		/I.E., SET BIT-17 & CLEAR OTHERS.

	MES113

	JMP	LDTRSL

	LAC	(001)

	DAC	FANI

	JMS	LDTENT		/ENTER INDICATOR & NAME IN LDT

/

/ LINK NAME HAS BEEN ENTERED IN LDT. NOW GO AFTER THE VARIOUS

/ PROGRAM NAMES.

/

LDTFAN	JMS	FAN		/FETCH ANOTHER NAME

	LAC	FANM		/ERR 101 IF 0 OR 7 CHAR NAME

	SZA

	JMP	.+4

	JMS	ERR1

	MES101

	JMP	LDTRSL

	LAC	FANB		/TEST FOR COMMA, ALTMODE, OR SLASH

	SAD	(054)		/BREAK CHARACTER. ERR 103 IF OTHER.

	JMP	LDTSFX

	SAD	(175)

	JMP	LDTSFX

	SAD	(057)

	JMP	LDTSSF

	JMS	ERR3

	MES103

	JMP	LDTRSL

LDTSSF	XCT LDTEIF		/(RCHM-158) CHECK IF SLASH HAS ALREADY HAPPENED.

	JMP .+4			/ NOT YET, GO SET FLAG TO INTERNAL.

	JMS	ERR3		/TO EXTERNAL 

	MES103

	JMP	LDTRSL

	LAC (SKP)		/(RCHM-158) SET EXT/INT FLAG TO INTERNAL.

	DAC LDTEIF		/(RCHM-158)

	JMP	LDTSN3

/

LDTSFX	XCT LDTEIF		/(RCHM-158) COMMA OR ALTMODE BREAK, TEST FOR

	JMP	LDTSN3		/ SLASH READ.

	LAC RCL.BS		/(RCHM-158) SCAN BOTH RCL AND LDT.

LDTSN2	JMS	LDTSCN		/RCL & LDT FOR NAME.  ERR 116

				/IF NAME IS FOUND AND IS NOT

	JMP	LDTSN4		/ALSO AN INTERNAL COMPONENT

	DAC	TEMP1		/NAME

	LAC*	TEMP1

	AND	(004)

	SNA

	JMP	.+4

	LAC	TEMP1

	AAC LDTESZ		/(RCHM-158)

	JMP	LDTSN2

	JMS	ERR2

	MES116

	JMP	LDTRSL

/

LDTSN4	LAC	LDTLSX		/ERR 104 IF NAME IS FOUND IN 

	JMS	LDTSCN		/CURRENT LINE

	SKP			/(RCHM-158)

	JMP	.+3

	LAC	(004)		/(BIT-15 FOR INT SUB NAME)

	JMP	LDTEN2

	JMS	ERR2

	MES104

	JMP	LDTRSL

LDTSN3	LAC RCL.BS		/(RCHM-158) SCAN RCL & LDT FOR NAME, ERR 105

	JMS	LDTSCN		/IF FOUND.

	SKP			/(RCHM-158)

	JMP	.+3

	LAC	(002)		/(BIT-16 FOR EXT SUB NAME)

	JMP	LDTEN2

	JMS	ERR2

	MES105

	JMP	LDTRSL

LDTEN2	XOR	FANI		/SET INDICATOR AND MAKE

	DAC	FANI		/LDT ENTRY

	JMS	LDTENT

	LAC	FANB		/END OF LINE?

	SAD	(175)

	SKP

	JMP	LDTFAN		/NO -- FETCH ANOTHER NAME

	LAC RL.LA		/(RCHM-158) YES -- UPDATE LINE START

	DAC	LDTLSX		/INDEX AND START A NEW

	JMP	LDTSNL		/LINE

/

LDTRSL	LAC	LDTLSX	/ERROR DETECTED, RESTART LOGICAL LINE

	DAC RL.LA		/(RCHM-158)

	JMP	LDTSNL

/

/ LDTENT -- SUBROUTINE TO MAKE A RCL OR LDT ENTRY.

/           THE INDICATOR AND NAME ARE TAKEN FROM FANI, FANM,

/           & FANM+1.

/           LDTX1 IS UPDATED TO POINT TO THE NEXT LDT ENTRY

/

LDTENT	0

	LAC	FANI

	JMS	LDTENS

	LAC	FANM

	JMS	LDTENS

	LAC	FANM+1

	JMS	LDTENS

	JMP*	LDTENT

/

LDTENS	0

	DAC* RL.LA		/(RCHM-158)

	ISZ RL.LA		/(RCHM-158)

	JMP*	LDTENS

	.EJECT

/

/ LDTSCN -- SUBROUTINE TO SCAN THE RCL OR LDT FOR

/           THE NAME CONTAINED IN FANM & FANM+1.  THE SCAN 

/           START INDEX IS TAKEN FROM AC.  IF NAME IS

/           FOUND, THE LDT ENTRY INDEX IS RETURNED IN AC.

/           IF NOT FOUND, AC IS SET TO -1

/           TEMP1 IS USED TO SCAN ENTRIES

/           TEMP2 IS USED TO SCAN WITHIN ENTRIES

/

LDTSCN	0

LDTSC1	SAD RL.LA		/(RCHM-158) TEST FOR END OF TABLE

	JMP	LDTSC3

	DAC	TEMP1

	DAC	TEMP2

	ISZ	TEMP2	/COMPARE TWO WORD NAME

	LAC*	TEMP2

	SAD	FANM

	SKP

	JMP	LDTSC2	/FIRST WORD, NO MATCH

	ISZ	TEMP2

	LAC*	TEMP2

	SAD	FANM+1

	SKP

	JMP	LDTSC2	/SECOND WORD, NO MATCH

	LAC	TEMP1	/NAME MATCH, EXIT WITH AC CONTAINING THE

	ISZ LDTSCN		/(RCHM-158) TAKE FOUND EXIT.

	JMP*	LDTSCN	/INDEX OF ENTRY WITH MATCHING NAME.

/

LDTSC2	LAC	TEMP1	/NO MATCH, AUGMENT ENTRY INDEX

	AAC LDTESZ		/(RCHM-158)

	JMP	LDTSC1

/

LDTSC3	LAW	-1	/NAME NOT FOUND IN LDT, EXIT WITH

	JMP*	LDTSCN	/AC=-1

/

 .TITLE *** BUILD OVERLAY DESCRIPTION TABLE (ODT)

/

/ A CONSTRUCT OF THE FORM "NAME:...." HAS BEEN IDENTIFIED. ALL THE REST

/ OF THE DEFINITIONS SHOULD BE OVERLAY DESCRIPTIONS. CONTSTURCT THE

/ OVERLAY DESCRIPTION TABLE.

/

LDTODT	LAC	(001)	/TERMINATE LDT WITH AN INDICATOR FOR A

	DAC* RL.LA		/(RCHM-158) LINK DEFINITION.

	LAC RL.LA		/(RCHM-158) INITIALIZE ODT

	AAC 1			/(RCHM-158)

	DAC	ODTX1	/ODT IS PRECEDED BY AN ALTMODE TO PROVIDE

	LAC	(175)	/A 'PREVIOUS BREAK CHARACTER' FOR THE

	DAC*	ODTX1	/FIRST ODT ENTRY.

	ISZ	ODTX1

	LAC	ODTX1

	DAC	ODTBSE

	DAC	ODTLSX

	JMP	ODTSN1

/

/ READ OVERLAY DESCRIPTION COMMANDS AND CONSTRUCT THE

/ OVERLAY DESCRIPTION TABLE (ODT) FOLLOWING THE LDT.

/ ODT ENTRY FORMAT:

/    INDICATOR--SAME AS IN LDT

/    NAME--SAME AS IN LDT

/    REGISTER USED WHEN PROCESSING LDT (BACK POINTER)

/    BREAK CHARACTER (IMAGE ALPHA)

/

ODTSNL=.				/START NEW LINE

	JMS	RFAN		/READ COMMAND LINE  & FETCH FIRST NAME

	LAC	FANM		/TEST FOR NAME SIZE ERROR

	SZA

	JMP	ODTCX1

	LAC	FANM+1		/NAME SIZE ERROR -- IF ZERO

	SNA			/LENGTH NAME & ALTMODE BREAK

	JMP	.+4		/(I.E., ZERO LENGTH LINE), TERMINATE

ODT101	JMS	ERR1		/ODT, OTHERWISE ERR 101

	MES101

	JMP	ODTRSL

	LAC	FANB

	SAD	(175)

	SKP

	JMP	ODT101

	LAC	ODTX1		/ZERO LENGTH LINE, TERMINATE

	SAD	ODTBSE		/ODT, UNLESS ZERO LENGTH ODT.

	JMP	ODT101

	JMP	ODTTTL

ODTCX1	LAC	FANB		/BREAK FOLLOWING FIRST NAME MUST

	SAD	(072)		/BE A COLON--ERROR IF NOT.

	JMP	ODTSN1		/  EQUAL SIGN, ERR 107

	SAD	(075)		/  OTHER, ERR 108

	JMP	.+4

	JMS	ERR1

	MES108

	JMP	ODTRSL

	JMS	ERR1

	MES107

	JMP	ODTRSL

/

ODTFAN	JMS	FAN		/FETCH ANOTHER NAME

	LAC	FANM		/ERR 101 IF 0 OR 7 CHAR NAME

	SNA

	JMP	ODT101

ODTSN1	LAC RCL.BS		/(RCHM-158) SCAN RCL & LDT FOR NAME

	JMS	LDTSCN

	SKP			/(RCHM-158)

	JMP	ODTS1A

	LAC	FANI		/NOT FOUND -- CONSIDER EXTERNAL NAME

	XOR	(002)		/SET BIT (16) IN FETCHED NAME INDICATOR

	DAC	FANI

	JMP	ODTCX2

/

ODTS1A	DAC	TEMP1		/NAME FOUND--

	LAC*	TEMP1		/ ERR 106 IF NAME IS A LINK COMPONENT

	AND	(100)		/ERR 117 IF NAME OF RESIDENT ROUTINE

	SNA

	JMP	.+4

	JMS	ERR2

	MES117

	JMP	ODTRSL

	LAC*	TEMP1

	AND	(001)		/ERR 113 IF NAME IS A LINK NAME

	SZA			/ AND A LIBRARY INDICATOR WAS

	JMP	.+4		/ KEYED IN.

	JMS	ERR2		/ OTHERWISE, ACCEPT NAME AND

	MES106			/ SET INDICATOR BIT-17 (CLEAR OTHERS)

	JMP	ODTRSL		/ IN NAME FETCH INDICATOR (PREPARE

	LAC	FANI		/ FOR OTD ENTRY

	AND	(020)

	SNA

	JMP	.+4

	JMS	ERR2

	MES113

	JMP	ODTRSL

	LAC	(001)

	DAC	FANI

ODTCX2	LAC	FANB		/TEST BREAK CHARACTER FOR COLON.

	SAD	(072)		/COMMA OR ALTMODE.

	JMP	ODTLC		/ERR 103 IF OTHER

	SAD	(054)

	JMP	ODTRC

	SAD	(175)

	JMP	ODTRC

	JMS	ERR3

	MES103

	JMP	ODTRSL

ODTRC	LAC	ODTBSE		/BREAK CHARACTER IS COMMA OR ALTMODE.

	JMS	ODTSCN		/SINCE FIRST NAME MUST BE FOLLOWED

				/BY A COLON, THIS NAME MUST FOLLOW

	JMP	ODTE1		/A COLON.  A NAME MAY APPEAR ONCE

	JMS	ERR2		/ON THE RIGHT OF A COLON AND IF

	MES110			/USED LEFT OF A COLON IT MUST

	JMP	ODTRSL		/HAVE BEEN USED ON THE RIGHT FIRST.

				/THEREFORE, ERR 110 IF NAME IS

				/ALREADY IN THE ODT.

/

ODTLC	LAC	ODTX1		/COLON BREAK CHAR, I.E., NAME IS

	AAC -1			/(RCHM-158) USED LEFT OF COLON -- TEST PREVIOUS

	DAC	TEMP1		/BREAK CHARACTER FOR COLON OR

	LAC*	TEMP1		/ALTMODE.  ERR 109 IF OTHER.

	SAD	(072)

	JMP	ODTCNC

	SAD	(175)

	JMP	ODTANC

	JMS	ERR1

	MES109

	JMP	ODTRSL

ODTCNC	LAC	ODTBSE		/COLON-NAME-COLON  NAME USED BOTH

	JMS	ODTSCN		/RIGHT & LEFT OF COLONS, AND

				/SHOULD NOT APPEAR AGAIN

	JMP	ODTE1		/IN THE ODT. ERR 111 IF FOUND

	JMS	ERR2

	MES111

	JMP	ODTRSL

ODTANC	LAC	ODTBSE		/ALTMODE-NAME-COLON  NAME IS USED

	JMS	ODTSCN		/LEFT OF COLON.  THEREFORE IF NAME

				/CAN BE FOUND IN THE ODT, IT MUST

	JMP	ODTE1		/BE RIGHT OF A COLON AND NOT ALSO

	AAC -1			/(RCHM-158) LEFT OF A COLON (I.E., IT MUST

	AAC ODTESZ		/(RCHM-158) NOT HAVE A COLON BREAK). ERR 112

	DAC	TEMP1		/IF NAME IS FOUND WITH COLON BREAK.

	LAC*	TEMP1

	ISZ	TEMP1

	SAD	(072)

	SKP

	JMP	.+4

	JMS	ERR2

	MES112

	JMP	ODTRSL

	LAC	TEMP1		/NAME FOUND, BUT RIGHT OF COLON ONLY.

	JMS	ODTSCN		/CONTINUE ODT SCAN, ERR 111 IF

				/NAME IS FOUND AGAIN.

	JMP	ODTE1

	JMS	ERR2

	MES111

	JMP	ODTRSL

/

ODTE1	JMS	ODTENT		/MAKE ODT ENTRY

	LAC	FANB		/END OF LINE?

	SAD	(175)

	SKP

	JMP	ODTFAN		/NO -- FETCH ANOTHER NAME

	LAC	ODTX1		/YES -- UPDATE LINE START

	DAC	ODTLSX		/INDEX AND START A NEW

	JMP	ODTSNL		/LINE

/

ODTRSL	LAC	ODTLSX		/ERROR DETECTED -- HAS A LINE OF OVERLAY

	SAD	ODTBSE		/DESCRIPTION BEEN ACCEPTED?

	JMP	LDTRSL		/NO -- RESTART LINE OF LINK DEFINITION

	DAC	ODTX1		/YES -- RESTART LINE OF OVERLAY DESCRIPTION

	JMP	ODTSNL

/

/ ODTENT -- SUBROUTINE TO MAKE AN OVERLAY-DESCRIPTION-TABLE ENTRY.

/	    THE INDICATOR, NAME, & BREAK CHARACTER ARE

/	    TAKEN FROM FANI, FANM, FANM+1, & FANB

/	    ODTX1 IS UPDATED TO POINT TO THE NEXT ODT ENTRY

/

ODTENT	0			/FORMAT: INDICATOR

	LAC	FANI		/         NAME

	JMS	ODTENS		/         NAME

	LAC	FANM		/         ZERO

	JMS	ODTENS		/         BREAK

	LAC	FANM+1

	JMS	ODTENS

	CLA

	JMS	ODTENS

	LAC	FANB

	JMS	ODTENS

	JMP*	ODTENT

/

ODTENS	0

	DAC*	ODTX1

	ISZ	ODTX1

	JMP*	ODTENS

/

/ ODTSCN -- SUBROUTINE TO SCAN THE OVERLAY-DESCRIPTION-TABLE

/	    FOR THE NAME CONTAINED IN FANM & FANM+1.  THE

/	    SCAN START INDEX IS TAKEN FROM AC.  IF NAME

/	    IS FOUND, THE LDT ENTRY INDEX IS LEFT IN AC.

/	    IF NOT FOUND, AC IS SET TO -1.

/             TEMP1 IS USED TO SCAN ENTRIES

/             TEMP2 IS USED TO SCAN WITHIN ENTRIES

/

ODTSCN	0

ODTSC1	SAD	ODTX1		/TEST FOR END OF TABLE

	JMP	ODTSC3

	DAC	TEMP1

	DAC	TEMP2

	ISZ	TEMP2		/COMPARE TWO WORDS

	LAC*	TEMP2

	SAD	FANM

	SKP

	JMP	ODTSC2		/FIRST WORD, NO MATCH

	ISZ	TEMP2

	LAC*	TEMP2

	SAD	FANM+1

	SKP

	JMP	ODTSC2		/SECOND WORD, NO MATCH

	LAC	TEMP1		/NAME MATCH, EXIT WITH AC CONTAINING THE

	ISZ ODTSCN		/(RCHM-158)

	JMP*	ODTSCN		/INDEX OF ENTRY WITH MATCHING NAME

ODTSC2	LAC	TEMP1		/NO MATCH, AUGMENT ENTRY INDEX

	AAC ODTESZ		/(RCHM-158)

	JMP	ODTSC1

ODTSC3	LAW	-1		/NOT FOUND, EXIT WITH AC=-1

	JMP*	ODTSCN

/

 .TITLE *** BUILD TRUNK-TO-TWIG LISTS (TTL'S)

ODTTTL	LAC	ODTX1	/END OF ODT, START TTL

	DAC	TTLBSE

	DAC	TTLX1

	JMP	TTLSNL

/

/ PROCESS ODT TO BUILD "TRUNK-TO-TWIG LISTS" (TTL'S).

/ ONE LIST FOR EACH SET OF "LINKS WITH SOME COMMON CORE".

/ EACH LIST BEGINS WITH A LINK THAT IS NOT DEFINED AS OVERLAYING

/ ANOTHER LINK (TRUNK), FOLLOWED BY LINKS THAT ARE DEFINED AS 

/ BOTH OVERLAYING AND OVERLAYED (IF ANY), AND ENDING WITH

/ A LINK THAT IS NOT DEFINED AS OVERLAYED BY ANOTHER LINK (TWIG).

/ TTL ENTRY FORMAT (3 WDS):

/    INDICATOR -- SAME AS IN LDT

/    LINK NAME -- SAME AS IN LDT

/ EACH LIST IS TERMINATED BY ONE WORD SET TO -1

/

TTLSNL	LAW	-1	/START NEW LIST -- SET POINTER TO -1

	DAC	TTLPNT

	LAC	ODTBSE	/SET TTLX2 TO POINT TO FIRST ODT ENTRY

	DAC	TTLX2

TTLFO1	LAC	TTLX2	/FETCH ODT ENTRY PER TTLX2

	JMS	TTLFOE

	LAC	TTLOEN	/BLANK (ZERO) NAME?

	SZA

	JMP	TTLE1	/NO -- ENTER INDICATOR AND NAME IN TTL

	LAC	TTLX2	/YES -- TEST FOR END OF ODT.  IF NOT, FETCH

	AAC ODTESZ		/(RCHM-158) ANOTHER ODT ENTRY.

	DAC	TTLX2	/IF END OF ODT AND THE ENTIRE ODT HAS NOT BEEN

	SAD	ODTX1	/BLANKED (ZEROED), TERMINATE THIS TLL

	SKP		/AND PROCEDE TO START ANOTHER TTL

	JMP	TTLFO1	/IF ENTIRE ODT HAS BEEN BLANKED (POINTER=-1)

	LAC	TTLPNT	/ALL TTL'S HAVE BEEN MADE.

	SMA

	JMP	TTLTRM

	JMP	TTLLTB

/

TTLE1	LAC	TTLOEI	/NON-BLANK  NAME FOUND -- ENTER INDICATOR

	JMS	TTLENT	/AND NAME IN TTL

	LAC	TTLOEN

	JMS	TTLENT

	LAC	TTLOEN+1

	JMS	TTLENT

/

TTLSP1	LAC	TTLX2	/SET POINTER IN ODT, SET ODT ENTRY

	AAC 3			/(RCHM-158) INDEX IN POINTER, AND AUGMENT ODT INDEX

	DAC	TEMP1

	LAC	TTLPNT

	DAC*	TEMP1

	LAC	TTLX2

	DAC	TTLPNT

	AAC ODTESZ		/(RCHM-158)

	DAC	TTLX2

	LAC	TTLOEB	/SEARCH FOR AN OVERLAYING LINK.  IF A 

	SAD	(072)	/COLON BREAK CHAR, AN OVERLAYING LINK

	JMP	TTLFO1	/FOLLOWS IN ODT.  OTHERWISE, REMAINDER

	LAC	TTLOEN	/ODT MUST BE SEARCHED.

	DAC	TEMP3

	LAC	TTLOEN+1

	DAC	TEMP4

TTLOS1	LAC	TTLX2	/SCAN ODT FOR NAME IN TEMP3 & TEMP4

	SAD	ODTX1

	JMP	TTLTRM	/NOT FOUND, TERMINATE TTL & BLANK NAME

	JMS	TTLFOE

	LAC	TTLOEN

	SAD	TEMP3

	SKP

	JMP	TTLOS2

	LAC	TTLOEN+1

	SAD	TEMP4

	JMP	TTLSP1	/NAME FOUND, SET POINTER IN ODT AND 

			/SEARCH FOR ANOTHER OVERLAYING LINK.

TTLOS2	LAC	TTLX2

	AAC ODTESZ		/(RCHM-158)

	DAC	TTLX2

	JMP	TTLOS1

/

TTLTRM	LAW	-1	/TERMINATE A TTL

	JMS	TTLENT

/

TTLBE1	LAC	TTLPNT	/SAVE POINTER-1 (TO FETCH PREVIOUS

	DAC*	(X10)	/BREAK CHAR), BLANK (ZERO) NAME IN ODT

	AAC -1			/(RCHM-158) ENTRY INDICATED BY POINTER, AND NEW

	DAC	TEMP1	/POINTER FROM BLANKED ODT ENTRY.

	DZM*	X10

	DZM*	X10

	LAC*	X10

	DAC	TTLPNT

/

TTLBE2	LAC*	TEMP1	/SCAN PREVIOUS BREAK CHARACTERS TIL A

	SAD	(072)	/COLON OR ALTMODE IS FOUND.

	JMP	TTLBE3

	SAD	(175)

	JMP	TTLBE3

	LAC	TEMP1

	AAC -ODTESZ		/(RCHM-158)

	DAC	TEMP1

	JMP	TTLBE2

/

TTLBE3	LAC	TEMP1	/SCAN ODT FROM NAME FOLLOWING COLON OR

	AAC 1			/(RCHM-158) ALTMODE THRU A NAME TERMINATED BY COLON

	DAC	TTLX2	/OR ALTMODE FOR A NON-BLANK NAME.  IF NOT

TTLBE4	JMS	TTLFOE	/FOUND, FOLLOW POINTER BACK TO BLANK THE

	LAC	TTLOEN	/NAME OF THE LINK OVERLAYED BY THIS

	SZA		/LINK OR GROUP OF LINKS.

	JMP	TTLSNL	/IF FOUND, START NEW LIST

	LAC	TTLOEB

	SAD	(072)

	JMP	TTLBE5

	SAD	(175)

	JMP	TTLBE5

	LAC	TTLX2

	AAC ODTESZ		/(RCHM-158)

	DAC	TTLX2

	JMP	TTLBE4

/

TTLBE5	LAC	TTLPNT

	SMA

	JMP	TTLBE1

	JMP	TTLSNL

/

/ TTLFOE -- SUBROUTINE TO FETCH THE ODT ENTRY WHOSE INDEX IS IN AC.

/           THE ENTRY IS LEFT IN THE FIVE FOLLOWING REGISTERS:

/

TTLOEI	0	/INDICATOR

TTLOEN	.BLOCK 2	/NAME

TTLOEP	0	/POINTER

TTLOEB	0	/BREAK CHAR

/

TTLFOE	0

	AAC -1			/(RCHM-158)

	DAC*	(X10)

	LAC	(TTLOEI-1)	/(RCHM-156)

	DAC*	(X11)

	LAW	-5

	DAC	TTLFOC

TTLFOL	LAC*	X10

	DAC*	X11

	ISZ	TTLFOC

	JMP	TTLFOL

	JMP*	TTLFOE

/

TTLFOC	0

/

/ TTLENT -- SUBROUTINE TO ENTER THE WORD IN AC IN TTL

/

TTLENT	0

	DAC*	TTLX1

	ISZ	TTLX1

	JMP*	TTLENT

/

 .TITLE *** SUBR(S) TO READ AND BREAK DOWN COMMAND LINES

/ RFAN -- SUBROUTINE TO READ A COMMAND LINE (LOGICAL) AND

/	  FETCH THE FIRST NAME. I.E. TO SET THE FOUR

/	  FOLLOWING WORDS. THE BREAK CHARACTER IS LEFT IN AC.

/		FANI	INDICATOR

/		FANM	6-SIX BIT CHARACTER NAME (TWO WORDS)

/		FANM+1

/		FANB	BREAK CHARACTER (TERMINATING NAME)

/	  INDICATOR BITS SET AS FOLLOWS:

/		BIT-14 USER FILE

/		BIT-13 USER LIBRARY

/		BIT-12 SYSTEM LIBRARY

/	NAME IS RIGHT JUSTIFIED, LEFT FILLED WITH ZEROS.

/	FANM IS SET ZERO TO INDICATE A NAME LENGTH ERROR.

/	FANM+1 IS SET: 0 FOR ZERO LENGTH NAME

/	FANM+1 IS SET -1 FOR LENGTH GREATER THAN SIX CHAR

/

FANI	0		/FILE SOURCE INDICATOR

FANM	.BLOCK	2	/FILE NAME BUFFER

FANB	0		/BREAK CHAR BUFFER

CBUF	.BLOCK	42	/COMMAND BUFFER (80 CHARACTERS)

/

RFAN	0

	JMS	CRTN	/RETURN CARRIAGE

	XCT	BOSSW

	JMP	BOSS2

	JMS	TYPE	/TYPE ANGLE BRACKET

	CAGB

BOSS2	JMS	RFRD	/READ COMMAND LINE (PHYSICAL LINE)

	JMS	FAN	/FETCH FIRST NAME

	JMP*	RFAN	/EXIT

/

CAGB	.ASCII	/>/<175>

CHYP	.ASCII	/-/<175>

/

RFRD	0		/SUBROUTINE TO READ A LINE AND RESET

RFRDZ	.READ	CI,2,CBUF,34	/FACX1 & FACX2 IN FAC

	.WAIT	CI

	XCT	BOSSW

	JMP	BOSECH

RDCONT	LAC	(FACB+5)	/(RCHM-156)

	DAC	FACX1

	LAC	(CBUF+2)	/(RCHM-156)

	DAC	FACX2

	JMP*	RFRD

BOSECH	.WRITE	TO,2,CBUF,34	/ECHO LINE IF IN BOSS MODE

	.WAIT	TO

	JMP	RDCONT

/

/ FAN -- SUBROUTINE TO "FETCH A NAME". REGISTERS FANI, FANM, & FANB

/	 ARE SET AS DESCRIBED UNDER "RFAN".

/

FAN	0

	LAC	(010)		/SET INDICATOR BIT-14

	DAC	FANI		/TO INDICATE USER DEVICE SRC

	DZM	FANM

	DZM	FANM+1

	LAC	(FANBF-1)	/(RCHM-156) SETUP TO READ UP TO SIX CHARACTERS

	DAC*	(X10)		/INTO FANBF THRU FANBF+5

	LAW	-7

	DAC	FANX1

FAN1	JMS	FAC		/FETCH A CHARACTER

	SAD	(043)		/TEST FOR LIB INDICATOR (#)

	JMP	FAN5

	SAD	(072)		/BREAK CHARACTERS TEST --

	JMP	FAN2		/COLON

	SAD	(054)

	JMP	FAN2		/COMMA

	SAD	(075)

	JMP	FAN2		/EQUAL SIGN

	SAD	(057)

	JMP	FAN2		/SLASH

	SAD	(175)

	JMP	FAN2		/ALTMODE

	AND	(077)		/MASK TO SIX-BIT

	DAC*	X10		/SAVE CHAR

	ISZ	FANX1

	JMP	FAN1

	DAC	FANB		/NAME TOO LONG--USE SEVENTH CHARACTER

	DZM	FANM		/AS BREAK CHAR, CLEAR FIRST NAME

	LAW	-1		/WORD AND SET SECOND NAME WORD

	DAC	FANM+1		/TO -1, AND EXIT

	JMP	FAN4

FAN2	DAC	FANB		/SAVE BREAK CHARACTER

	DZM*	X10		/CLEAR TRAILING CHARACTERS THRU

	ISZ	FANX1		/SEVENTH (EXTRA WORD TO SAVE CODE)

	JMP	.-2

	LAC	(FANBF-1)	/(RCHM-156) SETUP TO PACK SIX CHARACTERS

	DAC*	(X10)		/INTO FANM & FANM+1

	LAC	(FANM)		/(RCHM-156)

	DAC	FANX1

	LAW	-6

	DAC	FANX2

FAN3	LAC*	FANX1		/PACK NAME

	CLL

	JMS	LCS6

	XOR*	X10

	DAC*	FANX1

	LAC	FANX2

	SAD	(-4)

	ISZ	FANX1

	ISZ	FANX2

	JMP	FAN3

FAN4	LAC	FANB		/LOAD AC WITH BREAK CHARACTER

	JMP*	FAN		/AND EXIT

/

FAN5	LAC	(020)		/LIBRARY INDICATOR FOUND

	DAC	FANI		/SET INDICATOR BIT-13

	JMP	FAN1		/(CLEAR OTHER BITS)

/

FANX1	0

FANX2	0

FANBF	.BLOCK	7

/

/ FAC -- SUBROUTINE TO FETCH A CHARACTER FROM THE COMMAND

/	 BUFFER AND LEAVE IT IN AC. IF CHAR IS A CARRIAGE

/	 RETURN, ANOTHER LINE WILL BE READ. IF CHAR IS

/	 AN ALTMODE (END OF LINE), IT WILL RETURNED FOR THIS

/	 AND ALL SUCCEEDING CALLS UNTIL A NEW LINE IS READ.

/          IF CHARACTER IS A BLANK, IT WILL BE IGNORED.

/	 FACX1 & FACX2 ARE RESET WHEN A NEW LINE IS READ.

/

FAC	0

FAC0	LAC	FACX1		/TEST FOR EMPTY CHARACTER FACB

	SAD	(FACB+5)	/(RCHM-156)

	JMP	FAC2

FAC1	LAC*	FACX1		/FETCH CHARACTER FROM FACB

	AND	(177)

	SAD	(040)		/IGNORE BLANKS

	JMP	FAC4

	SAD	(015)		/IF THE CARRIAGE RETURN, READ A

	JMP	FAC3		/CONTINUATION LINE, TO FETCH CHARACTER.

	SAD	(175)		/AUGMENT FACB INDEX & EXIT, UNLESS

	JMP*	FAC		/CHARACTER WAS ALTMODE, THEN

	ISZ	FACX1		/EXIT WITHOUT AUGMENTING THE

	JMP*	FAC		/FACB INDEX.

/

FAC2	LAC*	FACX2		/UNPACK FIVE CHARACTERS FROM COMMAND

	ISZ	FACX2		/BUFFER AND STORE AS 7-BIT IMAGE

	RCL

	JMS	LCS7

	DAC	FACB

	JMS	LCS7

	DAC	FACB+1

	JMS	LCS7

	AND	(170)

	DAC	FACB+2

	LAC*	FACX2

	ISZ	FACX2

	RTL

	RTL

	DAC	FACB+3

	AND	(007)

	XOR	FACB+2

	DAC	FACB+2

	LAC	FACB+3

	JMS	LCS7

	DAC	FACB+3

	JMS	LCS7

	DAC	FACB+4

	LAC	(FACB)		/(RCHM-156) RESET FACB INDEX

	DAC	FACX1

	JMP	FAC1		/TO FETCH A CHAR FROM FACB

/

FAC3=.

	XCT	BOSSW

	JMP	BOSS3

	JMS	TYPE		/TYPE HYPHEN TO INDICATE CONTINUATION

	CHYP			/OF IS EXPECTED.

BOSS3	JMS	RFRD		/READ A NEW LINE & RESET FACX1 & FACX2

	JMP	FAC2		/TO FETCH A CHAR FROM FACB

/

FAC4	ISZ	FACX1

	JMP	FAC0

/

FACX1	0			/FACB INDEX

FACX2	0			/COMMAND BUFFER INDEX

FACB	.BLOCK	5		/FIVE CHARACTER BUFFER

 .TITLE *** SUBR(S) FOR ERROR MESS.&ZERO LENGTH LINE TEST

/

/ ERR1, ERR2, & ERR3 -- SUBROUTINES TO OUTPUT ERROR MESSAGES.

/ EACH TAKES THE ADDRESS OF THE MESSAGE FROM THE WORD FOLLOWING

/ THE CALL (JMS).

/ ERR1  OUTPUTS A MESSAGE AND RETURNS

/ ERR2  OUTPUTS A MESSAGE, THE NAME IN FANM&FANM+1, AND RETURNS

/ ERR3  OUTPUTS A MESSAGE, THE BREAK CHAR IN FANB, AND RETURNS.

/

ERR1	0

	LAC*	ERR1

	ISZ	ERR1

	JMS	ERRTO

	JMP*	ERR1

/

ERR2	0

	LAC*	ERR2

	ISZ	ERR2

	JMS	ERRTO

	JMS	TYPE

	MES100

	LAC	FANM

	JMS	ERR6BO

	LAC	FANM+1

	JMS	ERR6BO

	JMP*	ERR2

/

ERR3	0

	LAC*	ERR3

	ISZ	ERR3

	JMS	ERRTO

	JMS	TYPE

	MES100

	LAC	FANB

	DAC	ERR6BF+2

ERR3Z	.WRITE	TO,3,ERR6BF,0

	.WAIT	TO

	JMP*	ERR3

/

ERR6BO	0	/.SIXBT OUTPUT

	DAC	TEMP1

	LAW	-3

	DAC	TEMP3

ERR6BL	LAC	TEMP1

	JMS	LCS7

	DAC	TEMP2

	RAR

	DAC	TEMP1

	LAC	TEMP2

	AND	(077)

	SNA

	JMP	ERR6BA

	XOR	(040)

	AAC 40			/(RCHM-158)

	DAC	ERR6BF+2

ERR6BZ	.WRITE	TO,3,ERR6BF,0

	.WAIT	TO

ERR6BA	ISZ	TEMP3

	JMP	ERR6BL

	JMP*	ERR6BO

/

ERR6BF	002000

	0

	0

	177

/

/

ERRTO	0

	AAC -2			/(RCHM-158)

	DAC	ERRTOW+2

	JMS	CRTN

ERRTOW	.WRITE	TO,2,XX,0

	.WAIT	TO

	XCT BOSSW

	JMS EXIT		/(RCHM-158)

	JMP*	ERRTO

/

/ ZLLX -- SUBROUTINE TO TEST FOR A ZERO 

/         LENGTH LINE (ALTMODE ONLY)

/	RETURN AT JMS+1 IF YES

/	RETURN AT JMS+2 IF NO

/

ZLLX	0

	LAC	FANM

	SZA

	JMP	ZLL1

	LAC	FANM+1

	SZA

	JMP	ZLL1

	LAC	FANB

	SAD	(175)

	JMP*	ZLLX	/YES

ZLL1	ISZ	ZLLX	/NO

	JMP*	ZLLX

 .TITLE *** TELETYPE MESSAGES PART 1.

/

/

/ TELETYPE OUTPUT MESSAGES.  THE TWO WORDS PRECEDING EACH

/ MESSAGE ARE USED AS AN IOPS ASCII HEADER.  THE ONLY HEADER

/ REQUIREMENT FOR TTY OUTPUT IS A GREATER THAN ONE WORD-

/ PAIR COUNT.

/

MES1	.SYSID <	.ASCII "CHAIN >,<000"<15>>  /(RCHM-166)

MES20	.ASCII	/NA/<0><0><0>/ME /<0><0>/XCT FILE/<175>

MES30	.ASCII	/LI/<0><0><0>/ST /<0><0>/OPTIONS & PARAMETERS/<175>

MES32	.ASCII	/^ UNRECOGNIZED SYMBOL/<175>

MES50	.ASCII	/DEFINE /<0><0><0>/RESIDENT CODE/<175>

MES51	.ASCII	/^ RES ROUTINE REQ'D/<175>

MES60	.ASCII	/DESCRIBE /<0>/LINKS & STRUCTURE/<175>

MES100	.ASCII	/ -- /<175>

MES101	.ASCII	/^ NAME LENGTH ERR/<175>

MES102	.ASCII	/^ LINK NAME USED PRV/<175>

MES103	.ASCII	/^ IMPROPER BREAK CHAR/<175>

MES104	.ASCII	/^ INTERNAL NAME REPEATED IN LINE/<175>

MES105	.ASCII	/^ EXTERNAL NAME USED PRV/<175>

MES106	.ASCII	/^ COMPONENT NAME USED AS LINK NAME/<175>

MES107	.ASCII	/^ LINK DEF WITHIN OVERLAY DESCRIPTION/<175>

MES108	.ASCII	/^ COLON MUST FOLLOW FIRST LINK NAME/<175>

MES109	.ASCII	/^ MORE THAN ONE LINK OVERLAYED/<175>

MES110	.ASCII	/^ NAME RIGHT OF COLON USED PRV/<175>

MES111	.ASCII	/^ NAME USED MORE THAN TWICE/<175>

MES112	.ASCII	/^ NAME USED LEFT OF COLON TWICE/<175>

MES113	.ASCII	/^ LIB IND ON LINK NAME/<175>

MES116	.ASCII	/^ INTERNAL NAME USED PRV/<175>

MES117	.ASCII	/^ RES ROUTINE NAME USED AS LINK NAME/<175>

MES118	.ASCII	/^ NAME USED MORE THAN ONCE/<175>

MES119	.ASCII /^ QUESTIONABLE MEMORY SIZE/<175> /(RCHM-158)

MES120	.ASCII /^ ZERO LENGTH LIBRARY NAME/<175> /(RCHM-159)

	.TITLE *** LITERAL POOL FOR CHAIN PART 1

	.LTORG			/(RCHM-163) THIS ELIMINATES SEVERAL CONSTANTS WHICH

				/(RCHM-163) ARE USED ONLY BY THE HEADER CODE.

				/(RCHM-163) WHILE IT WILL MAKE CHAIN SOMEWHAT LARGER

				/(RCHM-163) THIS SPACE WILL BE REUSED ANYWAY.

 .TITLE *** MOVE TTL'S TO HIGH CORE

/ ALL COMMAND INPUT HAS BEEN ACCEPTED

/

/ THE OVERLAY-DESCRIPTION-TABLE, AND THE CODE REQUIRED TO GENERATE 

/ THE RCL, LDT, ODT, & TTL'S, ARE NO LONGER NEEDED -- LEAVE  

/ RCL &  LDT IN THEIR PRESENT LOW CORE POSITION AND MOVE THE TTL'S 

/ TO AS HIGH CORE AS POSSIBLE.

/

TTLLTB	LAC (JMS EXIT)		/(RCHM-158) RESTART VIA ^P IS NO LONGER POSSIBLE,

	DAC	CPTVA	/SET ^P TRANSFER ADDRESS TO EXIT IF ^P.

	LAC	TTLBSE		/CHANGE TTLBSE & TTLX1 AND

	AAC -1			/(RCHM-158) SETUP TO MOVE TTL'S

	DAC*	(X10)

	LAC	TTLX1

	CMA!IAC			/(RCHM-157)

	TAD	TTLBSE

	DAC	TEMP1

	LAC	TRTTL

	AAC 1			/(RCHM-158)

	TAD	TEMP1

	DAC	TTLBSE

	AAC -1			/(RCHM-158)

	DAC*	(X11)

	LAC	TRTTL

	DAC	TTLX1

	JMS	CRTN

	JMP	MOVTTL

TRTTL	.	/THE TOP OF THE RELOCATED TTL'S WILL OVERLAY 

		/THIS WORD.

/

/^^^^^^^^^^^^^^^^^^^^^ CORE PRECEDING THIS ^^^^^^^^^^^^^^^^^^^^^

/^^^^^^^^^^^^^^^^^^^ LOCATION IS WRITTEN OVER ^^^^^^^^^^^^^^^^^^

/

MOVTTL	LAC*	X10	/MOVE TTL'S

	DAC*	X11

	ISZ	TEMP1

	JMP	MOVTTL

/

 .TITLE *** CONSTRUCT PRELIMINARY LINK TABLE (LTB)

/ CONSTRUCT THE PRELIMINARY LINK TABLE (LTB) BY SCANNING THE

/ TTL'S AND GENERATING AN LTB ENTRY FOR EACH NEW ROUTINE (LINK

/ OR LINK COMPONENT) NAME.  THE ONLY PERMANENT ENTRY ELEMENT IN THE

/ PRELIMINARY LTB IS THE LINK NUMBER.

/

/ LINK TABLE ENTRY FORMATS:

/

/    PRELIMINARY  FINAL           WHEN LINK

/    CONSTRUCTION CONSTRUCTION    IS RESIDENT

/

/     IND. (TTL)  0               0

/     LINK-	  DAC  BUF	  DAC  BUF

/        NAME	  JMS* (EXU)	  LAC  .-2

/     COMPONENT	  DAC* .+3	  DAC* .+3

/        NAME	  LAC  BUF	  LAC  BUF

/     R-FLAG	  JMP* .+2	  JMP* .+2

/     0		  ENTRY		  ENTRY

/     0		  ENTRY+1	  ENTRY+1

/     LINK #      LINK #          LINK #

/     INDEX	  MIN ADR	  MIN ADR

/     0		  MAX ADR	  MAX ADR

/

/ IND AND LINK NAME ARE

/ USED ONLY IN THE FIRST

/ LDT ENTRY FOR EACH LINK

/ (ZEROED IN OTHERS)

/

/ R-FLAG IS INITIALLY ZERO

/ AND IS SET NON-ZERO WHEN 

/ LINK IS RELOCATED & OUTPUT.

/

/ INDEX -- THE LDT INDEX OF

/ THE FIRST COMPONENT OF THIS

/ LINK.  ZERO IF LINK NAME AND

/ LONE COMPONENT ARE THE SAME

/ (NO LINK DEFINITION).

/

/ DEFINITION: SCL -- SINGLE COMPONENT LINK.  A LINK WHOSE SINGLE

/ COMPONENT HAS THE SAME NAME.  I.E., A LINK THAT IS NOT DEFINED

/ IN THE LINK DEFINITION TABLE (LDT).

/

	LAC	TTLBSE	/INITIALIZE LTB

	DAC	LTBX2

	AAC -1			/(RCHM-158)

	DAC	LTBTOP

	DAC	LTBBSE

	DZM	LNKNUM

	LAC	TTLBSE	/SETUP FOR TTL SCAN (LTBX3)

	JMP	CPLT1A

CPLT1	LAC	LTBX3	/FETCH NEXT TTL ENTRY

	AAC TTLESZ		/(RCHM-158)

CPLT1A	DAC	LTBX3

	JMS	FETTTL

	LAC	TTLETY	/END OF TTL?

	SMA

	JMP	CPLT2	/NO -- SCAN LTB FOR LINK NAME

	LAC	LTBX3	/YES -- END OF LAST TTL?

	SAD	TTLX1

	JMP	DLTBL	/YES -- DETERMINE SIZE AND LOCATION 

			/       AT EXECUTE TIME

	AAC 1			/(RCHM-158) NO -- AUGMENT LTBX3 AND FETCH

	JMP	CPLT1A	/      NEXT TTL ENTRY

CPLT2	LAC	LTBTOP	/SETUP FOR LTB SCAN (LTBX2)

	DAC	LTBX2	/(SCAN FROM TOP TO BASE)

CPLT3	LAC	LTBX2	/INDEX AT BASE?

	SAD	LTBBSE

	JMP	CPLT4	/YES -- NAME NOT FOUND, ADD ENTRY AT BASE

	AAC -LTBESZ		/(RCHM-158) NO -- DECREMENT INDES AND FETCH NEXT

	DAC	LTBX2	/LTB ENTRY

	JMS	FETLTB

	LAC	LTBETY+1 /NAME FOUND?

	SAD	TTLETY+1

	SKP

	JMP	CPLT3	/NO -- FETCH NEXT LTB ENTRY

	LAC	LTBETY+2

	SAD	TTLETY+2

	JMP	CPLT1	/YES -- FETCH NEXT TTL

	JMP	CPLT3	/NO -- FETCH NEXT LTB ENTRY

/

CPLT4	LAC	TTLETY+1 /SETUP LTB ENTRY FOR A SCL (SINGLE COMPONENT 

	DAC	LTBETY+1 /LINK).

	DAC	LTBETY+3

	LAC	TTLETY+2

	DAC	LTBETY+2

	DAC	LTBETY+4

	DZM	LTBETY+5

	DZM	LTBETY+6

	DZM	LTBETY+7

	ISZ	LNKNUM

	LAC	LNKNUM

	DAC	LTBETY+10

	DZM	LTBETY+11

	DZM	LTBETY+12

	LAC	TTLETY	/TEST FOR A SCL

	DAC	LTBETY

	AND	(001)

	SZA

	JMP	CPLT5	/NO -- ENTER EXTERNAL COMPONENTS IN LTB

	LAC	LTBBSE	/YES -- MAKE SINGLE LTB ENTRY

	AAC -LTBESZ		/(RCHM-158)

	DAC	LTBBSE

	JMS	SETLTB

	JMP	CPLT1

/

CPLT5	LAC	LDTBSE	/SCAN LDT FOR LINK NAME

	DAC	LTBX4

CPLT6	LAC	LTBX4

	JMS	FETLDT

	LAC	LTBX4

	AAC LDTESZ		/(RCHM-158)

	DAC	LTBX4

	LAC	LDTETY+1

	SAD	LTBETY+1

	SKP

	JMP	CPLT6

	LAC	LDTETY+2

	SAD	LTBETY+2

	SKP

	JMP	CPLT6

	LAC	LTBX4	/NAME FOUND, SET INDEX OF FIRST COMPONENT 

	DAC	LTBETY+11 /IN LTB ENTRY

CPLT7	JMS	FETLDT	/FETCH COMPONENT NAME

	LAC	LDTETY	/EXTERNAL NAME?

	AND	(002)

	SNA

	JMP	CPLT1	/NO -- END OF ENTRIES FOR THIS LINK

	LAC	LDTETY+1 /YES -- SET COMPONENT NAME IN LDT ENTRY

	DAC	LTBETY+3

	LAC	LDTETY+2

	DAC	LTBETY+4

/

	LAC	LTBBSE	/ADD LTB ENTRY

	AAC -LTBESZ		/(RCHM-158)

	DAC	LTBBSE

	JMS	SETLTB

	DZM	LTBETY	/BLANK (ZERO) IND, NAME, AND INDEX

	DZM	LTBETY+1

	DZM	LTBETY+2

	DZM	LTBETY+11

	LAC	LTBX4

	AAC LDTESZ		/(RCHM-158)

	DAC	LTBX4

	JMP	CPLT7

/

/ DETERMINE THE LIMITS OF CORE THAT WILL BE OCCUPIED

/ BY THE LINK TABLE (LOW CORE FOR FOREGROUND, HIGH CORE FOR

/ BACKGROUND), SET THE MAX (BGD) OR MIN (FGD) REGISTER 

/ REQUIRED, ADJUST LOAD LIMIT 'LDLMT'.

/(THE LINK TABLE INCLUDES A ONE WORD BUFFER BELOW LTBBSE OR LTBBAD)

/

DLTBL	XCT	SIFTOP		/(RCHM-158) TOP DOWN OR BOTTOM UP LOADING?

	JMP	DLTBLF

	LAC	LDLMT	/BGD CHAIN -- THE LINK TABLE WILL RESIDE IN 

	DAC	LTBTAD	/DECREASING CORE FORM LDLMT

	DAC	MAXREG	/SET MAX REG REQ

	LAC	LTBBSE

	CMA!IAC			/(RCHM-157)

	TAD	LTBTOP

	CMA!IAC			/(RCHM-157)

	TAD	LDLMT

	DAC	LTBBAD

	AAC -2			/(RCHM-158) (INCLUDE AC BUFFER BELOW LTBBSE)

	DAC	LDLMT	/UPDATE LDLMT

	DAC	CLT

	LAC ECLT		/(RCHM-158) RESET MAXREG IF NECESSARY.

	XCT SIF.EM		/(RCHM-158) EXTENDED MEMORY AVAILABLE?

	SKP			/(RCHM-158) NO.

	DAC MAXREG		/(RCHM-158) YES.

	JMP	CGST

/

DLTBLF	LAC	LTBBSE	/FGD CHAIN -- LINK TABLE WILL RESIDE IN INCREASING

	CMA!IAC			/(RCHM-157) CORE FROM LDLMT2

	TAD	LTBTOP	/IF NECESSARY, LDLMT IS INCREASED TO PREVENT THE

	DAC	TEMP10	/LINK TABLE FROM CROSSING A PAGE OR BANK BOUND

	AAC 1			/(RCHM-158)

	TAD	LDLMT

	AND	OPCMSK

	DAC	TEMP11

	LAC	LDLMT

	AND	OPCMSK

	SAD	TEMP11

	JMP	.+3

	LAC	TEMP11

	DAC	LDLMT

	LAC	LDLMT	/AVIOD AUTO-INDEX REGISTERS

	AND	ADRMSK

	AND	(777760)

	SZA

	JMP	.+4

	LAC	TEMP11

	XOR	(020)

	DAC	LDLMT

	LAC	LDLMT

	DAC	MINREG	/SET MIN REG REQ

	AAC 1			/(RCHM-158)

	DAC	LTBBAD	/SET LTB LIMITS

	TAD	TEMP10

	DAC	LTBTAD

	AAC 1			/(RCHM-158) UPDATE LDLMT

	DAC	LDLMT

/

/ CONSTRUCT GLOBAL SYMBOL TABLE ENTRIES FOR ALL EXTERNAL LINK

/ COMPONENT NAMES.  SYMBOLS ARE DEFINED AS POINTING TO

/ THE REGISTER THAT THE FIRST WORD OF THE CORESPONDING 

/ LINK TABLE WILL OCCUPY AT EXECUTE TIME.

/

CGST	LAC	LTBBSE	/INITIALIZE SYMBOL TABLE TO BE CONSTRUCTED

	AAC -1			/(RCHM-158) IN DECREASING CORE BELOW THE LINK TABLE

	DAC	SYMBEG

	DAC	SYMEND

	LAC	LTBTAD

	DAC	TEMP5

	LAC	LTBTOP

	DAC	LTBX2

CGST1	LAC	LTBX2

	SAD	LTBBSE

	JMP	CGST2

	AAC -LTBESZ		/(RCHM-158)

	DAC	LTBX2

	JMS	FETLTB

	LAC	LTBETY+3

	JMS	CTR50

	DAC	SYM1

	LAC	LTBETY+4

	JMS	CTR50

	DAC	SYM2

	SNA

	JMP	.+4

	LAC	SYM1

	XOR	(400000)

	DAC	SYM1

	LAC	TEMP5

	AAC -LTBESZ		/(RCHM-158)

	DAC	TEMP5

	XOR	(500000)

	DAC	SYMDEF

	JMS	DEFSYM

	JMP	CGST1

/

CGST2	LAC	SYMEND

	DAC	SYMEB1

/

/ INITIALIZE PATCH TABLE TO BE CONSTRUCTED IN INCREASING CORE

/ FROM THE END OF THE LINK DEFINITION TABLE (LTB).  I.E., TO 

/ WRITE OVER THE OVERLAY DESCRIPTION TABLE (OTB)

/

	LAC	ODTBSE

	DAC	PTBBSE

	JMP	WRC

 .TITLE *** RESIDENT CODE ONLY PROCESSING

/ NO OVERLAY DESCRIPTION -- RESIDENT CODE ONLY

/

RCO	LAC (JMS EXIT)		/(RCHM-158) ^P RESTART NO LONGER POSSIBLE

	DAC	CPTVA

	LAC	(SKP)	/SET SKIP-IF-RESIDENT-ONLY SWITCH TO SKIP

	DAC	SIFRO

	CLA!IAC			/(RCHM-158) TERMINATE RCL WITH AN LDT INDICATOR.

	DAC* RL.LA		/(RCHM-158) TO STOP RESIDENT CODE SCAN

	LAC RL.LA		/(RCHM-158) INITIALIZE PATCH TABLE TO FOLLOW THE RCL

	AAC 1			/(RCHM-158)

	DAC	PTBBSE

	LAC	TRTTL	/INITIALIZE SYMBOL TABLE TO START WHERE THE

	DAC	SYMBEG	/TTL'S WOULD HAVE STARTED IF OVERLAYS 

	DAC	SYMEB1	/EXISTED

	DAC	SYMEND

	DZM	LTBTAD	/INDICATE ZERO LENGTH LINK TABLE.  THIS WILL

	DZM	LTBBAD	/CAUSE EXECUTE TO NOT LOAD A LINK 

			/AND TO NOT SET A T.V. IN ITS HIGHEST REG.

	JMS	CRTN	/RETURN CARRIAGE

	XCT SIFTOP		/(RCHM-158) TOP DOWN OR BOTTOM UP LOADING?

	JMP	RCO1

	LAC ELDLM2		/(RCHM-158) SET UP MAXREG FOR HIGH MEMORY.

	XCT SIF.EM		/(RCHM-158) DO WE HAVE EXTENDED MEMORY?

	LAC LDLMT		/(RCHM-158) NO, FETCH HIGH SPOT OF LOW MEMORY.

	DAC	MAXREG

	JMP WXCUF		/(RCHM-158)

RCO1	LAC	LDLMT	/BOTTOM UP, SET MIN REG

	DAC	MINREG

	JMP WXCUF		/(RCHM-158)

/

 .TITLE *** BLANK COMMON LOAD LIMIT&WRITTING OUT XCU FILE

WRC	LAC	LDLMT	/INITIALIZE BLANK COMMON LOAD LIMIT

	DAC	LDLMT3

/

	LAC	LMFLAG	/IF MAP FLAG IS SET, TYPE:

	SNA

	JMP WXCUF	/(RCHM-158) LINK TABLE

	JMS	TYPE	/   XXXXX XXXXX

	MES602		/   RESIDENT CODE

	DZM	SYM1

	JMS	SYMMAP

	LAC	LTBBAD

	AAC -1			/(RCHM-158)(INCL AC BUFFER IN LTB SIZE)

	DAC	SLIMFA

	LAC	LTBTAD

	DAC	SLIMLA

	JMS	SLIM

	JMS	TYPMAP

	JMS	CRTN

	JMS	TYPE

	MES603

/

/ WRITE XCU FILE

/

WXCUF	DZM	LNKNUM	/RELOCATE AND OUTPUT RESIDENT CODE

	LAC RCL.BS		/(RCHM-158) FETCH POINTER TO RCL BASE.

	DAC	RAOX

	JMS	RAO

	LAC	LDLMT2	/UPDATE LDLMT

	DAC	LDLMT

	LAC	SYMEND	/SYMBOL TABLE ENTRIES GENERATED BEYOND THIS

	DAC	SYMEB1	/POINT ARE DELETED AFTER RELOCATION OF

			/EACH LINK.

/

	XCT	SIFRO	/SKIP RELOCATION OF LINKS IF 'RESIDENT ONLY'

	JMP	REL1

/

	LAC	LDLMT2	/SETUP BLANK COMMON LIMIT FOR RESIDENT ONLY

	DAC	LDLMT3

	JMP	REL70

/

 .TITLE *** RELOCATION LOOP

/ RELOCATION LOOP --

/ THE TTL'S AND THE LTB HAVE BEEN ORDERED SUCH THAT AS A

/ LINK NAME IF FETCHED FROM THE TTL'S AND THE LTB IS SCANNED

/ FOR THAT NAME, THE NAMES PASSED ARE NAMES OF LINKS THAT HAVE

/ BEEN RELOCATED AND OUTPUT AND ARE NOT OVERLAYED BY THE LINK 

/ WHOSE NAME WAS FETCHED FROM THE TTL'S.  I.E., THEY DETERMINE

/ A LOAD LIMIT FOR THE LINK WHOSE NAME WAS FETCHED FROM THE TTL'S.

/

REL1	LAC	TTLBSE	/RESET TTL SCAN INDEX (LTBX3)

	DAC	LTBX3

REL10	LAC	LTBTOP	/RESET LTB SCAN INDEX (LTBX2)

	DAC	LTBX2

REL20	LAC	LTBX3	/FETCH A TTL ENTRY

	JMS	FETTTL

	LAC	TTLETY	/END OF TTL?

	SMA

	JMP	REL30	/NO -- FETCH AN LTB ENTRY

	LAC	LTBX3	/YES -- END OF LAST TTL?

	SAD	TTLX1

	JMP	REL70	/YES -- ALL LINKS RELOCATED & OUTPUT

	AAC 1			/(RCHM-158) NO -- AUGMENT TTL SCAN INDEX, RESET LTB

	DAC	LTBX3	/      SCAN INDEX, AND CONTINUE SCANNING

	JMP	REL10

/

REL30	LAC	LTBX2	/FETCH NEXT LTB ENTRY

	AAC -LTBESZ		/(RCHM-158)

	DAC	LTBX2

	JMS	FETLTB

	LAC	LTBETY+1 /SKIP ENTRY IF BLANK LINK NAME

	SNA

	JMP	REL30

	SAD	TTLETY+1 /DO LINK NAMES (TTL & LTB) MATCH?

	SKP

	JMP	REL40	/NO -- UPDATE LOAD LIMIT

	LAC	LTBETY+2

	SAD	TTLETY+2

	JMP	REL50	/YES -- RELOCATE AND OUTPUT UNLESS R-FLAG 

REL40	XCT SIFTOP		/(RCHM-158) TOP DOWN OR BOTTOM UP LOADING?

	JMP	REL42

	LAC	LTBETY+11 /BGD -- UPDATE LDLMT

	CMA!IAC			/(RCHM-157)

	TAD	LDLMT

	SPA

	JMP	REL30

	LAC	LTBETY+11

	AAC -1			/(RCHM-158)

	DAC	LDLMT

	JMP	REL30

REL42	LAC	LDLMT /FGD -- UPDATE LDLMT

	CMA!IAC			/(RCHM-157)

	TAD	LTBETY+12

	SPA

	JMP	REL30

	LAC	LTBETY+12

	AAC +1			/(RCHM-158)

	DAC	LDLMT

	JMP	REL30

/

REL50	LAC	LTBETY+5 /IS R-FLAG SET?

	SZA		/NO -- RELOCATE AND OUTPUT LINK

	JMP	REL60	/YES -- LINK HAS ALREADY BEEN RELOCATED & OUTPUT

/

	JMS	PAUSX	/PAUSE IF PAUSE FLAG IS SET -- THE PAUSE IS FOR

			/THE PREVIOUSLY OUTPUT LINK.  THIS IS DONE SO

			/THE PAUSE AFTER THE LAST LINK CAN BE DONE

			/AFTER THE XCU FILE 'CLOSE', THUS PREVENTING

			/AN ISOLATED EOF RECORD ON PAPER TAPE

			/IF MANUAL FEED AT PAUSE.

/

/ PREPARE TO RELOCATE AND OUTPUT A LINK

/

	LAC	LTBETY+10 /SET LINK NUMBER

	DAC	LNKNUM

/

	LAC	LTBETY+11 /SETUP DUMMY LDT ENTRY IF SINGLE

	SZA		/COMPONENT LINK

	JMP	REL51

	LAC	LTBETY

	DAC	DUMLDT

	LAC	LTBETY+1

	DAC	DUMLDT+1

	LAC	LTBETY+2

	DAC	DUMLDT+2

	LAC	(DUMLDT)	/(RCHM-156)

REL51	DAC	RAOX	/SET RAOX TO POINT TO THE FIRST

			/COMPONENT DESCRIPTION.

	LAC	LMFLAG	/TYPE LINK NAME IF

	SNA		/MAP FLAG IS SET

	JMP	REL53

	JMS	CRTN

	JMS	TYPE

	MES604

	LAC	LTBETY+1

	DAC	T6BW1

	LAC	LTBETY+2

	DAC	T6BW2

	JMS	T6BN

	JMS	CRTN

			/------------------------

REL53	JMS	RAO	/RELOCATE AND OUTPUT LINK

			/------------------------

	XCT SIFTOP		/(RCHM-158) TOP DOWN OR BOTTOM UP LOADING?

	JMP	REL52

	LAC	LDLMT3	/BGD -- UPDATE BLANK COMMON LIMIT

	CMA!IAC			/(RCHM-157)

	TAD	LDLMT2

	SMA

	JMP	REL54

	LAC	LDLMT2

	DAC	LDLMT3

	JMP	REL54

REL52	LAC	LDLMT2	/FGD -- UPDATE BLANK COMMON LIMIT

	CMA!IAC			/(RCHM-157)

	TAD	LDLMT3

	SMA

	JMP	REL54

	LAC	LDLMT2

	DAC	LDLMT3

	JMP	REL54

/

/ SET CORE LIMITS IN ALL LTB ENTRIES FOR THE LINK JUST

/ RELOCATED AND OUTPUT.

/

REL54	XCT SIFTOP		/(RCHM-158) TOP DOWN OR BOTTOM UP LOADING?

	JMP	REL56

	LAC	LDLMT2	/BGD

	AAC +1			/(RCHM-158)

	DAC	MINLAD

	LAC	LDLMT

	DAC	MAXLAD

	JMP	REL57

REL56	LAC	LDLMT2	/FGD

	AAC -1			/(RCHM-158)

	DAC	MAXLAD

	LAC	LDLMT

	DAC	MINLAD

/

REL57	LAC	MINLAD	/CALCULATE NUMBER OF BLOCKS

	CMA!IAC			/(RCHM-157) NEEDED FOR THIS LINK

	TAD	MAXLAD	/AS A CORE IMAGE

	AAC 377			/(RCHM-158) TAKE CARE OF FACTIONAL BLOCKS NOW

	JMS	CALBLK	/MAKE CALCULATION AND STORE

			/NEW NUMBER OF BLOCKS IN OVLAYS

	LAC	LTBX2

	JMS	FETLTB

REL55	LAC	LTBETY+5 /IS R-FLAG SET?

	SNA

	JMP	REL58	/NO -- TERMINAL ERROR

	LAC	MINLAD	/YES -- SET CORE LIMITS IN LTB ENTRY

	DAC	LTBETY+11

	LAC	MAXLAD

	DAC	LTBETY+12

	LAC	LTBX2

	JMS	SETLTB

	LAC	LTBX2

	SAD	LTBBSE

	JMP	REL60

	AAC -LTBESZ		/(RCHM-158)

	JMS	FETLTB

	LAC	LTBETY+1

	SZA

	JMP	REL60

	LAC	LTBX2

	AAC -LTBESZ		/(RCHM-158)

	DAC	LTBX2

	JMP	REL55

/

REL58	JMS	TYPE	/R-FLAG WAS NOT SET DURING RAO.

	MES720		/I.E., A GLOBAL DEFINITION FOR THE 

	LAC	LTBETY+3 /EXTERNAL LINK COMPONENT NAME DID NOT

	DAC	T6BW1	/EXIST. 

	LAC	LTBETY+4 /TYPE:

	DAC	T6BW2	 /  "MISSING GLOBAL DEFINITION -- NAME"

	JMS	T6BN

	JMS	CRTN

	JMS EXIT		/(RCHM-158)

/

REL60	LAC	LTBX3	/AUGMENT TTL SCAN INDEX

	AAC TTLESZ		/(RCHM-158)

	DAC	LTBX3

	JMP	REL20

 .TITLE *** CLOSE XCU FILE&WRITE OUT XCT FILE

/ ALL LINKS HAVE BEEN RELOCATED AND OUTPUT

/

REL70	LAC	LDLMT2

	DAC	LDLMT

	.CLOSE	RO	/CLOSE XCU FILE

	JMS	PAUSX	/PAUSE IF PAUSE FLAG IS SET

	LAW	-1	/CHANGE EXTENSION FROM XCU TO XCT

	TAD	ROFNAM+2

	DAC	ROFNAM+2

	.INIT	RO,1,0	/OPEN XCT FILE

ERO3Z	.ENTER	RO,ROFNAM

/

/ WRITE XCT FILE RECORD (LINK #377777)

/

WXCTF	LAC	(377777)

	DAC	LNKNUM

	DAC	OUTBUF+3

	LAC (011000)		/(RCHM-163) NEED MORE WORDS FOR RESIDENT INFO.

	DAC	OUTBUF

	LAC (100000)		/ FLAG RECORD AS TYPE ONE FOR .SYSLD.

	DAC OUTBUF+2		/ WON'T GET UPSET.

	DZM OUTBUF+20		/(RCHM-163) SET UP IN CASE OF NO HIGH MEMORY.

	LAC LDLMT3		/(RCHM-158) FETCH HIGH WATER MAKR.

	DAC LDLMT2		/(RCHM-158) BECOMES NEW LOADLIMIT.

	LAC (FITLHL)		/(RCHM-158) CLEAR HIGH

	DAC FITLX1		/(RCHM-158) AND

	LAC MAX.XX		/(RCHM-158) FETCH BIGGEST BLANK COMMON BLOCK.

	CMA!SNA!IAC		/(RCHM-171) MAKE NEGATIVE FOR FIT ROUTINE.

	JMP WXCTF1		/(RCHM-171) NO MESSING WITH BLANK COMMON.

	DAC SIZE		/(RCHM-158)

	DAC BLKFLG		/(RCHM-158) SET COMMON BLOCK SWITCH.

	LAC (SKP)		/(RCHM-158) AREM HIGH MEMORY ALLOCATION.

	DAC SIF.HM		/(RCHM-158)

	JMS CK.XX		/(RCHM-158) SET UP BLANK COMMON ALLOCATION.

	JMS FIT			/(RCHM-158) FIT BLANK COMMON INTO CORE.

/

/ BLANK COMMON HAS BEEN FITTED INTO MEMORY. LOADADR CONTAINS BASE OF

/ BLANK COMMON. SET UP MIN AND MAX REGISTERS FOR EXECUTE.

/

	LAC LOADADR		/(RCHM-158) FETCH BASE OF BLANK COMMON.

	DAC OUTBUF+4		/(RCHM-158) SET UP INFO LINK FOR EXEC.
WXCTF1	XCT SIFTOP		/(RCHM-171) CHECK LOADING MECHANISM.

	JMP .XXBOT		/(RCHM-158) BOTTOM UP LOADING.

/

/ TOP DOWN LOADING OF BLANK COMMON HAS OCCURED.

/
	LAC LDLMT2		/(RCHM-158) LDLMT2 IS LOW WATER MARK.
	IAC			/(RCHM-178) INCREMENT FOR CORRECT ADDRESS.

	DAC MINREG		/(RCHM-158) SET UP MINREG.

	LAC IN.HMS		/(RCHM-171) ANYTHING IN HIGH MEMORY?
	SZA			/(RCHM-171) 0 => NO.
	JMP WXCT2		/(RCHM-171) IN HIGH MEMORY, LEAVE ALONE.
	LAC CLT			/(RCHM-171) USE CLT TOP UNLESS, LINKS ARE LOADED.
	XCT SIFRO		/(RCHM-171)
	LAC LTBTAD		/(RCHM-171) FETCH TOP OF LOW CORE.

	DAC MAXREG		/(RCHM-171) SET UP MAXREGISTER.

	JMP WXCT2		/(RCHM-158) ALL DONE.

/

/ BOTTOM UP LOADING OF BLANK COMMON HAS OCCURED.

/
.XXBOT	LAC IN.HMS		/(RCHM-160) CHECK TO SEE IF ANYTHING WENT HIGH.

	SNA			/(RCHM-160) IT DID.
	JMP .+4			/(RCHM-171) IT DID NOT.
	LAC ELDLM2		/(RCHM-160) FETCH HIGH MEMORY ENDING.
	AAC -1			/(RCHM-171) CALCULATE REAL HIGH MEMORY END.
	XCT SIF.EM		/(RCHM-158) EXTENDED MEMORY AVAILABLE?
	LAC CLT			/(RCHM-171) NO.
	DAC MAXREG		/(RCHM-158) SET UP MAXREG.

WXCT2	LAC LOADADR		/(RCHM-158) SET UP TAIL END PROCESSING.

	DAC LDLMT2		/(RCHM-158) MAP OF WHERE BLANK COMMON WENT.

	XCT SIF.EM		/(RCHM-163) ANY EXTENDED MEMORY?

	JMP WXCT3		/(RCHM-163) NO, DO NOT MODIFY CORE LIMITS.

	LAC IN.HMS		/(RCHM-163) ANY HIGH MEMORY USED?

	SNA			/(RCHM-163) YES?

	JMP WXCT3		/(RCHM-163) NO.

	LAC ELDLM2		/(RCHM-163) FETCH HIGH OR LOW WATER MARK FOR

				/(RCHM-163) UPPER MEMORY.

	XCT SIFTOP		/(RCHM-163) CONTENTS OF AC BASE OF HIGH MEMORY?

	CMA!IAC			/(RCHM-163) YES.

	DAC OUTBUF+20		/(RCHM-163) SET UP CORE INFORMATION.

WXCT3	LAC	MAINEP		/(RCHM-163) MAIN PROG ENTRY POINT

	DAC OUTBUF+5

	LAC	LTBBAD	/ADDRESS OF BASE OF LTB

	DAC	OUTBUF+6

	LAC	LTBTAD	/ADDRESS OF TOP OF LTB

	DAC	OUTBUF+7

	LAC	MINREG	/MINIMUM REGISTER REQUIRED

	DAC	OUTBUF+10

	LAC	MAXREG	/MAXIMUM REGISTER REQUIRED

	DAC	OUTBUF+11

	LAC	ENVIND	/ENVIRONMENT INDICATOR

	XOR	OVLAYS	/PUT IN # OF BLOCKS FOR OVERLAY

	XOR XVM.EV		/(RCHM-158) PUT IN XVM ON/OFF BIT.

	XOR BOO.EV		/(RCHM-158) PUT IN EXPECTED BOOT ADDRESS BIT.

	DAC	OUTBUF+12

	LAC	DATMAP	/.IODEV INFORMATION

	DAC	OUTBUF+13

	LAC	DATMAP+1

	DAC	OUTBUF+14

	LAC	DATMAP+2

	DAC	OUTBUF+15

	LAC	DATMAP+3

	DAC	OUTBUF+16

	LAC	DATMAP+4

	DAC	OUTBUF+17

	JMS	WOB

/

	XCT	SIFRO	/DON'T WRITE LINK TABLE IF RESIDENT ONLY

	SKP

	JMP	WLTB3

/

/ WRITE OUT LINK TABLE

/

	LAC	LTBBAD

	DAC	LOADADR

	LAC	LTBBSE

WLTB1	DAC	LTBX2

	SAD	LTBTOP

	JMP	WLTB2

	JMS	FETLTB	/FETCH AN LTB ENTRY

			/"DAC*  LOADADR" EACH WORD OF ENTRY

/

	CLA		/ZERO

	JMS	WLTS

	LAW	-1	/DAC   BUF

	TAD	LTBBAD

	AND	ADRMSK

	DAC	TEMP10

	XOR	(040000)

	JMS	WLTS

	LAC	LTBTAD	/JMS*  (EXECUTE)

	AND	ADRMSK

	XOR	(120000)

	JMS	WLTS

	LAC	LOADADR	/DAC*  .+3

	AAC 3			/(RCHM-158)

	AND	ADRMSK

	XOR	(060000)

	JMS	WLTS

	LAC	TEMP10	/LAC   BUF

	XOR	(200000)

	JMS	WLTS

	LAC	LOADADR	/JMP*  .+2

	AAC 2			/(RCHM-158)

	AND	ADRMSK

	XOR	(620000)

	JMS	WLTS

	LAC	LTBETY+6 /ENTRY POINT

	JMS	WLTS

	LAC	LTBETY+7 /ENTRY POINT PLUS ONE

	JMS	WLTS

	LAC	LTBETY+10 /LINK NUMBER

	JMS	WLTS

	LAC	LTBETY+11 /MIN ADR

	JMS	WLTS

	LAC	LTBETY+12 /MAX ADR

	JMS	WLTS

	LAC	LTBX2

	AAC LTBESZ		/(RCHM-158)

	JMP	WLTB1

/

WLTS	0

	JMS	STORE

	ISZ	LOADADR

	JMP*	WLTS

/

WLTB2	JMS	FROP	/WRITE PARTIAL RECORD

WLTB3	JMS	WNPPR	/WRITE DUMMY CODE-3 RECORD

/

	.CLOSE	RO	/CLOSE XCT FILE

	JMS	PAUSX	/PAUSE IF PAUSE FLAG IS SET

	LAC	LMFLAG	/TYPE BLANK COMMON (.XX) BOUNDS

	SNA		/IF BLANK COMMON EXISTS AND IF

	JMP	TOCREQ	/MAP FLAG IS SET

	LAC	MAX.XX

	SNA

	JMP TOCRQ1		/(RCHM-158) SEE ABOUT RESIDENT COMMONS.

	JMS	CRTN

	JMS	TYPE

	MES605

	JMS PRTPRG		/(RCHM-163) PRINT LIMITS OF BLANK COMMON,

				/(RCHM-163) SYM1, SYM2 SET UP BY CK.XX. SIZE SET

				/(RCHM-163) ABOVE AND LOADADR SET BY FIT.
TOCRQ1	XCT SIFRO		/(RCHM-174) RESIDENT ONLY CODE BEING OUTPUT?
	SKP			/(RCHM-174) NO.
	JMP TOCREQ		/(RCHM-174) ALL DONE WITH MESSAGES.
	JMS MV.BLK		/(RCHM-173) MOVE REMAINING COMMON SYMBOLS,

				/(RCHM-173) IF ANY, INTO RESIDENT PORTION.

	JMS BEGSYM		/(RCHM-158) SET UP POINTER TO SYMBOL TABLE.

	DZM PFLAG		/(RCHM-159) ZERO PFLAG.

TOCRQ2	LAC SYMPTR		/(RCHM-158) DONE WITH SYMBOLS?

	SAD SYMEB1		/(RCHM-158) CHECK AGAINST END OF RESIDENT AREA.

	JMP TOCREQ		/(RCHM-158) YES, TERMINATE LIST.

	LAC* SYMPTR		/(RCHM-158) FETCH SYMBOL TYPE.

	AND (300000)		/(RCHM-158) CHECK FOR COMMON BLOCKS.

	SAD (300000)		/(RCHM-158) COMMON BLOCK?

	SKP			/(RCHM-158) YES.

	JMP TOCRQ3		/(RCHM-158) NO, SOM OTHER SYMBOL TYPE.

	LAC* SYMPTR		/(RCHM-158) FETCH SIZE.

	AND (77777)		/(RCHM-158) EXTRACT SIZE.

	CMA!IAC			/(RCHM-163) MAKE NEGATIVE.

	DAC SIZE		/(RCHM-163) SET UP PRTPRG.

	JMS DECSPT		/(RCHM-158) MOVE POINTER TO NAME FIELD.

	LAC* SYMPTR		/(RCHM-158) FETCH FIRST PART OF NAME.

	SAD (.XX)		/(RCHM-158) BLANK COMMON IS NOT PRINTED.

	JMP TOCRQ3		/(RCHM-158)

	DAC SYM1		/(RCHM-158) SET UP TO PRINT NAME.

	SMA			/(RCHM-158) ANY MORE NAME?

	JMP .+4			/(RCHM-158) NO.

	JMS DECSPT		/(RCHM-158) MOVE POINTER TO REST OF NAME.

	LAC* SYMPTR		/(RCHM-158) FETCH LAST PART OF NAME.

	DAC SYM2		/(RCHM-158) SET UP NAME.

	JMS DECSPT		/(RCHM-158) MOVE POINTER TO LOAD ADDRESS.

	JMS DECSPT		/(RCHM-158)

	LAC* SYMPTR		/(RCHM-158) FETCH LOADADDRESS.

	DAC RELOC		/(RCHM-163) SET UP PRTPRG.

	LAC PFLAG		/(RCHM-159) PRINT HEADER THIS TIME?

	SZA			/(RCHM-159)

	JMP .+5			/(RCHM-159) NO.

	ISZ PFLAG		/(RCHM-159) PRINT FLAG ONLY ONCE.

	JMS CRTN		/(RCHM-159)

	JMS TYPE		/(RCHM-159) PRINT HEADER MESSAGE.

	MES725			/(RCHM-159)

	JMS PRTPRG		/(RCHM-163) PRINT MAP.

TOCRQ3	JMS NXNTRY		/(RCHM-158) ADVANCE TO NEXT TABOL ENTRY.

	JMP TOCRQ2		/(RCHM-158)

TOCREQ	JMS	CRTN	/TYPE OUT CORE REQUIRED

	JMS	TYPE

	MES690

	DZM	SYM1

	JMS	SYMMAP

	LAC	MINREG

	DAC	SLIMFA

	LAC	MAXREG

	DAC	SLIMLA

	JMS	SLIM

	ISZ	LMFLAG

	JMS	TYPMAP

	JMP	EXITX		/NORMAL EXIT

EXITXX	LAC*	(.SCOM+52	/(RCHM-158) GET BOSS WORD

	SMA		/IS BOSS RUNNING (BR-153)

	JMP	EXITX	/NO , EXIT

	AND	(777776)	/CLEAR OUT ERROR BIT (BR-153)

	AAC 1			/(RCHM-158) SET JOB ABORT (BR-153)

	DAC*	(.SCOM+52	/STORE NEW BOSS WORD (BR-153)

/

EXITX	.EXIT

 .TITLE *** SUBR(S) WFCP,FETTTL,FETLTB&SETLTB

/WFCP -- SUBROUTINE TO WAIT FOR ^P AND RETURN CONTROL TO CALLER

/

WFCP	0

	LAC	CPTVA	/SAVE ^P TRANS VECTOR

	DAC	CPBUF

	LAC (JMP WFCPR)		/(RCHM-158) SET ^P TV TO TRANSFER TO WFCPR 

	DAC	CPTVA	/WHEN ^P IS TYPED IN

	JMP	.	/WAIT HERE FOR ^P

WFCPR	LAC	CPBUF	/RESTORE CONTENTS OF ^P TV

	DAC	CPTVA

	JMP*	WFCP	/EXIT

/

CPTVA	JMP START		/(RCHM-158)

CPBUF	0

/

/ ^P HANDLER -- TRANSFER CONTROL PER CPTVA

/

CPTYPD	JMS	CRTN

	XCT CPTVA		/(RCHM-158)

/

/ FETLDT -- SUBROUTINE TO FETCH THE LDT ENTRY WHOSE INDEX IS IN AC.

/           THE ENTRY IS RETURNED IN LDTETY THRU LDTETY+2

/

FETLDT	0

	AAC -1			/(RCHM-158)

	DAC*	(X10)

	LAC*	X10

	DAC	LDTETY

	LAC*	X10

	DAC	LDTETY+1

	LAC*	X10

	DAC	LDTETY+2

	JMP*	FETLDT

/

/ FETTTL -- SUBROUTINE TO FETCH THE TTL ENTRY WHOSE INDEX IS IN AC.

/           THE ENTRY IS RETURNED INR	(17777	/FGD--BANK#+00000

	TAD	(-20000	/BANK# = (0,2 TTLETY THRU TTLETY+2

/

FETTTL	0

	AAC -1			/(RCHM-158)

	DAC*	(X10)

	LAC*	X10

	DAC	TTLETY

	LAC*	X10

	DAC	TTLETY+1

	LAC*	X10

	DAC	TTLETY+2

	JMP*	FETTTL

/

/ FETLTB -- SUBROUTINE TO FETCH THE LTB ENTRY WHOSE INDEX IS IN AC.

/           THE ENTRY IS RETURNED IN LTBETY THRU LTBETY+10

/

FETLTB	0

	AAC -1			/(RCHM-158)

	DAC*	(X10)

	LAC	(LTBETY-1)	/(RCHM-156)

	DAC*	(X11)

	LAW	-13

	DAC	TEMP1

	LAC*	X10

	DAC*	X11

	ISZ	TEMP1

	JMP	.-3

	JMP*	FETLTB

/

/ SETLTB -- SUBROUTINE TO SET THE LTB ENTRY WHOSE INDEX IN IN AC

/           THE ENTRY IS TAKEN FROM LTBETY TO LTBETY+10

/

SETLTB	0

	AAC -1			/(RCHM-158)

	DAC*	(X11)

	LAC	(LTBETY-1)	/(RCHM-156)

	DAC*	(X10)

	LAW	-13

	DAC	TEMP1

	LAC*	X10

	DAC*	X11

	ISZ	TEMP1

	JMP	.-3

	JMP*	SETLTB

 .TITLE *** SUBR(S) T6BN,T6BNS&TYPE

/

/ T6BN -- SUBROUTINE TO TYPE THE .SIXBT NAME IN T6BW1 & T6BW2

/         THRU THE FIRST BLANK OR SIXTH CHARACTER

/

T6BN	0

	LAC	T6BX5		/SETUP POINTER FOR

	DAC	T6BX4		/MESSAGE DATA STORE ROUTINE

	LAC	T6BW1

	JMS	T6BNS

	LAC	T6BW2

	JMS	T6BNS

/

T6BNZ	.WRITE	TO,3,T6BNB,0

	.WAIT	TO

	JMP*	T6BN

/

T6BNS	0

	DAC	T6BX1

	LAW	-3

	DAC	T6BX3

T6BNL	LAC	T6BX1

	JMS	LCS7

	DAC	T6BX2

	RAR

	DAC	T6BX1

	LAC	T6BX2

	AND	(077)

	SZA

	XOR	(040)

	AAC 40			/(RCHM-158)

	DAC*	T6BX4		/STORE CHAR

	IDX	T6BX4		/BUMP TO NEXT CHAR POSITION

	ISZ	T6BX3

	JMP	T6BNL

	JMP*	T6BNS

/

T6BW1	0

T6BW2	0

T6BX1	0

T6BX2	0

T6BX3	0

T6BX4	0

T6BX5	T6BPTR

T6BNB	005000

	0

	.REPT 6

T6BPTR	0

	177			/FOR TTY

	15			/FOR LP "BOSS15"

/

/ TYPE -- SUBROUTINE TO TYPE A MESSAGE

/

/ CALLING SEQUENCE:

/	JMS	TYPE

/	MESXX

/	...

/ MESXX	.ASCII	/MESSAGE/

/

/ THE TWO WORDS PRECEDING THE MESSAGE ARE USED AS AN IOPS ASCII

/ HEADER.  THE ONLY HEADER REQUIREMENTS FOR TTY OUTPUT IS A GREATER

/ THAN ONE WORD PAIR COUNT.

/

TYPE	0

TYPE2	LAC*	TYPE

	AAC -2			/(RCHM-158)

	DAC	.+3

	.WRITE	TO,2,XX,0

	.WAIT	TO

	ISZ	TYPE

	JMP*	TYPE

/

/

TYPE1	0

	XCT	BOSSW

	SKP

	JMP	TYPE3

	LAC	(4	/IF IN BOSS15 MODE

	TAD*	TYPE1	/DON'T TYPE 1'ST WORD

	DAC*	TYPE1	/OF MESSAGE

TYPE3	LAC	TYPE1	/MAKE IT LOOK LIKE WE

	DAC	TYPE	/WE CALLED "TYPE"

	JMP	TYPE2

 .TITLE *** SUBR(S) CRTN,SETBBS,LCS6,LCS7&CALBLK

/ CRTN -- SUBROUTINE TO RETURN CARRIAGE

/

CRTN	0

	JMS	TYPE

	CRTNX

	JMP*	CRTN

/

CRTNX	.ASCII	<015>

/

/ LCS6 -- LEFT-CIRCULAR-SHIFT SIX

/

LCS6	0

	RTL

	RTL

	RTL

	JMP*	LCS6

/

/ LCS7 -- LEFT-CIRCULAR-SHIFT SEVEN

/

LCS7	0

	RAL

	RTL

	RTL

	RTL

	JMP*	LCS7

/

/

/ CALBLK -- DIVIDE AC BY 400(8) <INTERGER>

/ THEN SHIFT RESLUT TO BITS 0-11 AND TAD

/ AC INTO "OVLAYS".

/

CALBLK	0

	RCR		/PERFORM DIVIDE AND LEFT

	RCR		/SHIFT OPERATION COMBINED

	AND	(777700

	CLL		/CLEAR LINK TO DETECT OVERFLOW

	TAD	OVLAYS	/UPDATE "OVLAYS" WITH NEW COUNT

	DAC	OVLAYS

	SNL		/DID OVERFLOW OCCUR

	JMP*	CALBLK	/NO -- EXIT

	LAC	(777700	/YES -- SET "OVLAYS" TO MAX VALUE

	DAC	OVLAYS

	JMP*	CALBLK	/EXIT

/

 .TITLE *** VARIABLES AND CONSTANTS

NCL.BS	0			/(RCHM-158) BASE OF NAMED COMMON LIST

NCL.PT	0			/(RCHM-158) POINTER FOR NCL SCANNER.

RCL.BS	0			/(RCHM-158) BASE OF RESIDENT CODE LIST

LDTBSE	0	/BASE OF LINK DEFINITION TABLE

LDTLSX	0	/LDT LINE START INDEX

LDTEIF	0	/LDT EXTERNAL (000)/INTERNAL (001) SUB NAME FLAG

RL.LA	0			/(RCHM-158) RCL & LDT LAST ADDRESS (POINTS TO NEXT ENTRY)

ODTBSE	0	/BASE OF OVERLAY-DESCRIPTION-TABLE

ODTLSX	0	/ODT LINE START INDEX

ODTX1	0	/ODT ENTRY INDEX (POINTS TO NEXT ENTRY)

TTLBSE	0	/BASE OF TRUNK-TO-TWIG LISTS

TTLPNT	0	/BACK POINTER (TO REF'ING ODT ENTRY)

TTLX1	0	/TTL INDEX (POINTS TO NEXT ENTRY)

TTLX2	0	/INDEX USED TO SCAN ODT

LTBTOP	0	/TOP OF LINK TABLE (ADR OF T.V. TO EXECUTE)

LTBBSE	0	/BASE OF LTB

LTBTAD	0	/LTB TOP ADR (AT EXECUTE TIME)

LTBBAD	0	/LTB BASE ADR (AT EXECUTE TIME)

LTBX2	0	/INDEX USED TO SCAN LTB

LTBX3	0	/INDEX USED TO SCAN TTL'S

LTBX4	0	/INDEX USED TO SCAN LDT

PTBBSE	0	/BASE OF PATCH TABLE (PTB)

PTBX1	0	/PTB INDEX (POINTS TO NEXT ENTRY)

PTBX2	0	/PTB SCAN INDEX

LNKNUM	0	/LINK NUMBER

MINLAD	0	/MIN LINK ADR

MAXLAD	0	/MAX LINK ADR

MINREG	0	/MIN REGISTER REQUIRED FOR OVERLAY SYSTEM TO RUN

MAXREG	0	/MAX REGISTER REQUIRED 

MAINEP	-1	/MAIN PROG ENTRY POINT

MAX.XX	0	/SIZE OF LARGEST BLANK COMMON

LDLMT	0	/LOAD LIMIT BEFORE RELOCATION (TO SUB RAO)

LDLMT2	0	/LOAD LIMIT AFTER RELOCATION (FROM SUB RAO)

ELDLM2	0			/(RCHM-158) HIGH OR LOW WATER MARK IN EXTEND

				/(RCHM-158) MEMORY.

LDLMT3	0	/LIMIT OF BLANK COMMON

MEM.SZ	0			/(RCHM-158) TOTAL MEMORY SIZE INCLUDING

				/(RCHM-158) EXTENDED MEMORY.

LTBETY	.BLOCK 13 /LTB ENTRY BUFFER

TTLETY	.BLOCK 3 /TTY ENTRY BUFFER

LDTETY	.BLOCK 3 /LDT ENTRY BUFFER

DUMLDT	.BLOCK 3 /DUMMY LDT ENTRY

	000001	 /(MUST FOLLOW DUMLDT)

CLT	.BLOCK 11		/(RCHM-158) CORE LIMITS TABLE (CLT)

				/(RCHM-158) FOR EXECUTABLE CODE ONLY.

CLTX1	0	/POINTS TO END OF CLT (TERMINATOR)

CLTX2	0	/CLT SCAN INDEX

ECLT	.BLOCK 31		/(RCHM-158) EXTENDED MEMORY CORE LIMITS

				/(RCHM-158) TABLE. FOR COMMON BLOCKS ONLY.

ECLTX1	0			/(RCHM-158) POINTS TO END OF ECLT.

ECLTX2	0			/(RCHM-158) ECLT SCAN INDEX.

/BDBSX	0	/A LIMIT OF THE BOOTSTRAP USED TO PREVENT ALLOCATION

		/OF BLOCK DATA OVER THE BOOTSRTAP IN A "12K" SYSTEM.

		/  TOP OF BOOTSTRAP IN "12K" SYSTEMS

		/  BOTTOM OF BOOTSTRAP IN OTHER (ANYTHING ABOVE LDLMT2)

TEMP1	0

TEMP2	0

TEMP3	0

TEMP4	0

TEMP5	0

TEMP10	0

TEMP11	0

PFLAG	0			/(RCHM-159) GENERAL FLAG USABLE BY ANYONE.

BOT.AD	0			/(RCHM-158) BOTTOM ADDRESS FOR BOTTOM UP

				/(RCHM-158) LOADING. IT BECOMES LDLMT DURING

				/(RCHM-158) INITIALIZATION.

LMFLAG	1	/LOAD MAP FLAG   ZERO:OFF::NON-ZERO:ON

GMFLAG	0	/GLOBAL MAP FLAG   ZERO:OFF::NON-ZERO:ON

SZFLAG	0	/SIZE OUTPUT FLAG   ZERO:OFF::NON-ZERO:ON

ROFLAG	0	/RESIDENT ONLY FLAG   0:OFF::NON-ZERO:ON

SAFLAG	0	/SINGLE ALLOCATION FLAG (OF LABELED COMMON BLOCKS)

		/0:OFF::NON-ZERO:ON

PSFLAG	0	/PAUSE FLAG:

		/NON-ZERO -- PAUSE AFTER RELOCATION OF A LINK OR

		/THE RESIDENT CODE.  FLAG IS INCREMENTED AT EACH PAUSE.

		/ZERO -- NO PAUSE

		/NOTE: SETTING PSFLAG=-1 WILL RESULT IN A PAUSE ONLY

		/AFTER RELOCATING THE RESIDENT CODE.

SIFTOP	SKP			/(RCHM-158) SKIP-IF-TOP DOWN LOADING SWITCH

				/(RCHM-158) BOT-UP:NOP::TOP-DOWN:SKP

VTC.ALL	NOP			/(RCHM-158) ALL COMMON ARE VTC SWITCH.

				/(RCHM-158) NOP IF NO, SKP IF YES.

RES.ALL	NOP			/(RCHM-158) ALL COMMON ARE RES SWITCH.

				/(RCHM-158) NOP IF NO, SKP IF YES.

VTC.SW	NOP			/(RCHM-158) A GIVEN COMMON IS VTC.

				/(RCHM-158) NOP IF NO, SKP IF YES

RES.SW	NOP			/(RCHM-158) A GIVEN COMMON IS RES.

				/(RCHM-158) NOP IF NO, SKP IF YES.

SIF.EM	NOP			/(RCHM-158) SKIP IF EXTENDED MEMORY ON SYSTEM.

SIF.HM	NOP			/(RCHM-158) SKIP IF ALLOWED TO RELOCATE

				/(RCHM-158) INTO EXTENDED MEMORY.

SK.F01	SKP			/(RCHM-163) SKIP IF FIRST 01 LOADER CODE NOT ENCOUNTERED.

CBSIZE	0			/(RCHM-163) SIZE OF COMMON BLOCK FOR CORAL TYPE

				/(RCHM-163) COMMON BLOCK INITIALIZATION.

SAV.BD	0			/(RCHM-163) SAVE CELL FOR BLKDSW VALUE.

SAV.SZ	0			/(RCHM-163) SAVE CELL FOR SIZE.

SAV.LD	0			/(RCHM-163) SAVE CELL FOR LOADADDR.

SAV.RL	0			/(RCHM-163) SAVE ADDRESS FOR RELOC

IN.HMS	0			/(RCHM-160) IN HIGH MEMORY SWITCH. SET TO NON-ZERO

				/(RCHM-160) IF ANYTHING IS PUT IN HIGH MEMORY.

BLKDSW	0	/BLOCK DATA SWITCH  USED IN "FIT" -- SET IN CODE11 PROCESSING

ADRSAV	0	/ADDR MSK SAVE FOR FIT ROUTINE

SIFRO	NOP	/SKIP-IF-RESIDENT-ONLY SWITCH  OVERLAYS:NOP::NO-OVERLAYS:SKP

BOSSW	SKP			/IF IN BOSS MODE

LIBSCT	0		/LIBRARY PASS COUNTER

/

/ PDP 9/15 MASKS  PDP-9    PDP-15

ADRMSK	0 /	017777	007777

OPCMSK	0 /	760000	770000

AMREST	0	/ADRMSK RESTORATION

/

ROFNAM	.SIXBT	/------XCU/

ENVIND	0	/ENVIRONMENT INDICATOR

		/BIT-14 SET FOR 32K BOOT ADDRESS, RESET FOR 24K BOOT ADDRESS.

		/ BIT-15 SET FOR XVM NEEDED, RESET FOR XVM NOT NEEDED.

		/*** NOW UNUSED ***  BIT-16 SET FOR FGD, RESET FOR BGD

		/  BIT-17 SET FOR PDP-9, RESET FOR PDP-15

		/BITS 0-11 THE NUMBER OF 400(8) WORD

		/BLOCKS NEED TO SAVE THE OVERLAY SYSTEM

		/AS CORE IMAGES **FOR THE FUTURE**

OVLAYS	0	/BITS 0-11 TEMP STORE OF #

		/OF BLOCKS NEEDED OF OVERLAY

		/DURRING THE CHAINING OF THE SYSTEM

		/XOR'ED INTO "ENVIND".

XVM.EV	0			/(RCHM-158) STATE OF THE XVM OPTION. XORED WITH

				/(RCHM-158) THE ENVIND AT THE SAME TIME AS

				/(RCHM-158) OVLAYS.

BOO.EV	0			/(RCHM-158) EXPECTED ADDRESS OF BOOTSTRAP AT RUN

				/(RCHM-158) TIME.

 .TITLE *** SUBR. TO RELOCATE AND OUTPUT A LINK (RAO)

/ RAO -- SUBROUTINE TO RELOCATE AND OUTPUT A LINK

/

/ 'RAOX' POINTS TO EITHER:

/ 1. THE FIRST RCL ENTRY WHEN RELOCATING THE RESIDENT CODE.

/ 2. THE SECOND LDT ENTRY OF A LINK DESCRIPTION WHEN RELOCATING

/    A NON-SCL LINK.

/ 3. THE DUMMY LDT ENTRY WHEN RELOCATING A SCL.

/

/ IN ANY CASE 'RAOX' POINTS TO AN TABLE ENTRY THAT DEFINES

/ A ROUTINE TO BE RELOCATED & OUTPUT (AN INDICATOR WORD

/ AND A TWO-WORD NAME).  IN THE CASE OF A MULTI-ROUTINE

/ LINK OR MORE THAN ONE RESIDENT ROUTINE, SUCCEDING ENTRIES

/ INDICATE OTHER ROUTINES TO BE RELOCATED.  IN ANY CASE,

/ NAMES OF ROUTINES ARE FETCHED AND THE ROUTINES RELOCATED

/ AND OUTPUT UNTIL AN INDICATOR WITH BIT-17 SET IS FOUND.

/

/ ROUTINES ARE RELOCATED BELOW (BGD) OR ABOVE (FGD) THE

/ ADDRESS IN 'LDLMT'.  WHEN FINISHED RELOCATING A LINK (OR THE

/ RESIDENT CODE), 'LDLMT2' POINTS TO THE WORD BELOW (BKG) OR ABOVE

/ (FGD) THE LAST ROUTINE RELOCATED & OUTPUT.

/

/ LDLMT2 IS LEFT POINTING TO THE NEXT AVAILABLE REGISTER

/ LDLMT IS NOT ALTERED

/

/ SYMBOL TABLE ENTRY CODES:

/	0 -- DELETED GLOBAL SYMBOL ENTRY

/	1 -- UNRESOLVED GLOBAL SYMBOL REFERENCE *

/	5 -- GLOBAL SYMBOL DEFINITION, OR RESOLVED

/	     GLOBAL SYMBOL REFERENCE *

/	6 -- DUMMY GLOBAL SYMBOL ENTRY  

/	     USED TO INSURE THE RELOCATION OF A

/	     LIBRARY ROUTINE. (IT MIGHT NOT BE 

/	     REFERENCED FROM WITHIN THE LINK OR

/	     RESIDENT CODE BEING RELOCATED, OR

/	     IT MAY BE ONLY REFERENCED BY ROUTINES

/	     FOLLOWING IT IN THE LIBRARY.)

/	7 -- UNDEFINED COMMON BLOCK NAME *

/	3 -- DEFINED COMMON BLOCK NAME *

/	4 -- COMMON ELEMENT REFERENCE *

/ 			* SAME AS LINKING LOADER

/

RAOX	0

/

RAO	0

	JMS MV.BLK		/(RCHM-173) MOVE SAC OR RES BLOCKS.

	LAC	SYMEB1

	DAC	SYMEND

/

	LAC	PTBBSE	/RESET BEGINNING OF PATCH TABLE

	DAC	PTBX1

	LAC	(SKDATA)	/(RCHM-156) SETUP SEEK DATA POINTER

	DAC	SDPTR

	LAC (FITLHL)		/(RCHM-158) RESET REMAINING HOLES LIST INDEX

	DAC FITLX1		/(RCHM-158)

	LAC	(002000)/WRITE LINK HEADER RECORD

	DAC	OUTBUF

	LAC	(100000)

	DAC	OUTBUF+2

	LAC	LNKNUM

	DAC	OUTBUF+3

	JMS	WOB

	LAC	LDLMT

	DAC	LDLMT2

	LAC	RAOX

RAOFCN	JMS	FETLDT	/FETCH COMPONENT LDT ENTRY

	LAC	LDTETY	/NEXT LINK DESCRIPTION?

	AND	(001)

	SZA		/NO -- RELOCATE OR MAKE DUMMY SYMTAB ENTRY

	JMP	RAOCUD	/YES -- CLOSE FILE ON USER'S DEV

	LAC	LDTETY+1 /SET FILE NAME IN SEEK DATA AND IN

	DAC	SKDATA	/SYM1 & SYM2 (RADIX50).

	JMS	CTR50

	DAC	SYM1

	LAC	LDTETY+2

	DAC	SKDATA+1

	JMS	CTR50

	DAC	SYM2

	SNA

	JMP	.+4

	LAC	SYM1

	XOR	(400000)

	DAC	SYM1

	LAC	LDTETY	/WAS THIS ROUTINE FLAGED AS RESIDING IN

	AND	(020)	/IN A LIBRARY?

	SNA

	JMP	RAORAO	/NO -- RELOCATE AND OUTPUT

	LAC	(677777)/YES -- MAKE DUMMY SYMBOL TABLE ENTRY

	DAC	SYMDEF	/TO INSURE LOADING DURING LIBRARY SEARCH

	JMS	DEFSYM	/EVEN IF ROUTINE IS NOT CALLED OR CALLING

	JMP	RAOAUX	/ROUTINE(S) FOLLOW THIS ROUTINE IN LIBRARY.

/

RAORAO	LAW	UD		/(RCHM-163) 'SEEK' A FILE ON THE USER'S DEVICE

	JMS	SEEK

	LAW	UD

	JMS	LDPROG

/

RAOAUX	LAC	RAOX	/AUGMENT RAOX

	AAC LDTESZ		/(RCHM-158)

	DAC	RAOX

	JMP	RAOFCN

	.EJECT

/

/	ROUTINE TO MOVE COMMON BLOCKS WHICH HAVE BEEN EITHER SACED

/	OR RESED INTO THE SPACE USED BY THE RESIDENT CODE SYMBOLS.

/

MV.BLK	XX			/(RCHM-173) MOVE COMMONS AROUND.

	LAC	SAFLAG	/SINGLE ALLOCATION OF COMMON BLOCKS?

	SNA

	JMP	RAO4A		/(RCHM-158) NO -- TRIM SYMBOL TABLE BACK TO RESIDENT CODE ENTRIES ONLY

	LAC	SYMEB1	/YES -- PACK COMMON BLOCK DEFINITIONS (CODE=3) ADJACENT
RAO1	DAC	SYMWD1	/TO ENTRIES MADE BY RESIDENT CODE, AND TRIM

	DAC	SYMPTR	/SYMBOL TABLE TO INCLUDE RESIDENT CODE ENTRIES

	JMS	FINDCOD /AND SAVED COMMON BLOCK DEFINITIONS.

	300000

	JMP* MV.BLK		/(RCHM-173) RETURN TO CALLER.

	JMS MVCTOR		/(RCHM-158) MOVE ENTRY TO RESIDENT CODE

				/(RCHM-158) SECTION.

	JMP RAO1		/(RCHM-158) GO GET NEXT ENTRY.
/
/ SAC NOT SET, CHECK FOR ANY NEW RES COMMON BLOCKS.
/ THE BASIC ALGORITHM BY WHICH THIS IS ACCOMPLISHED IS,
/ LOOK AT THE COMMON BLOCK, IF IT'S BASE ADDRESS IF GREATER THAN
/ THE TOP ADDRESS OF THE CLT, IT WAS THE TARGET OF THE RES SWITCH.
/
RAO4A	LAC SYMEB1		/(RCHM-173) FETCH BEGINNING OF NEW SYMBOLS.
RAO4B	DAC SYMWD1		/(RCHM-173) SET UP STARTING POINT FOR SEARCH.
	DAC SYMPTR		/(RCHM-173) SET UP MOVING POINTER THROUGH TABLE.
RAO4C	JMS FINDCOD		/(RCHM-173) LOOK FOR COMMON BLOCKS.
	300000			/(RCHM-173) CODE FOR COMMON BLOCKS.
	JMP* MV.BLK		/(RCHM-173) RETURN TO CALLER.
	LAC SYMPTR		/(RCHM-173) FETCH POINTER TO LOCATED WORD.
	AAC -1			/(RCHM-173) CHECK LENGTH OF NAME.
	DAC SYM1		/(RCHM-173) SET UP FOR INDIRECTION.
	LAC* SYM1		/(RCHM-173) FETCH FIRST? PART OF NAME.
	RAL!CLL!CLA		/(RCHM-173) SAVE CONTINUATION BIT IN LINK.
	AAC 3			/(RCHM-173) SET UP FOR LENGTH CALCULATION.
	SNL!CMA			/(RCHM-173) CONVERT 3 TO -4 IF 2 WORDS OF NAME.
	IAC			/(RCHM-173) CONVERT TO -3 IF ONLY 1 WORD OF NAME.
	TAD SYMPTR		/(RCHM-173) CALCULATE POINTER TO COMMON BASE ADDR.
	DAC SYM1		/(RCHM-173) SET UP FOR INDIRECTION.
	LAC* SYM1		/(RCHM-173) FETCH COMMON BASE ADDRESS.
	CMA!IAC			/(RCHM-173) CONVERT TO NEGATIVE.
	TAD CLT			/(RCHM-173) COMPARE AGAINST TOP OF CLT.
	SZA!SMA			/(RCHM-173) IS IT GREATER THAN OR EQUAL TO TOP?
	JMP RAO4D		/(RCHM-173) NO.
	JMS MVCTOR		/(RCHM-173) YES.
	JMP RAO4B		/(RCHM-173) GO PROCESS NEXT ENTRY.
RAO4D	JMS NXNTRY		/(RCHM-173) MOVE TO NEXT ENTRY.
	JMP RAO4C		/(RCHM-173) GO TO NEXT ENTRY.
/
/
/ ROUTINE TO MOVE COMMON BLOCK ENTRY FROM NON-RESIDENT CODE TO RESIDENT
/ CODE. RETURNS NEW STARTING ADDRESS IN AC. SYMEB1 IS UPDATED. THIS
/ ROUTINE IS USED WHEN EITHER THE SAC SWITCH IS SET OR A DEFINED COMMON
/ IS FLAGGED AS RES.
/
MVCTOR	XX			/(RCHM-158) ROUTINE ENTRY POINT.
	LAC*	SYMPTR
	DAC	TEMP1
	JMS	DECSPT
	LAC*	SYMPTR
	DAC	TEMP2
	JMS	DECSPT
	LAC	TEMP2
	SMA
	JMP	RAO2
	LAC*	SYMPTR
	DAC	TEMP3
	JMS	DECSPT
RAO2	JMS	DECSPT
	LAC*	SYMPTR
	DAC	TEMP4
	JMS	DECSPT

	LAC	SYMPTR

	DAC	TEMP5

/

	LAC	SYMEB1

	DAC	SYMPTR

	LAC	TEMP1

	DAC*	SYMPTR

	JMS	DECSPT

	LAC	TEMP2

	DAC*	SYMPTR

	JMS	DECSPT

	LAC	TEMP2

	SMA

	JMP	RAO3

	LAC	TEMP3

	DAC*	SYMPTR

	JMS	DECSPT

RAO3	DZM*	SYMPTR

	JMS	DECSPT

	LAC	TEMP4

	DAC*	SYMPTR

	JMS	DECSPT

	LAC	SYMPTR

	DAC	SYMEB1

	LAC	TEMP5

	JMP* MVCTOR		/(RCHM-158) RETURN TO USER.

	.EJECT

/

/ ALL ROUTINES FROM USER'S DEVICE HAVE BEEN RELOCATED

/

RAOSAG	LAW	-3	/RESET LIBRARY POINTER

	TAD	SDPTR

	DAC	SDPTR

	JMP	RAOCUE	/RESCAN LIBRARY

/

RAOCUD	.CLOSE	UD	/CLOSE FILE ON USER'S DEVICE

	JMS	VIRTUAL	/ARE THERE ANY UNRESOLVED GLOBALS?

	JMP	TROR	/NO -- TERMINATE RELOCATED OUTPUT RECORD

	LAC	SDPTR

	AAC 3			/(RCHM-158)

	DAC	SDPTR

RAOCUE	DZM	RESG		/(GAR:167) RESET RESOLVED GLOBLS FLAG.

	LAC*	DATP		/(GAR:167) YES -- SCAN USER'S LIBRARY IF

	AAC UL			/(RCHM-158) A DEVICE IS ASSIGNED

	DAC	TEMP1

	LAC*	TEMP1

	SNA

	JMP	RAOSSL	/(NO USER'S LIB, SCAN SYS LIB)

	LAW	UL

	JMS	LIBRARY

/

	JMS	VIRTUAL	/ARE THERE ANY UNRESOLVED GLOBALS?

	JMP	TROR	/NO -- TERMINATE RELOCATED OUTPUT RECORD

	LAC	RESG		/(GAR:167) WERE ANY GLOBLS RESOLVED?

	SZA			/(GAR:167)

	JMP	RAOCUE		/(GAR:167) YES, SCAN THE USER LIBRARY AGAIN.

RAOSSL	LAC	SDPTR		/(GAR:167) NO -- SCAN SYS LIB

	AAC 3			/(RCHM-158)

	DAC	SDPTR

RAOSS1	DZM	RESG		/(GAR:167) RESET THE RESOLVED GLOBLS FLAG.

	LAW	SL

	JMS	LIBRARY

/

	JMS	VIRTUAL	/ARE THERE ANY UNRESOLVED GLOBALS?

	JMP	TROR	/NO -- TERMINATE RELOCATED OUTPUT RECORD

/(GAR:167)

/(GAR:167)	DELETED TWO LINES WHICH CAUSED THE USER AND SYSTEM

/(GAR:167)	LIBRARIES TO BE SCANNED AT MOST TWO TIMES.  THE

/(GAR:167)	SCAN WAS 'USER -- SYSTEM -- USER -- SYSTEM'.  IF

/(GAR:167)	AFTER THE TWO SCANS ANY UNRESOLVED GLOBLS REMAINED

/(GAR:167)	THE 'UNRESOLVED GLOBLS' ERROR WAS GIVEN.

/(GAR:167)

/(GAR:167)	EDIT #167 CHANGED THE LIBRARIES' SCAN.  NOW THE

/(GAR:167)	USER LIBRARY (IF PRESENT) IS SCANNED UNTIL A SCAN

/(GAR:167)	IS MADE WHERE NO GLOBLS WERE RESOLVED.  IF THERE

/(GAR:167)	ARE STILL UNRESOLVED GLOBLS, THE SYSTEM LIBRARY IS

/(GAR:167)	SCANNED UNTIL A PASS IS MADE WHERE NO GLOBLS WERE

/(GAR:167)	RESOLVED.

/(GAR:167)	IF THERE ARE STILL UNRESOLVED GLOBLS, THE SCAN OF

/(GAR:167)	LIBRARIES IS STARTED AGAIN WITH THE USER LIBRARY.

/(GAR:167)	THE SCANS OF THE TWO LIBRARIES CONTINUES UNTIL A SCAN

/(GAR:167)	IS MADE WHERE NO GLOBLS ARE RESOLVED FROM EITHER

/(GAR:167)	LIBRARY.

/(GAR:167)

	LAC	RESG		/(GAR:167) WERE ANY GLOBLS RESOLVED?

	SZA			/(GAR:167)

	JMP	RAOSS1		/(GAR:167) YES, SCAN THE SYSTEM LIBRARY AGAIN.

	LAC	RESGBL		/(GAR:167) NO, WERE ANY GLOBLS RESOLVED FROM ...

				/(GAR:167) EITHER LIBRARY?

	SNA			/(GAR:167)

	JMP	UNRERR		/(GAR:167) NO, GO GIVE ERROR REPORT.

	DZM	RESGBL		/(GAR:167) YES, RESET THE RESOLVED GLOBLS FLAG.

	JMP	RAOSAG		/(GAR:167) START THE LIBRARIES' SCAN AGAIN.

UNRERR	JMS	TYPE	/(GAR:167) YES -- TYPE OUT NAMES AND EXIT

	MES710

	DZM EXT			/(RCHM-166) MAKE SURE NO EXTENSION GETS PRINTED.

	JMS	SHTMAP	/SHORTEN MAP LINE AND SET MAP FLAG

GLBERR	JMS VIRTUAL	/ANY UNDEFINED GLOBALS?

	JMS EXIT		/(RCHM-158) NO -- EXIT

	DZM* SYMWD1	/YES. KILL THE ENTRY IN THE SYMBOL TABLE

			/TO AVOID SEEING IT AGAIN.

	JMS NEXSYM	/PICK UP GLOBAL NAME

	DAC SYM1

	JMS NEXSYM

	DAC SYM2

	JMS	SYMMAP	/SET NAME IN MAP LINE

	JMS	TYPMAP	/TYPE MAP LINE

	JMP GLBERR	/CONTINUE UNTIL THEY'RE ALL DONE

/

TROR	JMS	FROP	/TERMINATE AND WRITE RELOCATED OUTPUT

			/RECORD.

/

/ RESOLVE UNDEFINED COMMON BLOCKS

/

	JMS	BEGSYM	/SCAN SYMBOL TABLE FOR UNDEFINED COMMON 

RCB1	SAD	SYMEND	/BLOCK ENTRIES (CODE=7). 

	JMP	OUTPTB

	LAC*	SYMWD1

	AND	(700000)

	SAD	(700000)

	JMP	RCB10

RCB2	JMS	NXNTRY

	JMP	RCB1

/
RCB10	LAC*	SYMPTR	/UNDEFINED COMMON BLOCK ENTRY FOUND

	AND	(077777)/SAVE BLOCK SIZE

	DAC	TEMP1

	CMA!IAC			/(RCHM-157) SAVE 2'S COMPL OF SIZE AND SET BLOCK FLAG

	DAC	SIZE

	DAC BLKFLG		/SET COMMON BLOCK IN PROGRESS.

	JMS	DECSPT	/GET NAME AND TEST FOR BLANK COMMON

	LAC*	SYMPTR	/DEFINITION (RADIX 50 FOR '.XX' IS 131330)

	SAD	(.XX)

	JMP	RCB20

/

			/NAMED COMMON FOUND --

	DAC	SYM1	/SAVE NAME FOR MAP LINE

	SMA

	JMP	.+4

	JMS	DECSPT

	LAC*	SYMPTR

	DAC	SYM2

	DZM PRG1		/(RCHM-163) CLEAR PROGRAM NAME IN CASE OF ONLY

				/(RCHM-163) COMMON NAMES OR SOMETHING.

/

/CHECK THE NAMED COMMON LIST

/FOR THIS NAME AND SET SWITCH

/"VTCSW" TO A NOP IF FOUND

/SAVE THE ADDR MASK USED BY THE

/FIT ROUTINE SO THAT IT CAN BE

/CHANGED FOR MEMORY BANKS

/THEN CALL "FIT" AND AFTER

/RETURNING RESTORE THE ADDR MASK
/IN "FIT" -- ALSO OPCMSK IF FGD
/
/
/ COMMON BLOCKS WILL BE ALLOWED INTO HIGH CORE IF ANY OF THE
/ FOLLOWING CONDITIONS ARE MET. 1) THE LINK BEING PROCESSED IS THE
/ RESIDENT LINK (LINKNUM=0) OR 2) THE BLOCK IS THE TARGET OF A RES ALL
/ OR RES/NAM/ ARGUMENT.
/
	LAC LNKNUM		/(RCHM-172) RESIDENT LINK BEING PROCESSED?
	SZA			/(RCHM-172) 0 => YES.
	JMP UN.CM1		/(RCHM-172) NO.
	LAC (SKP)		/(RCHM-172) JAM ALLOWANCE INTO HIGH MEMORY.
	DAC SIF.HM		/(RCHM-172)
	JMS RV.SET		/(RCHM-172) SET RES.SW AND VTC.SW ON GENERAL
	JMP UNDCOM		/(RCHM-172) PRINCIPLES (TO MAKE IT WORK RIGHT)
/
/ SOME LINK OTHER THAN THE RESIDENT LINK IS BEING PROCESSED,
/ ONLY SET SIF.HM IF THE BLOCK BEING PROCESSED IS THE TARGET OF
/ THE RES SWITCH.
/
UN.CM1	JMS RV.SET		/(RCHM-172) SET RES AND VTC SWITCHES.
	LAC (SKP)		/(RCHM-172) SET UP SIF.HM FROM RES.SW
	XCT RES.SW		/(RCHM-172) SKP => BLOCK TARGET OF RES SWITCH.
	LAC (NOP)		/(RCHM-172)
	DAC SIF.HM		/(RCHM-172) ALLOWED IN HIGH MEMORY SWITCH SET.
UNDCOM	XCT SIFTOP		/(RCHM-158)
	JMP	FGDCOM
	LAC	AMREST
	SKP
FGDCOM	LAC	ADRMSK
	DAC	ADRSAV
	JMS	FIT
	LAC (NOP)		/(RCHM-172) PROTECT BLOCKS FROM HIGH MEMORY.
	DAC SIF.HM		/(RCHM-172)
	LAC	ADRSAV
	XCT SIFTOP		/(RCHM-158)
	JMP	FGDCM1
	DAC	AMREST
	JMP	VTCCNT
FGDCM1	DAC	ADRMSK
	CMA
	DAC	OPCMSK
VTCCNT	JMS PRTPRG		/(RCHM-163) PRINT COMMON BLOCK NAME.
	LAC*	SYMWD1	/COMMON BLOCK IS NOW DEFINED, CHANGE SYMBOL
	AND	(377777)/TABLE CODE FROM 7 TO 3.
	DAC*	SYMWD1
	JMS	DECSPT	/SET BASE OF BLOCK (DEFINITION) IN
	JMS	DECSPT	/SYMBOL TABLE, AND LEAVE SYMPTR POINTING
	LAC	LOADADR	/TO THE SYMTAB CHAIN ADDRESS
	DAC*	SYMPTR
	ISZ	SYMPTR
/
	JMS	DEFCOM	/FOLLOW SYMBOL TABLE CHAIN MAKING PATCH
	JMP	RCB2	/TABLE ENTRIES (CODE=0) FOR EACH TRANSFER 
			/VECTOR  TO THIS NAMED COMMON BLOCK.
/
			/BLANK COMMON FOUND --
RCB20	LAC	TEMP1	/UPDATE LARGEST-BLANK-COMMON-BLOCK
	CMA!IAC			/(RCHM-157) IF NECESSARY.
	TAD	MAX.XX
	SPA
	CLA
	TAD	TEMP1
	DAC	MAX.XX
/
	JMS	DECSPT	/FOLLOW SYMBOL TABLE CHAIN MAKING 
	LAC*	SYMPTR	/PATCH TABLE ENTRIES (CODE=2) FOR
			/EACH TRANSFER VECTOR TO BLANK COMMON
/
	DZM*	SYMPTR	/INDICATE NO STRING (FOR FUTURE ENTRIES)
RCB21	SNA
	JMP	RCB2
	DAC	SYMPTR
	JMS	DECSPT
	LAC*	SYMPTR
	AND	(077777)

	XOR	(200000)

	DAC	PTBW1

	JMS	DECSPT

	LAC*	SYMPTR

	DAC	PTBW2

	JMS	PTBENT

	ISZ	SYMPTR

	ISZ	SYMPTR

	LAC*	SYMPTR

	AND	(077777)

	JMP	RCB21

/

/ OUTPUT PATCH TABLE

/

OUTPTB	LAC	PTBBSE	/SETUP HEADER --

	CMA!IAC			/(RCHM-157) BITS 0-2 -- CODE=3

	TAD	PTBX1	/  BITS 3-17 -- WORD LENGTH OF PATCH TBL

	SNA

	JMP	OPTB4	/SPECIAL CASE: ZERO LENGTH PATCH TABLE

	RCR

	XOR	(300000)

	DAC	OUTBUF+2

	LAC	PTBBSE

	DAC	PTBX2

	LAC	OUTBEG

	AAC 2			/(RCHM-158)

	DAC	TEMP1

OPTB1	LAC	TEMP1

	DAC	TEMP2

	DZM	OUTBUF+3

	LAC	(002000)

	DAC	OUTBUF

OPTB2	LAC	PTBX2

	SAD	PTBX1

	JMP	OPTB3

	LAC*	PTBX2

	ISZ	PTBX2

	DAC*	TEMP2

	ISZ	TEMP2

	LAC*	PTBX2

	ISZ	PTBX2

	DAC*	TEMP2

	ISZ	TEMP2

	ISZ	OUTBUF+3

	LAC	OUTBUF

	TAD	(001000)

	DAC	OUTBUF

	SAD	(021000)

	SKP

	JMP	OPTB2

	JMS	WOB

	JMP	OPTB1

/

OPTB3	LAC	OUTBUF

	SAD	(002000)

	SKP

	JMS	WOB

	JMP*	RAO

/

OPTB4	JMS	WNPPR	/WRITE NO PATCH PATCH-RECORD

/

	JMP*	RAO	/EXIT RAO SUBROUTINE

 .TITLE *** SUBR. TO PAUSE AND TYPE OUT LINK

/

/ PAUSX -- SUBROUTINE TO PAUSE AND TYPE OUT LINK 

/          NUMBER IF PAUSE FLAG IS SET

/

PAUSX	0

	LAC	PSFLAG	/IS PAUSE FLAG SET?

	SNA

	JMP*	PAUSX	/NO -- EXIT

	ISZ	PSFLAG	/YES -- TURN OFF IF 'PAUSE AFTER RESIDENT'

	NOP

	JMS	TYPE	/TYPE "PAUSE #XXX "

	MES610

	LAC	(PSNB+2)	/(RCHM-156)

	DAC	MAPX1

	LAC	LNKNUM

	JMS	ADROUT

	LAW	040

	DAC	PSNB+2

	LAW	043

	DAC	PSNB+3

PAUSZ	.WRITE	TO,3,PSNB,0

	JMS	WFCP	/WAIT FOR ^P

	JMP*	PAUSX	/EXIT

/

 .TITLE *** PROGRAM LOADING ROUTINE

/ GLEANED FROM:

/ B/F .SYSLD V1A - 21 MAY 1969 - JEAN-CLAUDE P. PROTEAU

/

/ MAIN SUBROUTINE LDPROG: LOAD A PROGRAM UNIT VIA THE 'CAL .DAT SLOT' IN

/ AC.

/ WHEN RELOCATING FROM THE USER'S DEVICE, RELOCATION PROCEDES

/ THRU THE END OF FILE.  EXIT: JMP* LDPROG

/ WHEN RELOCATING FROM A LIBRARY, ONLY ONE BINARY UNIT IS RELOCATED.

/ EXIT: JMP* LDPROG.  IF IN LIBRARY SEARCH AND AN EOF IS READ,

/ EXIT IS VIA: JMP LIBCLOS.

/

IDX=ISZ

SET=ISZ

/

LDPROG	0		/CAL .DAT SLOT IS IN THE AC.

	AND (777

	DAC	READ1

	DAC	WAIT1

	LAC	SYMEND	/SAVE SYMEND TO BE RESTORED IF LIBRARY

	DAC	SYMEB2	/ROUTINE IS NOT RELOCATED

NXUN	DZM	DGSNB	/CLEAR DUPLICATE GLOBAL NAME INDICATION

	DZM PRG1		/(RCHM-163) CLEAR PROGRAM NAME SWITCH.

	DZM	BLKFLG	/CLEAR BLOCK FLAG

	DZM BLKDSW		/(RCHM-163) CLEAR BLOCK DATA SWITCH.

BUFMPTY	LAC	(INBUF)		/(RCHM-156)

	DAC	BUFPTR

READ1	.READ	0,0,INBUF,50

WAIT1	.WAIT	0

/ TEST THE HEADER WORDS IN THE BUFFER JUST READ INTO.

	LAC* BUFPTR	/PICKUP HEADER WORD 1.

	AND	(017)	/MASK TO FUNCTION BITS

	SAD	(005)	/END-OF-FILE?

	SKP

	JMP	PSBX	/NO -- TEST FOR ERRORS

	LAC	LIBFLG	/YES -- LIBRARY SEARCH?

	SZA

	JMP	LIBCLOS /YES -- CLOSE LIBRARY

	JMP*	LDPROG	/NO -- EXIT LDPROG

/

PSBX	LAC* BUFPTR

	AND (60		/GET BITS 12 AND 13.

	SNA		/PARITY, CHECKSUM, BUFFER OVERFLOW?

	JMP	PLIT9

	LAC	(MES705)

	JMP	TERR

PLIT9	LAW -1000		/LAC (777000

	TAD* BUFPTR	/PICKUP WORD PAIR COUNT, SUBTRACT

	AND .-2		/1 FOR HEADER PAIR, MULTIPLY BY 2

	CLL!RAL		/TO GET WORD COUNT (IN BITS 0 THRU 8).

	DAC WRDCNT

 

/ HEADER IS OK. NOW UPDATE THE BUFFER POINTER TO 1ST DATA WORD - 1.

/ INITIALIZE CODE WORD COUNT SO 1ST WORD IS TAKEN TO BE A CODE WORD.

/ ISSUE NEXT READ.

 

	IDX BUFPTR

	LAW -1

	DAC CDWCNT

 

 

/ CHECK IF BUFFER IS EMPTY. RETURN HERE WHENEVER READY TO PROCESS

/ ANOTHER DATA WORD.

 

BUFCHK	IDX BUFPTR	/POINT TO NEXT BUFFER WORD.

	LAC WRDCNT	/IS BUFFER EMPTY?

	SNA

	JMP BUFMPTY	/YES. READ IN SOME MORE.

	TAD PLIT9		/(777000

	DAC WRDCNT	/SUBTRACT 1 FROM THE WORD COUNT.

	ISZ CDWCNT	/READY FOR NEXT CODE WORD?

	JMP GETCOD	/NO. THERE ARE MORE CODES LEFT IN OLD ONE.

	LAW -4		/YES. RESET COUNT FOR 3 CODES PER WORD.

	DAC CDWCNT

	LAC* BUFPTR	/GET NEXT CODE WORD.

	DAC CODEWD

	JMP BUFCHK

 

	.EJECT

/ UNPACK THE NEXT CODE.

 

GETCOD	LAC CODEWD	/SHIFT CODE WORD SO THAT NEXT CODE

	RTL		/IS IN LOW ORDER AC BITS (12 THRU 17).

	RTL

	RTL

	DAC CODEWD

	RAL

	AND (77

	DAC TEMP1	/SAVE CODE FOR TESTING.

 

	LAC LIBFLG	/IS LIBRARY SEARCH MODE IN EFFECT?

	SNA

	JMP LOADIT	/NO. ALL LOADER CODES ARE IN EFFECT.

 

/ WHILE LIBRARY SEARCH MODE IS IN EFFECT, EXAMINE ONLY SPECIFIC

/ LOADER CODES; IGNORE ALL OTHERS.

 

	LAC TEMP1

	SAD (001)	/CODE 1 - PROGRAM SIZE.

	JMP LOADIT

	SAD (7		/CODE 7 - SYMBOL (1ST 3 CHARS).

	JMP LOADIT

	SAD (10		/CODE 8 - SYMBOL (2ND 3 CHARS).

	JMP LOADIT

	SAD (012)	/CODE 10 - INTERNAL GLOBAL DEFINITION.

	JMP LOADIT

	SAD (27		/CODE 23 - END OF PROGRAM UNIT.

	JMP LOADIT

	SAD	(31)	/CODE 25 -- SET BANK RELOCATION

	JMP	LOADIT

	SAD	(32)	/CODE 26 -- SET PAGE RELOCATION

	JMP	LOADIT

	SAD (33)		/(RCHM-163) CODE 27 -- EXTENSION.

	JMP LOADIT		/(RCHM-163)

	SAD (13		/CODE 11 - BLOCK DATA SUBPROGRAM.

	SKP

	JMP BUFCHK	/IGNORE ALL OTHER CODES.

	DZM LIBFLG	/CLEAR SELECTIVE LOADING FLAG SO THAT

			/THIS BLOCKDATA SUBPROGRAM IN THE USER'S

			/LIBRARY WILL BE LOADED IN (A FEATURE!!)

 

/ CODE ACCEPTED FOR PROCESSING. PICKUP THE ASSOCIATED DATA WORD AND

/ JUMP TO THE APPROPRIATE DATA PROCESSING ROUTINE.

 

LOADIT	LAW -35		/-29 DECIMAL.

	TAD TEMP1

	SMA		/IS THIS CODE >28 DECIMAL?

	JMP ERR106	/YES. BAD CODE.

 

	TAD (CODTAB+35)		/(RCHM-156)

	DAC TEMP1		/SAVE DISPATCH ADDRESS.

	LAC* BUFPTR	/PICKUP DATA WORD.

	JMP* TEMP1	/PROCESS IT.

 

 .TITLE *** DISPATCH TABLE FOR LINKING LOADER CODES

/ DISPATCH TABLE TO CODE PROCESSING ROUTINES.

/ CODES 11 THRU 18, 20 AND 21 ARE GENERATED ONLY BY FORTRAN.

 

CODTAB	JMP ERR106	/CODE 0 IS ILLEGAL.

	JMP CODE1		/ PROGRAM UNIT SIZE

	JMP CODE2		/ PROGRAM LOAD ADDRESS

	JMP CODE3		/ RELOCATABLE INSTRUCTION

	JMP CODE4		/ ABSOLUTE INSTRUCTION OR CONSTANT OR ADDRESS

	JMP CODE5		/ RELOCATABLE VECTOR

	JMP CODE6		/ NON-COMMON STORAGE ALLOCATION

	JMP CODE7		/ SYMBOL - FIRST THREE CHARACTERS

	JMP CODE8		/ SYMBOL - LAST THREE CHARACTERS

	JMP CODE9		/ EXTERNAL SYMBOL DEFINITION

	JMP CODE10		/ INTERNAL GLOBAL SYMBOL DEFINITION

	JMP CODE11		/ BLOCK DATA DECLARATION

	JMP CODE12		/ COMMON BLOCK DEFINITION

	JMP CODE8		/ COMMON SYMBOL DEFINITION

				/ CODE 13 IS PROCESSED JUST LIKE CODE 8.

	JMP CODE14		/ COMMON SYMBOL REFERENCE DEFINITION

	JMP CODE15		/ DATA INITIALIZATION CONSTANT - FIRST WORD

	JMP CODE16		/ DATA INITIALIZATION CONSTANT - SECOND WORD

	JMP CODE17		/ DATA INITIALIZATION CONSTANT - THIRD WORD

	JMP CODE18		/ DATA INITIALIZATION CONSTANT DEFINITION

	JMP CODE19		/ PROGRAM NAME OR INTERNAL SYMBOL DEFINITION

	JMP CODE20		/ STRING CODE - FIRST HALF

	JMP CODE21		/ STRING CODE - SECOND HALF

	JMP CODE22		/ INPUT/OUTPUT DEVICE ROUTINE REQUEST

	JMP CODE23		/ END OF PROGRAM UNIT

	JMP	BUFCHK	/CODE 24 IS IGNORED

	JMP	CODE25		/ ENABLE BANK RELOCATION

	JMP	CODE26		/ DISABLE BANK RELOCATION

	JMP CODE27		/(RCHM-163) SOURCE EXTENSION.

	JMP CODE28		/(RCHM-163) CORAL STYLE COMMON BLOCK INITIALIZATION.

 .TITLE *** LINKING LOADER CODE PROCESSING

/ CODE 1 PROCESSOR: PROGRAM UNIT'S SIZE. COMPUTE LOAD ADDRESS AND

/ RELOCATION FACTORS.

 

CODE1	DZM CBSIZE		/(RCHM-163) CLEAR CORAL COMMON BLOCK SIZE.

	SPA!CMA!IAC		/(RCHM-163) ABSOLUTE OR RELOCATABLE PROGRAM.

	JMP ERR115	/ABSOLUTE.

	XCT SK.F01		/(RCHM-163) IS THIS THE FIRS 01 LOADER CODE?

	JMP CORALB		/(RCHM-163) NO, SHOULD BE A CORAL COMMON BLOCK INIT.

	DAC SIZE		/SAVE 2'S COMPLEMENT OF PROGRAM SIZE.

	LAC (NOP)		/(RCHM-163) DISABLE SKIP FOR NEXT 01 LOADER CODE.

	DAC SK.F01		/(RCHM-163)

 

/ IF IN LIBRARY SEARCH MODE, DON'T CHECK IF THIS PROGRAM UNIT CAN FIT

/ IN CORE UNTIL IT IS KNOWN THAT IT WILL BE LOADED (SEE CODE 10).

 

	LAC LIBFLG	/ARE WE IN LIBRARY SEARCH MODE?

	SZA

	JMP ABSOLU	/YES. DON'T CHECK FOR FIT YET.

 

/ SEE IF PROGRAM WILL FIT IN AVAILABLE CORE. COMPUTE THE PROGRAM'S

/ LOAD ADDRESS AND RELOCATION FACTOR.

 

	JMS FIT

	LAC GMFLAG		/(RCHM-168) PRINT FILE NAME IF GMFLAG IS SET.

	SNA			/(RCHM-168)

	JMP BUFCHK		/(RCHM-168)

	DZM EXT			/(RCHM-168) CLEAR EXT.

	JMS PRTPRG		/(RCHM-168) PRINT FILE NAME.

	JMP BUFCHK

 

ABSOLU	DZM RELOC		/0 THE RELOCATION FACTOR.

	JMP BUFCHK	/GO TO PROCESS THE NEXT DATA WORD.

/

CORALB	DAC CBSIZE		/(RCHM-163) SAVE CORAL COMMON BLOCK SIZE.

	JMP BUFCHK		/(RCHM-163) GO GET NEXT LOADER CODE.

 

	.EJECT

/ CODE 2 PROCESSOR: PROGRAM'S LOAD ADDRESS.

 
CODE2	SPA

	JMP ERR116		/(RCHM-158)

	DAC TEMP1		/(RCHM-163) SAVE OFFSET TEMPORARILY.

	TAD	RELOC

	DAC	LOADADR

	LAC TEMP1		/(RCHM-163) FETCH OFFSET.

	TAD SIZE		/(RCHM-163) SUBTRACT CURRENT SIZE.

	SPA!SNA			/(RCHM-163) OFFSET BIGGER THAN SIZE?

	JMP BUFCHK
ERR117	JMS ERROR4		/(RCHM-176) YES, PRINT ERROR AND EXIT.

	MES728			/(RCHM-163)

/ ***	ERROR4 DOES NOT RETURN   ***/

ERR116	LAC (MES724)		/(RCHM-158) FETCH MESSAGE NUMBER.

	JMP TERR		/(RCHM-158) PRINT TERMIAL ERROR.

 

/ CODE 3 PROCESSOR: RELOCATABLE INSTRUCTION.

 

/ CODE 4 PROCESSOR: A NON-MEMORY REFERENCING INSTRUCTION, A NON-

/ RELOCATABLE MEMORY REFERENCING INSTRUCTION, AN ABSOLUTE ADDRESS,

/ OR A CONSTANT.

 

CODE3	DAC	TEMP1	/ADD IN THE RELOCATION FACTOR

	LAC	RELOC	/(MODULO 13-BITS) TO THE ADDRESS

	AND	ADRMSK	/FIELD.

	TAD	TEMP1

CODE4	JMS STORE		/STORE THE WORD IN CORE.

	IDX LOADADR

	JMP	BUFCHK

 

/ CODE 5 PROCESSOR: RELOCATABLE PROGRAM ADDRESS (VECTOR).

 

CODE5	TAD RELOC		/ADD IN THE 15-BIT

	JMP CODE4		/RELOCATION FACTOR.

 

	.EJECT

/ CODE 6 PROCESSOR: NON-COMMON VARIABLE AND ARRAY STORAGE ALLOCATION.

 

CODE6	TAD LOADADR	/INCREASE THE PRESENT LOAD ADDRESS BY THE

	DAC	LOADADR	/STORAGE SIZE.

	JMP	BUFCHK

 

 

/ CODE 7 PROCESSOR: 1ST 3 CHARACTERS OF A SYMBOL.

 

CODE7	DAC SYM1		/SAVE RADIX 50 SYMBOL CODE.

	JMP BUFCHK

 

 

/ CODE 8 PROCESSOR: LAST 3 CHARACTERS OF A SYMBOL.

/ (CODE 13 ALSO STARTS HERE).

 

CODE8	DAC SYM2		/SAVE RADIX 50 SYMBOL CODE.

	JMP BUFCHK

 

 

/ CODE 9 PROCESSOR:  GLOBAL SYMBOL REFERENCE.

/ CONTAINS UNRELOCATED ADDRESS OF A TRANSFER VECTOR, WHICH

/ HAS BEEN SETUP TO POINT TO ITSELF.

 

CODE9	TAD RELOC		/ADD RELOCATION FACTOR,

	TAD (100000)		/ADD CODE (1) FOR A VIRTUAL GLOBAL,

	JMS SCAN		/SCAN THE SYMBOL TABLE TO SEE IF THIS SYMBOL

			/HAS ALREADY BEEN ENTERED.

	JMP CDE9A		/YES.

	JMS DEFSYM	/ENTER IN SYMTAB.

	LAC	SYMDEF

	AND	(077777)

 

/ GLOBAL SYMBOL IS  IN THE SYMBOL TABLE. IF UNRESOLVED, AC HAS

/ THE ADDRESS OF THE 1ST TRANSFER VECTOR IN THE CHAIN. IF RESOLVED,

/ AC HAS TRUE ADDRESS OF THE GLOBAL. IN EITHER CASE, STORE THIS

/ ADDRESS IN THE TRANSFER VECTOR.

/

CDE9A	DAC	PTBW2	/STORE 15-BIT DEFINITION IN A

	LAC	SYMDEF	/TRANSFER VECTOR IN THE PATCH TABLE

	AND	(077777)

	DAC	PTBW1

	JMS	PTBENT

	LAC* SYMWD1	/GET 1ST WORD OF GLOBAL ENTRY.

	SPA		/IS IT STILL VIRTUAL?

	JMP BUFCHK	/NO. PROCESS NEXT DATA WORD.

 

/ SINCE THE GLOBAL IS STILL VIRTUAL, ENTER THE ADDRESS OF THE LATEST

/ TRANSFER VECTOR INTO THE SYMBOL TABLE ENTRY FOR THE GLOBAL, THEREBY

/ RECLOSING THE CHAIN.

 

	LAC SYMDEF

	DAC* SYMWD1

	JMP BUFCHK

 

/ CODE 10 PROCESSOR:  GLOBAL SYMBOL DEFINITION -- AC  CONTAINS

/ THE UNRELOCATED DEFINITION (ADDRESS) OF THE LAST SYMBOL 

/ (CODES 7 & 8) ENCOUNTERED.

/

/ 1. IF THE SYMBOL HAS NOT BEEN REFERENCED (OR DEFINED), 

/    ENTER THE DEFINITION IN THE SYMBOL TABLE.

/    IF IN LIBRARY SEARCH AND THE ROUTINE IS NOT RELOCATED, 

/    THE END OF THE SYMBOL TABLE IS RETRACTED, EFFECTIVELY 

/    DELETING ANY DEFINITIONS MADE FOR THE ROUTINE THAT WAS

/    READ THRU BUT NOT RELOCATED.

/

/ 2. IF THE SYMBOL HAS BEEN REFERENCED, DEFINE SYMBOL AND 

/    RESOLVE ALL REFERENCES TO IT.  IF IN LIBRARY SEARCH, 

/    SETUP TO RELOCATE FROM LIBRARY (JMS SUTLFL).

/

/ 3. IF THE SYMBOL HAS BEEN DEFINED AND THE DEFINITION 

/    IS A LINK TABLE ENTRY, AND WHERE NOT IN LIBRARY SEARCH MODE

/    MAKE SURE THE FILE NAME EQUALS THE GLOBAL NAME.

/    IF IT DOSN'T SET THE DUPLICATE SYMBOL FLAG (DGSNB)

/    WHICH WILL RESULT IN A TERMINAL ERROR. IF THE NAMES ARE 

/    EQUAL CHECK THE "R" FLAG IN THE LTB ENTRY AND IF SET

/    SET THE "DGSNB" FLAG. IF ITS CLEAR THEN SET IT AND PUT

/    THE ACTUAL DEFINITION IN THE LTB ENTRY.

/

/ 4. IF THE SYMBOL HAS BEEN DEFINED AND THE DEFINITION

/    IS AN LTB ENTRY AND WHERE IN LIBRARY SEARCH MODE

/    MAKE SURE THERE IS A CODE 6 ENTRY IN THE SYMBOL TABLE.

/    IF THERE IS NO CODE 6 ENTRY SET THE "DGSNB" FLAG WHICH

/    WILL RESULT IN A TERMINAL ERROR IF THE ROUTINE IS LOADED.

/    IF THERE IS AN ENTRY SETUP TO LOAD FROM THE LIBRARY

/    AN CHECK THE "R" FLAG ECT AS IN (3) ABOVE.

/ 

/ 5. IF SYMBOL HAS BEEN DEFINED AND THERE IS NO LTB ENTRY

/    SET THE "DGSNB" FLAG AND IF IN LIBRARY SEARCH MODE

/    AND THERE IS A CODE 6 ENTRY IN THE SYMBOL TABLE

/    SETUP TO LOAD FROM THE LIBRARY (JMS SUTLFL) SO THAT

/    A TERMINAL ERROR WILL RESULT. REFER TO (6) BELOW

/    FOR DETAILS ON THE DUPLICATE SYMBOL FLAG AND THE POSSIBLE

/    ERROR THAT CAN RESULT.

/

/ 6. IF THE SYMBOL HAS BEEN DEFINED AND THE DEFINITION IS

/    NOT A LINK TABLE ENTRY, SAVE THE SYMBOL NAME TO FLAG

/    A DUPLICATE SYMBOL DEFINITION.  IF THE ROUTINE IS REL-

/    OCATED (NOT IN LIBRARY SEARCH, OR IN LIB SEARCH AND 

/    ANOTHER DEFINITION MATCHED AN UNRESOLVED REFERENCE), THE

/    SET DUPLICATE SYMBOL FLAG WILL RESULT IN A TERMINAL

/    ERROR. 

/
CODE10	TAD RELOC	/ADD RELOCATION FACTOR.
	DAC TEMP3
	AND (700000)		/(RCHM-176) CHECK TO SEE IF THE DEFINITION
	SZA			/(RCHM-176) (INCLUDING RELOCATION FACTOR) PUTS
	JMP ERR117		/(RCHM-176) THIS GLOBAL DEFINITION ABOVE 32K.
	LAC TEMP3		/(RCHM-176)

	TAD (500000)	/(500000 ADD CODE FOR DEFINED GLOBAL.

	JMS SCAN	/IS THERE A GLOBAL WITH THE SAME NAME

			/ALREADY IN THE SYMBOL TABLE?

	JMP INTABLE	/YES.

/ SYMBOL NOT IN TABLE -- ENTER DEFINITION (CODE 5).

/   IF IN LIB SEARCH AND ROUTINE IS NOT RELOCATED, THE ENTRY

/   WILL BE DELETED.

/   IF IN LIB SEARCH, AND THE ROUTINE IS LOADED, ANY GLOBAL

/   SYMBOL DEFINITIONS MADE WILL BE RELOCATED WHEN CORE FOR

/   THE ROUTINE IS ALLOCATED.

	JMS DEFSYM	/ENTER SYMBOL AND ITS DEFINITION.

/

/ GLOBAL DEF DOES NOT MATCH AN UNRESOLVED GLOBAL REF --

/ IF IN LIBRARY SEARCH, TEST FOR: GLOBAL SYMBOL DEF

/ MATCHING A DUMMY GLOBAL SYMBOL REF.  IF FOUND, SET UP TO

/ LOAD FROM LIBRARY (JMS SUTLFL)

/

	LAC	LIBFLG

	SNA

	JMP	BUFCHK

	LAC	(600000)

	JMS	SCAN

	JMS	SUTLFL

	JMP	BUFCHK

/

	.EJECT

/ GLOBAL ALREADY IN SYMBOL TABLE.

 

INTABLE	DAC TEMP4	/SAVE 15-BIT DEFINITION FROM SYMTAB ENTRY.

	LAC* SYMWD1	/IS IT ALREADY DEFINED?

	SPA!CLA

	JMP	LTBCHK	/YES

	SAD LIBFLG	/NO. ARE WE IN LIBRARY SEARCH MODE?

	JMP RESOLVE	/NO. DEFINE THE GLOBAL ENTRY.

	JMS	SUTLFL

	JMP	RESOLVE

 

/ LIBFLG ON MEANS THE LOADER IS SEARCHING THRU SOME LIBRARY FOR INTERNAL

/ (DEFINED) GLOBALS WHICH ARE REQUESTED IN THE SYMBOL TABLE. JUST FOUND

/ ONE. NOW TEST IF THIS LIBRARY PROGRAM WILL FIT IN AVAILABLE CORE AND

/ SETUP THE RELOCATION FACTOR. IF IT FITS,

/ CLEAR LIBFLG TO INDICATE THAT A GLOBAL WAS RESOLVED (SEE INSTRUCTIONS

/ AT NEXLIB) AND ALSO SO THAT THE REMAINDER OF THIS PROGRAM ( UP TO THE

/ END-OF-PROGRAM CODE (23) ) WILL BE LOADED IN (INCLUDING SUBSEQUENT

/ GLOBAL DEFINITIONS).

/

SUTLFL	0		/SET UP TO LOAD FROM LIBRARY

	JMS FIT		/TEST IF LIBRARY PROGRAM FITS IN CORE AND

			/COMPUTE LOAD ADDRESS AND RELOC FACTOR.

	DZM LIBFLG	/CLEAR LIBRARY MODE FLAG SO REST OF PROGRAM

			/WILL BE LOADED AND TO SIGNAL THAT IT WAS.

	LAC GMFLAG		/(RCHM-168) SEE IF PRINTING GLOBAL NAMES IS OK.

	SNA			/(RCHM-168)

	JMP SUTL0		/(RCHM-168) NO.

	DZM EXT			/(RCHM-168) DON' PRINT EXTENSION.

	DZM PRG1		/(RCHM-168) KILL PREVIOUS PROGRAM NAME.

	JMS PRTPRG		/(RCHM-168) PRINT GLOBAL.

SUTL0	LAC	SYMPTR		/(RCHM-168) SCAN SYMBOL TABLE ENTERIES GENERATED

	DAC	TEMP10	/SINCE THIS LIB ROUTINE WAS FIRST ENCOUNTERED

	LAC	SYMWD1	/AND RELOCATE ANY GLOBAL SYMBOL DEFINITIONS

	DAC	TEMP11	/(SYMWD1 & SYMPTR WILL BE RESTORED)

	LAC	SYMEB2

	DAC	SYMWD1

SUTL1	SAD	SYMEND

	JMP	SUTL2

	LAC*	SYMWD1

	AND	(700000)

	SAD	(500000)

	SKP

	JMP	.+4

	LAC*	SYMWD1

	TAD	RELOC

	DAC*	SYMWD1

	JMS	NXNTRY

	JMP	SUTL1

SUTL2	LAC	(600000)/SCAN FOR A DUMMY GLOBAL SYMBOL ENTRY

	JMS	SCAN	/AND KILL IF FOUND.

	DZM*	SYMWD1

	LAC	TEMP10	/(RESTORE SYMWD1 & SYMPTR)

	DAC	SYMPTR

	LAC	TEMP11

	DAC	SYMWD1

	LAC TEMP3		/ADD RELOCATION FACTOR AGAIN (TO GLOBAL

	TAD RELOC		/ADDRESS) BECAUSE IT WAS 0 PREVIOUSLY.

	DAC TEMP3

	TAD (500000)	/(500000

	DAC SYMDEF	/SAVE FOR SYMBOL DEFINITION.

	JMP*	SUTLFL

/

/ GLOBAL SYMBOL ALREADY IN TABLE AND DEFINED!

/

LTBCHK	LAC	TEMP4	/IS THE DEFINITION A LINK TABLE ENTRY?

	CMA!IAC			/(RCHM-157)

	TAD	LTBTAD

	SPA

	JMP	DUPGL1	/NO -- FLAG DUPLICATE GLOBAL SYMBOL

	LAC	LTBBAD

	CMA!IAC			/(RCHM-157)

	TAD	TEMP4

	SPA

	JMP	DUPGL1	/NO -- FLAG DUPLICATE GLOBAL SYMBOL

	LAC	LIBFLG	/ARE WE IN LIBRARY SEARCH MODE

	SZA

	JMP	LTBLIB	/YES --GO HANDLE IT

	LAC	SYM1	/NO -- ASSUME ROUTINE IS AN EXTERNAL LINK COMPONENT.

			/WITHOUT A LIBRARY INDICATOR ON IT

	SAD	FNM1	/THEREFORE GLOBAL NAME AND FILE NAME MUST BE

	SKP		/INDENTICAL.  ARE THEY?

	JMP	DUPGBL	/NO -- FLAG DUPLICATE GLOBAL NAME

	SMA

	JMP	SLTEPO	/YES -- SET LINK TABLE ENTRY POINT-PLUS-ONE

	LAC	SYM2

	SAD	FNM2

	JMP	SLTEPO	/YES -- SET LINK TABLE ENTRY POINT-PLUS-ONE

	JMP	DUPGBL	/NO -- FLAG DUPLICATE GLOBAL SYMBOL

/

SLTEPO	LAC	LTBTAD	/SET R-FLAG TO INDICATE THAT THIS

	CMA!IAC			/(RCHM-157) COMPONENT HAS BEEN RELOCATED, SET ENTRY

	TAD	LTBTOP	/POINT, AND ENTRY POINT PLUS ONE,

	TAD	TEMP4	/IN THE APPROPRIATE LINK TABLE ENTRY.

	AAC 5			/(RCHM-158)

	DAC	TEMP5

	LAC*	TEMP5	/FLAG DUPLICATE GLOBAL IF R-FLAG IS ALREADY SET

	SZA

	JMP	DUPGBL

	ISZ*	TEMP5	/(R-FLAG)

	ISZ	TEMP5

	LAC	TEMP3	/(ENTRY)

	DAC*	TEMP5

	ISZ	TEMP5

	AAC 1			/(RCHM-158) (ENTRY+1)

	DAC*	TEMP5

	JMP	BUFCHK

/

LTBLIB	LAC	(600000	/IS THERE A CODE 6 ENTRY

	JMS	SCAN	/IN SYMBOL TABLE FOR THIS GLOBAL

	SKP		/SKIP IF THERE IS

	JMP	DUPGBL	/FLAG DUPLICATE SYMBOL

	DZM*	SYMWD1	/KILL ENTRY

	JMS	FIT	/SEE IF IT WILL FIT IN CORE AND COMPUTE

			/LOAD ADDRESS AND RELOCATION FACTOR

	JMS PRTPRG		/(RCHM-163) PRINT LOAD MAP.

	DZM	LIBFLG	/CLEAR FLAG SO REST OF PROGRAM WILL BE LOADED

	LAC	RELOC	/CALCULATE TRUE DEFINITION

	TAD	TEMP3

	DAC	TEMP3

	JMP	SLTEPO	/CKECK "R" FLAG ECT

/

DUPGL1	LAC	LIBFLG	/IN LIBRARY MODE

	SNA

	JMP DUPGBL	/NO -- GO FLAG DUPLICATE SYMBOL

	LAC	(600000	/IS THERE A CODE 6 ENTRY IN SYMBOL TABLE

	JMS	SCAN

	JMS	SUTLFL	/YES -- MAKE SURE WE GET ERROR

/

DUPGBL	LAC	SYM1	/FLAG DUPLICATE GLOBAL SYMBOL -- THIS WILL

	DAC	DGSNB	/RESULT IN A TERMINAL ERROR IF THE ROUTINE 

	LAC	SYM2	/IS RELOCATED.

	DAC	DGSNB+1

	JMP	BUFCHK

/

	.EJECT

/ RESOLVE THE VIRTUAL GLOBAL ENTRY IN THE SYMBOL TABLE BY FOLLOWING THE

/ CHAIN (OF TRANSFER VECTORS POINTING TO OTHER TRANSFER VECTORS) AND

/ REPLACING EACH LINK WITH THE REAL DEFINITION.

 

RESOLVE	LAC*	SYMWD1	/SAVE TRANSFER VERTOR POINTER AND MAKE

	AND	(077777)	/DEFINITION ENTRY IN SYMBOL TABLE

	DAC	TEMP1

	LAC	SYMDEF

	DAC*	SYMWD1

	AND	(077777)	/SAVE 15-BIT DEFINITION

	DAC	TEMP3

/

RVPRS1	LAC	PTBBSE	/FOLLOW CHAIN OF TRANSFER VECTORS

	DAC	PTBX2	/(IN PATCH TABLE) REPLACING POINTERS

RVPRS2	LAC*	PTBX2

	SAD	TEMP1

	JMP	.+4

	ISZ	PTBX2

	ISZ	PTBX2

	JMP	RVPRS2

	ISZ	PTBX2

	LAC*	PTBX2

	DAC	TEMP2

	LAC	TEMP3

	DAC*	PTBX2

	LAC	TEMP2

	SAD	TEMP1

	JMP	BUFCHK

	DAC	TEMP1

	JMP	RVPRS1

/ CODE 11 PROCESSOR: BLOCK DATA SUBPROGRAM DECLARATOR.

CODE11	CMA!IAC			/(RCHM-167)

	DAC BLKDSW		/(RCHM-163) SET UP BLOCK DATA SWITCH.

	JMP BUFCHK	/SETS THE FLAG NON-ZERO.

 

	.TITLE *** CODE12 - COMMON BLOCK DEFINITION PROCESSOR.

/

/ IF BLOCK DATA FLAG IS SET THEN THIS ROUTINE DISPATCHES TO THE CORAL COMMON

/ BLOCK DEFINITION CODE. ALL BLOCKS WILL BE HANDLED IN EXACTLY THE SAME FASHION.

/

CODE12	DAC TEMP1		/(RCHM-163) SAVE IN CASE WE HAVE TO BUILD NEW HEADER.

	CMA!IAC			/(RCHM-163) MAKE SIZE NEGATIVE.

	DAC TEMP2		/(RCHM-163) SAVE FOR SIZE TESTS.

	LAC BLKDSW		/(RCHM-163) GOING TO DEFINE THE NEW BLOCK?

	SZA			/(RCHM-163)

	JMP CD1228		/(RCHM-163) GO ENTER CODE28.

	LAC (300000)		/(RCHM-163) FETCH SCANNER CODE.

	JMS SCAN		/(RCHM-163) SCAN SYMBOL TABLE FOR COMMON BLOCK.

	SKP			/(RCHM-163) COMMON BLOCK FOUND.

	JMP CD12.1		/(RCHM-163) GO MAKE NEW COMMON ENTRY.

/

/ THE COMMON BLOCK HAS BEEN LOCATED IN THE SYMBLO TABLE. CHECK TO SEE IF IT

/ IS A DEFINED COMMON.

/

	DAC TEMP3		/(RCHM-163) CHECK FOR SIZE CHANGES LATER.

	LAC* SYMWD1		/(RCHM-165) FETCH BLOCK TYPE.

	AND (700000)		/(RCHM-163) CHECK FOR DEFINED/UNDEFINED.

	SAD (700000)		/(RCHM-163) IS IT UNDEFINED?

	JMP CD12.2		/(RCHM-163) YES.

/

/ DEFINED COMMON BLOCK HAS BEEN RETRIEVED. MAKE SURE THE NEW DEFINITION IS

/ NO BIGGER THAN THE OLD ONE.

/ AND SET UP COMCHN AND COMDEF FOR ANY PECULIAR PROCESSING WHICH CAN HAPPEN.

/ OUR WAY.

/

	JMS CD12.3		/(RCHM-163) CHECK FOR SIZE DIFFERENCE 

	JMP LCBSZE		/(RCHM-163) COMMON BLOCK SIZE DIFFERENCE.

	LAC SYMPTR		/(RCHM-163) FETCH ADDRESS BEFORE POINTERS.

	AAC -1			/(RCHM-169) POINT TO COMCHN.

	JMS CD12.4		/(RCHM-163) DEFIN COMCHN AND COMDEF.

	JMP BUFCHK		/(RCHM-163) GO GET NEXT LOADER CODE.

/

/ REGULAR COMMON NOT IN SYMBLO TABLE.

/

CD12.1	LAC TEMP1		/(RCHM-163) FETCH COMMON BLOCK SIZE

	AND (700000)		/(RCHM-163) CHECK RANGE.

	SZA			/(RCHM-163) CAN'T BE BIGGER THAN 32K.

	JMP CD28E4		/(RCHM-163) GO TO ERROR ROUTINE.

	LAC TEMP1		/(RCHM-163) PREPARE HEADER FOR SYMBLO TABLE ENTRY.

	XOR (700000)		/(RCHM-163) SET UP NEW UNDEFINED COMMON BLOCK.

	DAC SYMDEF		/(RCHM-163) SET UP CALL TO DEFSYM.

	JMS DEFSYM		/(RCHM-163) DEFIN NEW COMMON BLOCK.

	LAC SYMEND		/(RCHM-163) SET UP COMCHN AND COMDEF.

	JMS CD12.4		/(RCHM-163)

	DZM* SYMEND		/(RCHM-163) CLEAR COMMON CHAIN.

	JMS UPSYM		/(RCHM-163) MOVE END OF TABLE.

	DZM* SYMEND		/(RCHM-163) CLEAR LOAD ADDRESS.

	JMS UPSYM		/(RCHM-163) FINAL ADJUSTMENT OF BOTTOM.

	JMP BUFCHK		/(RCHM-163) FETCH NEXT    LOADER CODE.

/

/ STANDARD UNDEFINED COMMON BLOCK FOUND. UPDATE THE SIZE IF NECESSARY AND QUIT.

/

CD12.2	LAC SYMPTR		/(RCHM-163) FETCH CYMPTR.

	AAC -1			/(RCHM-165) AND DEFINE COMCHN AND COMDEF.

	JMS CD12.4		/(RCHM-163)

	JMS CD12.3		/(RCHM-163) CHECK SIZE.

	SKP			/(RCHM-163) NEW COMMON IS BIGGER.

	JMP BUFCHK		/(RCHM-163) FETCH NEXT LOADER CODE.

	LAC (700000)		/(RCHM-163) FETCH UNDEFINED COMMON CODE.

	XOR TEMP1		/(RCHM-163) FETCH NEW SIZE.

	DAC* SYMWD1		/(RCHM-163) UPDATE SYMBOL TABLE

	JMP BUFCHK		/(RCHM-163) GO GET NEXT LOADER CODE.

/

/ ROUTINE TO CHECK COMMON BLOCK SIZES AND SKIP A LOCATION IF NOE IS SMALLER.

/

CD12.3	XX			/(RCHM-163) ROUTINE ENTRY POINT.

	LAC TEMP1		/(RCHM-163) CHECK FOR VALID SIZE.

	AND (700000)		/(RCHM-163)

	SZA			/(RCHM-163)

	JMP CD28E4		/(RCHM-163) GIVE ERROR.

	LAC TEMP3		/(RCHM-163) FETCH OLD BLOCK SIZE.

	AND (77777)		/(RCHM-163) STRIP OUT SIZE.

	TAD TEMP2		/(RCHM-163) SUBTRACT NEW SIZE.

	SMA			/(RCHM-163) NEW ONE BIGGER?

	ISZ CD12.3		/(RCHM-163) NO.

	JMP* CD12.3		/(RCHM-163) RETURN TO USER.

/

/ ROUTINE TO DEFINE COMCHN AND COMDEF.

/

CD12.4	XX			/(RCHM-163) ROUTINE ENTRY POINT.

	DAC COMCHN		/(RCHM-163) INITIALIZE COMMON BLOCK CHAIN POINTER.

	AAC -1			/(RCHM-163) CALCULATE COMMON DEFINITION.

	DAC COMDEF		/(RCHM-163) INITIALIZE COMMON DEFINITION.

	JMP* CD12.4		/(RCHM-163) RETURN TO  CALLER.

/

/ LABELED COMMON BLOCK SIZE ERROR

/
LCBSZE	DZM EXT			/(RCHM-179) CLEAR EXTENSION, JUST IN CASE.
	JMS ERROR4		/(RCHM-179) PRINT ERROR.
	MES707			/(RCHM-158)
/ ***	ERROR4 DOES NOT RETURN   *** /
COD12E	DZM EXT			/(RCHM-179) CLEAR EXTENSION, JUST IN CASE.
	JMS ERROR4		/(RCHM-179) PRINT ERROR.
	MES722			/(RCHM-158) ILLEGAL ATTEMPT AT INIT.
/ ***	ERROR4 DOES NOT RETURN   *** /

/ CODE 13 PROCESSOR: COMMON SYMBOL DEFINITION (ADDRESS RELATIVE TO THE

/ START OF THE COMMON BLOCK). USE SAME CODE AS CODE8.

/ (RELATIVE ADDRESS TO SYM2)

 

 

/ CODE 14 PROCESSOR: COMMON SYMBOL REFERENCE DEFINITION (UNRELOCATED

/ ADDRESS OF THE TRANSFER VECTOR).

 

CODE14	TAD RELOC		/ADD THE RELOCATION FACTOR TO

	AND	(077777)	/POINT TO WHERE THE TV IS NOW

	DAC	PTBW1	/SAVE TV ADR FOR POSSIBLE PATCH TBL ENTRY

	XOR	(400000)	/SAVE TV ADR FOR POSSIBLE SYMBOL TBL ENTRY

	DAC	SYM1

	LAC* COMDEF	/0 OR THE BLOCK'S BASE ADDRESS.

	TAD SYM2		/COMMON SYMBOL'S RELATIVE POSITION.

	DAC	PTBW2	/SAVE TV FOR POSSIBLE PATCH TBL ENTRY

	DAC	SYM2	/SAVE REL POS FOR POSSIBLE SYMBOL TBL ENTRY

	LAC* COMDEF	/IS THE BLOCK DEFINED?

	SZA

	JMP	CDE14A	/YES -- MAKE PATCH TABLE ENTRY

 

/ BLOCK IS NOT DEFINED. MAKE AN ENTRY IN THE SYMBOL TABLE AND INSERT

/ THE ENTRY IN THE COMMON CHAIN.

 

	LAC* COMCHN	/POINTER TO 1ST LINK IN CHAIN.

	TAD (400000	/TACK ON CODE 4.

	DAC SYMDEF

	LAC SYMEND	/END OF SYMBOL TABLE IS WHERE THE 1ST

			/WORD OF THIS ENTRY WILL GO.

	DAC* COMCHN	/MAKE THE NEW ENTRY BECOME THE 1ST LINK.

	JMS	DEFSYM	/MAKE 3-WORD ENTRY IN THE SYMBOL TABLE.

	JMP	BUFCHK

/

CDE14A	JMS	PTBENT	/MAKE PATCH TABLE ENTRY (CODE=0) FOR

	JMP	BUFCHK	/A REFERENCE TO A DEFINED COMMON BLOCK.

 

/ CODE 15 PROCESSOR: DATA INITIALIZATION CONSTANT (1ST WORD).

 

CODE15	DAC DATA1

	JMP BUFCHK

 

 

/ CODE 16 PROCESSOR: DATA INITIALIZATION CONSTANT (2ND WORD).

 

CODE16	DAC DATA2

	JMP BUFCHK

 

	.EJECT

/ CODE 17 PROCESSOR: DATA INITIALIZATION CONSTANT (3RD WORD).

 

CODE17	DAC DATA3

	JMP BUFCHK

 

 

/ CODE 18 PROCESSOR: DATA INITIALIZATION CONSTANT DEFINITION. 

/  BITS 1-2 INDICATE DATA TYPE (NUMBER OF WORDS) AND BITS 3-17 CONTAIN

/  THE LOCATION OF THE FIRST WORD OF THE CONSTANT RELATIVE TO THE

/  LOAD ADDRESS OF OF THE ROUTINE (RELOC) OR, IF BLOCK DATA, RELATIVE

/  TO THE BASE OF THE LAST COMMON BLOCK DEFINED (* COMDEF)

CODE18	DAC TEMP1		/SAVE DATA WORD.

	LAC BLKDSW		/(RCHM-163) BLOCK DATA BEING PROCESSED?

	SNA

	JMP	.+4

	LAC*	COMDEF

	AND	(077777)

	SKP

	LAC	RELOC

	TAD	TEMP1

	DAC	TEMP1	/DETERMINE 2S COMPLIMENT OF NUMBER

	RTL		/OF WORDS TO BE STORED FROM CODE BITS

	RTL		/IN THE ADDRESS WORD

	AND	(003)

	CMA

	SAD	(-4)

	LAW	-1

	DAC	TEMP10

	LAC	(DATA1)	/(RCHM-156)

	DAC	TEMP11

	LAC*	TEMP11

	DAC	ROPWB

	LAC	TEMP1

	JMS	ROP

	ISZ	TEMP1

	ISZ	TEMP11

	ISZ	TEMP10

	JMP	.-7

	JMP BUFCHK

 

	.EJECT

/ CODE 19 PROCESSOR: INTERNAL SYMBOL OR PROGRAM NAME

/

CODE19	AND	(400000)	/IGNORE INTERNAL SYMBOL

	SNA

	JMP	BUFCHK

	LAC BLKDSW		/(RCHM-166) BLOCK DATA SWITCH ON?

	SZA			/(RCHM-166) 0 => NO.

	JMP CD19.1		/(RCHM-163) YES.

	LAC SYM1		/(RCHM-163)

	DAC PRG1		/(RCHM-163)

	LAC SYM2		/(RCHM-163)

	DAC PRG2		/(RCHM-163)

	LAC	GMFLAG	/IGNORE  PROG NAME IF GLOBAL MAP FLAG

	SNA		/IS SET, OTHERWISE, SET NAME IN 

	JMS PRTPRG		/(RCHM-163) PRINT NAME.

	JMP	BUFCHK

/

CD19.1	LAC MAPBUF		/(RCHM-163) FETCH CURRENT MAP LENGTH

	DAC TEMP1		/(RCHM-163) SAVE MAP LENGTH

	LAC LMFLAG		/(RCHM-163) SEE IF MAP TO BE PRINTED.

	SNA			/(RCHM-163) NON-ZERO IF YES.

	JMP BUFCHK		/(RCHM-163) NO MAP, ALL DONE.

	JMS TYPE		/(RCHM-163) PRINT BLOCK DATA MESSAGE.

	MES726			/(RCHM-163)

	JMS SYMMAP		/(RCHM-163) EXPAND PROGRAM NAME.

	JMS SHTMAP		/(RCHM-163) SHORTEN MAP AND INSERT CR/LF.

	JMS TYPMAP		/(RCHM-163) PRINT MAP.

	LAC TEMP1		/(RCHM-163) FETCH PREVIOUS MAP LENGTH.

	DAC MAPBUF		/(RCHM-163) RESTORE MAP LENGTH.

	LAC (040)		/(RCHM-166) RESTORE BLANKS TO MAP BUFFER.

	DAC MAPFAD-1		/(RCHM-166)

	DAC MAPFAD		/(RCHM-166)

	JMP BUFCHK		/(RCHM-163) GO GET NEXT LOADER CODE.

	.EJECT

/ CODE 20 PROCESSOR: STRING CODE (FIRST HALF) - UNRELOCATED POINTER

/ TO AN INSTRUCTION WHOSE ADDRESS PART IS TO BE REPLACED (CODE 21).

 

CODE20	TAD RELOC		/ADD RELOCATION FACTOR.

	DAC STRING	/SAVE POINTER TO THE INSTRUCTION.

	JMP BUFCHK

 

/ CODE 21 PROCESSOR: STRING CODE (SECOND HALF) - UNRELOCATED ADDRESS

/ WHICH IS TO REPLACE THE ADDRESS PART OF AN INSTRUCTION (SEE CODE 20).

 

CODE21	TAD	RELOC	/MAKE PATCH TABLE ENTRY FOR

	AND	ADRMSK	/STRING CODE MODIFICATION

	DAC	PTBW2

	LAC	STRING

	XOR	(100000)

	DAC	PTBW1

	JMS	PTBENT

	JMP BUFCHK

 

/ CODE 22 -- .IODEV REQUESTS

/

CODE22	SPA	/FLAG .DAT+0 TO INDICATE ".IODEV ALL" 

	CLA

	TAD	(777400)

	XOR	(777400)

	DAC	TEMP1

	.DEC

	AAC +18			/(RCHM-158) ACCEPTABLE RANGE:  -19<.DAT>+72

	SPA		/IGNORE OUT OF RANGE .DAT SLOT NOS.

	JMP	BUFCHK

	AAC -90			/(RCHM-158)

	SMA

	JMP	BUFCHK

	LAC	(DATMAP)	/(RCHM-156) SET POINTER TO DATMAP TABLE

	DAC	TEMP2

	LAC	TEMP1	/GET DAT SLOT #

CDE22A	SPA		/IF POS MAKE IT NEG

	JMP	CDE22B	/SET SHIFT COUNT

	AAC -18			/(RCHM-158) MOVE DOWN DATMAP TABLE

	.OCT

	ISZ	TEMP2	/UNTIL AC IS NEG.

	JMP	CDE22A

CDE22B	DAC	TEMP3	/AC IS NEG - SET SHIFT COUNT

	CLA!STL		/SET SHIFT BIT IN LINK

CDE22C	RAL		/START SHIFTING BIT INTO POSITION

	ISZ	TEMP3

	JMP	CDE22C

	DAC	TEMP3	/STORE FINAL POSITION OF BIT

	CMA

	AND*	TEMP2	/AND SET THAT BIT IN THE

	XOR	TEMP3	/DATMAP TABLE WORD POINTED TO BY TEMP2

	DAC*	TEMP2

	JMP	BUFCHK

/

/ CODE 23 PROCESSOR: END OF PROGRAM UNIT (PROGRAM START ADDRESS).

 

CODE23	DZM BLKDSW		/(RCHM-163) TURN OFF BLOCKDATA SUBPROGRAM FLAG

	DZM BLKFLG		/(RCHM-163) TURN OFF COMMON BLOCK FLAG ON GENERAL PRINCIPLES.

	DAC	TEMP1	/SAVE ENTRY POINT IN TEMP1

	LAC (SKP)		/(RCHM-163) REARM SKIP ON FIRST 01 LOADER CODE

	DAC SK.F01		/(RCHM-156) SWITCH.

	LAC	AMREST	/RESTORE RELOCATION MODE MASKS

	DAC	ADRMSK

	CMA

	DAC	OPCMSK

	LAC	LIBFLG	/WAS A ROUTINE RELOCATED?

	SZA

	JMP	CDE23A	/NO -- DELETE ANY SYM TAB ENTRIES MADE

	LAC	MAINEP	/YES -- HAS AN ENTRY POINT BEEN RECORDED?

	SMA

	JMP	CDE23E	/YES -- IGNORE ROUTINE ENTRY POINT

	LAC	TEMP1	/NO -- USE ROUTINE ENTRY POINT AS ENTRY TO

	TAD	RELOC	/OVERLAY SYSTEM

	AND	(77777)

	DAC	MAINEP

CDE23E	DZM EXT			/(RCHM-163) CLEAR EXTENSION FOR NEXT TIME.

	LAC	DGSNB	/WERE THERE ANY DUPL GLOBAL SYMBOL

	SZA		/NAMES DURING THIS ROUTINE?

	JMP	CDE23B	/YES -- TERMINAL ERROR

	LAC	SDPTR	/RELOCATION FROM A LIBRARY?

	SAD	(SKDATA)	/(RCHM-156)

	JMP	NXUN	/NO -- RELOCATE THRU EOF

	JMP*	LDPROG	/YES -- EXIT LDPROG

/

CDE23A	LAC	SYMEB2	/ROUTINE NOT LOADED, RESTORE SYMEND TO

	DAC	SYMEND	/VALUE BEFORE THIS ROUTINE WAS ENCOUNTERED

	JMP*	LDPROG

/

CDE23B	LAC	DGSNB	/EXIT TO MONITOR

	DAC	SYM1

	LAC	DGSNB+1

	DAC	SYM2

	JMS	ERROR4		/(RCHM-158) DUPLICATE GLOBALS FOUND -- TYPE

	MES721		/NAME OF LAST DUPLICATE FOUND AND

/ ***	ERROR4 DOES NOT RETURN  *** /

/

/ CODE 25 -- SET BANK RELOCATION (FOR GRAPHICS PACKAGE)

/ CODE 26 -- SET PAGE RELOCATION (FOR GRAPHICS PACKAGE)

/

CODE25	LAC	(17777)

	SKP

CODE26	LAC	(07777)

	DAC	ADRMSK

	CMA

	DAC	OPCMSK

	JMP	BUFCHK

/

CODE27	DAC EXT			/(RCHM-163) SET UP EXTENSION NAME.

	JMP BUFCHK		/(RCHM-163) GO GET NEXT LOADER CODE.

	.TITLE *** CORAL COMMON BLOCK INITIALIZATION PROCESSOR.

/

/	LOADER CODE SEQUENCE FOR USING THE CORAL COMMON INITIALIZATION

/	PROCESSOR.

/

/	07		BLOCK NAME (NON-ZERO)

/	10		BLOCK NAME (OPTIONAL)

/	01		BLOCK SIZE (OPTIONAL)

/	34		ENTER INITIALIZATION MODE

/	.

/

/	.

/	.

/	07		BLOCK NAME (0)

/	34		LEAVE INITIALIZATION MODE

/

/

/ ENTRY POINT IN CASE BLOCK DATA IS ON AND A COMMON BLOCK IS PROCESSED.

/
CD1228	LAC TEMP2		/(RCHM-163) FETCH SIZE OF COMMON BLOCK (NEGATIVE)

	DAC CBSIZE		/(RCHM-163) SET UP CODE PROPERLY.
	JMP CD28.0		/(RCHM-175) ENTER CODE PROPERLY.

CODE28	LAC SYM1		/(RCHM-163) FETCH NAME OF SYMBOL

	SNA			/(RCHM-163) AC '= 0 => ABOUT TO ENTER COMMON

				/(RCHM-163) INITIALIZATION MODE.

	JMP CD28.7		/(RCHM-163) CLEAN UP CONTEXT.

	SAD (.XX)		/(RCHM-163) CHECK FOR BLANK COMMON.

	JMP COD12E		/(RCHM-163) BLANK COMMON CANNOT BE INITIALIZED.
CD28.0	JMS NCL.SC		/(RCHM-175) CHECK THE NCL LIST.

	JMP CD28.1		/(RCHM-163) NOT FOUND, CONTINUE.

	ISZ NCL.PT		/(RCHM-163) FETCH RES SWITCH.

	LAC* NCL.PT		/(RCHM-163) BECAUSE IF IT IS ON, TOO BAD.

	SPA			/(RCHM-163) RES ON FOR THIS COMMON?

	JMP COD12E		/(RCHM-163) YES, ERROR.

CD28.1	LAC SIZE		/(RCHM-163) SAVE CURRENT CONTEXT.

	DAC SAV.SZ		/(RCHM-163)

	LAC LOADADR		/(RCHM-163)

	DAC SAV.LD		/(RCHM-163)

	LAC RELOC		/(RCHM-163)

	DAC SAV.RL		/(RCHM-163)

	LAC BLKDSW		/(RCHM-163)

	DAC SAV.BD		/(RCHM-163)

	LAC (300000)		/(RCHM-163) SCAN SYMTAB FOR COMMON BLOCKS.

	JMS SCAN		/(RCHM-163)

	SKP			/(RCHM-163) FOUND

	JMP CD28.6		/(RCHM-163) NOT IN SYMBOL TABLE.

	DAC TEMP1		/(RCHM-163) SAVE COMMON BLOCK SIZE.

	LAC SYMEB1		/(RCHM-163) CHECK TO SEE IF COMMON BLOCK IS IN

	CMA!IAC			/(RCHM-163) RESIDENT CODE AREA (PERHAPS BECAUSE OF

	TAD SYMWD1		/(RCHM-163) SAC SWITCH).

	SMA!SZA			/(RCHM-163) COMMON ASSOCIATED WITH RESIDENT CODE?

	JMP COD12E		/(RCHM-163) YES, GO GIVE ERROR.

/

/ THE COMMON BLOCK TO BE INITIALIZED IS SO FAR:

/

/ 1.	NOT BLANK COMMON.

/ 2.	NOT IN THE NAMED COMMON LIST (NCL)

/ 3.	NOT ASSOCIATED WITH RESIDENT CODE, I.E. VIA EITHER THE SAC

/	SWITCH OR THE RES SWITCH.

/

	LAC* SYMWD1		/(RCHM-163) IF DEFINED THEN WE MAY WISH TO CHECK

	AND (700000)		/(RCHM-163) THE COMMON SIZES AGAINST EXPECTED

	SAD (700000)		/(RCHM-163) SIZES. COMMON ALREADY DEFINED?

	JMP CD28.4		/(RCHM-163) NOT YET.

/

/ THE COMMON BLOCK IS NOW KNOWN TO BE PREVIOUSLY DEFINED WITHIN THIS

/ LINK. WE MUST NOW CHECK AND SET UP THE VARIOUS SIZES AND POINTERS

/ REQUIRED FOR THE PROPER HANDLING OF CODE '02' AND '04' AND '05'.

/

	LAC CBSIZE		/(RCHM-163) DID A '01' CODE APPEAR FOR THIS COMMON

	SNA			/(RCHM-163)

	JMP CD28.2		/(RCHM-163) NO.

	TAD TEMP1		/(RCHM-163) ADD IN DEFINED COMMON SIZE.

	SPA			/(RCHM-163) IS THE NEW EXPECTED SIZE BIGGER?

	JMP LCBSZE		/(RCHM-163) YES, GO GIVE ERROR.

	JMP CD28.3		/(RCHM-163) NO, GO PICK UP RELOCATABLE ADDRESSES.

CD28.2	LAC TEMP1		/(RCHM-163) FETCH SIZE OF COMMON BLOCK.

	CMA!IAC			/(RCHM-163) CONVERT TO NEGATIVE NUMBER AS FROM

				/(RCHM-163) CODE '01' PROCESSING.

	DAC CBSIZE		/(RCHM-163) SET UP COMMON BLOCK SIZE.
CD28.3	JMS DECSPT		/(RCHM-163) MOVE POINTER TO COMMON CHAIN

	LAC SYMPTR		/(RCHM-163) FETCH POINTER TO COMCHN.

	JMS CD12.4		/(RCHM-163) SET UP IN CASE OF BLOCK DATA.

	JMS DECSPT		/(RCHM-163) MOVE POINTER TO LOAD ADDRESS.

	LAC* SYMPTR		/(RCHM-163) FETCH LOAD ADDRESS.

	DAC LOADADR		/(RCHM-163) SET UP LOAD ADDRESS
	DAC RELOC		/(RCHM-163) AND RELOCATION FACTOR.
	LAC CBSIZE		/(RCHM-177) SET UP SIZE FOR 02 AND 04 PROCESSING.
	DAC SIZE		/(RCHM-177)
	JMP BUFCHK		/(RCHM-163) GO GET NEXT LOADER CODE.

/

/ STANDARD UNDEFINED COMMON. SEEN PREVIOUSLY BUT NOT FITTED INTO CORE.

/

CD28.4	LAC CBSIZE		/(RCHM-163) CHECK FOR DEFINED COMMON BLOCK SIZE.

	SNA			/(RCHM-163) CHECK FOR UNSPECIFIED COMMON SIZE.

	LAW -1			/(RCHM-163) DEFAULT SIZE IS -1

	DAC CBSIZE		/(RCHM-163) UPDATE SIZE.

	TAD TEMP1		/(RCHM-163) CHECK AGAINST SIZE LISTED IN TABLE.

	SMA			/(RCHM-163) IS THIS BLOCK BIGGER?

	JMP CD28.5		/(RCHM-163) NO, USE SIZE FROM TABLE.

	LAC CBSIZE		/(RCHM-163) FETCH BLOCK SIZE.

	CMA!IAC			/(RCHM-163) MAKE POSITIVE.

	DAC TEMP1		/(RCHM-163) SAVE FOR LATER.

	AND (700000)		/(RCHM-163) CHECK FOR LENGTH VIOLATION.

	SZA			/(RCHM-163) CAN'T DEFINE BLOCK BIGGER THAN 32K-1.

	JMP CD28E4		/(RCHM-163) BLOCK SIZE ERROR.

	LAC TEMP1		/(RCHM-163) FETCH SIZE.

	XOR (700000)		/(RCHM-163) SET COMMON FLAG.

	DAC* SYMWD1		/(RCHM-163) SET UP NEW SIZE.

CD28.5	LAC* SYMWD1		/(RCHM-163) FETCH COMMON FLAG AND SIZE.

	AND (377777)		/(RCHM-163) MAKE IT A DEFINED COMMON BLOCK.

	DAC* SYMWD1		/(RCHM-163) SET UP NEW COMMON FLAG.

	AND (77777)		/(RCHM-163) STRIP OUT SIZE.

	CMA!IAC			/(RCHM-163) MAKE NEGATIVE.

	DAC CBSIZE		/(RCHM-163) SET UP CBSIZE.

	JMS RV.SET		/(RCHM-163) SET UP VTC AND RES SWTICHES.

	JMS RES.OFF		/(RCHM-163) TURN OFF RES.

	LAC CBSIZE		/(RCHM-163) FETCH COMMON SIZE

	DAC SIZE		/(RCHM-163) SET UP SIZE

	DAC BLKFLG		/(RCHM-163) SET UP BLK FLAG.

	DAC BLKDSW		/(RCHM-163) NOT BLOCK DATA.

	JMS FIT			/(RCHM-163) FIT BLOCK.

	JMS PRTPRG		/(RCHM-163) PRINT BLOCK NAME.

	JMS DECSPT		/(RCHM-163) MOVE POINTER TO COMMON CHAIN.

	LAC SYMPTR		/(RCHM-163) SET UP COMCHN IN CASE BLOCK DATA.

	JMS CD12.4		/(RCHM-163)

	JMS DECSPT		/(RCHM-163) MOVE POINTER TO LOAD ADDRESS.

	LAC LOADADR		/(RCHM-163) FETCH LOAD ADDRESS.

	DAC* SYMPTR		/(RCHM-163) SET UP LOAD ADDRESS.

/

/ NO GO OFF AND DEFINE ALL COMMON CHAINS IN THIS ELEMENT.

/

	ISZ SYMPTR		/(RCHM-163) PREPARE TO RESOLVE CHAIN ENTRIES.

	JMS DEFCOM		/(RCHM-163) DEFINE ANY AND ALL CHAINED ELEMENTS.

	JMP BUFCHK		/(RCHM-163) GET NEXT LOADER CODE.

/

/ BRAND NEW COMMON BLOCK HAS BEEN ENTERED. SET UP AN ENTRY IN THE SYMBOL

/ TABLE AND GO DEFINE IT THROUGH THE PREVIOUS CODE.

/

CD28.6	LAC CBSIZE		/(RCHM-163) MAKE SURE CBSIZE IS OK.

	SNA!CMA!IAC		/(RCHM-163) CONVERT BACK TO POSITIVE NUMBER

	CLA!IAC			/(RCHM-163) DEFAULT BLOCK SIZE IS 1.

	DAC TEMP1		/(RCHM-163) SET UP FOR ABOVE.

	DAC SYMDEF		/(RCHM-163) BEGIN SETTING UP SYMBOL HEADER

	AND (700000)		/(RCHM-163) CHECK FOR BLOCK TOO BIG.

	SZA			/(RCHM-163) THIS HAD BETTER BE 0.

	JMP CD28E4		/(RCHM-163) BLOCK SIZE ERROR.

	LAC SYMDEF		/(RCHM-163) FETCH BLOCK SIZE

	XOR (700000)		/(RCHM-163) SET UNDEFINED.

	DAC SYMDEF		/(RCHM-163) SET UP SYMBOL HEADER.

	LAC SYMEND		/(RCHM-163) SET UP POINTER TO ENTRY START.

	DAC SYMWD1		/(RCHM-163)

	JMS DEFSYM		/(RCHM-163) DEFINE NEW COMMON BLOCK.

	DZM* SYMEND		/(RCHM-163) START COMMON CHAIN.

	JMS UPSYM		/(RCHM-163) MOVE TABLE BOTTOM.

	DZM* SYMEND		/(RCHM-163) CLEAR LOAD ADDRESS.

	JMS UPSYM		/(RCHM-163) MOVE TABLE BOTTOM

	LAC SYMEND		/(RCHM-163) FETCH END OF TABLE.

	AAC 3			/(RCHM-163) POINT TO END OF BLOCK NAME.

	DAC SYMPTR		/(RCHM-163) PRETEND JUST CALLED SCAN.

	JMP CD28.4		/(RCHM-163) GO DEFINE BLOCK.

/

/ RESTORE PREVIOUS CONTEXT.

/

CD28.7	LAC SAV.SZ		/(RCHM-163)

	DAC SIZE		/(RCHM-163)

	LAC SAV.LD		/(RCHM-163)

	DAC LOADADR		/(RCHM-163)

	LAC SAV.RL		/(RCHM-163)

	DAC RELOC		/(RCHM-163)

	LAC SAV.BD		/(RCHM-163)

	DAC BLKDSW		/(RCHM-163)

	JMP BUFCHK		/(RCHM-163)

/

/ ATTEMPT TO DEFINE COMMON BLOCK BIGGER THAN 32K.

/

CD28E4	JMS ERROR4		/(RCHM-163) PRINT ERROR MESSAGE.

	MES727			/(RCHM-163) COMMON BLOCK TOO BIG.

/ ***	ERROR4 CODES NOT RETURN   *** /

	.TITLE *** FIT ROUTINE - TOP DOWN LOADING

/

/ FIND A BLOCK OF CORE INTO WHICH THE CURRENT ITEM (SIZE OF ITEM		/(RCHM-158)

/ IS IN "SIZE") CAN FIT INTO. ALL HOLES ARE CHECKED PRIOR TO ALLOCATION		/(RCHM-158)

/ OF NEW SPACE. COMMON BLOCKS ARE FITTED INTO EXTENDED MEMORY WHENEVER		/(RCHM-158)

/ POSSIBLE. ALLOCATION OF MEMORY INTO EXTENDED MEMORY AND INTO LOW		/(RCHM-158)

/ IS DETERMINED IN THE FOLLOWING MANNER:					/(RCHM-158)

/										/(RCHM-158)

/ 1.	IF BLKDSW IS SET (NON-ZERO) DATA IS ALLOCATED IN LOW MEMORY.		/(RCHM-158)

/ 2.	IF BLKFLG IS NOT SET (ZERO) DATA IS ALLOCATED IN LOW MEMORY.		/(RCHM-158)

/ 3.	IF SIF.EM IS NOT SET (NOP) DATA IS ALLOCATED IN LOW MEMORY.		/(RCHM-158)

/ 4.	IF SIF.AM IS NOT SET (NOP) DATA IS ALLOCATED IN LOW MEMORY.		/(RCHM-158)

/										/(RCHM-158)

/ TO ALLOCATE CORE IN EXTENDED MEMORY, THE FOLLOWING THINGS MUST BE		/(RCHM-158)

/ TRUE:										/(RCHM-158)

/										/(RCHM-158)

/ 1.	A COMMON BLOCK IS TO BE ALLOCATED.					/(RCHM-158)

/ 2.	EXTENDED MEMORY MUST BE AVAILABLE.					/(RCHM-158)

/ 3.	THE SIF.AM FLAG MUST BE SET (SKP).					/(RCHM-158)

/ 4.	THE BLOCK DATA SWITCH (BLKDSW) MUST BE CLEARED.				/(RCHM-158)

/										/(RCHM-158)

FIT	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

	XCT SIFTOP		/ CHECK FOR TOP DOWN LOADING.			/(RCHM-158)

	JMP FITBOT		/ FIT FOR BOTTOM UP LOADING.			/(RCHM-158)

/										/(RCHM-158)

/ FIRST CHECK IF A COMMON BLOCK IS BEING ALLOCATED. IF SO, GO CHECK		/(RCHM-158)

/ CONSTRAINTS ON EXTENDED MEMORY.						/(RCHM-158)

/										/(RCHM-158)

	LAC BLKFLG		/ FETCH BLOCK FLAG.				/(RCHM-158)

	SZA			/ DOING A COMMON BLOCK?				/(RCHM-158)

	JMP FITTBL		/ GO FIT COMMON FROM TOP DOWN.			/(RCHM-158)

/										/(RCHM-158)

/ SETUP FOR CODE AND LOW CORE RESIDENT COMMON ALLOCATION.			/(RCHM-158)

/ FIRST CHECK FOR HOLES WHICH CAN ACCOMADATE DATA ITEM.				/(RCHM-158)

/										/(RCHM-158)

FITTCD	LAC (FITLX1)		/ FETCH POINTER TO PROPER HOLE TABLE		/(RCHM-158)

				/ TERMINATOR.					/(RCHM-158)

	DAC HOLEP		/ SAVE FOR USE LATER DURING TERMINATION.	/(RCHM-158)

	LAC (FITLHL)		/ FETCH ADDRESS OF LOW CORE HOLE TABLE		/(RCHM-158)

	JMS FITHOL		/ VTC SET UP WAS PERFORMED BELOW.		/(RCHM-158)

	SAD FITLX1		/ COMPARE INDEX AGAINST LOWER CORE HOLES	/(RCHM-158)

	JMP FITTC1		/ DATA ITEM NOT ALLOCATED, GO TRY		/(RCHM-158)

				/ LOWER CORE.					/(RCHM-158)

/										/(RCHM-158)

/ A FIT HAS OCCURED. UPDATE THE HOLES TABLE AND PROCEED TO CALCULATE		/(RCHM-158)

/ THE RELOCATION AND LOAD ADDRESS CONSTANTS BEFORE RETURNING TO THE USER	/(RCHM-158)

/										/(RCHM-158)

FITTC6	LAC FITTAD		/ FETCH TOP OF DATA ITEM HOLE.			/(RCHM-158)

	TAD SIZE		/ CALCUALTE BOTTOM OF DATA ITEM.		/(RCHM-158)

	DAC FITXTR		/ SAVE NEW BOTTOM TEMPORARILY.			/(RCHM-158)

	XOR FITTAD		/ CHECK TO SEE THAT HOLE HASN'T BEEN		/(RCHM-158)

	AND OPCMSK		/ STRIP OUT HIGH ADDRESS BITS.			/(RCHM-158)

	SZA			/ ENTIRELY FILLED.				/(RCHM-158)

	JMP FITTC2		/ WE HAVE FILLE HOLE, GO UPDATE TABLE.		/(RCHM-158)

	LAC FITXTR		/ FETCH NEW HOLE TOP.				/(RCHM-158)

	DAC* FITX2		/ UPDATE HOLE TABLE.				/(RCHM-158)

/										/(RCHM-158)

/ CALCULATE ALL NECESSARY CONSTANTS FOR THE LOADING PROCESS.			/(RCHM-158)

/										/(RCHM-158)

FITTC3	LAC FITTAD		/ FETCH OLD TOP OF HOLE				/(RCHM-158)

	TAD SIZE		/ SUBTRACT PROGRAM SIZE.			/(RCHM-158)

	AAC 1			/ ADD 1 TO GET THE ADDRESS RIGHT.		/(RCHM-158)

	DAC LOADADR		/ SET UP LOADING ADDRESS AND			/(RCHM-158)

	DAC RELOC		/ RELOCATION FACTOR.				/(RCHM-158)

/										/(RCHM-158)

/ PRINT PRETTY MAP IF DESIRED.							/(RCHM-158)

/										/(RCHM-158)

	DAC SLIMFA		/ STORE STARTING ADDRESS.			/(RCHM-158)

	LAC FITTAD		/ FETCH ENDING ADDRESS.				/(RCHM-158)

	DAC SLIMLA		/ STORE LAST ADDRESS.				/(RCHM-158)

	JMS SLIM		/ PRINT MAP LINE.				/(RCHM-158)

	JMS VTC.OFF		/ TURN VTC SWITCH OFF.				/(RCHM-158)

	JMS RES.OFF		/ TURN RES SWITCH OFF.				/(RCHM-158)

	JMP* FIT		/ FIT DONE, RETURN TO CALLER.			/(RCHM-158)

/										/(RCHM-158)

/ REMOVE HOLE FROM HOLE LIST.							/(RCHM-158)

/										/(RCHM-158)

FITTC2	JMS HOLUPD		/ A HOLE HAS BEEN FILLED, UPDATE PROPER		/(RCHM-158)

	SAD* HOLEP		/ TABLE.					/(RCHM-158)

	DAC* HOLEP		/ SET UP NEW HOLE TERMINATOR.			/(RCHM-158)

	JMP FITTC3		/ GO TERMINATE NICELY.				/(RCHM-158)

/										/(RCHM-158)

/ NO HOLE FITS DATA ITEM. ALLOCATE BELOW CURRENT CODE AND EXIT.			/(RCHM-158)

/										/(RCHM-158)

FITTC1	LAC (CLT)		/ SET UP FOR CALLS TO				/(RCHM-158)

	DAC CLTX2		/ FITTAB (ALLOCATE BLOCKS)			/(RCHM-158)

	LAC FITLX1		/ AND						/(RCHM-158)

	DAC FITX1		/ FITTAC (ALLOCATE CODE)			/(RCHM-158)

	LAC BLKFLG		/ WHICH SHOULD I CALL.				/(RCHM-158)

	SNA			/ FITTAB OR					/(RCHM-158)

	JMP FITTC4		/ FITTAC.					/(RCHM-158)

	LAC LDLMT2		/ FETCH INITIAL GUESS.				/(RCHM-158)

	JMS FITTAB		/ AND FIND A SPOT FOR IT.			/(RCHM-158)

	JMS FITER0		/ NO SPOT, ERROR.				/(RCHM-158)

FITTC5	LAC FITX1		/ RESTORE INITIAL SET UP CONDITIONS.		/(RCHM-158)

	DAC FITLX1		/ RESTORE NEW HOLE POINTER			/(RCHM-158)

	LAC FITTAD		/ UPDATE LDLMT2.				/(RCHM-158)

	TAD SIZE		/ BY THE SIZE OF DATA ITEM.			/(RCHM-158)

	DAC LDLMT2		/ NEW LOAD LIMIT.				/(RCHM-158)

	JMP FITTC3		/ RETURN TO CALLER.				/(RCHM-158)

FITTC4	LAC LDLMT2		/ FETCH INITIAL GUESS				/(RCHM-158)

	JMS FITTAC		/ AND ATTEMPT TO FIT CODE.			/(RCHM-158)

	JMS FITER0		/ NO SPOT, ERROR.				/(RCHM-158)

	JMP FITTC5		/ RETURN.					/(RCHM-158)

/										/(RCHM-158)

/ FIT A COMMON BLOCK OR A BLOCK DATA DECLARATION INTO MEMORY.			/(RCHM-158)

/										/(RCHM-158)

FITTBL	LAC BLKDSW		/ ALLOCATING BLOCK DATA SPACE?			/(RCHM-158)

	SZA			/ NO.						/(RCHM-158)

	JMP FITTCD		/ YES, IGNORE COMMON RESTRICTIONS		/(RCHM-158)

	XCT VTC.ALL		/ SET UP VTC.SW AS THE ONLY VTC DETECTION.	/(RCHM-158)

	SKP			/ NOT ON.					/(RCHM-158)

	JMS VTC.ON		/ TURN ON.					/(RCHM-158)

	LAC (17777)		/ SET UP VTC MASK.				/(RCHM-158)

	XCT VTC.SW		/ VTC ON?					/(RCHM-158)

	SKP			/ NO.						/(RCHM-158)

	DAC AMREST		/ YES, ALWAYS USED BANK ADDRESSING.		/(RCHM-158)

	XCT RES.SW		/ IGNORE SIF.HM IF RES IS ON.			/(RCHM-158)

	SKP			/ NOT ON					/(RCHM-158)

	JMP FITTB1		/ GO PUT IN HIGH MEMORY				/(RCHM-158)

	XCT SIF.HM		/ AM I ALLOWED TO PUT THIS BLOCK IN HIGH	/(RCHM-158)

				/ MEMORY.					/(RCHM-158)

	JMP FITTB2		/ NO.						/(RCHM-158)

FITTB1	XCT SIF.EM		/ IS HIGH MEMORY AVAILABLE.			/(RCHM-158)

	JMP FITTB2		/ NO.						/(RCHM-158)

	LAC (FITHX1)		/ FETCH POINTER TO PROPER HOLE TERMINATOR.	/(RCHM-158)

	DAC HOLEP		/ SET UP FOR FUNNY EXIT.			/(RCHM-158)

	LAC (FITHHL)		/ FETCH START OF HOLE TABLE.			/(RCHM-158)

	JMS FITHOL		/ AND TRY TO FIND A HOLE.			/(RCHM-158)

	SAD FITHX1		/ COMPARE AGAINST PROPER TERMINATOR.		/(RCHM-158)

	SKP			/ HOLE NOT FOUND, TRY ELSEWHERE.		/(RCHM-158)

	JMP FITTC6		/ HOLE FITTED EXIT.				/(RCHM-158)

	LAC (ECLT)		/ SET UP FOR EXTEND CORE ALLOCATION.		/(RCHM-158)

	DAC CLTX2		/ SET UP SUBROUTINE ARGUMENTS.			/(RCHM-158)

	LAC FITHX1		/ SET UP POINTER TO LAST HOLE ENTRY.		/(RCHM-158)

	DAC FITX1		/ SET UP SUBROUTINE ARGUMENTS.			/(RCHM-158)

	LAC ELDLM2		/ FETCH INITIAL GUESS.				/(RCHM-158)

	JMS FITTAB		/ AND GO FIT CORE.				/(RCHM-158)

	JMP FITTB2		/ NO SPACE.					/(RCHM-158)

	LAC FITX1		/ UPDATE HOLE TABLE POINTER.			/(RCHM-158)

	DAC FITHX1		/ FOR NEXT ENTRY.				/(RCHM-158)

	DAC IN.HMS		/(RCHM-160) SET IN HIGH MEMORY SWITCH,

	LAC FITTAD		/ FETCH FIT ADDRESS.				/(RCHM-158)

	TAD SIZE		/ CALCULATE NEW ELDLMT2.			/(RCHM-158)

	DAC ELDLM2		/ NEW TOP ADDRESS.				/(RCHM-158)

	CMA!IAC			/(RCHM-163) MAKE NEGATIVE.

	DAC FITXTR		/(RCHM-163) SAVE FOR A BIT.

	LAC CLT			/(RCHM-163) FETCH BOOT ADDRESS.

	AND OPCMSK		/(RCHM-163) EXTRACK PAGE AND OR BANK BITS.

	TAD ADRMSK		/(RCHM-163) FIGURE OUT TOP OF BOOT.

	TAD FITXTR		/(RCHM-163) HAVE WE OVERFLOWED?

	SPA!SNA			/(RCHM-163) ?

	JMP FITTC3		/ EXIT.						/(RCHM-158)

FITTB2	XCT RES.SW		/ DOES THE BLOCK HAVE TO BE RESIDENT?		/(RCHM-158)

	JMP FITTCD		/ NO.						/(RCHM-158)

	JMS ERROR4		/ PRINT ERROR AND EXIT.				/(RCHM-158)

	MES723			/ ERROR MESSAGE ADDRESS.			/(RCHM-158)

/ ***	ERROR4 DOES NOT RETURN   *** /						/(RCHM-158)

	.EJECT									/(RCHM-158)

/										/(RCHM-158)

/ SUBROUTINE TO ALLOCATE SPACE FOR A COMMON BLOCK FROM AN ARBITRARY		/(RCHM-158)

/ SET OF TABLES.								/(RCHM-158)

/										/(RCHM-158)

/ CALLING SEQUENCE								/(RCHM-158)

/										/(RCHM-158)

/	LAC CLTPTR		/ FETCH CORE LIMITS POINTER.			/(RCHM-158)

/	DAC CLTX2		/ SET UP POINTER TO CLT.			/(RCHM-158)

/	LAC HOLEND		/ FETCH POINTER TO LAST HOLE INDEX		/(RCHM-158)

/	DAC FITX1		/ STORE LAST HOLE INDEX.			/(RCHM-158)

/	LAC CORADD		/ FETCH INITIAL GUESS AT TOP OF LIMIT.		/(RCHM-158)

/	JMS FITTAB		/ GO FIT A BLOCK.				/(RCHM-158)

/	JMP NOCORE		/ RETURNS HERE WHEN CAN'T FIT.			/(RCHM-158)

/	LAC FITX1		/ RESTORE NEW HOLE END POINTER.			/(RCHM-158)

/	DAC HOLEND		/ RESTORE HOLE POINTER.				/(RCHM-158)

/										/(RCHM-158)

/	TOP ADDRESS OF ROUTINE IS CONTAINED IN FITTAB UPON RETURN		/(RCHM-158)

/	FROM THIS ROUTINE.							/(RCHM-158)

/										/(RCHM-158)

FITTAB	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

	XCT VTC.SW		/ SHOULD WE WORRY ABOUT PANK/PAGE BOUNDS	/(RCHM-158)

	SKP			/ NO.						/(RCHM-158)

	JMP FITTA1		/ YES.						/(RCHM-158)

	DAC FITTAD		/ SAVE INITIAL GUESS.				/(RCHM-158)

	TAD SIZE		/ WILL THE CODE FIT?				/(RCHM-158)

	SPA			/ SKIP IF YES.					/(RCHM-158)

	JMP* FITTAB		/ THIS ASSUMES THAT ALL HOLES HAVE BEEN		/(RCHM-158)

				/ SCANNED PRIOR TO THE EXECUTION OF THIS	/(RCHM-158)

				/ CODE.						/(RCHM-158)

FITTA2	ISZ FITTAB		/ SET UP FOR RETURN.				/(RCHM-158)

	JMP* FITTAB		/ RETURN.					/(RCHM-158)

FITTA1	JMS FITTAC		/ FIT THIS COMMON BLOCK AS A PIECE OF		/(RCHM-158)

				/ CODE.						/(RCHM-158)

	JMP* FITTAB		/ NO FIT.					/(RCHM-158)

	JMP FITTA2		/ FIT.						/(RCHM-158)

	.EJECT									/(RCHM-158)

/										/(RCHM-158)

/ ROUTINE TO ALLOCATE SPACE FOR A PIECE OF CODE. ARGUMENTS AS ABOVE		/(RCHM-158)

/ FOR FITTAB.									/(RCHM-158)

/										/(RCHM-158)

FITTAC	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

FITTA5	DAC FITTAD		/ SAVE NEW GUESS.				/(RCHM-158)

	JMS FITX		/ WILL IT FIT?					/(RCHM-158)

	JMP FITTA3		/ YES.						/(RCHM-158)

	LAC FITTAD		/ NO						/(RCHM-158)

	DAC* FITX1		/ LEAVE A HOLE					/(RCHM-158)

	ISZ FITX1		/ INCREMENT LAST HOLE POINTER.			/(RCHM-158)

FITTA4	ISZ CLTX2		/ GET NEXT MEMORY BOUND.			/(RCHM-158)

	LAC* CLTX2		/ FETCH MEMORY BOUND.				/(RCHM-158)

	SPA			/ OUT OF MEMORY?				/(RCHM-158)

	JMP* FITTAC		/ YES.						/(RCHM-158)

	CMA!IAC			/ CALCULATE TO SEE				/(RCHM-158)

	TAD FITTAD		/ IF WE HAVE ARRIVED AT THE			/(RCHM-158)

	SPA!SNA			/ PROPER MEMORY BOUND.				/(RCHM-158)

	JMP FITTA4		/ NO.						/(RCHM-158)

	LAC* CLTX2		/ FETCH NEW MEMORY BOUND.			/(RCHM-158)

	JMP FITTA5		/ GO MAKE NEW TRY.				/(RCHM-158)

FITTA3	ISZ FITTAC		/ SET UP FOR RETURN.				/(RCHM-158)

	JMP* FITTAC		/ RETURN.					/(RCHM-158)

	.EJECT									/(RCHM-158)

/										/(RCHM-158)

/ SUBROUTINE TO FIT DATA IN ARBITRARY HOLE					/(RCHM-158)

/										/(RCHM-158)

/ CALLING SEQUENCE:								/(RCHM-158)

/										/(RCHM-158)

/	LAC HOLPTR		/ FETCH POINTER TO HOLE TABLE.			/(RCHM-158)

/	JMS FITHOL		/ GO FIT HOLE.					/(RCHM-158)

/	SAD ENDHOL		/ INSTRUCTION TO COMPARE AGAINST END		/(RCHM-158)

/				/ OF HOLE TABLE.				/(RCHM-158)

/	XXX			/ RETURN IF DATA NOT ALLOCATED.			/(RCHM-158)

/	YYY			/ RETURN IF DATA ALLOCATED.			/(RCHM-158)

/										/(RCHM-158)

FITHOL	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

	DAC FITX2		/ SET UP POINTER TO HOLE TABLE.			/(RCHM-158)

	LAC BLKFLG		/ SET UP FITXTR FOR FITX.			/(RCHM-158)

	SNA!CLA			/ NO EXTRA NEEDED IF BLOCK DATA.		/(RCHM-158)

	LAW -20			/ 20 CELLS NEEDED TO AVOID AUTO INCR.		/(RCHM-158)

				/ REGISTERS AT THE BOTTOM OF PAGES AND		/(RCHM-158)

				/ BANKS.					/(RCHM-158)

	DAC FITXTR		/ SET UP EXTRA SPACE COUNTER.			/(RCHM-158)

FITH1	LAC FITX2		/ FETCH CURRENT TABLE POINTER.			/(RCHM-158)

	XCT* FITHOL		/ DONE WITH TABLE?				/(RCHM-158)

	JMP FITH3		/ YES, TAKE NOT ALLOCATED EXIT.			/(RCHM-158)

	LAC* FITX2		/ FETCH CURRENT HOLE TOP.			/(RCHM-158)

	JMS FITX		/ WILL DATA ITEM FIT IN HOLE?			/(RCHM-158)

	JMP FITH2		/ YES, GO UPDATE HOLE				/(RCHM-158)

	ISZ FITX2		/ POINT TO NEXT HOLE ENTRY.			/(RCHM-158)

	JMP FITH1		/ GO PROCESS NEXT HOLE ENTRY.			/(RCHM-158)

/										/(RCHM-158)

/ A HOLE WHICH WILL FIT THE DATA ITEM HAS BEEN DETECTED, RETURN TO		/(RCHM-158)

/ THE USER WITH FITX2 POINTING TO THE PROPER HOLE.				/(RCHM-158)

/										/(RCHM-158)

FITH2	ISZ FITHOL		/ INCREMENT TO PROPER RETURN LOCATION.		/(RCHM-158)

FITH3	ISZ FITHOL		/ INCREMENT TO PROPER RETURN LOCATION.		/(RCHM-158)

	JMP* FITHOL		/ RETURN TO USER.				/(RCHM-158)

	.EJECT									/(RCHM-158)

/										/(RCHM-158)

/ ROUTINE TO DETERMINE WHETHER OR NOT A GIVEN DATA ITEM WILL FIT IN		/(RCHM-158)

/ THE CURRENT HOLE. THE HOLE PLACEMENT IS GIVEN BY FITX2.			/(RCHM-158)

/										/(RCHM-158)

/ CALLING SEQUENCE:								/(RCHM-158)

/										/(RCHM-158)

/	LAC HOLPTR		/ FETCH HOLE POINTER.				/(RCHM-158)

/	DAC FITX2		/ SET UP POINTER FOR FITX.			/(RCHM-158)

/	LAC EXTRA		/ RESERVE EXTRA SPACE FOR THIS CODE.		/(RCHM-158)

/	DAC FITXTR		/ SAVE FOR FITX ROUTINE.			/(RCHM-158)

/	.									/(RCHM-158)

/	.									/(RCHM-158)

/	.									/(RCHM-158)

/	LAC* FITX2		/ FETCH HOLE ADDRESS.				/(RCHM-158)

/	JMS FITX		/ DETERMINE IF ITEM FITS.			/(RCHM-158)

/	XXX			/ RETURN IF HOLE FITS.				/(RCHM-158)

/	YYY			/ RETURN IF HOLE DOESN'T FIT.			/(RCHM-158)

/										/(RCHM-158)

/ UPON RETURN FROM FITX, FITTAD IS SET UP WITH THE TOP ADDRESS OF		/(RCHM-158)

/ THE DATA ITEM, I.E. THE ADDRESS CONTAINED IN THE CURRENT HOLE.		/(RCHM-158)

/										/(RCHM-158)

FITX	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

	DAC FITTAD		/ SAVE FOR RETURN FROM CODE.			/(RCHM-158)

	AND AMREST		/ CLEAR BITS FOR BANK/PAGE FITS.		/(RCHM-158)

	AAC 1			/ ADD ONE TO GET OFFSET RIGHT.			/(RCHM-158)

	TAD SIZE		/ SUBTRACT SIZE.				/(RCHM-158)

	TAD FITXTR		/ AND ANY EXTRA THAT MAY BE NECESSARY.		/(RCHM-158)

	SPA			/ DOES ITEM FIT IN HOLE?			/(RCHM-158)

	ISZ FITX		/ NO, INCREMENT RETURN.				/(RCHM-158)

	JMP* FITX		/ RETURN TO USER.				/(RCHM-158)

	.EJECT									/(RCHM-158)

/										/(RCHM-158)

/ SUBROUTINE TO UPDATE THE HOLES LIST FOR EITHER THE TOP DOWN OR BOTTOM		/(RCHM-158)

/ UP FITTING PROCESSORS.							/(RCHM-158)

/										/(RCHM-158)

/ CALLING SEQUENCE:								/(RCHM-158)

/										/(RCHM-158)

/	LAC HOLPTR		/ FETCH HOLE POINTER.				/(RCHM-158)

/	DAC FITX2		/ POINT TO HOLE TO BE ELIMINATED.		/(RCHM-158)

/	JMS HOLUPD		/ ELIMINATE HOLE				/(RCHM-158)

/	SAD ENDHOL		/ INSTRUCTION TO COMPARE FOR END OF TABLE.	/(RCHM-158)

/	DAC HOLEND		/ AC CONTAINS NEW TABLE ENDING UPON RETURN.	/(RCHM-158)

/										/(RCHM-158)

HOLUPD	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

	LAC FITX2		/ FETCH POINTER INTO TABLE.			/(RCHM-158)

	DAC FITXTR		/ SAVE FOR REVERSE POINTER.			/(RCHM-158)

HOLOOP	ISZ FITX2		/ POINT TO NEXT HOLE ENTRY.			/(RCHM-158)

	LAC FITX2		/ FETCH ADDRESS FOR END OF LOOP COMPARE.	/(RCHM-158)

	XCT* HOLUPD		/ DONE YET?					/(RCHM-158)

	JMP HOLEXT		/ YES, GO LEAVE.				/(RCHM-158)

	LAC* FITX2		/ FETCH NEW HOLE.				/(RCHM-158)

	DAC* FITXTR		/ STORE IN PREVIOUS HOLE.			/(RCHM-158)

	ISZ FITXTR		/ POINT TO CURRENT HOLE.			/(RCHM-158)

	JMP HOLOOP		/ PROCESS NEXT HOLE ENTRY.			/(RCHM-158)

HOLEXT	ISZ HOLUPD		/ MOVE PAST COMPARE INSTRUCTION.		/(RCHM-158)

	AAC -1			/ DECREMENT END OF TABLE POINTER PROPERLY.	/(RCHM-158)

	JMP* HOLUPD		/ RETURN NEW END OF TABLE TO USER.		/(RCHM-158)

	.TITLE *** FIT ROUTINE - BOTTOM UP LOADING				/(RCHM-158)

/										/(RCHM-158)

/ OPERATES BY THE SAME RULES AS THE TOP DOWN FIT ROUTINE. ALL ROUTINES		/(RCHM-158)

/ IN THIS CODE ARE FUNCTIONALLY IDENTICAL TO THE EQUIVALENT ROUTINES		/(RCHM-158)

/ IN THE TOP DOWN CODE WITH THE EXCEPTION THAT THEY ALLOCATE CODE AND		/(RCHM-158)

/ COMMON BLOCKS IN AN OPPOSITE DIRECTION.					/(RCHM-158)

/										/(RCHM-158)

FITBOT	LAC SIZE		/ CONVERT SIZE TO + NUMBER			/(RCHM-158)

	CMA!IAC			/ SO THAT BOTTOM UP ALLOCATION			/(RCHM-158)

	DAC SIZE		/ WILL WORK PROPERLY.				/(RCHM-158)

	LAC BLKFLG		/ CHECK FOR COMMON BLOCK FLAG.			/(RCHM-158)

	SZA			/ 0 => NO COMMON BLOCK.				/(RCHM-158)

	JMP FITBBL		/ GO FIT A COMMON BLOCK.			/(RCHM-158)

/										/(RCHM-158)

/ FIT CODE OR LOW CORE RESIDENT COMMON BLOCKS.					/(RCHM-158)

/										/(RCHM-158)

FITBCD	LAC (FITLX1)		/ SET UP FOR GENERALIZED			/(RCHM-158)

	DAC HOLEP		/ HOLE FILLING ENDING CASE.			/(RCHM-158)

	LAC (FITLHL)		/ FETCH POINTER TO HOLE TABLE.			/(RCHM-158)

	JMS FITBHOL		/ TRY FOR A HOLE FIT.				/(RCHM-158)

	SAD FITLX1		/ USED BY FITBHOL FOR END TEST.			/(RCHM-158)

	JMP FITBC1		/ NO FIT, TRY ABOVE LDLMT2.			/(RCHM-158)

/										/(RCHM-158)

/ A HOLE WAS FOUND TO FIT THE DATA ITEM, UPDATE THE HOLE LIST.			/(RCHM-158)

/										/(RCHM-158)

FITBC6	LAC FITTAD		/ FETCH HOLE BOTTOM ADDRESS.			/(RCHM-158)

	TAD SIZE		/ COMPUTE NEW BOTTOM OF HOLE.			/(RCHM-158)

	DAC FITXTR		/ SAVE FOR LATER.				/(RCHM-158)

	XOR FITTAD		/ CHECK FOR COMPLETELY FILLED HOLE.		/(RCHM-158)

	AND OPCMSK		/ EXTRACT OVERFLOW BITS.			/(RCHM-158)

	SZA			/ 0 => HOLE NOT COMPLETELY FILLED.		/(RCHM-158)

	JMP FITBC2		/ GO REMOVE HOLE ENTRY FROM LIST.		/(RCHM-158)

	LAC FITXTR		/ FETCH NEW HOLE ADDRESS.			/(RCHM-158)

	DAC* FITX2		/ UPDATE HOLE ADDRESS.				/(RCHM-158)

/										/(RCHM-158)

/ COMPUTE RELOCATION CONSTANTS AND OUTPUT MEMORY MAP.				/(RCHM-158)

/										/(RCHM-158)

FITBC3	LAC FITTAD		/ FETCH HOLE BOTTOM.				/(RCHM-158)

	DAC LOADADR		/ SET UP LOADING ADDRESS			/(RCHM-158)

	DAC RELOC		/ AND RELOCATION FACTOR.			/(RCHM-158)

	DAC SLIMFA		/ STORE FIRST ADDRESS.				/(RCHM-158)

	TAD SIZE		/ COMPUTE					/(RCHM-158)

	AAC -1			/  LAST ADDRESS.				/(RCHM-158)

	DAC SLIMLA		/ STORE LAST ADDRESS.				/(RCHM-158)

	JMS SLIM		/ OUTPUT MEMORY MAP.				/(RCHM-158)

	LAC SIZE		/ RESTORE SIZE FOR THE				/(RCHM-158)

	CMA!IAC			/ REST OF					/(RCHM-158)

	DAC SIZE		/ CHAIN.					/(RCHM-158)

	JMS VTC.OFF		/ TURN VTC OFF.					/(RCHM-158)

	JMS RES.OFF		/ TURN RES OFF.					/(RCHM-158)

	JMP* FIT		/ RETURN TO CALLER.				/(RCHM-158)

FITBC2	JMS HOLUPD		/ REMOVE HOLE FROM HOLE LIST.			/(RCHM-158)

	SAD* HOLEP		/ USED FOR END OF TABLE CHECK.			/(RCHM-158)

	DAC* HOLEP		/ UPDATE LAST HOLE INDEX.			/(RCHM-158)

	JMP FITBC3		/ GO COMPLETE FITTING.				/(RCHM-158)

/										/(RCHM-158)

/ NO HOLE FITS DATA ITEM. ALLOCATE ABOVE CURRENT MEMORY AND EXIT.		/(RCHM-158)

/										/(RCHM-158)

FITBC1	LAC CLTX1		/ SET UP CALLING SEQUENCE.			/(RCHM-158)

	DAC CLTX2		/ TO EITHER FITBAB				/(RCHM-158)

	LAC FITLX1		/ OR						/(RCHM-158)

	DAC FITX1		/ TO FITBAC					/(RCHM-158)

	LAC (CLT)		/ POINTER TO TOP OF CORE LIMIT TABLE.		/(RCHM-158)

	DAC FITCT		/						/(RCHM-158)

	LAC BLKFLG		/ WHICH SHOULD I CALL?				/(RCHM-158)

	SNA			/ >0 => FITBAB					/(RCHM-158)

	JMP FITBC4		/ GO CALL FITBAC				/(RCHM-158)

	LAC LDLMT2		/ FETCH INITIAL GUESS.				/(RCHM-158)

	JMS FITBAB		/ FIT COMMON BLOCK.				/(RCHM-158)

	JMS FITER0		/ NO MEMORY AVAILABLE.				/(RCHM-158)

FITBC5	LAC FITX1		/ SET UP NEW HOLE TABLE, JUST IN CASE.		/(RCHM-158)

	DAC FITLX1		/ END OF HOLE TABLE POINTER.			/(RCHM-158)

	LAC FITTAD		/ FETCH BOTTOM OF FIT.				/(RCHM-158)

	TAD SIZE		/ CALCULATE NEW BOTTOM.				/(RCHM-158)

	DAC LDLMT2		/ UPDATE LOAD LIMIT.				/(RCHM-158)

	JMP FITBC3		/ GO EXIT.					/(RCHM-158)

FITBC4	LAC LDLMT2		/ FETCH INITIAL GUESS.				/(RCHM-158)

	JMS FITBAC		/ FIT CORE LIMIT.				/(RCHM-158)

	JMS FITER0		/ NO CORE, GIVE ERROR.				/(RCHM-158)

	JMP FITBC5		/ GO EXIT.					/(RCHM-158)

	.EJECT									/(RCHM-158)

/										/(RCHM-158)

/ FIT A COMMON BLOCK IN HIGH MEMORY.						/(RCHM-158)

/										/(RCHM-158)

FITBBL	LAC BLKDSW		/ BLOCK DATA BEING ALLOCATED?			/(RCHM-158)

	SZA			/ NO						/(RCHM-158)

	JMP FITBCD		/ YES.						/(RCHM-158)

	XCT VTC.ALL		/ SET UP					/(RCHM-158)

	SKP			/ VTC.SW					/(RCHM-158)

	JMS VTC.ON		/ IF VTC ALL IS ON.				/(RCHM-158)

	LAC (17777)		/ SET UP VTC ADDRESS MASKS IF NECESSARY.	/(RCHM-158)

	XCT VTC.SW		/ VTC ON.					/(RCHM-158)

	JMP FITBB0		/ NO.						/(RCHM-158)

	DAC ADRMSK		/ RESET ADDRESSING MODES.			/(RCHM-158)

	CMA			/ CALCUALTE OP CODE MASK.			/(RCHM-158)

	DAC OPCMSK		/ SET UP OP CODE MASK.				/(RCHM-158)

FITBB0	XCT RES.SW		/ IGNORE SIF.HM IF RES IS ON.			/(RCHM-158)

	SKP			/ NOT ON.					/(RCHM-158)

	JMP FITBB1		/ GO PUT IN HIGH MEMORY.			/(RCHM-158)

	XCT SIF.HM		/ ARE WE ALLOWED TO PUT IN HIGH MEMORY?		/(RCHM-158)

	JMP FITBB2		/ NO.						/(RCHM-158)

FITBB1	XCT SIF.EM		/ ANY HIGH MEMORY?				/(RCHM-158)

	JMP FITBB2		/ NO, GO ALLOCATE IN LOW CORE.			/(RCHM-158)

	LAC (FITHX1)		/ SET UP HOLES EXIT.				/(RCHM-158)

	DAC HOLEP		/						/(RCHM-158)

	LAC (FITHHL)		/ FETCH HOLE TABLE POINTER.			/(RCHM-158)

	JMS FITBHOL		/ TRY TO FIT TO HOLE.				/(RCHM-158)

	SAD FITHX1		/ COMPARE AGAINST END OF TABLE.			/(RCHM-158)

	SKP			/ HOLE NOT THERE.				/(RCHM-158)

	JMP FITBC6		/ TAKE HOLE EXIT.				/(RCHM-158)

	LAC (ECLT)		/ FETCH TOP OF CLT.				/(RCHM-158)

	DAC FITCT		/ SET UP POINTER.				/(RCHM-160)

	LAC FITHX1		/ SET UP POINTER FOR HOLE TABLE ENTRY.		/(RCHM-158)

	DAC FITX1		/(RCHM-160) SET UP HOLE POINTER TABLE.

	LAC ECLTX2		/ FETCH POINTER TO LAST CORE ENTRY.		/(RCHM-158)

	DAC CLTX2		/ SET UP POINTER.				/(RCHM-158)

	LAC ELDLM2		/ FETCH INITIAL GUESS.				/(RCHM-158)

	JMS FITBAB		/ TRY TO FIT BLOCK.				/(RCHM-158)

	JMP FITBB2		/ CHECK IF POSSIBLE TO PUT IN LOW MEMORY	/(RCHM-158)

	LAC FITX1		/ UPDATE HOLE TABLE				/(RCHM-158)

	DAC FITHX1		/ POINTER.					/(RCHM-158)

	DAC IN.HMS		/(RCHM-160) SET IN HIGH MEMORY SWITCH.

	LAC FITTAD		/ FETCH NEW MEMORY SIZE.			/(RCHM-158)

	TAD SIZE		/ CALCULATE NEW LOAD LIMIT.			/(RCHM-158)

	DAC ELDLM2		/ EXTEND LOAD LIMIT.				/(RCHM-158)

	JMP FITBC3		/ GO EXIT.					/(RCHM-158)

FITBB2	XCT RES.SW		/ CAN WE PUT IN LOW MEMORY?			/(RCHM-158)

	JMP FITBCD		/ YES.						/(RCHM-158)

	JMS ERROR4		/ TERMINAL ERROR.				/(RCHM-158)

	MES723			/ ERROR MESSAGE.				/(RCHM-158)

/ ***	ERROR4 DOES NOT RETURN    *** /						/(RCHM-158)

	.EJECT									/(RCHM-158)

/										/(RCHM-158)

/ FIT A COMMON BLOCK.								/(RCHM-158)

/										/(RCHM-158)

/ CALLING SEQUENCE:								/(RCHM-158)

/										/(RCHM-158)

/	LAC CLTX1		/ BOTTOM OF CORE TABLE.				/(RCHM-158)

/	DAC CLTX2		/ BOTTOM OF FIT TABLE.				/(RCHM-158)

/	LAC HOLEND		/ NEXT ENTRY IN HOLE TABLE.			/(RCHM-158)

/	DAC FITX1		/ PTR TO NEXT ENTRY IN HOLE TABLE.		/(RCHM-158)

/	LAC TOPCLT		/ POINT TO TOP OF CORE LIMIT TABLE.		/(RCHM-158)

/	DAC FITCT		/ SET UP NO MEMORY TEST.			/(RCHM-158)

/	LAC CORADD		/ INITIAL GUESS FOR FITTING.			/(RCHM-158)

/	JMS FITBAB		/ FIT BLOCK.					/(RCHM-158)

/	JMP NOCORE		/ NO CORE EXIT.					/(RCHM-158)

/	LAC FITX1		/ FETCH NEW HOLE POINTER.			/(RCHM-158)

/	DAC HOLEND		/ UPDATE HOLE END.				/(RCHM-158)

/										/(RCHM-158)

FITBAB	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

	XCT VTC.SW		/ CHECK VTC OPTION.				/(RCHM-158)

	SKP			/ NOT ON.					/(RCHM-158)

	JMP FITBA1		/ GO PROCESS LIKE CODE.				/(RCHM-158)

	DAC FITTAD		/ SAVE INITIAL GUESS.				/(RCHM-158)

	TAD SIZE		/ ADD IN SIZE					/(RCHM-158)

	CMA			/ - ADDRESS -1					/(RCHM-158)

	TAD* FITCT		/ + TOP ADDRESS IN MEMORY TABLE.		/(RCHM-158)

	SMA			/ <0 => TOO BIG FOR MEMORY.			/(RCHM-158)

FITBA2	ISZ FITBAB		/ SET UP FOUND RETURN.				/(RCHM-158)

	JMP* FITBAB		/ FETURN.					/(RCHM-158)

FITBA1	JMS FITBAC		/ TRY TO FIT AS CODE.				/(RCHM-158)

	JMP* FITBAB		/ NO CORE.					/(RCHM-158)

	JMP FITBA2		/ FIT RETURN.					/(RCHM-158)

	.EJECT									/(RCHM-158)

/										/(RCHM-158)

/ ROUTINE TO FIT A BLOCK OF CODE INTO A BANK OR PAGE.				/(RCHM-158)

/										/(RCHM-158)

/ ARGUMENTS AS ABOVE.								/(RCHM-158)

/										/(RCHM-158)

FITBAC	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

FITBA5	DAC FITTAD		/ SAVE NEW GUESS.				/(RCHM-158)

	JMS FITBX		/ WILL CODE FIT IN BANK?			/(RCHM-158)

	JMP FITBA3		/ YES.						/(RCHM-158)

	LAC FITTAD		/ FETCH GUESS.					/(RCHM-158)

	AND ADRMSK		/ CHECK TO SEE IF GUESS ON BANK OR PAGE.	/(RCHM-158)

	SZA			/ 0 => YES.					/(RCHM-158)

	JMP FITBA4		/ NO.						/(RCHM-158)

	LAC FITTAD		/ DECREMENT TO GUARENTEE GETTING TO RIGHT	/(RCHM-158)

	AAC -1			/ HOLE.						/(RCHM-158)

	DAC FITTAD		/						/(RCHM-158)

	JMP FITBA6		/ GO SCAN CLT.					/(RCHM-158)

FITBA4	LAC FITTAD		/ FETCH NEW HOLE ADDRESS.			/(RCHM-158)

	DAC* FITX1		/ SET UP HOLE.					/(RCHM-158)

	ISZ FITX1		/ POINT TO NEW HOLE				/(RCHM-158)

FITBA6	LAC CLTX2		/ FETCH NEXT BANK OR PAGE.			/(RCHM-158)

	SAD FITCT		/ COMPARE AGAINST CORE TABLE TOP.		/(RCHM-158)

	JMP* FITBAC		/ NO MORE CORE.					/(RCHM-158)

	AAC -1			/ DECREMENT POINTER.				/(RCHM-158)

	DAC CLTX2		/ SAVE NEW POINTER.				/(RCHM-158)

	LAC FITTAD		/ FETCH GUESS.					/(RCHM-158)

	CMA!IAC			/ - ADDRESS					/(RCHM-158)

	TAD* CLTX2		/ GOT THERE YET?				/(RCHM-158)

	SPA			/ >=0 => YES.					/(RCHM-158)

	JMP FITBA6		/ NO.						/(RCHM-158)

	LAC BLKFLG		/ CHECK FOR OFFSET.				/(RCHM-158)

	SNA!CLA!IAC		/ SET 1 IN AC.					/(RCHM-158)

	AAC 20			/ INCREMENT PAST AR REGISTERS.			/(RCHM-158)

	TAD* CLTX2		/ + TOP ADDRESS OF PREVIOUS BANK OR PAGE.	/(RCHM-158)

	DAC FITTAD		/ UPDATE NEW GUESS.				/(RCHM-158)

	JMP FITBA5		/ TRY NEW GUESS.				/(RCHM-158)

FITBA3	ISZ FITBAC		/ SET UP FIT RETURN.				/(RCHM-158)

	JMP* FITBAC		/ RETURN TO CALLER				/(RCHM-158)

	.EJECT									/(RCHM-158)

/										/(RCHM-158)

/ SEARCH FOR HOLE FIT. SAME ARGUMENTS AS FITHOL ABOVE.				/(RCHM-158)

/										/(RCHM-158)

FITBHOL	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

	DAC FITX2		/ SET UP HOLE POINTER.				/(RCHM-158)

FITBH1	LAC FITX2		/ CHECK TO SEE IF TABLE IS EMPTY.		/(RCHM-158)

	XCT* FITBHOL		/ TARGET INSTRUCTION IS A SAD.			/(RCHM-158)

	JMP FITBH3		/ NO FIT.					/(RCHM-158)

	LAC* FITX2		/ FETCH HOLE BOTTOM ADDRESS.			/(RCHM-158)

	JMS FITBX		/ SEE IF DATA WILL FIT IN HOLE.			/(RCHM-158)

	JMP FITBH1		/ FIT.						/(RCHM-158)

	ISZ FITX2		/ TRY NEXT HOLE.				/(RCHM-158)

	JMP FITBH1		/						/(RCHM-158)

FITBH2	ISZ FITBHOL		/ FIT FOUND, ADDRESS IN FITTAB.			/(RCHM-158)

FITBH3	ISZ FITBHOL		/ NO FIT FOUND.					/(RCHM-158)

	JMP* FITBHOL		/ RETURN TO USER.				/(RCHM-158)

	.EJECT									/(RCHM-158)

/										/(RCHM-158)

/ CHECK ADDRESS FOR FIT WITHIN BANK OR PAGE. SAME ARGUMENTS AS			/(RCHM-158)

/ FITX ABOVE.									/(RCHM-158)

/										/(RCHM-158)

FITBX	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

	DAC FITTAD		/ SAVE GUESS.					/(RCHM-158)

	AND ADRMSK		/ STRIP OFF HIGH ADDRESS BITS.			/(RCHM-158)

	TAD SIZE		/ ADD IN SIZE					/(RCHM-158)

	AAC -1			/ SUBTRACT TO GET ENDING ADDRESS RIGHT.		/(RCHM-158)

	AND OPCMSK		/ CHECK TO SEE IF BANK OR PAGE OVERFLOW.	/(RCHM-158)

	SZA			/ 0 => NO OVERFLOW.				/(RCHM-158)

	ISZ FITBX		/ WON'T FIT, RETURN.				/(RCHM-158)

	JMP* FITBX		/ RETURN TO CALLER.				/(RCHM-158)

	.EJECT									/(RCHM-158)

/										/(RCHM-158)

/ VARIABLES NECESSARY FOR THE FIT ROUTINE.					/(RCHM-158)

/										/(RCHM-158)

FITTAD	XX			/ TOP HOLE ADDRESS INTO WHICH A GIVEN		/(RCHM-158)

				/ DATA ITEM WILL FIT. SET BY FITX.		/(RCHM-158)

				/ BOTTOM HOLE ADDRESS INTO WHICH A GIVEN	/(RCHM-158)

				/ DATA ITEM WILL FIT. SET BY FITBX.		/(RCHM-158)

FITXTR	XX			/ NUMBER OF EXTRA LOCATIONS RESERVED		/(RCHM-158)

				/ THE FIT PROCESS FOR A GIVEN DATA ITEM.	/(RCHM-158)

				/ 0 FOR COMMON BLOCKS, -20 FOR CODE.		/(RCHM-158)

FITLHL	.BLOCK 11		/ HOLE TABLE FOR LOW CORE			/(RCHM-158)

FITLX1	XX			/ POINTER TO LAST ENTRY IN LOW CORE		/(RCHM-158)

				/ HOLE TABLE.					/(RCHM-158)

FITX1	XX			/ BASE OF HOLE TABLE DURING CORE ALLOCATION.	/(RCHM-158)

FITX2	XX			/ INDEX FOR HOLE TABLE SCAN.			/(RCHM-158)

FITHHL	.BLOCK 41		/ HOLE TABLE FOR HIGH CORE.			/(RCHM-158)

FITHX1	FITHHL			/ AS FOR FITLX1					/(RCHM-158)

HOLEP	XX			/ POINTER TO HOLE FOR GENERALIZED TERMINATION	/(RCHM-158)

FITCT	XX			/ POINTER TO TOP OF CLT DURING BOTTOM UP FIT	/(RCHM-158)

	.TITLE *** ERROR ROUTINES						/(RCHM-158)

/										/(RCHM-158)

/ NO MORE CORE DURING CODE ALLOCATION ERROR.					/(RCHM-158)

/										/(RCHM-158)

FITER0	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

	JMS TYPE		/ PRINT ERROR MESSAGE.				/(RCHM-158)

	MES702			/ NO MORE CORRE MESSAGE ADDRESS.		/(RCHM-158)

	JMS EXIT		/ TERMINATE PROGRAM.				/(RCHM-158)

/ ***	EXIT DOES NOT RETURN   *** /						/(RCHM-158)

/										/(RCHM-158)

/ ROUTINE TO EXIT WITH MESSAGE AND PRINT CONTENTS OF SYM1 AND SYM2.		/(RCHM-158)

/										/(RCHM-158)

ERROR4	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

	LAC* ERROR4		/ FETCH MESSAGE ADDRESS.			/(RCHM-158)

	DAC .+2			/ SET UP CALL TO TYPE.				/(RCHM-158)

	JMS TYPE		/ TYPE MESSAGE.					/(RCHM-158)

	XX			/ MESSAGE ADDRESS.				/(RCHM-158)

	JMS SYMMAP		/ SET UP MAP LINE.				/(RCHM-158)

	JMS SHTMAP		/ SHORTEN LINE.					/(RCHM-158)

	JMS TYPMAP		/ TYPE MAP LINE AFTER MESSAGE.			/(RCHM-158)

	JMS EXIT		/ GO KILL PROGRAM.				/(RCHM-158)

/ ***	EXIT DOES NOT RETURN   *** /						/(RCHM-158)

/										/(RCHM-158)

/ COMMON EXIT POINT. DURING DEBUGGING, THIS ROUTINE WILL HALT PRIOR TO		/(RCHM-158)

/ ISSUING THE .EXIT MMONITOR CAL.						/(RCHM-158)

/										/(RCHM-158)

EXIT	XX			/ ROUTINE ENTRY POINT.				/(RCHM-158)

	.IFDEF %DEBUG		/(RCHM-163)

	HLT			/ HALT PRIOR TO EXIT.				/(RCHM-158)

	.ENDC			/(RCHM-163)

	JMP EXITXX								/(RCHM-158)

 .TITLE *** SUBR(S) FOR GLOBAL,SYMBOL&LIBRARY SEACHES

/ VIRTUAL -- SUBROUTINE TO SEARCH FOR AN UNRESOLVED GLOBAL

/            SYMBOL REFERENCE (CODES 1 OR 5) OR A DUMMY 

/	  GLOBAL SYMBOL ENTRY (CODE 6).

/

VIRTUAL	0

 

	JMS BEGSYM	/START AT BEG OF SYMTAB.

	JMS FINDCOD	/SEARCH FOR

	100000		/VIRTUAL GLOBAL ENTRY.

	JMP	.+3	/RETURN HERE IF NOT FOUND

	IDX VIRTUAL	/HERE IF FOUND.

	JMP* VIRTUAL

	JMS	BEGSYM	/START AT BEG OF SYMTAB

	JMS	FINDCOD	/SEARCH FOR

	600000		/DUMMY GLOBAL ENTRY

	JMP*	VIRTUAL	/RETURN HERE IF NOT FOUND

	IDX	VIRTUAL	/HERE IF FOUND

	JMP*	VIRTUAL

/

/ SUBROUTINE FINDCOD: STARTING AT THE CURRENT POSITION OF SYMWD1, SEARCH THRU

/ THE SYMBOL TABLE FOR AN ENTRY WHOSE CODE MATCHES THE CODE FOLLOWING THE

/ JMS FINDCOD. SKIP ON RETURN IF FOUND.

 

FINDCOD	0

 

	LAC SYMWD1	/ARE WE AT THE END OF

NEXCOD	SAD SYMEND	/THE SYMBOL TABLE?

	JMP NOFIND	/YES.

 

	LAC* SYMWD1	/GET 1ST WORD OF ENTRY IN SYMTAB.

	AND (700000)	/(700000 MASK TO CODE BITS.

	SAD* FINDCOD	/MATCH?

	JMP .+3		/YES.

 

NOMATCH	JMS NXNTRY	/MOVE POINTER TO THE NEXT ENTRY.

	JMP NEXCOD

 

FOUND	IDX FINDCOD

NOFIND	IDX FINDCOD

	JMP* FINDCOD

 

	.EJECT

/ LIBRARY SEARCH SUBROUTINE: LOAD IN ALL REQUESTED

/ LIBRARY ROUTINES.

 

LIBRARY	0

	AND (777

	DAC LIBCLOS		/SETUP LIBRARY .CLOSE.

	JMS	SEEK		/'SEEK' FILE ON DEVICE WHOSE

				/.DAT SLOT NUMBER IS IN AC

MORLIB	SET LIBFLG		/SET LIBR MODE FLAG FOR SELECTIVE

				/LOADING.

	JMS VIRTUAL		/ARE THERE ANY UNRESOLVED GLOBALS?

	JMP LIBCLOS		/NO.

 

NEXLIB	LAC	LIBCLOS		/GET CAL TO THE CORRECT DAT SLOT.

	JMS LDPROG		/LOAD IN LIBRARY SUBPROGRAM ONLY

				/IF IT IS REQUESTED IN THE SYMBOL

				/TABLE AS A VIRTUAL GLOBAL. IF

				/LIBRARY END OF FILE IS ENCOUN-

				/TERED, CONTROL IS RETURNED TO

				/LOCATION 'LIBCLOS'. IF THE NEXT

				/PROGRAM IN THE LIBRARY WAS

				/INDEED LOADED, LIBFLG WILL BE 0

				/ON RETURN.

	LAC LIBFLG		/WAS NEXT LIBR PROGRAM READ IN?

	SZA

	JMP NEXLIB		/NO. TRY NEXT SUBPROGRAM.

	ISZ	RESG		/(GAR:167) SET THE RESOLVED GLOBLS FLAG.

	ISZ	RESGBL		/(GAR:167) SET THE RESOLVED GLOBLS FLAG.

	JMP MORLIB		/YES. DO ANY MORE NEED TO BE READ IN?

 

/ IF SUBROUTINE LDPROG DETECTS THE LIBRARY END-OF-FILE,

/ IT WILL RETURN CONTROL HERE.

 

LIBCLOS	.CLOSE 0			/.CLOSE THE LIBRARY FILE.

	DZM LIBFLG

	JMP* LIBRARY

 

/ SUBROUTINE DEFSYM: ENTER 3 WORDS INTO THE SYMBOL TABLE: SYMBOL

/ DEFINITION, SYMBOL 1, AND SYMBOL 2.

 

DEFSYM	0

 

	LAC SYMDEF	/1ST WORD IS THE DEFINITION.

	JMS ENTSYM

	LAC SYM1		/IF BIT0=1, THERE IS A SYM2.

	SMA

	JMP .+3		/SYMBOL NAME IS <4 CHARS.

	JMS ENTSYM	/ENTER 1ST HALF OF SYMBOL NAME.

	LAC SYM2		/2ND HALF OF SYMBOL NAME.

	JMS ENTSYM	/ENTER WORD2 OR WORD3.

	JMP* DEFSYM

 

/ SUBROUTINE ENTSYM: ENTER THE WORD IN THE AC AT THE END OF THE SYMBOL

/ TABLE AND MOVE THE POINTER TO THE END OF THE SYMBOL TABLE UP ONE.

 

ENTSYM	0

 

	DAC* SYMEND	/STORE DATA AT END OF TABLE.

	JMS UPSYM		/INDEX END POINTER.

	JMP* ENTSYM

 

/ SUBROUTINE UPSYM: INDEX POINTER TO END OF SYMBOL TABLE AND TEST

/ FOR OVERFLOW.

 

UPSYM	0

 

	LAW -1

	TAD SYMEND

	DAC SYMEND

	CMA!IAC			/(RCHM-157)

	TAD PTBX1		/LOWEST REGISTER AVAILABLE TO SYMTAB.

	SPA!SNA		/OVERFLOW?

	JMP* UPSYM	/NO.

	LAC	(MES701)

	JMP	TERR

 

	.EJECT

/ SUBROUTINE NXNTRY: MOVE SYMBOL TABLE POINTERS OVER THE CURRENT ENTRY

/ TO THE BEGINNING OF THE NEXT ENTRY.

 

NXNTRY	0

 

	LAC SYMWD1	/POINTER TO 1ST WORD OF CURRENT ENTRY.

	DAC SYMPTR

	JMS NEXSYM	/GET 1ST HALF OF SYMBOL NAME.

	SPA		/IF BIT0=1, NAME IS 2 WORDS LONG.

	JMS DECSPT

	JMS DECSPT

 

	LAC* SYMWD1	/LOOK AT CODE BITS IN WORD 1.

	AND (300000	/LOOK FOR COMMON BLOCK CODE: 3 OR 7.

	SAD (300000	/COMMON BLOCK?

	SKP		/YES.

	JMP .+3		/NO.

	JMS DECSPT	/COMMON BLOCK ENTRY IS 2 WORDS LONGER

	JMS DECSPT	/THAN ALL OTHERS.

 

	LAC SYMPTR	/POINTING AT 1ST WORD OF NEXT ENTRY.

	DAC SYMWD1

	JMP* NXNTRY

 

/ SUBROUTINE NEXSYM: INDEX THE SYMBOL TABLE POINTER AND PICK UP THE

/ NEXT WORD.

 

NEXSYM	0

 

	JMS DECSPT

	LAC* SYMPTR

	JMP* NEXSYM

 

/ SUBROUTINE DECSPT:

 

DECSPT	0

 

	LAW -1

	TAD SYMPTR

	DAC SYMPTR

	JMP* DECSPT

 

/ SUBROUTINE BEGSYM:

 

BEGSYM	0

 

	LAC SYMBEG

	DAC SYMWD1

	DAC SYMPTR

	JMP* BEGSYM

 

	.EJECT

/ SCAN -- SUBROUTINE TO SCAN THE SYMBOL TABLE FOR THE NAME

/	IN SYM1 & SYM2 WITH THE SAME CODE BITS 1 & 2 AS THE

/	WORD IN AC.

/

/ IF FOUND -- RETURN AT JMS+1 WITH 15-BIT DEFINITION IN AC

/ IF NOT FOUND -- RETURN AT JMS+2 WITH ZERO IN AC

/

/ SEARCH FROM THE BEGINNING OF THE SYMBOL TABLE FOR:

/ A COMMON BLOCK NAME ENTRY (CODE 3 OR 7), A GLOBAL

/ SYMBOL ENTRY (CODE 1 OR 5), OR A DUMMY GLOBAL ENTRY (CODE 6)

/ WHOSE NAME MATCHES SYM1 AND SYM2. RETURN 0 IF NOT FOUND. RETURN

/ 15-BIT DEFINITION OF THE ENTRY IF FOUND.

/

/ WHEN A NAME MATCH IS FOUND, SYMPTR IS LEFT POINTING TO THE LAST WORD

/ OF THE NAME & SYMWD1 IS LEFT POINTING TO THE ID/BLOCK-SIZE WORD.

/

SCAN	0

	DAC	SYMDEF	/SAVE SYMBOL DEFINITION WITH CODE BITS

	JMS BEGSYM	/START AT BEGINNING OF SYMTAB.

NEXSCAN	SAD SYMEND	/END OF SYMBOL TABLE?

	JMP RTNZERO	/YES. NO MATCH. RETURN 0.

 

	LAC* SYMWD1	/PICKUP ENTRY'S 1ST WORD.

	XOR SYMDEF	/MATCH WITH SEARCH CODE BITS.

	AND (300000

	SZA		/SKIP IF PROPER CODE.

	JMP MORSCAN

 

	JMS NEXSYM	/GET 1ST HALF OF SYMBOL NAME.

	SAD SYM1		/MATCH?

	SKP		/YES.

	JMP MORSCAN	/NO.

 

	SMA		/IS NAME 2 WORDS LONG?

	JMP RTNDEF	/NO. ENTRY HAS BEEN FOUND.

 

	JMS NEXSYM	/GET 2ND HALF OF SYMBOL NAME.

	SAD SYM2		/MATCH?

	JMP RTNDEF	/YES. ENTRY HAS BEEN FOUND.

 

MORSCAN	JMS NXNTRY	/NO. SKIP TO BEGINNING OF NEXT ENTRY.

	JMP NEXSCAN

 

RTNZERO	CLA!SKP		/RETURN 0 IN AC WHEN NOT FOUND.

RTNDEF	LAC* SYMWD1	/RETURN 15-BIT DEFINITION OF THE ENTRY

	AND (77777	/WITHOUT THE CODE BITS.

	SNA		/0 RETURNED IN AC IF NOT FOUND.

	IDX SCAN		/NOT FOUND.

	JMP* SCAN		/FOUND.

	.EJECT

/+

/ NAMED COMMON LIST (NCL) SCANNER. SCANS THE NCL FOR THE NAMED COMMON

/ APEARING IN SYM1 AND SYM2.

/

/ SYM1 ONE CONTAINS THE TWO WORD ENTRY BIT AND THE FIRST 3 CHARACTERS

/ OF THE COMMON NAME. SYM2 CONTAINS THE LAST THREE CHARACTERS OF THE

/ COMMON NAME, IF THE TWO WORD BIT IS SET. OTHERWISE, SYM2 CONTAINS

/ 0.

/

/ CALL:

/

/	...			/ SET UP SYM1 AND SYM2.

/	JMS NCL.SC		/ CALL SCANER.

/	JMP NOT.FN		/ NOT FOUND RETURN.

/-

NCL.SC	XX			/(RCHM-157) NCL SCANNER ENTRY POINT.

	LAC NCL.BS		/(RCHM-157) FETCH BASE ADDRESS OF NCL.

	DAC NCL.PT		/(RCHM-157) SET UP FOR SCAN OF NCL.

NCL.S1	LAC NCL.PT		/(RCHM-157) FETCH LIST POINTER.

	SAD RCL.BS		/(RCHM-157) ARE WE AT THE END OF THE LIST?

	JMP* NCL.SC		/(RCHM-157) YES, TAKE NOT FOUND EXIT.

	LAC* NCL.PT		/(RCHM-157) FETCH FIRST HALF OF LIST ENTRY.

	AND (577777)		/(RCHM-157) EXTRACT PERTENENT INFORMATION.

	SMA!STL			/(RCHM-157) SET NEXT CHECK BIT IN LINK.

	CLL			/(RCHM-157) CLEAR LINK IF ONLY ONE WORD IN ENTRY.

	XOR SYM1		/(RCHM-157) CHECK TO SEE IF IT EQUALS SYM1.

	SZA			/(RCHM-157) DO WE MATCH THUS FAR?

	JMP NCL.S2		/(RCHM-157) GO TO NEXT LIST ENTRY.

	SNL			/(RCHM-157) MUST WE CHECK MORE?

	JMP NCL.S4		/(RCHM-157) NO, RETURN TO CALLER.

	ISZ NCL.PT		/(RCHM-157) CHECK NEXT ENTRY IN LIST.

	LAC* NCL.PT		/(RCHM-157) FETCH LAST HALF OF ENTRY.

	XOR SYM2		/(RCHM-157) CHECK AGAINST SYM2.

	AND (177777)		/(RCHM-170) IGNORE STATE OF VTC BIT.

	SZA			/(RCHM-157) DOES IT MATCH?

	JMP NCL.S3		/(RCHM-157) NO, GO TO NEXT LIST ENTRY.

	LAC NCL.PT		/(RCHM-157) BACK UP FOUND POINTER.

	AAC -1			/(RCHM-157) BY ONE.

	DAC NCL.PT		/(RCHM-157) POINTER NOW JUSTIFIED PROPERLY.

NCL.S4	ISZ NCL.SC		/(RCHM-157) BUMP RETURN POINTER TO INDICATE FOUND.

	JMP* NCL.SC		/(RCHM-157) RETURN TO CALLER.

NCL.S2	ISZ NCL.PT		/(RCHM-157) MOVE POINTER TO SECOND HALF OF LIST ENTRY.

NCL.S3	ISZ NCL.PT		/(RCHM-157) MOVE POINTER TO NEXT LIST ENTRY.

	JMP NCL.S1		/(RCHM-157) CHECK NEXT ENTRY.

	.EJECT

/

/ ROUTINE TO SET UP FLAGS FOR BLANK COMMON.

/

CK.XX	XX			/(RCHM-158) ROUTINE ENTRY POINT.

	LAC (.XX)		/(RCHM-158) FETCH NAME.

	DAC SYM1		/(RCHM-158) SET UP NAME.

	DZM SYM2		/(RCHM-158) CLEAR 2ND HALF.

	JMS RV.SET		/(RCHM-158) SET UP RES AND VTC SWITCH.

	JMP* CK.XX		/(RCHM-158) RETURN TO CALLER.

/

/ SET UP RES.SW AND VTC.SW ACCORDING TO STATES OF RES.ALL, VTC.ALL

/ AND THE STATE OF THE NCL.

/
RV.SET	XX			/(RCHM-158) ROUTINE ENTRY POINT.

	JMS VTC.OFF		/(RCHM-158) TURN VTC OFF.

	JMS RES.OFF		/(RCHM-158) TURN RES OFF.

	XCT VTC.ALL		/(RCHM-158) TURN ON VTC MAYBEE.

	SKP			/(RCHM-158)

	JMS VTC.ON		/(RCHM-158) YES.
	XCT RES.ALL		/(RCHM-158)

	SKP			/(RCHM-158)

	JMS RES.ON		/(RCHM-158) ARM RES S2ITCH

RV.S1	JMS NCL.SC		/(RCHM-158) SCAN NCL FOR SYM1 AND SYM2.

	JMP* RV.SET		/(RCHM-158) NOT FOUND, RETURN.

	LAC* NCL.PT		/(RCHM-158) CHECK VTC SWITCH.

	RTL			/(RCHM-158)

	SZL			/(RCHM-158)

	JMS VTC.ON		/(RCHM-158) TURN ON VTC.

	ISZ NCL.PT		/(RCHM-158) POINT TO RES SWITCH.

	LAC* NCL.PT		/(RCHM-158) FETCH STATE OF RES SWITCH.

	SPA			/(RCHM-158)

	JMS RES.ON		/(RCHM-158) TURN ON RES.

	JMP* RV.SET		/(RCHM-158) RETURN.

	.TITLE *** (RCHM-158) ROUTINES TO MANIPULATE VTC AND RES SWITCHES.

/+

/ THESE ROUTINES SET, RESET, AND INITIALIZE THE NCL, VTC, RES, AND

/ RCL LISTS AND SWITCHES.

/-

VTC.ON	XX			/ TURN VTC ON.

	LAC (SKP)		/ FETCH VTC ON FLAG.

	DAC VTC.SW		/ TURN ON VTC.

	JMP* VTC.ON		/ RETURN TO CALLER.

/

VTC.OFF	XX			/ TURN VTC OFF.

	LAC (NOP)		/ FETCH VTC OFF FLAG.

	DAC VTC.SW		/ TURN OFF VTC.

	JMP* VTC.OFF		/ RETURN TO CALLER.

/

RES.ON	XX			/ TURN RES ON.

	LAC (SKP)		/ FETCH RES ON FLAG.

	DAC RES.SW		/ TURN ON RES.

	JMP* RES.ON		/ RETURN TO CALLER.

/

RES.OFF	XX			/ TURN RESS OFF.

	LAC (NOP)		/ FETCH RES OFF FLAG.

	DAC RES.SW		/ TURN OFF RES

	JMP* RES.OFF		/ RETURN TO CALLER.

/

 .TITLE *** SUBR TO DEFINE EACH MEMBER OF THE COMMON BLOCK

 

/ SUBROUTINE DEFCOM: GO THROUGH THE COMMON BLOCK CHAIN AND DEFINE

/ EACH MEMBER (IF ANY) OF THE COMMON BLOCK.

 

DEFCOM	0

 

	LAC*	SYMPTR	/GET STARTING ADDRESS OF THE CHAIN.

	DZM*	SYMPTR	/SET CHAIN WORD TO 0 TO INDICATE THAT

			/THERE ARE NO UNRESOLVED CHAIN MEMBERS.

 

DEFLOOP	SNA		/ARE THERE ANY MORE CHAIN MEMBERS?

	JMP* DEFCOM	/NO.

	DAC	SYMPTR	/FOLLOW SYMBOL TABLE CHAIN, MAKING

	JMS	DECSPT	/A PATCH TABLE ENTRY (CODE=0) FOR EACH

	LAC*	SYMPTR	/TRANSFER VECTOR TO THE DEFINED COMMON BLOCK.

	AND	(077777)

	DAC	PTBW1

	JMS	DECSPT

	LAC*	SYMPTR

	TAD	LOADADR

	DAC	PTBW2

	JMS	PTBENT

	ISZ	SYMPTR

	ISZ	SYMPTR

	LAC*	SYMPTR

	AND	(077777)

	JMP	DEFLOOP

/

ERR106	LAC	(MES706)

	JMP	TERR

ERR115	LAC	(MES715)

	JMP	TERR

 .TITLE *** TELETYPE MESSAGES PART 2.

/

/ TELETYPE OUTPUT MESSAGES.  THE TWO WORDS PRECEDING EACH

/ MESSAGE ARE USED AS AN IOPS ASCII HEADER.  THE ONLY HEADER

/ REQUIREMENT FOR TTY OUTPUT IS A GREATER THAN ONE WORD-

/ PAIR COUNT.

/

MES602	.ASCII	/LINK TABLE/<015>

MES603	.ASCII	/RESIDENT CODE/<015>

MES604	.ASCII	/LINK -- /<175>

MES605	.ASCII	/BLANK COMMON/<015>

MES610	.ASCII	/PAUSE/<175>

MES620	.ASCII /NON-FILE ORIENTED INPUT DEVICE/<15> /(RCHM-164)

MES690	.ASCII	/CORE REQ'D/<015>

MES701	.ASCII	/TABLE OVERLAP/<15>

MES702	.ASCII	/LOW CORE OVERFLOW/<15>

MES703	.ASCII	/EOM, ^P TO RESTART /<175>

MES705	.ASCII	/READ ERROR/<15>

MES706	.ASCII	/ILLEGAL LOADER CODE/<15>

MES707	.ASCII	/LABELED COMMON BLK SIZE ERR -- /<175>

MES710	.ASCII	/UNRESOLVED GLOBAL(S):/<15>

MES715	.ASCII	/ABS PROG/<15>

MES720	.ASCII	/MISSING GLOBAL DEF -- /<175>

MES721	.ASCII	/DUPLICATE GLOBAL DEF -- /<175>

MES722	.ASCII /ILLEGAL ATTEMPT TO INITIALIZE COMMON BLOCK -- /<175>		/(RCHM-158)

MES723	.ASCII /HIGH CORE OVERFLOW -- /<175> /(RCHM-158)

MES724	.ASCII /ABSOLUTE LOAD ADDRESS/<175> /(RCHM-158)

MES725	.ASCII /RESIDENT COMMON BLOCKS/<015> /(RCHM-158)

MES726	.ASCII /*** BLOCK DATA SUBROUTINE -- /<175> /(RCHM-163)

MES727	.ASCII /COMMON BLOCK TOO BIG --/<175>	/(RCHM-163)

MES728	.ASCII /GLOBAL SYMBOL TOO BIG --/<175>	/(RCHM-163)

 .TITLE *** SOME MORE VARIABLES AND CONSTANTS

/

RESG	0			/(GAR:167) USED TO DETERMINE IF ANY GLOBLS WERE

				/(GAR:167) RESOLVED DURING THE LAST PASS OF

				/(GAR:167) A LIBRARY.

				/(GAR:167)   0 => NONE RESOLVED.

				/(GAR:167)   NON-ZERO => GLOBL(S) WERE RESOLVED.

RESGBL	0			/(GAR:167) USED TO DETERMINE IF ANY GLOBLS

				/(GAR:167) WERE RESOLVED DURING THE LAST PASS

				/(GAR:167) OF BOTH LIBRARIES.

				/(GAR:167)   0 => NONE RESOLVED.

				/(GAR:167)   NON-ZERO => GLOBL(S) WERE RESOLVED.

SIZE	0		/2'S COMPLEMENT OF PROGRAM SIZE.

WRDCNT	0		/IOPS BINARY BLOCK WORD COUNT.

CDWCNT	0		/CODE WORD BLOCK COUNTER.

CODEWD	0		/CODE WORD CONTAINS 3 LOADER CODES.

SYMDEF	0		/TEMP REGISTER FOR THE 1ST WORD OF A SYMTAB

			/ENTRY: CODE + DEFINITION.

SYM1	0		/1ST 3 CHARS OF A SYMBOL (RADIX-50)

SYM2	0		/2ND 3 CHARS OF A SYMBOL.

EXT	0			/(RCHM-163) SOURCE EXTENSION IF PRESENT.

FNM1	0	/1ST THREE CHARS OF A FILE NAME (RADIX-50)

FNM2	0	/2ND THREE CHARS OF A FILE NAME

DATA1	0		/TEMP STORAGE FOR A DATA INITIALIZATION CONSTANT.

DATA2	0		/(DATA1, DATA2, & DATA3 MUST BE CONTIGUOUS

DATA3	0		/AND IN THIS ORDER)

DGSNB	.BLOCK 2		/DUPL GLOBAL SYMBOL NAME BUFFER

COMCHN	0

COMDEF	0

STRING	0

		/.DAT MAP

DATMAP	0	/-18  -1

	0	/  0  +17

	0	/+18  +35

	0	/+36  +53

	0	/+54  +71

/

DATP=.			/.DAT ZERO POINTER

	123

 .TITLE *** CHARACTER CONVERSION SUBROUTINES

/ SYMMAP -- SUBROUTINE TO CONVERT THE SYMBOL NAME IN SYM1 & SYM2

/           FROM RADIX 50 TO 7-BIT IMAGE ALPHA AND STORE THE

/           RESLUTING SIX WORDS IN MAPNAM THRU MAPNAM+5

/

SYMMAP	0

	LAC	(MAPNAM)	/(RCHM-156)

	DAC	MAPX1

	LAC	SYM1

	AND	(377777)

	JMS	CONVERT

	LAC	SYM1

	SMA

	DZM	SYM2

	LAC	SYM2

	AND	(377777)

	JMS	CONVERT

	LAC BLKFLG		/(RCHM-163) CHECK COMMON BLOCK FLAG BEFOR PRINTING

				/(RCHM-163) EXTENSION.

	SZA			/(RCHM-163) BLOCK ON?

	SKP!CLA			/(RCHM-163) YES, PAD WITH BLANKS.

	LAC EXT			/(RCHM-163) FETCH EXTENSION NAME.

	IDX MAPX1		/(RCHM-163) LEAVE A BLANK BETWEEN FILENAME AND EXT.

	JMS CONVERT		/(RCHM-163) CONVERT TO PRINTABLE FORM.

	JMP*	SYMMAP

/

CONVERT	0

	JMS	DIVIDE

	-3100

	JMS	DIVIDE

	-50

	JMS	DIVIDE

	-1

	JMP*	CONVERT

/

DIVIDE	0

	DZM	DIVQUO

DIVLP	DAC	DIVREM

	TAD*	DIVIDE

	SPA

	JMP	.+3

	ISZ	DIVQUO

	JMP	DIVLP

/

	LAC	DIVQUO

	SNA

	LAW -40

	SAD (33

	LAW -33

	SAD (34

	LAC (33

	SAD (47

	LAW -35

	AAC -33			/(RCHM-158)

	SPA

	AAC 55			/(RCHM-158)

	AAC 56			/(RCHM-158)

	DAC*	MAPX1

	ISZ	MAPX1

	LAC	DIVREM

	ISZ	DIVIDE

	JMP*	DIVIDE

/

DIVQUO	0

DIVREM	0

/

/ ADROUT -- SUBROUTINE TO CONVERT THE OCTAL ADDRESS (5-DIGITS)

/           IN AC TO IMAGE ALPHA AND STORE THE FIVE RESULTING

/           WORDS STARTING AT THE ADDRESS IN 'MAPX1'

/	  MAPX1 IS LEFT POINTING TO THE LAST CHARACTER

/	  ADDRESS PLUS TWO.

/

ADROUT	0

	RAL			/(RCHM-158)

	DAC	CTRBF

	LAW	-6		/(RCHM-158)

	DAC	CTRC1

ADROT1	LAC	CTRBF

	RAL

	RTL

	DAC	CTRBF

	AND	(007)

	XOR	(060)

	DAC*	MAPX1

	ISZ	MAPX1

	ISZ	CTRC1

	JMP	ADROT1

	ISZ	MAPX1

	JMP*	ADROUT

	.EJECT

/ CTR50 -- SUBROUTINE TO CONVERT THE THREE SIXBIT CHARACTERS IN

/          AC TO RADIX 50 AND LEAVE THE RESULT IN AC

/

CTR50	0

	DAC	CTRBF

	LAW	-3

	DAC	CTRC1

	DZM	CTRAC

CTRLOP	LAC	CTRBF

	RTL

	RTL

	RTL

	RAL

	DAC	CTRCB

	RAR

	DAC	CTRBF

	LAC	CTRCB	/PROCESS .SIXBT CHARACTER (BLANK=00)

	AND	(077)

	AAC -33			/(RCHM-158)

	SPA

	JMP	CTRAZB	/ A-Z  BLANK

	SAD	(23)

	LAC	(24)	/ .

	SAD	(12)

	LAC	(23)	/ %

	SAD	(10)

	LAC	(37)	/ #

	AAC -23			/(RCHM-158)  0-9  .  %  #

CTRAZB	AAC +33			/(RCHM-158) A-Z  BLANK  0-9  .  %  #

	TAD	CTRAC

	ISZ	CTRC1

	SKP

	JMP*	CTR50

	DAC	CTRAC

	LAW	-50

	DAC	CTRC2

	CLA

	TAD	CTRAC

	ISZ	CTRC2

	JMP	.-2

	DAC	CTRAC

	JMP	CTRLOP

/

CTRBF	0

CTRCB	0

CTRAC	0

CTRC1	0

CTRC2	0

 .TITLE *** .SEEK AND .INIT SUBR(S) FOR OUTPUT FILE

/ SEEK -- SUBROUTINE TO PREPARE A FILE TO BE READ.

/         IF FROM A FILE-ORIENTED DEVICE, SEEK FILE.

/         IOPS13 IF FILE NOT FOUND.

/         IF FROM A NON FILE ORIENTED DEVICE, THE REQ'D 

/         FILE NAME IS TYPED OUT, AND CHAIN WAITS FOR

/         A ^P BEFORE READING THE FILE.

/

SEEK	0		/ENTER WITH .DAT SLOT NO IN AC 

	AND	(0777)	/SET .DAT SLOT NOS IN CALLS

	DAC	SKIT

	DAC	SKSK

/

	LAC	SDPTR	/SAVE FILE NAME IN RADIX-50 (FNM1 & FNM2) AND

	DAC	TEMP11	/IN SIX-BIT (T6BW1 & T6BW2) FOR TYPE OUT

	LAC*	TEMP11	/IF A NON-FILE-ORIENTED DEVICE.

	DAC	T6BW1

	JMS	CTR50

	DAC	FNM1

	ISZ	TEMP11

	LAC*	TEMP11

	DAC	T6BW2

	JMS	CTR50

	DAC	FNM2

	SNA

	JMP	SKIT

	LAC	FNM1

	XOR	(400000)

	DAC	FNM1

/

SKIT	.INIT	0,0,0	/INITIALIZE DEVICE HANDLER

	LAC	SKIT+3	/FILE ORIENTED DEVICE (BUF SIZE > 63)?

	AND	(700)

	SNA		/YES -- SEEK FILE 

	JMP	SKCP	/NO -- TYPE NAME & WAIT FOR ^P

SKSK	.SEEK	0,0	/SEEK FILE & EXIT

	JMP*	SEEK

SDPTR=SKSK+2	/EXTERNALLY MODIFIED SEEK DATA POINTED IS

		/WITHIN .SEEK MACRO.

/

SKCP	JMS	TYPE	/TYPE:

	MES620		/ "NON-FILE ORIENTED INPUT DEVICE"		/(RCHM-164)

	JMS EXIT		/ RETURN TO XVM/DOS			/(RCHM-163)

/

/ SEEK DATA TABLE

SKDATA	.SIXBT /------BIN/	/NO INSERTION BETWEEN SEEK DATA TRIPLITS!!

ULNM	.SIXBT /------BIN/	/(RCHM-159) SPOT FOR USER LIBRARY NAME.

SLNM	.SIXBT /------BIN/	/(RCHM-159) SPOT FOR SYSTEM LIBRARY NAME.

DULNM	.SIXBT /.LIBR5/		/(RCHM-159) DEFAULT USER LIBRARY NAME.

DSLNM	.SIXBT /.LIBR@/		/(RCHM-159) DEFAULT SYSTEM LIBRARY NAME.

 .TITLE *** LISTING BUFFERS AND OUTPUT ROUTINES

INBUF	.BLOCK 62

/

OUTBUF	021000

	.BLOCK 41

OUTEND	.

OUTBEG	OUTBUF+2

/

PSNB	004000	/PAUSE NUMBER BUFFER

	.BLOCK 6

	040

/

MAPBUF	017000	/(RCHM-163) MAP LINE HEADER -- WORD-PAIR COUNT IS SET 

	0	/TO 016 IF SIZE IS TO BE OUTPUT

MAPNAM	0		/NAME

	.REPT 12		/(RCHM-163)

	040

MAPFAD	0		/FIRST WORD ADDRESS

	.REPT 6			/(RCHM-158)

	055

	0		/LAST WORD ADDRESS

	.REPT 6			/(RCHM-158)

	040			/(RCHM-159)

	015			/(RCHM-159) SIZE IF SZFLAG IS SET.

	012			/(RCHM-159)

	.REPT 6			/(RCHM-159)

	015

	012

MAPX1	0	/MAP LINE INDEX

/

/ SLIM -- SUBROUTINE TO SET THE CORE LIMITS IN 'SLIMFA' & 'SLIMLA'

/	INTO THE LOAD MAP LINE BUFFER.  IF SZFLAG IS SET, THE

/	SIZE (SLIMLA-SLIMFA+1) IS ALSO SET IN THE MAP LINE.

/

SLIMFA	0	/FIRST WORD ADDRESS

SLIMLA	0	/LAST WORD ADDRESS

/

SLIM	0

	LAC	(MAPFAD)	/(RCHM-156)

	DAC	MAPX1

	LAC	SLIMFA

	JMS	ADROUT

	LAC	SLIMLA

	JMS	ADROUT

	LAC	SZFLAG

	SNA

	JMP*	SLIM

	LAC	SLIMFA

	CMA!IAC			/(RCHM-157)

	AAC 1			/(RCHM-158)

	TAD	SLIMLA

	JMS	ADROUT

	JMP*	SLIM

	.EJECT

/ SHTMAP -- SUBROUTINE TO SET MAP FLAG AND

/           TO SHORTEN MAP LINE TO NAME ONLY

/

SHTMAP	0

	LAC (007000)		/(RCHM-163) SET UP NEW HEADER WORD PAIR.

	DAC	MAPBUF

	DAC	LMFLAG

	LAC (MAPFAD-1)		/(RCHM-166) FETCH ADDRESS TO BE CLOBBERED.

	DAC	MAPX1

	LAC	(015)

	DAC*	MAPX1

	ISZ	MAPX1

	LAC	(012)

	DAC*	MAPX1

	JMP*	SHTMAP

/

/ TYPMAP -- SUBROUTINE TO TYPE A MAP LINE

/           IF MAP FLAG IS SET

/

TYPMAP	0

	LAC	LMFLAG

	SNA

	JMP*	TYPMAP

TMAPZ	.WRITE	TO,3,MAPBUF,0

	.WAIT	TO

	JMP*	TYPMAP

/

/ SUBROUTINE TO PRODUCE A STRAIGHT FORWARD  MAP OUTPUT OF WHATEVER IS IN SYM1,

/ SYM2, WITH STARTING ADDRESS LOADADR AND SIZE SIZE.

/

PRTPRG	XX			/(RCHM-163) ROUTINE ENTRY POINT.

	JMS PSYMSW		/(RCHM-163) SWAP SYMBOLS MAYBE?

	JMS SYMMAP		/(RCHM-163) EXPAND SYM1 AND SYM2, PLUS EXT.

	LAC SIZE		/(RCHM-163) FETCH -SIZE.

	CMA			/(RCHM-163) PRODUCE SIZE -1.

	TAD RELOC		/(RCHM-163) FIGURE OUT LAST ADDRESS.

	DAC SLIMLA		/(RCHM-613) SET UP SLIM.

	LAC RELOC		/(RCHM-163) FETCH FIRST ADDRESS.

	DAC SLIMFA		/(RCHM-163) SET UP SLIM.

	JMS SLIM		/(RCHM-163) EXPAND ADDRESSES.

	JMS TYPMAP		/(RCHM-163) PRINT MAP.

	JMS PSYMSW		/(RCHM-163) SWAP THEM BACK.

	DZM PRG1		/(RCHM-163) DISARM SWAP.

	JMP* PRTPRG		/(RCHM-163) RETURN.

PSYMSW	XX			/(RCHM-163)

	LAC PRG1		/(RCHM-163)

	SNA			/(RCHM-163)

	JMP* PSYMSW		/(RCHM-163)

	LMQ			/(RCHM-163)

	LAC SYM1		/(RCHM-163)

	DAC PRG1		/(RCHM-163)

	LACQ			/(RCHM-163)

	DAC SYM1		/(RCHM-163)

	LAC PRG2		/(RCHM-163)

	LMQ			/(RCHM-163)

	LAC SYM2		/(RCHM-163)

	DAC PRG2		/(RCHM-163)

	LACQ			/(RCHM-163)

	DAC SYM2		/(RCHM-163)

	JMP* PSYMSW		/(RCHM-163)

PRG1	0			/(RCHM-163)

PRG2	0			/(RCHM-163)

 .TITLE *** POINTERS AND FLAGS

/ POINTERS:

 

SYMBEG	0		/TO BEG OF SYMBOL TABLE.

SYMEND	0		/TO LAST SYMTAB REGISTER - 1.

SYMEB1	0		/SYMEND BUFFER (TO RESTORE SYMEND 

			/FOR A NEW LINK)

SYMEB2	0		/SYMEND BUFFER (TO RESTORE SYMEND

			/FOR NON-RELOCATED LIBRARY ROUTINE)

SYMWD1	0		/TO 1ST WORD OF A SYMTAB ENTRY.

SYMPTR	0		/TO SOMEWHERE WITHIN A SYMTAB ENTRY.

LOADADR	0		/PROGRAM'S LOAD ADDRESS.

RELOC	0		/RELOCATION FACTOR.

BUFPTR	0		/TO LINE BUFFER #1 OR #2.

 

/ FLAGS:

 

LIBFLG	0		/SET NON-0 WHEN IN LIBRARY SEARCH MODE.

BLKFLG	0		/SET NON-0 (WITH THE LOAD ADDRESS) WHEN

			/A BLOCKDATA SUBPROGRAM IS BEING LOADED.

 .TITLE *** SUBR USED FOR RELOCATING&OUTPUTING CHAINED PGM

/ STORE -- SUBROUTINE TO EFFECT:  DAC*  LOADADR

/

STORE	0

	DAC	ROPWB

	LAC	LOADADR

	JMS	ROP

	JMP*	STORE

/

/ ROP --  SUBROUTINE TO OUTPUT THE RELOCATED WORD IN ROPWB

/	TO BE LOADED AT THE ADDRESS IN AC.

/

/	RECORD FORMAT:

/	    IOPS BINARY HEADER

/	    SUB-RECORD HEADER	(SUB-RECORDS ARE

/	    RELOCATED WORD(S)	BLOCKS OF CONTIGUOUS

/	    SUB-RECORD HEADER	CORE LOADINGS)

/	    RELOCATED WORD(S)

/	      .         .

/	      .         .

/	    END-OF-RECORD IND.

/	SUB-RECORD HEADER FORMAT:

/	    TYPE CODE (BITS 0-8) & WORD COUNT (BITS 9-17)   CODE=0

/	    LOAD ADDRESS OF FIRST WORD

/

ROP	0			/ENTER WITH ADDRESS IN AC

	DAC	ROPLA

	LAC	ROPFEF		/FIRST ENTRY TEST

	SZA

	JMP	ROP10

	ISZ	ROPFEF

	DZM	ROPBWC

	JMP	ROP35

ROP10	LAC	ROPLA		/BREAK IN ADDRESS SEQUENCE?

	SAD	ROPLLA

	JMP	ROP20		/NO -- SET WORD IN BUFFER

	LAC	OUTEND		/YES -- SET NEW SUB-HDR & WORD IN BUF

	CMA			/IS THERE ROOM IN BUFFER FOR FOUR

	AAC 4			/(RCHM-158) MORE WORDS (HDR,WORD, & END-OF REC)?

	TAD	ROPX1

	SMA

	JMP	ROP30		/NO -- END RECORD & SET WDS IN NEXT BUF

	JMP	ROP40		/YES -- SET THREE WORDS IN BUFFER

/

ROP20	LAC	OUTEND		/IS THERE ROOM IN BUFFER FOR TWO

	CMA			/MORE WORDS (WORD & END-OF-REC)?

	AAC 2			/(RCHM-158)

	TAD	ROPX1

	SMA

	JMP	ROP30		/NO -- END RECORD & SET WORD IN NEXT BUF

	JMP	ROP50		/YES -- SET WORD IN BUFFER

/

ROP30	LAW	-1		/SET END-OF-RECORD INDICATOR (-1) IN

	JMS	ROPSW		/BUFFER AND OUTPUT

	JMS	ROPWOB		/WRITE OUTPUT BUFFER

/

ROP35	LAC	OUTBEG		/SETUP FOR NEW RECORD

	DAC	ROPX1

/

ROP40	LAC	ROPX1		/SET NEW SUB-RECORD HEADER IN BUFFER,

	DAC	ROPX2		/SAVE HEADER INDEX, & SET LAST-

	LAC	(200000)	/LOAD-ADR-PLUS-ONE

	JMS	ROPSW

	LAC	ROPLA

	DAC	ROPLLA

	JMS	ROPSW

/

ROP50	LAC	ROPWB		/SET RELOCATED WORD IN BUFFER, UPDATE

	JMS	ROPSW		/LAST-LOAD-ADR-PLUS-ONE, & AGUMENT SUB-

	ISZ	ROPLLA		/RECORD WORD COUNT

	ISZ*	ROPX2

/

	JMP*	ROP		/EXIT

/

ROPSW	0			/SET WORD SUBROUTINE

	DAC*	ROPX1

	ISZ	ROPX1

	ISZ	ROPBWC

	JMP*	ROPSW

/

ROPWOB	0

	LAC	ROPBWC

	AAC 3			/(RCHM-158)

	JMS	LCS6

	RTL

	AND	(777000)

	DAC	OUTBUF

	JMS	WOB

	DZM	ROPBWC

	JMP*	ROPWOB

/

ROPLA	0			/LOAD ADDRESS

ROPLLA	-1			/LAST LOAD ADDRESS PLUS ONE

ROPFEF	0			/FIRST ENTRY FLAG

ROPX1	0			/BUF INX AT WHICH WORD IS TO BE STORED

ROPX2	0			/INDEX OF LAST SUB-RECORD HEADER

ROPBWC	0			/BUFFER WORD COUNT

ROPWB	0			/WORD BUFFERS

/

/ FROP -- FINISH PARTIAL RECORD STARTED BY ROP

/

FROP	0

	LAC	ROPFEF

	SNA

	JMP*	FROP

	LAW	-1

	JMS	ROPSW

	JMS	ROPWOB

	DZM	ROPFEF

	JMP*	FROP

/

/ WNPPR -- SUBROUTINE TO WRITE A NO PATCH PATCH-RECORD

/

WNPPR	0

	LAC	(002000)

	DAC	OUTBUF

	LAC	(300000)

	DAC	OUTBUF+2

	DZM	OUTBUF+3

	JMS	WOB

	JMP*	WNPPR

/

/ WOB -- SUBROUTINE TO WRITE OUTPUT BUFFER

/

WOB	0

WOB1	.WRITE RO,0,OUTBUF,0

	.WAIT  RO

	JMP*	WOB

/

/ PTBENT -- SUBROUTINE TO ENTER PTBW1 & PTBW2 IN THE PATCH TABLE

/

PTBW1	0	/BITS 0-2 CODE

		/BITS 3-17 ADDRESS

		/	CODE=0 -- STORE THE WORD IN PTBW2

		/		AT ADDRESS

		/	CODE=1 -- SET BITS 5=17 OF THE WORD IN

		/		IN PTBW2 IN BITS 5-17 AT ADDRESS

		/	CODE=2 -- ADD THE BASE OF BLANK COMMON

		/		TO THE WORD IN PTBW2 AND STORE

		/		AT ADDRESS

PTBW2	0	/WORD TO BE STORED PER CODE

		/ IF AN ENTRY FOR AN ADDRESS ALREADY EXISTS, IT

		/WILL BE WRITTEN OVER.

/

PTBENT	0

	LAC	PTBBSE	/SCAN PATCH TABLE FOR AN ENTRY FOR THE

PTBEN1	DAC	PTBX2	/ADDRESS IN PTBW1 BITS 3-17

	SAD	PTBX1

	JMP	PTBEN3	/ADR NOT FOUND (END OF TABLE)

	LAC*	PTBX2

	XOR	PTBW1

	AND	(077777)

	SNA

	JMP	PTBEN2	/ADDRESS FOUND

	LAC	PTBX2

	AAC 2			/(RCHM-158)

	JMP	PTBEN1

/

PTBEN2	LAC	PTBW1	/ENTER PTBW1 & PTBW2 OVER PREVIOUS ENTRY

	DAC*	PTBX2	/FOR SAME ADDRESS

	ISZ	PTBX2

	LAC	PTBW2

	DAC*	PTBX2

	JMP*	PTBENT	/EXIT

/

PTBEN3	LAC	PTBW1	/ADD PTBW1 & PTBW2 TO PATCH TABLE

	DAC*	PTBX1

	ISZ	PTBX1

	LAC	PTBW2

	DAC*	PTBX1

	ISZ	PTBX1

	LAC	SYMEND	/DO SYMBOL AND PATCH TABLES OVERLAP?

	CMA

	TAD	PTBX1

	SPA!SNA

	JMP*	PTBENT	/NO -- EXIT

	LAC	(MES701)/YES -- TERMINAL ERROR

/

/ TERMINAL ERROR WHILE RELOCATING A ROUTINE -- TYPE OUT 

/  THE MESSAGE WHOSE ADDRESS IS IN AC.  FOLLOWED BY

/ A MAP LINE (IF MAP FLAG IS SET).

/ AND EXIT TO MONITOR

/

TERR	AAC -2			/(RCHM-158)

	DAC	.+3

	.WRITE	TO,2,XX,0

	.WAIT	TO

	JMS	TYPMAP

	JMS EXIT		/(RCHM-158)

/

	.LTORG			/(RCHM-156)

%PATCH	.BLOCK 40		/(RCHM-156)

	.END START		/(RCHM-156)
