	.TITLE XVM LINKING LOADER - V1A000
/(ABOVE LINE EDIT 131 JAH)
/ 
/ 
/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 REPONSIBILITY FOR THE USE OR RELIABILITY
/OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
/
	.TITLE PARAMETER ASSIGNMENTS
/
/EDIT #23	10-6-71
/EDIT #24	4-18-74
/     #25	21-JUN-74 BY ED GARDNER.  FIX SO WILL TREAT DEVICE
/		HANDLERS ALREADY LOADED CORRECTLY.
/     #26	11-JUL-74 BY ED GARDNER.  FIX SO WILL DO .FSTAT BEFORE
/		DOING .SEEK TO INPUT FILES, AND GIVE "NAME ERROR" IF
/		FILE NOT FOUND
/	#27	EK	14-JULY-74	CHANGE SIGNON NUMBER
/	#28	EK	26_JULY-74	FORGOT TO CHANGE SIGNON
/					MESSAGE FOR BANK VERSION
/	029	SK	5-AUG-74	FIX X4K/UC15 BIT CONFLICT
/	030	EAG	19-NOV-74	IGNORE NULL FILE NAMES IN COMMAND
/					STRING IF INPUT IS FROM FILE-ORIENTED
/					DEVICE.
/	031	EAG	17-JAN-75	FIX BUG (TYPING GLITCH) IN 030
/	131	JAH	29-MAY-75	XVM CONVERSION
/       132     JAH     25-JUNE-75      CORAL MODIFICATIONS
/	133	JAH	24-JULY-75	TRIM BITS 0-2 OFF START ADDR
/	134	JAH	28-JULY-75	INSERT .LOAD 9 DUPLICATE HANDLER
/					CHECK,ALLOW USER .DAT -1 AND -4 USAGE,
/					PERMIT NON .DAT ASSIGNMENTS
/	135	JAH	29-JULY-75	TURN ON XVM FOR DDT, CLEANUP
/	136	JAH	31-JULY-75	ADD FLEXIBLE NAME LIBRARY CAPABILITY
/	137	JAH	7-AUGUST-75	ELIMINATE EXCESSIVE .INIT'S AND .USER'S
/	138	JAH	18-AUGUST-75	CORRECT SPECIAL .DAT -1, -4, -5 CODE
/	139	JAH	21-AUGUST-75	AVOID HANDLER DUP. IN SYS .DAT SLOTS
/	140	JAH	9-SEPTEMBER-75	USE REAL TEMPS FOR LTEMP5 & LTEMP6
/	141	GAR	17-SEP-75	CHANGE THE LOADING SEQUENCE TO:
/					1.  HANDLERS AND THEN USER LIBRARY
/					    (IF PRESENT).  REPEAT UNTIL NO
/					    GLOBLS RESOLVED.
/					2.  SYSTEM LIBRARY, REPEAT UNTIL NO
/					    GLOBLS RESOLVED.
/					3.  IF UNRESOLVED GLOBLS STILL EXIST
/					    START OVER AT #1.  REPEAT THIS
/					    ENTIRE PROCESS UNTIL A COMPLETE
/					    SCAN OF BOTH LIBRARIES IS MADE
/					    WHERE NO .GLOBLS ARE RESOLVED
/					    FROM EITHER.
/	142	GAR	17-SEP-75	CHANGE HELLO TO 'V1A000'.
/	143	GAR	16-OCT-75	FIX SO THAT .DAT -7'S MASS
/					STORAGE BUSY TABLE (MSBT) ENTRY
/					IS PRESERVED AND NOT CLEARED BY
/					THE LOADER.  THIS IS NECESSARY
/					SO THAT BOSS AND BATCH JOBS CAN
/					READ FROM THE 'CM' PSEUDO-DEVICE.
/
/	144	GAR	31-OCT-75	FIX PROBLEM THAT PREVENTED THE
/					REPEATED SCAN OF THE LIBRARIES.
/					THIS PREVENTED THE LOADING OF HANDLERS
/					OR PROGRAM UNITS REFERENCED BY PROGRAMS
/					IN THE SYSTEM LIBRARY.
/
/%PDP9 DEFINED FOR BANK ASSEMBLY
/
	.IFDEF	%PDP9
PDP9=0
	.ENDC
	.IFUND	PDP9
PDP15=0
	.ENDC
/
IDX=ISZ		/USED WHEN NO SKIP INTENDED.
	.IFUND	.DAT
.DAT=141
	.ENDC
.DATBG=.DAT-15
.DATND=.DAT+11
.SCOM=100
SC.NMF=.SCOM+42		/ NON-RESIDENT MONITOR'S FLAGS.		/(GAR-143)
SC.BOS=.SCOM+52		/					/(GAR-143)
SC.ACT=.SCOM+36		/ NUMBER OF ENTRIES IN MSBT.		/(GAR-143)
SC.BTA=.SCOM+62		/ FIRST ADDRESS OF MSBT.		/(GAR-143)
SC.BTL=.SCOM+63		/ NUMBER OF WORDS PER MSBT ENTRY.	/(GAR-143)
	.IFUND	SCOM20
SCOM20=.SCOM+20
	.ENDC
LDBEG=.	/START OF LINK LOADER.
LTEMP1=.
SCOM2   .DSA    0               
LSMST	.DSA	0		/START OF SYMBOL TABLE.
LSMEND  .DSA    0               /END OF SYMBOL TABLE.
TVSCM5  .SCOM+5                 /.SCOM+5 TRANS. VECTOR.
TVSCM2  .SCOM+2                 /.SCOM+2 TRANS. VECTOR.
	.TITLE LOADER EXIT
/EXIT FROM LINKING LOADER.
LOAD21	CAL 775		/.WAIT ON TTY TO COMPLETE
	12		/MEMORY MAP OUTPUT.
	LAC*	(.SCOM+1		/UPDATE .SCOM+2 TO REGISTER JUST ABOVE RESIDENT KM9 OR TO
	DAC*	TVSCM2		/START OF THIS ROUTINE, LOWEST FREE ADDRESS.
	LAC	LP20
	SNA
	JMP	SCM20
	LAC*	LP20
	XOR*	(SCOM20		/SK-29	SAVE HIGH ORDER 3 BITS OF .SCOM20
	AND	(77777		/SK-29
	XOR*	(SCOM20		/SK-29
	DAC*	(SCOM20
SCM20=.
	LAC*	(.SCOM+1	/*JAH134* IS .DAT SLOT -1, -4
	SAD	LDSIZ		/*JAH134* OR -5 BEING USED BY USER?
	JMP	NOAC0		/*JAH134* YES, DON'T CLEAR .DAT SLOTS
	DZM*	DATMI1		/CLEAR LINKING
	DZM*	DATM4		/LOADER .DAT
	DZM*	DATM5		/SLOTS TO DETECT INADVERTENT USER USE.
NOAC0=.				/*JAH134*
	LAW	-7		/COMPUTE .DAT-16
	TAD	DATM7
	DAC*	(10		/FIRST LOOKED AT WILL BE .DAT-15
	LAC*	(.SCOM+24	/COMPUTE # OF .DAT SLOTS
	CMA
	TAD	(-15
	DAC	LTEMP2		/NEGATIVE OF # OF .DAT SLOTS PLUS 1
NOAC1	LAC*	10
	AND	L77777		/GET .DAT SLOT CONTENTS AND CLEAN OFF
				/UNIT #
	TAD*	IOCONF		/IS THIS .DAT SLOT SET UP?
	SMA!SZA
	ISZ	TMP1		/YES
	ISZ	LTEMP2		/THROUGH?
	JMP	NOAC1		/NO ITERATE
	LAW	-2		/IGNORE .DAT -2,-3
	TAD	TMP1		/COMPUTE # OF ACTIVE SLOTS
	DAC*	(.SCOM+36	/PUT INTO .SCOM+36
	CMA			/SET UP COUNTER FOR ROUTINE TO INITIALIZE
	DAC	TMP1		/THIS BUSY TABLE TO 0
	CLA!SKP			/COMPUTE # OF WORDS IN BUSY TABLE
NOAC2	TAD*	(.SCOM+63		/# OF WORDS PER ENTRY
	ISZ	TMP1		/LAST ENTRY?
	JMP	NOAC2		/NO
	CMA			/COMPUTE COUNTER FOR INITIALIZATION
	TAD	(1
	DAC	SIZE		/SIZE OF CORE TO BE ALLOCATED FOR BUSY TABLE.
	DAC LTEMP2		/FOR LATER CLEARING OF BUSY TABLE.
	LAC LSCN01		/'CLA' AN EFFECTIVE NOP TO AVOID A CHECK
	DAC FITNOP		/AGAINST OVERLAYING THE SYMBOL TABLE.
	DZM	COMFLG		/*JAH132* TREAT BUSY TABLE AS NORMAL
	JMS	FIT		/SEE IF BUSY TABLE FITS.
	LAC LRELOC
	DAC*	(.SCOM+62	/START OF BUSY TABLE.
	TAD M1
	DAC* (10		/ALL SETUP TO CLEAR BUSY TABLE.
	LAC	LPRES4		/*JAH131* FIRST FREE LOCATION
	DAC*	(.SCOM+76	/*JAH131* BEYOND BOOTSTRAP
	SAD	(-1		/*JAH131* ANY FREE LOCS. ABOVE BOOT. ?
	DAC*	(.SCOM+77	/*JAH131* NO, SET ALL FULL INDICATOR
	LAC	LPRES		/LAST FREE ADDRESS PUT IN .SCOM+3
	DAC*	(.SCOM+3
	LAC*	(.SCOM+6
	AND	L77777		/*JAH133* TRIM OFF CODE BITS
	DAC	NOLOAD		/USER START ADDRESS.
	LAC*	(.SCOM+6	/*JAH133* FETCH START ADDR WITH CODE
	SMA!RAL
	JMP	LOAD30		/NOT $DDT
	LAC	LSMST		/START OF SYM. TAB.
	DAC*	(.SCOM+11	/SAVED FOR DDT.
	LAC	LSMEND		/HIGH ADDR.
	DAC*	TVSCM2		/SAVED FOR DDT.
	LAC LTEMP2		/PASS DDT THE SIZE OF
	DAC* (.SCOM+10		/BUSY TABLE FOR LATER CLEARING.
	LAC*	(.SCOM+4	/*JAH135* IS SYSTEM
	AND	(1		/*JAH135* IN XVM
	SNA			/*JAH135* MODE?
	JMP*	TVSCM5		/*JAH135* NO, GO TO DDT
	.XVMON			/*JAH135* YES, ENTER USER MODE
	JMP* TVSCM5		/GO TO DDT.
LOAD30=.
	DAC LTEMP8		/SAVE LOAD/GLOAD INDICATOR.
	DZM* 10			/MUST CLEAR THE BUSY TABLE.
	ISZ LTEMP2		/SIZE OF TABLE IN LTEMP2.
	JMP .-2
/								/(GAR-143)
/	IN ORDER THAT BOSS AND BATCH JOBS CAN READ FROM THE	/(GAR-143)
/	'CM' PSEUDO-DEVICE, IT IS NECESSARY TO PRESERVE THE	/(GAR-143)
/	.DAT -7 MASS STORAGE BUSY TABLE ENTRY.  IT IS ASSUMED	/(GAR-143)
/	THAT IF .DAT -7 HAS A MSBT ENTRY THAT IT WILL ALWAYS 	/(GAR-143)
/	BE THE FIRST ONE.  IF THERE IS NOT A .DAT -7 ENTRY,	/(GAR-143)
/	THERE SHOULD BE NO ENTRIES AND THE COPYING OF ZEROES	/(GAR-143)
/	WILL HAVE NO EFFECT.					/(GAR-143)
/								/(GAR-143)
	LAW	-1		/ 				/(GAR-143)
	TAD*	(SC.BTA)	/ COMPUTE THE ADDRESS OF THE	/(GAR-143)
	DAC*	(10)		/ MSBT-1, SET UP AIL10.		/(GAR-143)
	LAW	-1		/				/(GAR-143)
	TAD	SVMSBT		/ COMPUTE THE ADDRESS OF THE	/(GAR-143)
	DAC*	(11)		/ PREVIOUS MSBT-1, SET UP AIL11.	(GAR-1439
	LAC*	(SC.BTL)	/ GET THE NO. OF WORDS TO MOVE.	/(GAR-143)
	TCA			/				/(GAR-143)
	DAC	LTEMP2		/				/(GAR-143)
MSLP	LAC*	11		/ MOVE IT ...			/(GAR-143)
	DAC*	10		/ OVER TO THE MSBT.		/(GAR-143)
	ISZ	LTEMP2		/ INCR. COUNTER.		/(GAR-143)
	JMP	MSLP		/ NOT DONE, CONTINUE.		/(GAR-143)
	LAC LTEMP8
	SMA			/*JAH131* GLOAD?
	JMP	OUTBF3		/*JAH131* NO, LOAD
	LAC*	(.SCOM+4	/*JAH131* IS SYSTEM IN
	AND	(1		/*JAH131* XVM
	SNA			/*JAH135* MODE?
	JMP*	NOLOAD		/*JAH135* NO, GO TO USER DIRECTLY
	.XVMON			/*JAH135* YES, ENTER USER MODE
	JMP*	NOLOAD		/$GLOAD - GO TO USER.
OUTBF3	IDX	WRBFPT		/CHANGE ^P TO ^S
	JMP	PRTEOM
	.TITLE BUFFERS, TEMPORARY STORAGE
LTEMP4	373720			/ASCII '>'<175>
LTEMP3	0
LTEMP2	0			/GENERAL TEMP. STORAGE 2.
LTEMP5	0			/*JAH140*
LTEMP6	0			/*JAH140*
LTEMP7	0
LTEMP8	0
TEMP	0			/*JAH132*
WDCNT	0			/LINE BUFFER WORD COUNT.
				/ALSO USED AS TEMP. STORE.
LIBDIR	561411		/.LI 
LIBDR1	022265		/BR5
	021116		/BIN
	.IFUND	PDP9
OUTBUF	.SYSID <	.ASCII 'LOADER >,<000'<175>>	/*JAH140*(GAR:141)(GAR:142)
	.ENDC
	.IFDEF	PDP9
OUTBUF	.SYSID <	.ASCII 'BLOADER >,<000'<175>>	/*JAH140*(GAR:141)(GAR:142)
	.ENDC
LOCNT	0		/LOCAL SYMBOL COUNT FOR COMMON OVERLAYS.
NOLOAD	.DSA	000000		/ SELECTIVE LOADING FLAG
LBDF	.DSA	0		/ BLOCK DATA SUBPROGRAM FLAG
LN2BUF	.DSA	L2BUFF		/ ADDRESS LINE BUFFER---2
DDTMDE	.DSA	0		/ NEGATIVE DURING LOADING OF DDT.
CWDTAL	.DSA	000000		/NON-ZERO IF NO SYMBOLS
LRELOC	.DSA	777777		/ *JAH132* CURRENT RELOCATION FACTOR
				/ *JAH132* -1 INDICATES CODE 1 NOT READ YET
SAVRLC	.DSA	777777		/ *JAH132* PROGRAM RELOCATION FACTOR
LIM	.DSA	777777		/ *JAH132* PROGRAM OR COMMON BLK LAST LOC + 1
				/ *JAH132* -1 INDICATES MODULE NOT LOADED YET
PLIM	.DSA	777777		/ *JAH132* PROGRAM LAST LOCATION + 1
LMAIN	.DSA	000000		/ MAIN PROG. LOADING FLAG
LPLA	.DSA	000000		/ ADDRESS GENERATED BY CODE 2 DATA WORD
LSYM1	.DSA	000000		/ FIRST WORD OF SYMBOL TEMPORARY STORAGE
LSYM2	.DSA	000000		/ SECOND WORD OF SYMBOL TEMPORARY STORAGE.
LSYM3	0			/SOURCE EXTENSION OF PROGRAM
RESG	1			/INDICATOR OF WHETHER A .GLOBL WAS
				/WAS SATISFIED IN LAST LIBRARY SEARCH
RESGLB	0			/(GAR:141) USED WHILE LOADING FROM THE LIBRARY(S)
				/(GAR:141) TO TELL IF ANY GLOBLS WERE
				/(GAR:141) RESOLVED FROM EITHER LIBRARY DURING
				/(GAR:141) THE LAST SCAN.  IF 'RESGLB' = 0
				/(GAR:141) THEN NONE WERE RESOLVED.
TLSMST	.DSA	0		/ TEMP. START OF SYM. TAB.
LSMW1	.DSA	000000		/ PRESENT STORE ADDRESS OF SYMBOL TABLE.
LSMPT	.DSA	000000		/ PRESENT WORD COUNTER IN SYMBOL ENTR.
LSMDEF	.DSA	000000		/ SYMBOL TAPE AND DEFINITION
LPRES	.DSA	0		/ HIGHEST FREE ADDRESS.
LDSIZ	.SIZE			/THIS REGISTER USED FOR OVERLAYING
				/HANDLERS WHEN THEY ARE UNEEDED
.32K	100000			/*JAH131* 32K WORDS
M.32K	700000			/*JAH131* -32K WORDS
DEFBIT	0			/*JAH135* USED BY CODE 22 TO SAVE BITS 1&2
FINLIB	0			/(GAR:141) IF ZERO, SCAN SYSTEM LIBRARY NEXT.
				/(GAR:141) IF NON-ZERO, SCAN HANDLERS AND
				/(GAR:141) USER LIBRARY NEXT.
USYM1	0			/*JAH136* USER LIBRARY NAME - 1ST 3 CHARS
USYM2	0			/*JAH136* USER LIBRARY NAME - 2ND 3 CHARS
SSYM1	0			/*JAH136* SYSTEM LIBRARY NAME - 1ST 3 CHARS
SSYM2	0			/*JAH136* SYSTEM LIBRARY NAME - 2ND 3 CHARS
COLCHK	0			/*JAH136*  OPTION CHARACTER READ STATUS
				/*JAH136*  '0 = HAVE JUST READ L FROM UL OR SL OPTION
				/*JAH136* 0  = OTHER
LSWCH	0			/*JAH136* OPTION CHARACTER READ STATUS
				/*JAH136* '0 = HAVE JUST READ U OR S FROM UL OF SL OPTION
				/*JAH136* 0 = OTHER
				/*JAH136* 0 = OTHERWISE
NAM1	0			/*JAH139* .DAT SLOT -1 HANDLER NAME 1ST 2 CHARS
NAM4	0			/*JAH139* .DAT SLOT -4 HANDLER NAME - 1ST 2 CHARS
NAM5	0			/*JAH139* .DAT SLOT -5 HANDLER NAME - 1ST 2 CHARS
SAVNAM	0			/*JAH139* FILE NAME TEMP
SVMSBT	0		/ USED TO SAVE ADDRESS OF MSBT.		/(GAR-143)
	.EJECT
	.IFUND	PDP15
/
/HIGHEST FREE ADDRESS IN EACH OF THE
/FOUR MEMORY BANKS.
LPRES4	0			/*JAH131* FIRST FREE LOCATION ABOVE BOOTSTRAP
LPRES3	77777
LPRES2	57777
LPRES1	37777
LPRES0	17777
LPRESS	LPRES3-1
LPRESP	0
LP20	0
/
	.ENDC
	.IFDEF	PDP15
/
/HIGHEST FREE ADDRESS IN EACH
/OF THE EIGHT 4K MEMORY BANKS.
/
LPRES4	0	/*JAH131* FIRST FREE LOCATION ABOVE BOOTSTRAP
LPRES3	77777
	67777
LPRES2	57777
	47777
LPRES1	37777
	27777
LPRES0	17777
	07777
LPRESS	LPRES3-1
LPRESP	0
LP20	0		/NONZERO (POINTS TO FIRST FREE
				/ODD PAGE)WHEN EXTRA 4 K IS PRESENT
/
	.ENDC
LSTRNG=STSYM2			/ STRING CODE (FIRST HALF)
LCMDEF=STSYM2+1			/ ADDRESS OF COMMON BLOCK DEFINITION
LCMCHN=STSYM2+2			/ COMMON CHAIN ADDRESS (TEMP. STORAGE).
LCHN1=STSYM2+3			/ TRANSFER VECTOR ADDRESS (TEMP. STOR.).
LCHN2=STSYM2+4			/ RELATIVE ADDRESS, COMMON NAME (TEMP. STOR.)
LDATA1=STSYM2+5
LDATA2=STSYM2+6
LDATA3=STSYM2+7
RECDIN=STSYM2+10
SIZE	0		/*JAH131* 2'S COMP OF SELECTED MODULE SIZE
PSIZE	0		/*JAH132* 2'S COMP OF PROGRAM SIZE
CSIZE	0		/*JAH132* 2'S COMP OF COMMON BLK SIZE (CODE 28)
CHK9	0		/*JAH134* TEMP. USED TO POINT TO SYM TABLE ENTRY
CHK9A	0		/*JAH134* TEMP. USED TO POINT TO SYM TABLE ENTRY
RSIZE	0		/*JAH131* ACTUAL SIZE OF MODULE
TMPEND	0			/*JAH133* USED IN LOADING OF COMMON BLOCKS
/LINE BUFFER #1
LNBUFF=.			/LINE BUFFER 50 (DECIMAL) WORDS.
DDTDIR	040424			/ DDT
	0
LNBUF2	021116			/ BIN
TLITRL	XCT+CNTL.T		/ADR. FOR ^T TRANFER+BIT0=1
	.TITLE LOADER INITIALIZATION (START)
/LINKING LOADER
/ INITIALIZATION
/
.LOAD=.
	LAC*	(.SCOM+62		/COMPUTE WHETHER MASS STORAGE
	DAC	SVMSBT		/ SAVE ADDRESS OF MSBT.		/(GAR-143)
	SAD	LDSIZ		/BUSY TABLE IS ABOVE .LOAD
	SKP!CLC		/IT IS ABOVE .LOAD
	JMP	.LO1		/NO IT ISN'T
	TAD*	(.SCOM+36	/ADD BUSY TABLE TO TOP OF .LOAD
	CMA
	DAC	TLSMST		/COUNTER FOR COMPUTING SIZE OF BUSY TABLE
	LAC	LDSIZ		/START OUT WITH TOP OF LOADER
	TAD*	(.SCOM+63	/ADD FIRST ENTRY
	ISZ	TLSMST		/LAST?
	JMP	.-2		/NO; ITERATE
	DAC	LDSIZ		/NEW END OF .LOAD
.LO1=.
	LAC*	TVSCM2		/COMPUTE FIRST ADRESS OF IOC...
	DAC	TLSMST		/ SYMBOL TABLE START
	DAC	LSMST
	DAC	LSMEND		/ SYMBOL TABLE END
	TAD M1		/(-1
	DAC	IOCONF		/IOC POINTER.
	DAC*	(10		/FOR CLEARING HIGH CORE
	TAD*	IOCONF		/BY OVERLAYING THE LOADER
	SAD	LDSIZ		/THIS CODE ELIMINATES OVERLAYING
	LAC	(LDBEG		/HANDLERS WHEN NEEDED.  IF THE HANDLERS
				/ALTHOUGH LOADED BEFORE .LOAD ARE
				/HIGHER IN CORE THAN .LOAD, THIS FACT
				/MEANS THAT OVERLAYING .LOAD SHOULD BE
				/AVOIDED.  THIS INSTRUCTION INDICATES
				/THAT OVERLAYING .LOAD IS PERMISABLE
	DAC	LDSIZ		/OVERLAYING IOC TABLE ALWAYS OK.
	LAC*	(.SCOM+3		/ FETCH .SCOM + 3 FOR ...
	DAC	LPRES		/ PRESENT LOAD ADDRESS
	DZM*	10		/ZERO FREE CORE.
	SAD*	(10
	SKP
	JMP	.-3
/ROUTINE TO 0 MEMORY PAGE ADDRESSES OF MEMORY BANKS/PAGES THAT DO NOT EXIST.
	LAC	LPRESS	/ADDRESS -1 OF BLOCK OF ADDRESSES
	DAC	LPRESP
BANK1	IDX	LPRESP
	LAC*	LPRESP
	DAC*	(10		/FOR CLEARING XTRA 4K IF PRESENT
	DZM*	LPRESP
	XOR	LPRES	/.SCOM+3
	.IFUND	PDP9
	AND	(70000		/PAGE MASK
	.ENDC
	.IFDEF	PDP9
	AND	(60000
	.ENDC
	SZA
	JMP	BANK1	/.SCOM+3 NOT POINTING TO THIS PAGE
	LAC	LPRES
	DAC*	LPRESP	/AVOID BOOTSTRAP
	LAC*	(.SCOM+76	/*JAH131* FIRST AVAILABLE LOCATION
	DAC	LPRES4		/*JAH131* ABOVE BOOTSTRAP
/*JAH131* XVM DOES NOT SUPPORT XTRA 4K SO FOLLOWING INSTRUCTIONS NOT NEEDED
/	LAC*	(SCOM20
/	SMA!CLA!CMA
/	JMP	BANK2		/NO XTRA 4K
/XTRA 4K, CORRECT ADDRESS TABLE AND CLEAR CORE.
/	TAD	LPRESP		/BACKUP POINTER.
/	DAC	LP20
/	LAW	-10000
/	DAC	LTEMP2
/	DZM*	10		/CLEAR XTRA 4K
/	ISZ	LTEMP2
/	JMP	.-2
/	LAC*	(10
/	DAC*	LP20		/CORRECT ADDRESS TABLE ENTRY.
/BANK2=.
	LAW	-7		/COMPUTE .DAT AT RUN TIME FOR LOADER
	TAD*	(.SCOM+23	/ADDRESS OF .DAT STORED IN .SCOM+23
	DAC	DATM7		/.DAT-7
	TAD	(2
	DAC	DATM5
	TAD	(1
	DAC	DATM4
	TAD	(1
	DAC	DATM3
	TAD	(2
	DAC	DATMI1
	TAD	(1
	DAC	DAT.
	CLC			/COMPUTE .UFD-1
	TAD*	(.SCOM+25
	DAC	M1UIC		/PERFORM INDIRECTION
	LAC*	M1UIC		/AC CONTAINS UIC
	DAC	M1UIC		/PUT IT INTO .USER CAL
	LAC*	(.SCOM+24		/COMPUTE # OF + .DAT SLOTS
	TAD*	(.SCOM+23	/FOR TESTING .IODEV SLOTS FOR FIT
	CMA
	DAC	MDATND		/THIS IS THE NEGATIVE OF THE ADDRESS OF
				/THE FIRST LOCATION BEYOND THE HIGHEST
				/.DAT SLOT LOCATION
	TAD*	(.SCOM+24	/NEGATIVE OF .DAT+0
	TAD	(16		/NEGATIVE OF .DAT-15
	DAC	MDATBG
	LAW	-1		/*JAH139* CALCULATE
	TAD*	IOCONF		/*JAH139* POINTER TO
	TAD	IOCONF		/*JAH139* HANDLER 
	DAC	SAVNAM		/*JAH139* NAME
	LAC*	(.SCOM+7	/*JAH139* CALCULATE
	TAD	SAVNAM		/*JAH139* TRUE PTR
	DAC	LSYM1		/*JAH139* HANDLER NAME
	LAC	(NAMTMP		/*JAH139* DESTINATION OF 1ST
	DAC	LTEMP6		/*JAH139* 3 CHARS OF NAME
	LAC*	LSYM1		/*JAH139* FETCH 1ST 3 CHARS IN RADIX
	AND	(177777		/*JAH139* GET RID OF EXTRANEOUS BITS
	JMS	CONWRD		/*JAH139* CONVERT TO 1 CHAR/WORD
	LAC	NAMTMP		/*JAH139* FETCH FIRST CHAR
	SWHA			/*JAH139* PLACE IN LEFT BYTE
	XOR	NAMTMP+1	/*JAH139* POP IN SECOND CHAR
	DAC	NAM1		/*JAH139* SAVE FOR HANDLER LOADING ROUTINE
	LAC*	(.SCOM+10	/*JAH139* CALCULATE
	TAD	SAVNAM		/*JAH139* TRUE PTR
	DAC	LSYM1		/*JAH139* HANDLER NAME
	LAC	(NAMTMP		/*JAH139* DESTINATION OF 1ST
	DAC	LTEMP6		/*JAH139* 3 CHARS OF NAME
	LAC*	LSYM1		/*JAH139* FETCH 1ST 3 CHARS IN RADIX
	AND	(177777		/*JAH139* GET RID OF EXTRANEOUS BITS
	JMS	CONWRD		/*JAH139* CONVERT TO 1 CHAR/WORD
	LAC	NAMTMP		/*JAH139* FETCH FIRST CHAR
	SWHA			/*JAH139* PLACE IN LEFT BYTE
	XOR	NAMTMP+1	/*JAH139* POP SECOND CHAR IN RIGHT BYTE
	DAC	NAM4		/*JAH139* SAVE FOR HANDLER LOADING ROUTINE
	LAC*	(.SCOM+11	/*JAH139* CALCULATE
	TAD	SAVNAM		/*JAH139* TRUE PTR
	DAC	LSYM1		/*JAH139* HANDLER NAME
	LAC	(NAMTMP		/*JAH139* DESTINATION OF 1ST
	DAC	LTEMP6		/*JAH139* 3 CHARS OF NAME
	LAC*	LSYM1		/*JAH139* FETCH 1ST 3 CHARS IN RADIX
	AND	(177777		/*JAH139* GET RID OF EXTRANEOUS BITS
	JMS	CONWRD		/*JAH139* CONVERT TO 1 CHAR/WORD
	LAC	NAMTMP		/*JAH139* FETCH FIRST CHAR
	SWHA			/*JAH139* PLACE IN LEFT BYTE
	XOR	NAMTMP+1	/*JAH139* POP SECOND CHAR IN RIGHT BYTE
	DAC	NAM5		/*JAH139* SAVE FOR HANDLER LOADING ROUTINE
	LAC*	(.SCOM+6
	SMA
	JMP	LOAD02		/ NOT A SYSTEM LOAD
	DAC	DDTMDE		/ NEGATIVE DURING DDT LOAD.
	.EJECT
/THIS SPACE IS RESERVED FOR THE MEANS WHEREBY A PROGRAM IS
/LOCATED AND POSITIONED FOR INPUT---.SEEK WITH DDT ENTRY BLOCK.
/
/.INIT -1
	CAL	777
	1
	LLCTLP			/CONTROL P RETURN.
	0
/.SEEK	-1, DDTDIR
DATM1	CAL	777
	3
	DDTDIR
	LAC	DATM1	/INITIALIZE READ MACRO TO INPUT FROM THE
	DAC	LL010		/ SYSTEM DEVICE (.DAT SLOT -1).
	LAC	TLITRL		/BIT0=1; ^T XFER ADR.
	DAC	DDTCTL		/^T INIT FOR ENTRY TO DDT.
	JMS	LL000		/ LOAD SYSTEM PROGRAM - DDT
/BUFFER #1 ENDS HERE.
	DAC*	TVSCM5		/PUT STARTING ADDRESS IN .SCOM+5
	DAC	TVSCM5		/*JAH140* NO LONGER LTEMP6
/.CLOSE	-1
/BUFFER #2 BEGINS HERE.
L2BUFF=.
	CAL	777
	6
	LAC	DDTMDE		/BIT 2=1 OF DDTNS, LOAD, OR GLOAD
LOAD02	AND	(100000
	DAC	DDTMDE		/NON-0 IF NO SYMBOLS LOADED
	.TITLE READ COMMAND STRING
/FETCH COMMAND INPUT FROM KEYBOARD OR BATCH DEVICE
/RETURN TO 'RESTART' ON CONTROL P TO START FRESH COMMAND STRING
RESTART	LAC TLSMST	/RESTART COMMAND STRING BY
	DAC LSMEND	/RESETTING END OF SYM. TAB. POINTER
	DZM	PSWCH
	DZM	GSWCH
	DZM	CSWCH
	DZM	OPSWCH
/.INIT -3
	CAL 1775		/PRINT CAR. RET. LIN. FD. ON TTY.
	1
	RESTART		/CONTROL P RESTART ADR.
SYMFLG	0		/USED BELOW TO FLAG FULL SYMBOL
/.WRITE -3,2,OUTBUF-2,6
	CAL 2775		/IOPS ASCII TO TTY
	11
	OUTBUF-2		/PRINT 'LOADER V?A'
L175	175		/ASCII FOR ALT MODE.
/.INIT -3
	CAL 1775		/PRINT CAR. RET. LIN. FD. ON TTY.
	1
DDTCTL	RESTART		/IF DDT LOADED, THIS ADR WILL BE
	0		/^T TRANSFER ADR.
/.WRITE -3,3, OUTBF3,4
LOAD03	CAL 2775		/IOPS ASCII TO TTY.
	11
	OUTBF3		/PRINT '>' TO TELL USER
BUFPTR	LNBUF2		/TO TYPE IN COMMAND STRING
/.READ -2,2 LNBUFF,50.
	CAL 2776		/IOPS ASCII FROM TTY OR BATCH DEVICE
	10
	LNBUFF		/READ A LINE INTO BUFFER #1.
	-62
/.WAIT -2
	CAL 776		/WAIT FOR LINE TO BE READ IN
	12
	LAC BUFPTR	/INIT. LINE BUFFER PTR.
	DAC LTEMP1
	LAW -1		/INIT. 5/7 CHAR. BYTE COUNT.
	DAC LTEMP2
LOAD04	DZM SYMFLG	/SYMBOL FLAGGED "NOT FULL."
	DZM WDCNT		/CLEAR WORD TERMINATOR.
	LAW -2
	DAC LTEMP3	/INIT. 2-WORD SYMBOL COUNT.
	DZM LSYM2		/INIT. TEMP. SYM. AC.
SET3	LAW -3
	DAC LTEMP8	/INIT. 3 CHAR. PER WORD COUNT.
	SKP
NAMEND	DAC WDCNT		/SAVE TERMINATOR.
GETCHA	CLA!CLL
	SAD WDCNT		/SKIP IF WORD TERMINATED.
	JMP GETIT
	SAD SYMFLG	/SKIP IF SYMBOL FULL.
	JMP JUSTFY	/FILL REM. OF SYM. WITH 0'S
	JMP	CHKLIB		/*JAH136* CHECK FOR NEW LIBRARY NAME
GETIT	ISZ LTEMP2	/SKIP IF BYTE COUNT RUNS OUT
	JMP GETNEX
/BUFFER #2 ENDS HERE.
	LAW -5
	DAC LTEMP2	/RESET BYTE COUNT TO 5.
	LAC* LTEMP1	/GET NEXT 5/7 WORD PAIR
	DAC LTEMP5	/WORD 1
	IDX LTEMP1
	LAC* LTEMP1
	DAC LTEMP6	/WORD 2
	IDX LTEMP1
GETNEX	LAW -10
	DAC LTEMP7	/SET COUNT TO DO 7+1/2 SHIFTS
ROTMOR	LAC LTEMP6	/SHIFT WORD 2 WITH LINK
	RAL
	ISZ LTEMP7	/SKIP IF CHAR IN POSITION
	JMP DOWRD1
	AND OCT177	/MASK TO 7 BITS
	DAC LTEMP7	/SAVE FOR REFERENCE
	LAC	OPSWCH
	SZA
	JMP	NAMES
	SAD	LSWCH		/*JAH136* WAS U OR S OF UL OR SL OPTION JUST READ?
	SKP			/*JAH136* NO
	JMP	SCHECK		/*JAH136* YES, GO CHECK FOR FOLLOWING L
	LAC	LTEMP7
	SAD	(125		/*JAH136* U FOR UL OPTION?
	DAC	LSWCH		/*JAH136* YES, NOTE THIS
	SAD	(123		/*JAH136* S FOR SL OPTION?
	DAC	LSWCH		/*JAH136* YES, NOTE THIS
METLET	SAD	(103		/*JAH136* C
	DAC	CSWCH
	SAD	(107	/G
	DAC	GSWCH
	SAD	(120	/P
	DAC	PSWCH
	SAD	(137	/_ OPTION TERMINATION
	DAC	OPSWCH
	SAD	L175	/ALT. MODE
	JMP NAMERR		/NO INPUT FILES--ERROR
	SAD	PLUS15	/CR RET
	JMP	LOAD03
	JMP	GETCHA
SCHECK	SAD	COLCHK		/*JAH136* HAS L BEEN READ?
	SKP			/*JAH136* NO
	JMP	CCHECK		/*JAH136* YES, GO CHECK FOR COLON
	LAC	LTEMP7		/*JAH136* LOAD CHAR
	SAD	(114		/*JAH136* IS IT AN L FOR LIBRARY?
	SKP			/*JAH136* YES
	JMP	NOTSC		/*JAH136* NO, ILLEGAL OPTION SYNTAX
	DAC	COLCHK		/*JAH136* TAKE NOTICE THAT WE'VE READ L
	JMP	GETCHA		/*JAH136* GO FETCH NEXT CHAR
CCHECK	LAC	LTEMP7		/*JAH136* LOAD CHAR
	SAD	(072		/*JAH136* IS IT A COLON?
	SKP!CLA!IAC		/*JAH136* YES
	JMP	NOTSC		/*JAH136* NO, ILLEGAL OPTION SYNTAX
	DAC	OPSWCH		/*JAH136* TRICK INTO READING SYMBOL
	JMP	GETCHA		/*JAH136* FETCH NEXT CHAR
NOTSC	DZM	COLCHK		/*JAH136* INITIALIZE
	DZM	LSWCH		/*JAH136* LIBRARY VARS.
	LAC	LTEMP7		/*JAH136* LOAD CHAR
	JMP	METLET		/*JAH136* PROCESS AS NEW OPTION
NAMES	LAC	LTEMP7
	SAD (54		/COMMA
	JMP NAMEND
	SAD	(137		/*JAH136* BACK-ARROW POSSIBLE FOR LIBRARY OPTION
	JMP	NAMEND		/*JAH136* YES
	SAD L175		/ALT MODE
	JMP NAMEND
	SAD PLUS15	/CAR. RET.
	JMP NAMEND
	SAD PLUS12	/IGNORE LINE FEED
	JMP GETCHA
	SAD SPACE		/IGNORE SPACE
	JMP GETCHA
NAMEM	LAC SYMFLG	/*JAH136* IGNORE IF SYMBOL FULL
	SZA!CLL
	JMP GETCHA
	LAC LTEMP7	/TRIM CHAR. TO SIXBIT
	AND (77
JUSTFY	XOR LSYM2		/ADD IN ACCUMULATED SYMBOL.
	ISZ LTEMP8	/SKIP IF HAVE 3 CHARS
	JMP LDROTA
	ISZ LTEMP3	/SKIP IF SYM. FULL.
	JMP HAFFUL
	IDX SYMFLG	/NON-ZERO TO FLAG MEANS FULL
	JMP STSYM2
HAFFUL	DAC LSYM1		/SAVE FIRST HALF
	DZM LSYM2
	JMP SET3		/RESET 3-CHAR. PER WORD COUNT
LDROTA	RTL		/SHIFT PARTIAL SYMBOL WORD LEFT 6.
	RTL
	RTL
STSYM2	DAC LSYM2		/THIS + NEXT 8 REGS. ARE USED
	JMP GETCHA	/LATER ON FOR TEMP STORAGE
DOWRD1	DAC LTEMP6	/WORD 2.
	LAC LTEMP5	/WORD 1.
	RAL
	DAC LTEMP5
	JMP ROTMOR
NAMERR	.WRITE -3,2,NAMMSS,NAMMSL	/FILE NOT FOUND OR NO FILES
	JMP RESTART			/IN COMMAND STRING--ERROR
 
NAMMSS	NAMMSL*400
	0
	.ASCII /    NAME ERROR/<015>
NAMMSL=.-NAMMSS
CHKLIB	CLA			/*JAH136* WAS PAST SYMBOL
	SAD	COLCHK		/*JAH136* A USER LIBRAY NAME?
	JMP	ENTERS		/*JAH136* NO, GO PUT IN SYMBOL TABLE
	LAC	LSWCH		/*JAH136* WAS THIS OPTION
	SAD	(125		/*JAH136* A UL?
	JMP	SUNAM		/*JAH136* YES
SSNAM	LAC	LSYM1		/*JAH136* FETCH 3 CHARS OF NAME
	DAC	SSYM1		/*JAH136* AND STORE AWAY
	LAC	LSYM2		/*JAH136* FETCH ANOTHER 3 CHARS OF NAME
	DAC	SSYM2		/*JAH136* AND STORE AWAY
	JMP	DONLIB		/*JAH136* CLEAN UP LIBRARY VARS.
SUNAM	LAC	LSYM1		/*JAH136* FETCH 3 CHARS OF NAME
	DAC	USYM1		/*JAH136* AND STORE AWAY
	LAC	LSYM2		/*JAH136* FETCH ANOTHER 3 CHARS OF NAME
	DAC	USYM2		/*JAH136* AND STORE AWAY
DONLIB	DZM	COLCHK		/*JAH136* CLEAR L INDICATOR
	DZM	LSWCH		/*JAH136* CLEAR : INDICATOR
	DZM	OPSWCH		/*JAH136* GET BACK TO OPTION MODE
	DZM	SYMFLG		/*JAH136* SYMBOL FLAGGED "NOT FULL"
	DZM	WDCNT		/*JAH136* CLEAR WORD TERMINATOR
	LAW	-2		/*JAH136* 
	DAC	LTEMP3		/*JAH136*INIT. 2-WORD SYMBOL COUNT
	DZM	LSYM2		/*JAH136* INIT TEMP SYM AC
	LAW	-3		/*JAH136*
	DAC	LTEMP8		/*JAH136* INIT 3 CHAR PER WORD COUNT
	LAC	LTEMP7		/*JAH136* FETCH LAST CHAR READD
	SAD	(137		/*JAH136* WAS IT A BACK-ARROW?
	ISZ	OPSWCH		/*JAH136* YES, MOVE TO RIGHT SIDE OF ARG
	JMP	GETCHA		/*JAH136* NO, FETCH NEXT OPTION SWITCH
 
 
 
ENTERS	LAC LSMEND		/SAVE ADDRESS OF FILE NAME (IN SYMBOL
	DAC NAMPTR		/     TABLE) TO DO .FSTAT LATER.  ALSO TO
				/     RESTORE LSMEND IF NULL FILE NAME IS
				/     IGNORED
	LAC LSYM1		/ENTER FILENAME IN SYMTAB
	JMS LSTSYM
	LAC LSYM2
	JMS LSTSYM
	LAC LIBDIR+2	/WITH EXTENSION NAME 'BIN'.
	JMS LSTSYM
	.INIT -4,0,RESTART	/CHECK TO SEE THAT FILE EXISTS
/	.FSTAT -4,*LSMEND
	CAL+3000 -4&777
	2
NAMPTR	0			/POINTER TO FILE NAME IN SYMBOL TABLE
	SZA
	JMP CHKTRM		/AC NOT 0 => FILE EXISTS OR NON-FILE 
				/	STRUCTURED DEVICE
	LAC NAMPTR		/AC=0   IS .DAT -4 DEVICE FILE STRUCTURED?
	AND (700000
	SNA
	JMP CHKTRM		/NON-FILE STRUCTURED, SO OK
	LAC LSYM1		/FILE NOT FOUND--CHECK FOR NULL FILE NAME
	SAD LSYM2
	SZA
	JMP NAMERR		/"NAME ERROR" IF FILE NAME NOT NULL
	LAC NAMPTR		/IGNORE NULL FILE NAME--BACKUP SYMBOL
	AND (77777		/     TABLE POINTER
	DAC LSMEND
CHKTRM	LAC WDCNT		/COMMA, CAR. RET., OR ALT MODE.
	SAD (54		/COMMA?
	JMP LOAD04
	SAD PLUS15	/CAR. RET.?
	JMP LOAD03
/COMMAND STRING ALL IN SYMBOL TABLE
/.INIT -3
	CAL 775		/PRINT CAR. RET. LIN. FD. ON TTY.
	1
	LLCTLP		/CONTROL P TRANSFER ADDRESS FOR
SPACE	40		/EOM RESTARTS ON INPUT.
	.WAIT	-3
	LAC	LSMEND
	DAC	LSMST		/ END OF FILE DIR. ENTRY BLOCKS.
LOAD08	LAC	TLSMST
	SAD	LSMST
	JMP	LOAD06		/(GAR:141) COMMAND STRING IS EXHAUSTED - GO TRY HANDLERS.
	DAC	LOAD07		/ SET .SEEK ADDRESS
	TAD	(3
	DAC	TLSMST		/ UPDATE COMMAND STRING FILE BLOCK ADDR.
	DZM	RECDIN		/ INDICATES NEW READ NECESSARY.
	.TITLE READ A PROGRAM
/.INIT -4
	CAL	774
	1
DAT.	.DAT
LNBUFP	0			/LINE BUFFER POINTER
/	.SEEK	-4,X		/ FILE ORIENTED SETUP.
LODC20	CAL	000774		/ DEVICE -4
	.DSA	000003		/ SEEK CODE
LOAD07	.DSA	000000		/ ADDRESS FILE DIRECTORY BLOCK
LODM4	LAC	LODC20		/ DAT SLOT -4
	DAC	LL010
	JMS	LL000		/ LOAD THE PROGRAM UNIT
	AND	L77777
	DAC	LTEMP1		/ SAVE START ADDRESS
	LAC	LMAIN		/ 1ST PROGRAM LOADED IS MAIN PROGRAM
	SZA!CLA!CMA
	JMP	LODM4
	DAC	LMAIN
	LAC*	(.SCOM+6		/SET PROGRAM STARTING ADDRESS WHICH IS
	AND	LFTSVN		/THE STARTING ADDRESS OF THE MAIN
	XOR	LTEMP1		/ PROGRAM) IN .SCOM + 6 WITHOUT
	DAC*	(.SCOM+6		/ DISTURBING BITS 0-2
	JMP	LODM4
CLM4	.CLOSE	-4
	JMP	LOAD08
	.TITLE LOAD HANDLERS
 
/IF USER TYPES CONTROL T, TRANSFER HERE.
 
CNTL.T=.			/*JAH135*
/.WRITE -3			/*JAH135*
	CAL	3775		/*JAH135* WRITE
	11			/*JAH135* CR
	CRLF			/*JAH135* AND
	0			/*JAH135* LF
/(GAR:141)
/(GAR:141)	DESCRIPTION OF THE LOADING PROCESS.
/(GAR:141)
/(GAR:141)
/(GAR:141)		AFTER ALL EXPLICITLY STATED FILES HAVE BEEN LOADED (IN THE
/(GAR:141)	ORDER IN WHICH TYPED IN THE COMMAND STRING) CONTROL IS TRANSFERRED
/(GAR:141) 	TO 'LOAD06'.  STARTING AT 'LOAD06' THE SYMBOL TABLE IS SCANNED
/(GAR:141)	FOR ALL .DAT SLOT REFERENCES AND THE ASSOCIATED HANDLERS 
/(GAR:141)	ARE LOADED.  WHEN NO .DAT SLOT REFERENCES REMAIN
/(GAR:141)	CONTROL IS PASSED TO 'USRLIB'.  AT 'USRLIB'
/(GAR:141)	IT IS DECIDED IF A USER LIBRARY IS TO BE SCANNED BY SEEING
/(GAR:141)	IF .DAT -5 HAS A HANDLER ASSIGNED TO IT.  IF A USER LIBRARY
/(GAR:141)	IS NOT TO BE SCANNED, THEN CONTROL IS PASSED TO 'MDCL21'.
/(GAR:141)	AFTER AN EOF IS ENCOUNTERED ON THE USER LIBRARY, A CHECK
/(GAR:141)	IS MADE FOLLOWING 'MDCAL2' TO SEE IF ANY GLOBLS WERE RESOLVED
/(GAR:141)	IN THE SCAN THROUGH THE USER LIBRARY.  IF ANY GLOBLS WERE
/(GAR:141)	RESOLVED, CONTROL IS PASSED TO 'LOAD06' TO START THE HANDLER AND
/(GAR:141)	USER LIBRARY SCAN OVER AGAIN.  WHEN A SCAN THROUGH THE USER LIBRARY
/(GAR:141)	DOES NOT RESOLVE ANY GLOBLS, CONTROL GOES TO 'MDCL21'.
/(GAR:141)	AT 'MDCL21' THE SWITCH 'FINLIB' IS TESTED TO DETERMINE WHICH
/(GAR:141)	LIBRARY IS TO BE SCANNED NEXT.  IF 'FINLIB'=0, CONTROL GOES TO
/(GAR:141)	'SYSLIB' WHERE THE SYSTEM LIBRARY IS SCANNED REPEATEDLY UNTIL
/(GAR:141)	A SCAN IS MADE WHERE NO GLOBLS ARE RESOLVED.  WHEN THIS
/(GAR:141)	OCCURS, THE SWITCH 'FINLIB' IS TESTED.  IF 'FINLIB' .NE. 0
/(GAR:141)	THE SWITCH 'RESGLB' IS TESTED.  IF 'RESGLB' = 0, THE LIBRARY
/(GAR:141)	SCAN IS TERMINATED AND CONTROL IS PASSED TO 'LOAD15' TO
/(GAR:141)	CONTINUE ON.  HOWEVER, IF 'RESGLB' .NE. 0, IT IS ZEROED
/(GAR:141)	AND THE ENTIRE SCAN IS RESTARTED WITH THE HANDLER SEARCH.
/(GAR:141)		NOTE:  THERE ARE SEVERAL CHECKS MADE TO SEE IF ANY
/(GAR:141)		UNRESOLVED .GLOBLS REMAIN.  IF IT IS FOUND THAT
/(GAR:141)		THERE ARE NONE, THE LIBRARY(S) SCAN IS IMMEDIATELY
/(GAR:141)		TERMINATED.
/(GAR:141)
/(GAR:141)
LOAD06=.			
	JMS	LOAD60		/GO THROUGH SYMBOL TABLE FOR HANDLER NAMES
GLOBT2	SAD	(100000		/VIRTUAL .GLOBL SEARCH
	JMP	USRLIB		/(GAR:141)NO MORE IN TABLE; FINISHED WITH HANDLERS
	LAC	LSMPT		/SAVE SYMBOL TABLE POINTER
	DAC	LTEMP9		/FOR CONTINUATION LATER
	LAC*	LSMPT		/GET DEFINITION TO SEE IF .DAT SLOT
	AND	L77777		/GET RID OF VIRTUAL .GLOBL INDICATOR
	DAC	LTEMP8		/STORE TEMPORARILY
	TAD	MDATND		/IS IT MORE THAN .DAT SLOT
	SMA
	JMP	FH1		/YES; GO ON
	LAC	MDATBG		/NO; IS IT LESS THAN .DAT TABLE
	TAD	LTEMP8
	SPA
	JMP	FH1		/YES; GO ON
	LAC	(LNAMBF		/NO; IT MUST BE A HANDLER
	DAC	LTEMP6		/THIS IS FOR CONWRD ROUTINE
	DAC	R50TP2		/THIS IS FOR PACKING CHARATERS IN .SIXBT
	JMS	UFSMPT		/FETCH FIRST HALF OF SYMBOL
	AND	(177777		/REMOVE SIGN BIT
	JMS	CONWRD		/CONVERT TO .ASCII
	LAC	LSMPT		/*JAH134* SAVE SYMBOL
	DAC	CHK9		/*JAH134* TABLE POINTER
	LAC	LNAMBF		/*JAH139* FETCH FIRST CHAR OF NAME
	SWHA			/*JAH139* PLACE IN LEFT BYTE
	XOR	LNAMBF+1	/*JAH139* POP SECOND CHAR IN RIGHT BYTE
	DAC	SAVNAM		/*JAH139* SAVE FOR LATER
	SAD	NAM1		/*JAH139* DOES IT MATCH .DAT SLOT -1?
	JMP	ERROR9		/*JAH139* YES, DUPLICATE LOADER HANDLER WARNING
	SAD	NAM4		/*JAH139* DOES IT MATCH .DAT SLOT -4?
	JMP	ERROR9		/*JAH139* YES, DUPLICATE LOADER HANDLER WARNING
	SAD	NAM5		/*JAH139* DOES IT MATCH .DAT SLOT -5?
	JMP	ERROR9		/*JAH139* YES, DUPLICATE LOADER HANDLER WARNING
R50.1	LAC	CHK9		/*JAH134* SAVE PTR TO START
	DAC	CHK9A		/*JAH134* OF SYMBOL TABLE ENTRY
	ISZ	CHK9		/*JAH134* ADVANCE TO NAME
	LAC*	CHK9		/*JAH134* FIRST WORD OF SYMBOL NAME
	SPA			/*JAH134* TWO WORD ENTRY?
	ISZ	CHK9		/*JAH134* YES, SKIP OVER 2ND WORD OF NAME
	LAC*	CHK9A		/*JAH134* EXTRACT KEY
	AND	(300000		/*JAH134* FROM 1ST WORD OF ENTRY
	SAD	(300000		/*JAH134* TWO ADDITIONAL WORDS IN ENTRY?
	SKP			/*JAH134* YES
	JMP	R50.2		/*JAH134* NO
	ISZ	CHK9		/*JAH134* ADVANCE ONE WORD
	ISZ	CHK9		/*JAH134* ADVANCE ANOTHER WORD
R50.2	ISZ	CHK9		/*JAH134* ADVANCE TO START OF NEXT ENTRY
	LAC	CHK9		/*JAH134* END OF
	SAD	LSMEND		/*JAH134* SYMBOL TABLE?
	JMP	ALLOK		/*JAH134* YES, NO DUPLICATE HANDLERS
	LAC*	CHK9		/*JAH134* EXTRACT CODE FROM
	AND	(700000		/*JAH134* FIRST WORD OF SYM TABLE ENTRY
	SAD	(100000		/*JAH134* HANDLER?
	SKP			/*JAH134* YES
	JMP	R50.1		/*JAH134* NO, GO CHECK NEXT SYM TABLE ENTRY
	LAC*	CHK9		/*JAH134* GET DEFINITION TO SEE IF .DAT SLOT
	AND	(77777		/*JAH134* GET RID OF VIRTUAL .GLOBL INDICATOR
	DAC	CHK9A		/*JAH134* STORE TEMP.
	TAD	MDATND		/*JAH134* IS IT MORE THAN .DAT SLOT
	SMA			/*JAH134* NO
	JMP	R50.1		/*JAH134* YES, GO ON
	LAC	CHK9A		/*JAH134* NO, IT WAS LESS
	TAD	MDATBG		/*JAH134* 
	SPA			/*JAH134* LESS THAN .DAT SLOT
	JMP	R50.1		/*JAH134* YES, GO ON
	LAC	(NAMTMP		/*JAH134* NO, IT MUST BE HANDLER
	DAC	LTEMP6		/*JAH134* THIS IS FOR CONWRD ROUTINE
	LAC	CHK9		/*JAH134* 1ST WORD OF ENTRY
	IAC			/*JAH134* SET UP PTR
	DAC	CHK9A		/*JAH134* TO FIRST HALF OF NAME
	LAC*	CHK9A		/*JAH134* EXTRACT 1ST 3 LETTERS OF NAME
	AND	(177777		/*JAH134* REMOVE SIGN BIT
	JMS	CONWRD		/*JAH134* CONVERT TO ASCII
	LAC	NAMTMP		/*JAH134* FIRST CHARACTER
	SWHA			/*JAH139* PLACE IN LEFT BYTE
	XOR	NAMTMP+1	/*JAH139* POP SECOND CHAR IN RIGHT BYTE
	SAD	SAVNAM		/*JAH139* SAME AS CURRENT NAME?
	JMP	ERROR9		/*JAH139* YES, DUPLICATE LOADER HANDLER WARNING
	JMP	R50.1		/*JAH139* CONTINUE SEARCHING SYMBOL TABLE
ALLOK=.				/*JAH134* HANDLER NOT DUPLICATE
	LAW	-3		/3 .ASCII CHARACTERS
	DAC	LTEMP6
	DZM	HANAM		/ZERO ACCUMULATOR FOR .SIXBT PACKING
R50LP	LAC	HANAM		/FETCH ACCUMULATOR
	XOR*	R50TP2		/ADD NEW CHARACTER
	AND	(77		/MERGE ONLY LAST SIX BITS
	XOR	HANAM		/THE REST IS OLD
	ISZ	R50TP2		/BUMP POINTER TO CHARCTERS
	ISZ	LTEMP6		/IS THIS LAST ONE
	SKP!RTL		/NO; SHIFT LEFT 6 BITS FOR NEXT
	JMP	R50SIX		/YES; EXIT WITH NAME IN AC
	RTL
	RTL
	DAC	HANAM		/STORE IN ACCUMULATOR
	JMP	R50LP		/ITERATE
R50SIX	DAC	HANAM		/PUT INTO FILE NAME
	DZM	RECDIN		/NEW READ
FIRST	-1&777			/*JAH137* .USER -1, IOS
	23
	.SIXBT	'IOS'
	-1&777			/.INIT -1
	1
LTEMP9	0
R50TP2	0
M1CAL	-1&777			/.SEEK -1,'HANDLER NAME'
	3
	HANAM
	LAC	M1CAL		/.READ -1
	DAC	LL010
	LAC	(JMP M1CAL	/*JAH137* DO NOT REPEAT .USER
	DAC	FIRST		/*JAH137* AND .INIT
	JMS	LL000		/LOAD HANDLER
	.CLOSE	-1
FH1	LAC	(GLOBT2		/CONTINUE LOOKING THROUGH SYMBOL TABLE
	DAC	LOAD60		/BY SIMULATING A JMS
	LAC	LTEMP9
	DAC	LSMW1
	JMP	CONTIN
HANAM	.SIXBT	'@@@.@@BIN'
NAMTMP	0			/*JAH139*
	0
	0
/(GAR:141)  .USER PAG OR BNK MOVED TO SYSTEM LIBRARY SECTION.
	.TITLE LOAD REQUESTED SUBPROGRAMS
/ SELECTIVELY LOAD REQUESTED SUBPROGRAMS FROM THE LIBRARY (S)
/ WHEN COMMAND STRING IS EXHAUSTED.
USRLIB	DZM	LODSW		/(GAR:141)
	DZM	FINLIB		/(GAR:141) SET FLAG TO INDICATE SYSTEM LIB. NEXT.
/
/(GAR:141)  THREE LINES DELETED WHICH CHECKED WHETHER ANY GLOBLS
/(GAR:141)  RESOLVED LAST TIME.
/
	DZM	RESG		/CLEAR SWITCH FOR THIS PASS
	LAC	USYM1		/*JAH136* DO WE HAVE 
	SZA			/*JAH136* SPECIAL USER LIBRARY NAME?
	JMP	NEWU		/*JAH136* YES
	LAC	(561411		/*JAH136* FIRST 3
	DAC	LIBDIR		/*JAH136* CHARS OF LIBRARY NAME
	LAC	(22265		/.LIBR5
LIBM	DAC	LIBDR1		/*JAH136* FIX FILE NAME FOR SEEK
	JMS	LOAD60
	SAD	(100000
	JMP	LOAD15		/QUIT WHEN ALL RESOLVED
	LAC	(100000
	DAC	DDTMDE		/ INHIBIT DDT SYMBOL LOADING OF LIBRARY PROGRAMS
	LAC*	DATM5		/SET UP TO READ FROM EXTERNAL LIBRARY
				/ BEFORE SYSTEM DEVICE IF ONE IS
				/ AVAILABLE.
	SNA
	JMP	MDCL21		/TRY SYSTEM LIBRARY IF NO USER LIBRARY
	LAC	(-5&777
	JMP	LOAD81
NEWU	DAC	LIBDIR		/*JAH136* STORE FIRST 3 CHARS
	LAC	USYM2		/*JAH136* AND SECOND 3 CHARS
	JMP	LIBM		/*JAH136* OF NEW USER NAME
/	.CLOSE	X
MODCAL	CAL			/ .CLOSE LIBRARY FILE.
	6
	.TITLE ASSIGN COMMON
 /NOW ASSIGN COMMON
/
LOAD15	JMS	LOAD60		/ SCAN SYMBOL TABLE FOR COMMON BLOCK NAMES
	SAD	LFTSVN
	JMP	GLOBE		/ ALL DEFINED (OR NONE EXIST)
	JMS	UFSMPT		/ ADDRESS OF COMMON BLOCK NAME
	DAC	LSYM1
	SPA
	JMS	UFSMPT
	DAC	LSYM2
	LAC	LSMPT
	TAD	(1
	DAC	LCMCHN		/ ADDRESS OF CHAIN
	TAD	(1
	DAC	LCMDEF		/ ADDRESS OF DEFINITION
	LAC*	(.SCOM+1		/LET LSMEND BE WHAT IT WOULD
	DAC	TMPEND		/*JAH133* BE AT EXECUTION TIME
	LAW	-1		/*JAH131*  SET FLAG TO INDICATE
	DAC	COMFLG		/*JAH131*  UNINITIALIZED COMMON BLOCK
	JMS	GETCOM		/*JAH133* GO DEFINE C.B.
	DZM	TMPEND		/*JAH133*  PREPARE FOR NON-COMMON BLK
LOAD16	LAC*	LSMW1		/ CHANGE BLOCK CODE TO 3 SO THAT IT WILL
	AND	(377777		/ NOT BE FOUND AGAIN.
	DAC*	LSMW1
	JMP	LOAD15
	.TITLE UNDEFINED GLOBAL SEARCH
/SEARCH FOR REMAINING UNDEFINED GLOBALS. IF ANY MATCH COMMON
/BLOCK NAMES, DEFINE THEM TO BE THE ADDRESS OF THE COMMON BLOCK.
 
GLOBE	DZM NOLOAD
	JMS LOAD60	/ARE THERE ANY UNRESOLVED GLOBALS?
GLOBRT	SAD (100000
	JMP ANYUND	/NONE THAT CAN BE RESOLVED.
	LAC LSMPT		/SAVE POINTER TO GLOBAL ENTRY.
	DAC LTEMP8
	JMS UFSMPT	/GET GLOBAL'S NAME.
	DAC LSYM1
	JMS UFSMPT
	DAC LSYM2
	LAW		/SET MATCH CODE TO SEARCH FOR
	DAC LSMDEF	/COMMON BLOCK NAME.
	JMS LSMSCN	/IS THERE A COMMON BLOCK WITH
	SNA		/THIS GLOBAL'S NAME?
	JMP REST		/NO.
	LAC .-1		/YES. SETUP RETURN ADDRESS.
	DAC GLOBX
	IDX LSMPT		/PICKUP ADDRESS OF COMMON BLOCK.
	JMS UFSMPT
	JMP LCD10E	/GO DEFINE THE GLOBAL.
REST	LAC LTEMP8	/RESTORE THE SYMTAB PTR TO CONTINUE
	DAC LSMW1		/SEARCH FOR UNRESOLVED GLOBALS.
	LAC (GLOBRT
	DAC LOAD60
	JMP CONTIN
ANYUND	JMS LOAD60	/ANY UNRESOLVED GLOBALS?
	SAD (100000
	JMP LOAD21	/NO. PREPARE TO EXIT FROM LOADER.
JMPER3	JMP ERROR3	/YES.
 
/SUBROUTINE TO SEARCH SYMBOL TABLE FOR VIRTUALS OR BLOCK NAMES
/CALLING SEQUENCE...
/	JMS	LOAD60
/	SAD	(SYMBOL CODE
/	JMP	NOT FOUND
/	XXX	FOUND
/
LOAD60	CAL	0
	LAC	LSMST
LOAD62	DAC	LSMPT		/ CURRENT ENTRY ADDRESS
	DAC	LSMW1
	SAD	LSMEND
	JMP	LOAD61+1		/ NOT FOUND
	LAC*	LSMPT		/ FETCH SYMBOL CODE OF NEXT ENTRY
	AND	LFTSVN
	XCT*	LOAD60
				/ DOES SYMBOL CODE MATCH SEARCH CODE
	JMP	LOAD61		/ YES
CONTIN	JMS	NXCNT		/ NO, UPDATE SEARCH ADDRESS TO NEXT ENTRY
	JMP	LOAD62
LOAD61	IDX	LOAD60		/ SYMBOL FOUND
	IDX	LOAD60		/ SYMBOL NOT FOUND
	JMP*	LOAD60
/SUBROUTINE TO RESOLVE VIRTUAL GLOBALS
/
LOAD81	DAC	LL010		/ SET PROPER READ CODE
	DAC	MODCAL		/ SET UP
	DAC	MDCAL2		/ I/O
	DAC	MDSEEK		/ CAL'S
	DAC	MDINIT
	DZM	RECDIN	/SET NEW READ INDICATOR.
/.INIT X
MDINIT	CAL
	1
L77777	77777
CODEWD	0		/LOADER CODE WORD
/.SEEK X,LIBDIR
MDSEEK	CAL			/ SEEK
	3			/ LIBR
	LIBDIR			/ FILE.
LOAD82	IDX	NOLOAD		/ LOAD SELECTIVELY
	JMS	LOAD60		/ SCAN SYMBOL TABLE TO SEE IF ANY
	SAD	(100000		/ UNRESOLVED GLOBALS EXIST
	JMP	MODCAL		/ALL GLOBALS RESOLVED
READ	JMS	LL000		/SEE IF THIS PROGRAM HELPS
	LAC	NOLOAD
	SZA
	JMP	READ		/NO VIRT. RESOLVED.
	ISZ	RESG		/GLOBL RESOLVED
	ISZ	RESGLB		/(GAR:141) GLOBL RESOLVED.
	JMP	LOAD82
LODSW	5
LODSW1	SAD	LODSW
	JMP	CLM4
MDCAL2	.CLOSE	0		/(GAR:141)
	LAC	RESG		/(GAR:141) WERE ANY GLOBLS RESOLVED?
	SNA			/(GAR:141) 
	JMP	MDCL21		/(GAR:141) NO, GO DO NEXT LIBRARY.
	LAC	FINLIB		/(GAR:141) YES, DETERMINE LIBRARY JUST SCANNED ...
				/(GAR:141) AND SCAN IT AGAIN.
	SNA			/(GAR:141)
	JMP	LOAD06		/(GAR:141) IF ZERO, GO SCAN FOR HANDLERS & USER LIB. AGAIN.
	DZM	RESG		/(GAR:141) RESET RESOLVED GLOBLS FLAG.
	JMP	SYSLIB		/(GAR:141) IF NON-ZERO, GO SCAN SYSTEM LIBRARY AGAIN.
MDCL21	LAC	FINLIB		/(GAR:141) DETERMINE WHAT TO SCAN NEXT -  DISPATCH ON FLAG 'FINLIB'.
	SNA			/(GAR:141)
	JMP	SYSLIB		/(GAR:141) IF ZERO, LOAD FROM SYSTEM LIB. NEXT.
/(GAR:141)
/(GAR:141)	IF 'FINLIB' NOT ZERO, THE HANDLERS AND USER LIBRARY (IF PRESENT)
/(GAR:141)	ARE TO BE SCANNED NEXT.
/(GAR:141)
	LAC	RESGLB		/(GAR:141) WERE ANY .GLOBLS RESOLVED FROM
				/(GAR:141) EITHER LIBRARY?
	SNA			/(GAR-144)
	JMP	LOAD15		/(GAR:141) NO, TERMINATE THE LIBRARY(S) SCAN.
	DZM	RESGLB		/(GAR:141) ZERO THE FLAG FOR THE NEXT PASS.
	JMP	LOAD06		/(GAR:141) LOAD FROM THE HANDLERS AND USER LIB. .
SYSLIB	-1&777			/(GAR:141) .USER TO BNK OR PAG.
	23			/(GAR:141)
M1UIC	XX			/(GAR:141)
	LAC	SSYM1		/*JAH136* NEW SYS LIB NAME?
	SZA			/*JAH136*
	JMP	NEWS		/*JAH136* YES
	LAC	(561411		/*JAH136* NO ".LI"
	DAC	LIBDIR		/*JAH136* INSERT NORMAL FIRST 3 CHARS
	LAC	(022200		/*JAH136* AND NORMAL SECOND 3 CHARS
MDCL22	DAC	LIBDR1		/*JAH136* NAME ALL SET
	IDX	FINLIB		/(GAR:141)  SET FLAG TO NON-ZERO TO INDICATE HANDLERS NEXT.
	LAC	(777
	JMP	LOAD81		/ ONLY WHEN GLOBALS CANNOT BE RESOLVED.
NEWS	DAC	LIBDIR		/*JAH136* NEW FIRST 3 CHARS
	LAC	SSYM2		/*JAH136* AND 2N 3 CHARS
	JMP	MDCL22		/*JAH136*
	.TITLE SUBROT:LOAD A PROGRAM UNIT
/SUBROUTINE TO LOAD A PROGRAM UNIT.
/RETURNS WITH STARTING ADDRESS IN AC.
/IT IS DOUBLE BUFFERED EXCEPT WHEN
/IT IS LOADING DDT IN BULK STORAGE
/SYSTEMS.
LL000	0
	DZM	LSYM1		/*JAH132* CLEAR FILE NAME - FIRST 3 CHARS
	DZM	LSYM2		/*JAH132* - LAST 3 CHARS
	DZM	LSYM3		/*JAH132* - EXTENT
	DZM	COMFLG		/*JAH132* NORMAL RELOCATION MODE
	DZM	CSIZE		/*JAH133* COMMON BLOCK SIZE
	LAW	-1		/*JAH132* INITIALIZE
	DAC	LPLA		/*JAH132* CURRENT UPDATE ADDRESS
	DAC	LRELOC		/*JAH132* RELOCATION FACTOR
	DAC	SAVRLC		/*JAH132* PROGRAM RELOCATION FACTOR
	DAC	LIM		/*JAH132* LAST LOC OF RELOCATED MODULE + 1
	.IFDEF	PDP15		/*JAH132*
	LAC	(7777		/*JAH132*RESTORE PAGE MODE RELOCATION
	DAC	ADSWCH		/*JAH132* IN CASE THIS PROGRAM UNIT DESTROYED IT
	.ENDC			/*JAH132*
	LAC	LL010		/PLACE .DAT SLOT #
	DAC	LL014		/IN .WAIT CALL AND
	DAC	LL015		/IN OTHER .READ CALL.
LL002	LAC	DDTMDE
	SMA			/IS DDT BEING LOADED.
	JMP	LL017		/NO.
LL018	LAC	LNBUF		/YES.SET POINTER
	DAC	LNBUFP		/TO BUFFER A
	LAC	LN2BUF		/SET UP 2ND .READ TO
	DAC	LL016		/READ INTO L2BUFF.
/.READ X,0,LNBUFF,50		/READ ONE LINE BUFFER
LL010	CAL	0		/OF BINARY WORDS
	10			/INTO LNBUFF.
LNBUF	LNBUFF			/ADDRESS LINE BUFFER 1
	-62
	.TITLE FETCH A DATA CODE
/.WAIT X				/WAIT FOR BINARY INPUT.
LL014	CAL	0
	12
LL001	LAC*	LNBUFP
	AND	L17
	SAD	PLUS6
	JMP	PRTEOM
	SAD	(5		/EOF
	JMP	LODSW1
	LAC*	LNBUFP		/CHECK BITS 12
	AND	(60		/AND 13 OF 1ST
	SZA			/WORD OF L.B. HEADER
	JMP	ERROR2		/FOR PARITY, CHECKSUM, BUF. OVRFLOW
	777000			/PICK UP THE WORD
	TAD*	LNBUFP		/PAIR COUNT AND
	AND	.-2		/MULTIPLY BY 2
	CLL!RAL			/SUBTRACT 2 FOR HEADER.
	DAC	WDCNT
	LAC	DDTMDE
	SPA!CLA!CMA		/IS DDT BEING LOADED
	JMP	LL041		/YES
	DAC	RECDIN		/INDICATES .READ IN PROGRESS.
/.READ X,0,BUFFX,50
LL015	CAL	0		/READ ONE LINE OF
	10			/BINARY WORDS INTO
LL016	XX			/L2BUFF OR LNBUFF
	-62
/DATA CODE WORD FETCH ROUTINE.
/THIS ROUTINE SELECTS THE CODE WORD FROM THE LINE BUFFER AND DETER-
/MINES WHICH DATA WORD PROCESSING ROUTINE TO ENTER.
/
LL041	IDX	LNBUFP		/SET LINE BUFFER POINTER TO WORD THREE OF
	IDX	LNBUFP		/THE LINE BUFFER WHICH IS THE FIRST WORD
				/OF THIS DATA LINE.
MIN4=.
LL005	LAW	-4		/STORE CODE WORD SHIFT TALLY TO DETERMINE
	DAC	CWDTAL		/WHEN NEXT CODE WORD IS TO BE SELECTED.
	JMS	WRDCHK		/STORE CODE WORD IN TEMP STORAGE FOR
	DAC	CODEWD		/FURTHUR USE.
CODE1	LAC	CODEWD
	ISZ	CWDTAL		/DECREASE CODE TALLY WORD.
	SKP!RTL
	JMP	LL005		/GO GET NEXT CODE WORD
	RTL			/SHIFT CODE WORD SO THAT PRESENT CODE IS
	RTL			/IN LOW ORDER SIX BITS (12-17) ACC.
	DAC	CODEWD
	RAL
	AND	(77		/EXTRACT OUT EVERYTHING BUT 12-17 (CODE)
	DAC	LTEMP1		/SAVE LOADING CODE
	LAC	NOLOAD
	SNA			/ONLY SELECTIVE LOADING CODES ARE
	JMP	LL009		/EXAMINED WHEN NO-LOAD IS IN EFFECT.
	LAC	LTEMP1		/SELECTIVE LOADING.
	SAD	(1
	JMP	LL009		/PROGRAM SIZE
	SAD	(7
	JMP	LL009		/SYMBOL
	SAD	(10
	JMP	LL009		/SYMBOL
	SAD	(33		/SOURCE EXTENSION
	JMP	LL009
	SAD	PLUS12		/INTERNAL GLOBAL DEFINITION-CODE10
	JMP	LL009
	SAD	(27		/END OF PROGRAM UNIT-CODE 23
	JMP	LL009
	.IFDEF	PDP15
	SAD	(31		/.EBREL
	JMP	LL009
	SAD	(32		/.DBREL
	JMP	LL009
	.ENDC
	SAD	(13		/BLOCK DATA SUBPROGRAM-CODE 11
	JMP	LL008
	JMS	WRDCHK		/BYPASS DATA WORD.
	JMP	CODE1		/FETCH NEXT CODE
LL008	DZM	NOLOAD		/CLEAR FOR BLOCK DATA LOADING
LL009	LAW	-35		/*JAH132* NOW 28 CODES
	TAD	LTEMP1
	SMA
	JMP	ERROR2
	TAD	LL007		/ADD START ADDRESS OF TRANSFER VECTOR TABLE
	DAC	LL006		/STORE ADDRESS IN JMS TO PROPER DATA PROC.
	JMS	WRDCHK		/LOAD DATA WORD FOR THIS CODE
LL006	JMP*	ENTRY		/JUMP TO PROPER DATA WORD PROCESSOR PROG.
/END OF MEDIUM.
/	.WRITE -3,2,EOMBUF,4
PRTEOM	CAL	2775		/PRINTS ^S AT END OF LOAD, IF $LOAD.
	11			/NORMALLY IT PRINTS ^P AT AN EOM.

WRBFPT	EOMBUF			/THIS LOC INDEXED WHEN DOING ^S.

M3100	LAW	-3100		/CONSTANT

	LAC*	(.SCOM+4	/*JAH131* IS SYSTEM
	AND	(1		/*JAH131* IN XVM

	SNA			/*JAH135* MODE?

	JMP	EOMBUF		/*JAH135* NO
	.XVMON			/*JAH135* YES, ENTER USER MODE

EOMBUF	JMP	.

				/NEW MEDIUM IN DEVICE

MDATND	-.DATND

	572417			/.ASCII <136>'P'<175>

	572477			/.ASCII <136>'S'<175>

	500000			/END OF ALTMODE.

LFTFVE=.-1

	.TITLE DATA CODE DISPATCH

/TABLE OF DATA WORD PROCESSOR ADDRESSES

/

LL007	JMP*	ENTRY

	.DSA	ERROR2		/CODE 00 - ILLEGAL

	.DSA	LCD01		/CODE 01

	.DSA	LCD02		/CODE 02

	.DSA	LCD03		/CODE 03

	.DSA	LCD04		/CODE 04

	.DSA	LCD05		/CODE 05

	.DSA	LCD06		/CODE 06

	.DSA	LCD07		/CODE 07

	.DSA	LCD08		/CODE 08

	.DSA	LCD09		/CODE 09

	.DSA	LCD10		/CODE 10

	.DSA	LCD11		/CODE 11

	.DSA	LCD12		/CODE 12

	.DSA	LCD08		/CODE 13

	.DSA	LCD14		/CODE 14

	.DSA	LCD15		/CODE 15

	.DSA	LCD16		/CODE 16

	.DSA	LCD17		/CODE 17

	.DSA	LCD18		/CODE 18

	.DSA	LCD19		/CODE 19

	.DSA	LCD20		/CODE 20

	.DSA	LCD21		/CODE 21

	.DSA	LCD22		/CODE 22

	.DSA	LCD23		/CODE 23

	.DSA	CODE1		/CODE 24 - 18 BIT PARAMETER ASSIGNMENT

	.IFDEF	PDP15

	.DSA	LCD25		/CODE 25

	.DSA	LCD26		/CODE 26

	.ENDC

	.IFUND	PDP15

	.DSA	CODE1

	.DSA	CODE1

	.ENDC

	.DSA	LCD27		/CODE 27

	.DSA	LCD28		/*JAH132* CODE 28

	.EJECT

ENTRY=.

WRDCHK	0			/CHECK IF BUFFER EXHAUSTED,

	LAC	WDCNT		/IF NOT RETURN WITH

	SNA			/WORD IN AC.

	JMP	LL002		/GO READ NEXT LINE.

	TAD	TH777		/DECREMENT WORD COUNT

	DAC	WDCNT		/BY 1.

	LAC*	LNBUFP		/PICK UP WORD.

	IDX	LNBUFP		/INDEX POINTER.

	JMP*	WRDCHK

/DDT NOT BEING LOADED---DOUBLE BUFFER.

LL017	LAC	RECDIN

	SNA			/IS .READ IN PROGRESS.

	JMP	LL018		/NO.

LL019	LAC	LL016		/SET UP TO PROCESS

	DAC	LNBUFP		/BUFFER JUST FILLED

	LAC	LNBUF

	SAD	LNBUFP

	LAC	LN2BUF

LL021	DAC	LL016		/SET UP TO READ

	JMP	LL014		/INTO OTHER

	.TITLE CODE 1

/CODE 01 DATA WORD PROCESSOR -PROGRAM UNIT SIZE

/

LCD01	DAC	TEMP		/*JAH132* SAVE PROG. LENGTH TEMP.

	LAW	-1		/*JAH132* IS THIS A NORMAL

	SAD	LIM		/*JAH132* (NOT CODE 28 ASSOCIATED) CODE 1?

	JMP	LCD01A		/*JAH132* YES, PROCEED AS BEFORE

	LAC	TEMP		/*JAH132* NO, FETCH COMMON BLK LENGTH

	DAC	CSIZE		/*JAH132* SALT IT AWAY FOR USE BY NEXT CODE 28

	JMP	CODE1		/*JAH132* FETCH NEXT CODE

LCD01A	LAC	TEMP		/*JAH132* FETCH PROGRAM LENGTH

	AND	(377777		/*JAH132* STRIP OUT ABS/RELOC BIT

	CMA!IAC			/*JAH132* FROM 2'S COMP

	DAC	SIZE			/STORE IN TEMP STORAGE

	DAC	PSIZE		/*JAH132* SAVE PROGRAM SIZE (2'S COMP)

	LAC	TEMP		/*JAH132* IS THIS PROGRAM

	SPA			/*JAH132* ABSOLUTE?

	JMP	LDABS		/*JAH132* YES

	LAC	NOLOAD

	SNA			/IS IT A SELECTIVE LOAD

	JMP	LCOD1		/NO

	LAC	LSMEND		/YES; SAVE END OF SYMBOL TABLE

	DAC	NOLOAD

	JMP	LDABS

LCOD1	DZM	COMFLG		/*JAH132* NORMAL RELOCATION

	JMS	FIT		/*JAH132* GO LOAD PROGRAM

	JMS	SPRSIZ		/*JAH132* DEFINE PROGRAM LIMITS

	JMP	CODE1

/*JAH132*

/*JAH132* SUBR TO CALCULATE PROGRAM LIMITS AND SAVE BASE ADDR

/*JAH132*

SPRSIZ	0			/*JAH132* USED BY CODE 1 AND CODE 10

	LAC	SIZE		/*JAH132* 2'S COMP OF PROGRAM SIZE

	CMA!IAC			/*JAH132* MAKE POSITIVE

	TAD	LRELOC		/*JAH132* ADD RELOCATION FACTOR

	DAC	LIM		/*JAH132* FIRST LOC BEYOND END OF PROGRAM

	DAC	PLIM		/*JAH132* SAVE PROGRAM LIMIT

	LAC	LRELOC		/*JAH132* SAVE PROGRAM

	DAC	SAVRLC		/*JAH132* RELOCATION FACTOR

	JMP*	SPRSIZ		/*JAH132*

	.TITLE SUBROT: CORE FIT ROUTINE

FIT	0			/ENTRY POINT FOR ROUTINE TO FIND

				/A PLACE FOR CURRENT PROGRAM UNIT

	LAC	COMFLG		/*JAH131* TEST LOAD CATEGORY

	SZA			/*JAH131* PROGRAM?

	JMP	FIT2		/*JAH131* NO, DO COMMON BLK CHECKS

	.IFDEF	PDP15

	LAC	(7760		/IS THIS UNIT LESS THAN 4K

	TAD	SIZE		/SUBTRACT PROGRAM SIZE

	SPA!SZA			/*JAH131* LESS THAN 4K?

	JMP	ERR5		/*JAH131* NO, GIVE .LOAD 5

	.ENDC

	JMP	FIT3		/*JAH131* YES, LENGTH OK, PROCEED

FIT2	LAC*	(.SCOM+4	/*JAH131* DOES SYSTEM
	AND	(1		/*JAH131* HAVE XVM

	SNA			/*JAH131* ENABLED?

	JMP	FIT3		/*JAH131* NO, UNINIT. COMMON BLKS NOT SPECIAL

	LAC	COMFLG		/*JAH131* YES

	SMA			/*JAH131* UNINITIALIZED COMMON BLOCK?

	JMP	FIT3		/*JAH131* NO, RELOCATE BELOW BOOTSTRAP

	LAC	LPRES4		/*JAH131* YES, GET FIRST FREE LOC ABOVE BOOT.

	DAC	LRELOC		/*JAH131* STORE RELOCATION FACTOR

	DAC	LPLA		/*JAH131* STORE PROGRAM LOAD ADDRESS

	SAD	(-1		/*JAH131* ANY CORE LEFT ABOVE BOOTSTRAP?

	JMP	FIT3		/*JAH131* NO, RELOCATE BELOW BOOTSTRAP

	LAC	SIZE		/*JAH131* YES, 2'S COMP. OF BLK SIZE

	TAD*	(.SCOM+77	/*JAH131* LAST FREE LOC ABOVE BOOTSTRAP

	CMA			/*JAH131* 2'S COMP OF HIGHEST POSSIBLE STARTING ADDR

	TAD	LPRES4		/*JAH131* FIRST FREE LOC ABOVE BOOTSTRAP

	SMA!SZA			/*JAH131* ENOUGH ROOM ABOVE BOOTSTRAP?

	JMP	FIT3		/*JAH131* NO, TRY TO FIT BELOW BOOTSTRAP

	LAC	SIZE		/*JAH131* YES, 2'S COMP OF BLK SIZE

	CMA!IAC			/*JAH131* POSITIVE BLK SIZE

	TAD	LPRES4		/*JAH131* PREVIOUS 1ST FREE LOC ABOVE BOOT

	DAC	LPRES4		/*JAH131* NEW 1ST FREE LOC ABOVE BOOT.

	AAC	-1		/*JAH131* HAVE WE COMPLETELY

	SAD*	(.SCOM+77	/*JAH131* CORE ABOVE THE BOOTSTRAP?

	SKP!CLA!CMA		/*JAH131* YES

	JMP*	FIT		/*JAH131* NO, ALL DONE

	DAC	LPRES4		/*JAH131* -1 INDICATES CORE ABOVE BOOT FULL

	JMP*	FIT		/*JAH131* DONE

FIT3	LAC	LPRESS		/*JAH131* START LOOKING AT HIGHEST CORE BANK.

	DAC	LPRESP

FITLP	IDX	LPRESP

	.IFUND	PDP15

	LAC LPRESP

	SAD (LPRESS

	JMP ERROR1		/NO MORE CORE.

	LAC*	LPRESP

	.ENDC

	.IFDEF	PDP15

	LAC*	LPRESP

	SAD	LPRESS

	JMP	ERROR1

	.ENDC

	SNA

	JMP FITLP			/NO ROOM IN THIS BANK.

	TAD	SIZE		/COMPUTE POSSIBLE LOAD ADDRESS

	TAD	(1

	DAC	LRELOC		/STORE RELOCATION FACTOR

	DAC	LPLA		/STORE PROGRAM LOAD ADDRESS

	SPA!CMA

	JMP ERROR1		/NO ROOM IN CORE.

	DAC	TEMP9		/*JAH133* SAVE TIL AFTER C.B. TEST

	LAC	TMPEND		/*JAH133*  FINAL C.B.

	SNA			/*JAH133* ALLOCATION

	LAC	LSMEND		/*JAH133* NO, YES NORMAL SYMBOL TABLE END

	TAD	TEMP9		/*JAH133* ADD TEMP.

	SMA!CLA

FITNOP	JMP ERROR1		/OVERLAPPED THE SYMBOL TABLE.

				/CHANGED TO 'CLA' WHEN FITTING BUSY TABLE.

	SAD COMFLG		/DEFINING COMMON?

	JMP NONCOM		/NO.

	LAC* LPRESP		/YES. WILL IT FIT IN THIS BANK?

	XOR LPLA

	.IFUND	PDP15

	AND (60000

	.ENDC

	.IFDEF	PDP15

	AND	(70000

	.ENDC

	SNA!CLC

	JMP ONEBNK		/YES.

	LAC LPRESP		/NO. REQUIRES BANK OVERLAPPING.

	DAC TEMP9

COMLP	IDX TEMP9			/POINT TO NEXT LOWER BANK.

	LAC* TEMP9		/BANK MUST BE UNUSED, I.E.

	.IFUND	PDP15

	AND L17777		/POINTER MUST POINT TO

	SAD L17777		/HIGHEST REGISTER IN THE BANK.

	.ENDC

	.IFDEF	PDP15

	AND	(7777		/POINTER MUST POINT TO

	SAD	(7777		/HIGHEST REGISTER IN THE PAGE

	.ENDC

	SKP

	JMP FITLP			/BANK IS IN USE.

	LAC* TEMP9		/IS THE LOAD ADDRESS IN THIS BANK?

	XOR LPLA

	.IFUND	PDP15

	AND (60000

	.ENDC

	.IFDEF	PDP15

	AND	(70000

	.ENDC

	SZA!CLC

	JMP COMLP			/NO.

	TAD LPLA

	DAC* TEMP9		/SET NEW FREE ADR. IN LOWEST USED BANK.

ZLOOP	LAW -1			/ZERO THE HIGHER POINTERS

	TAD TEMP9			/TO THE BANKS USED.

	DAC TEMP9

	DZM* TEMP9

	LAC TEMP9

	SAD LPRESP

	JMP BITMOR

	JMP ZLOOP

NONCOM	LAC LPLA

	TAD (-20			/PREVENT LOADING INTO 0-17 OF UPPER MEM BNKS

	XOR*	LPRESP

	.IFUND	PDP15

	AND	(60000		/DOES PROGRAM LIE ENTIRELY IN THE

	.ENDC

	.IFDEF	PDP15

	AND	(70000

	.ENDC

	SZA!CLC			/CURRENT MEMORY BLOCK

	JMP FITLP

ONEBNK	TAD LPLA

	DAC* LPRESP		/SET NEW FREE ADR. PTR. FOR THIS BANK.

	.IFUND	PDP15

	AND	L17777

	SAD	L17777

	.ENDC

	.IFDEF	PDP15

	AND	(7777

	SAD	(7777	/IN CASE LOAD ADDRESS IS 1ST LOCATION IN BANK

	.ENDC

	DZM*	LPRESP

BITMOR	LAW -1			/CALCULATE THE HIGHEST REGISTER

	TAD LPLA			/AVAILABLE FOR USE BY THE

	DAC TEMP9			/SYMBOL TABLE.

	CMA!CLL

	TAD LPRES

	LAC TEMP9

	SZL

	DAC LPRES

	JMP* FIT

	.EJECT

TEMP9	0

COMFLG	0		/*JAH131* FIT ROUTINE FLAG

				/*JAH131* + = INITIALIZED COMMON BLOCK

				/*JAH131* - = UNINITIALIZED COMMON BLOCK

				/*JAH131* 0 = PROGRAM

	.IFDEF	PDP15

LCD25	LAC	(17777

	SKP

LCD26	LAC	(7777

	DAC	ADSWCH

	JMP	CODE1

	.ENDC

/

/ABSOLUTE PROGRAM.

LDABS	DZM	LRELOC		/NO RELOCATION.

	JMS	SPRSIZ		/*JAH132* DEFINE PROGRAM LIMITS

	JMP	CODE1

	.TITLE CODE 2,3,4,5,6,7,8,27

/CODE 02 DATA WORD PROCESSOR - PROGRAM LOAD ADDRESS

/

LCD02	TAD	LRELOC		/THE PROGRAM LOAD ADDRESS IS ABSOLUTE
	/***JAH135*** IF XVM 18 BIT ADDR MODE IS EVER USED, BIT 0 MUST BE MASKED

	DAC	LPLA		/IF BIT 0 IS A ONE AND LRELOC CONTAINS 0.

	JMP	CODE1

/CODE 03 DATA WORD PROCESSOR - RELOCATABLE INSTRUCTION

/

/CODE 04 DATA WORD PROCESSOR - ABSOLUTE INSTR/CONST/ADDRESS

/

LCD03	JMS	LMOD13		/GO ADD CURRENT RELOCATION FACTOR[MOD 13]

LCD04	DAC	TEMP		/*JAH132* SAVE DATA VALUE

	LAC	LPLA		/*JAH132* CURRENT ADDRESS

	SAD	(-1		/*JAH132* HAS INIT. SETUP OCCURRED?

	JMP	ERROR2		/*JAH132* NO, INPUT DATA FILE IN ERROR

	JMS	CHKLIM		/*JAH132* CHECK LIMITS OF MODULE

	LAC	TEMP		/*JAH132* RESTORE DATA WORD

	DAC*	LPLA		/*JAH132* DEPOSIT IT IN CURRENT ADDRESS

	IDX	LPLA		/SPECIFIED BY PRESENT LOAD ADDRESS. RETURN

	JMP	CODE1		/TO PROCESS NEXT DATA WORD.

/CODE 05 DATA WORD PROCESSOR - RELOCATABLE VECTOR

/

LCD05	TAD	LRELOC		/ADD CURRENT RELOCATION FACTOR (MOD 15)

	JMP	LCD04		/STORE DATA WORD.

/CODE 06 DATA WORD PROCESSOR - NON COMMON STORAGE ALLOCATION

/

LCD06	TAD	LPLA		/ADD CURRENT PROGRAM LOAD ADDRESS

	JMP	LCD02+1		/STORE ADJUSTED LOAD ADDRESS

				/RETURN TO PROCESS NEXT DATA WORD

/CODE 07 DATA WORD PROCESSOR - SYMBOL-FIRST THREE CHARACTERS

/			 - RADIX 50 (OCTAL)

LCD07	DAC	LSYM1		/STORE FIRST WORD OF SYMBOL IN TEMP. STORE.

	JMP	CODE1		/RETURN TO PROCESS NEXT DATA WORD.

/

/

/CODE 08 DATA WORD PROCESSOR - SYMBOL-SECOND THREE CHARACTERS

/			 - RADIX 50 (OCTAL)

LCD08	DAC	LSYM2		/STORE SECOND WORD OF SYMBOL IN TEMMPORARY

	JMP	CODE1		/STORAGE RETURN TO PROCESS NEXT DATA WORD

/

/CODE 27 DATA WORD PROCESSOR - PROGRAM SOURCE EXTENSION

/

LCD27	DAC	LSYM3		/STORE

	JMP	CODE1		/THIS IS USED ONLY WHEN LISTING

				/LOADER MAP

	.TITLE CODE 9

/CODE 09 DATA WORD PROCESSOR - VIRTUAL GLOBAL SYMBOL DEFINITION

/

LCD09	TAD	(100000		/ADD CODE FLAG FOR VIRTUAL SYMBOL DEF.

	TAD	LRELOC		/ADD RELOCATION FACTOR

	DAC	LSMDEF		/STORE IN TEMPORARY DEFINITION LOCATION.

	JMS	LSMSCN		/SCAN SYMBOL TABLE TO DETERMINE IF THIS

	SZA

	JMP	CD092

LCD09A	JMS	LSMSTR

	JMP	CODE1

/	SNA			/SYMBOL HAS BEEN PREVIOUSLY ENTERED. GO SEE

/	JMP	CD106		/IF SYMBOL HAS BEEN DEFINED

				/STORE DEFINITION AND SYMBOL IN

				/SYMBOL TABLE AS THIS SYMBOL HAS NOT BEEN

/				/PREVIOUSLY ENTERED.

CD092	DAC*	LSMDEF		/STORE DEFINITION IN TRANSFER VECTOR.

	LAC*	LSMW1

	SPA			/IF GLOBAL IS STILL A VIRTUAL, GIVE IT

	JMP	CODE1		/THE ADDRESS OF THIS TRANSFER VECTOR

	LAC	LSMDEF		/AS ITS NEW DEFINITION (EFFECTIVELY

	DAC*	LSMW1		/STRINGING VIRTUAL VECTORS).

	JMP	CODE1

	.TITLE ERROR OUTPUT

/ALL GLOBALS NOT RESOLVED.

ERROR3	LAC	(107	/G

	DAC	GSWCH

	JMS	LOAD60		/PRINT NAMES

	SAD	(100000		/OF UNRESOLVED

	JMP	ERR3		/GLOBALS.

	DZM*	LSMPT		/AVOID REPETITION.

	JMS	UFSMPT		/1ST 3 CHARS

	DAC	LSYM1		/OF NAME

	JMS	UFSMPT		/2ND OF 3 CHARS.

	DAC	LSYM2		/ OF NAME

	DZM	MINC		/*JAH132* NORMAL MAP PRINTOUT

	JMS	MEMAP1		/OUTPUT NAME

	LAC	(107	/G

	CLA

	JMP	ERROR3

				/KEEP GOING

ERROR2	LAW	17544		/DATA ERROR. - ASCII 2

ERROUT	DAC	ERRNO		/7-BIT ASCII ERROR NUMBER

/.WRITE -3,2,ERRBUF,10

	CAL	2775

	11

	ERRBUF

M50	LAW	-50

/.CLOSE -3

ERRCLS	CAL	775

PLUS6	6

/.EXIT

ERR1	CAL			/RETURN TO MONITOR.

	15

L17777=.

ERRBUF	17777

M1	LAW	-1

	.ASCII	' .LOAD '<177>

ERRNO=.-1

LFTSVN=ERRNO			/USED AS A LITERAL.

L17	17

LSYMBL	SYMBOL+500000

ERR3	LAW	17546		/ASCII 3

	JMP	ERROUT

	.IFDEF	PDP15

ERR5	LAW	17552		/ASCII 5 FOR .LOAD 5 ERROR

	JMP	ERROUT

	.ENDC

ERROR6	TAD	.32K		/*JAH131* RESTORE TO ACTUAL COMMON

	DAC	RSIZE		/*JAH131* BLOCK LENGTH

	LAC	(103		/*JAH131* MAKE SURE ERROR

	DAC	CSWCH		/*JAH131* LINE IS PRINTED

	DZM	MINC		/*JAH132* NORMAL MAP PRINTOUT

	JMS	MEMAP1		/*JAH131* GO PRINT ERROR LINE

	LAC	(103		/*JAH131* "C" - USED BY MEMAP1

	LAC	RSIZE		/*JAH131* ILLEGAL LENGTH - USED BY MEMAP1

	LAW	17554		/*JAH131* NOW PRINT

	JMP	ERROUT		/*JAH131* .LOAD 6

ERROR7	LAC	(107		/*JAH131* MAKE SURE ERROR

	DAC	GSWCH		/*JAH131* LINE IS PRINTED

	DZM	MINC		/*JAH132* NORMAL MAP PRINTOUT

	JMS	MEMAP1		/*JAH131* GO PRINT ERROR LINE

	LAC	(107		/*JAH131* "G" - USED BY MEMAP1

	LAC	LTEMP1		/*JAH131* ILLEGAL VALUE - USED BY MEMAP1

	LAW	17556		/*JAH131* NOW PRINT

	JMP	ERROUT		/*JAH131* .LOAD 7

ERROR8	LAW	17560		/*JAH132* ATTEMPT TO INITIALIZE DATA WORD

	JMP	ERROUT		/*JAH132* OUTSIDE OF RANGE OF PROGRAM

				/*JAH132* OR COMMON BLOCK (PROBABLY CAUSED

				/*JAH132* BY ILLEGAL .CBS PSEUDO-OP)
ERROR9	LAC	LNAMBF+2	/*JAH139* SAVE 3RD CHAR OF NAME
	DAC	SAVNAM		/*JAH139* FOR RETURN AFTER WARNING
	LAC	(15		/*JAH139* INSERT CR
	DAC	LNAMBF+2	/*JAH139* FOR PROPER PRINTOUT
/.WRITE -3			/*JAH134* PRINT .LOAD 9 WARNING MESSAGE

	CAL	3775		/*JAH134*

	11			/*JAH134*

	WARN9			/*JAH134*

	0			/*JAH134*

/.WAIT -3			/*JAH134*

	CAL	775		/*JAH134*
	12			/*JAH134*
	LAC	SAVNAM		/*JAH139* RETURN THIRD CHAR
	DAC	LNAMBF+2	/*JAH139* TO PROPER PLACE

	JMP	ALLOK		/*JAH134* RETURN TO NORMAL PROCESSING

/

WARN9	007000			/*JAH134* MESSAGE 7 DOUBLE WORDS LONG

	0			/*JAH134*

	056			/*JAH134* .

	114			/*JAH134* L

	117			/*JAH134* O

	101			/*JAH134* A

	104			/*JAH134* D

	040			/*JAH134* (SPACE)

	071			/*JAH134* 9

	040			/*JAH134* (SPACE)
LNAMBF	0 ; 0			/*JAH139* (HANDLER NAME)

	15			/*JAH134* CR

	12			/*JAH134* LF

CRLF	002000			/*JAH135*

	0			/*JAH135*

	15			/*JAH135* CR

	12			/*JAH135* LF

	.TITLE CODE 10

/CODE 10 DATA WORD PROCESSOR - INTERNAL GLOBAL SYMBOL DEFINITION

/

LCD10	TAD	LRELOC		/ADD RELOC FACTOR - SET SYMBOL DEF.

LCD10E	DAC	LTEMP1		/ENTRY POINT FOR GLOBE ROUTINE.

	TAD	M.32K		/*JAH131* IS SYMBOL VALUE

	SMA			/*JAH131* GREATER THAN 32K-1

	JMP	ERROR7		/*JAH131* YES, GIVE .LOAD 7

	TAD	.32K		/*JAH131* NO, GET BACK ORIG VALUE

	TAD	LFTFVE		/ADD INTERNAL GLOBAL SYM. DEF. CODE TO

	DAC	LSMDEF		/TO ADDRESS. STORE IN TEMPORARY DEFINITION

	JMS	LSMSCN		/LOCATION TILL SYMBOL IS LOCATED. GO SEE IF

	SZA			/SYMBOL HAS BEEN ENTERED IN SYMBOL TABLE.

	JMP	CD102		/JUMP IF SYMBOL IS IN THE TABLE.

	JMS	LSMSTR		/STORE DEFINITION AND SYMBOL IN TABLE

	LAC	NOLOAD		/UNREQUESTED INTERNAL GLOBALS ARE LOADED

	SZA

	JMP	CODE1

				/WHEN THEY FOLLOW REQUESTED GLOBALS OR

				/DURING UNCONDITIONAL LOADING.

CD106	DZM	MINC		/*JAH132* NORMAL MAP PRINTOUT

	JMS	MEMAP1		/*JAH132*

	LAC	(107	/G

	LAC	LTEMP1

	JMP	CODE1		/TABLE AS THIS SYMBOL HAS NOT BEEN PREV-

/				/IOUSLY ENTERED. GLOBE ROUTINE PUTS 'JMP REST' HERE

CD102	DAC	LTEMP2		/SAVE REFERENCE ADDRESS IF UNDEFINED

	LAC*	LSMW1

	SPA!CLA			/CHECK TO SEE IF GLOBAL IS DEFINED

				/IF DEFINED, IT HAS ALREADY BEEN LOADED

	JMP	CODE1		/ALREADY DEFINED.

	SAD	NOLOAD

	JMP	CD107		/NON SELECTIVE LOAD

	LAC	PSIZE		/*JAH132* RESTORE PROGRAM

	DAC	SIZE		/*JAH132* SIZE

	DZM	COMFLG		/*JAH132* NORMAL RELOCATION

	JMS	FIT

	JMS	SPRSIZ		/*JAH132* SET UP PROGRAM LIMITS

				/*JAH132* EXIT WITH LRELOC IN AC

	TAD	LTEMP1

	DAC	LTEMP1

	TAD	LFTFVE

	DAC	LSMDEF

CD107	LAC	LSMDEF

	DAC*	LSMW1		/DEFINE SYMBOL AS INTERNAL GLOBAL

CD104	LAC*	LTEMP2

	AND	L77777		/MASK OFF UNIT NO.

	DAC	LSMDEF		/FETCH AND SAVE NEXT REFERENCE ADDRESS

	LAC*	LTEMP2

	AND	LFTSVN		/PRESERVE UNIT NO.

	XOR	LTEMP1

	DAC*	LTEMP2

				/PUT SYMBOL DEF. IN CONTENTS OF REF. ADR.

	LAC	LSMDEF

	SAD	LTEMP2		/CHAIN COMPLETE WHEN NEXT CHAIN ADDR = SELF.

	JMP	CDSG2

	DAC	LTEMP2

	JMP	CD104

	.EJECT

/	THE FOLLOWING ROUTINE IS NEEDED IN ORDER TO RELOCATE THE SET

/OF GLOBALS IN SELECTIVE LOADING (INTERNAL) WHICH WERE PASSED

/THROUGH AND PUT INTO THE SYMBOL TABLE TENTATIVELY BEFORE A GLOBL

/WAS FOUND THAT WAS NEEDED BY THE PROGRAM BEING LOADED.  

CDSG2	DZM	MINC		/*JAH132* NORMAL MAP PRINTOUT

	JMS	MEMAP1		/*JAH132* OUTPUT THIS SYMBOL IF G OPTION

	LAC	(107		/G

	LAC	LTEMP1

	LAC	NOLOAD		/IS THIS A SELECTIVE LOAD?

	SNA

GLOBX	JMP	CODE1		/NO; PROCESS NEXT LOADER CODE

CDSG1	SAD	LSMEND		/IS THIS THE END OF THE NEWLY ENTERED

				/UNRELOCATED INTERNAL GLOBLS

	JMP	CDSGED		/YES

	DAC	LSMW1		/NO; RELOCATE THIS ENTRY

	DAC	LSMPT		/THIS IS TO FETCH SYMBOL FOR MEMORY MAP

	LAC*	LSMW1

	TAD	LRELOC		/ADD RELOCATION FACTOR

	DAC*	LSMW1

	AND	L77777		/CLEAN OFF TRANSFER VECTOR

	DAC	NOLOAD		/STORE TEMPORARILY

	JMS	UFSMPT		/GET SYMBOL AND PUT IN LSYM1

	DAC	LSYM1

	JMS	UFSMPT		/AND LSYM2

	DAC	LSYM2

	DZM	MINC		/*JAH132* NORMAL MAP PRINTOUT

	JMS	MEMAP1		/OUTPUT ON GLOBL SWITCH

	LAC	(107		/G

	LAC	NOLOAD		/DEFINITION

	JMS	NXCNT		/GO TO NEXT SYMBOL TABLE ENTRY

	JMP	CDSG1		/THE ADDRESS OF THE NEXT ENTRY IN AC

CDSGED	DZM	NOLOAD		/CLEAR SELECTIVE LOAD SWITCH

	JMP	CODE1		/PROCESS NEXT CODE

	.TITLE CODE 11,12

/CODE 11 DATA WORD PROCESSOR - BLOCK DATA DECLARATION

/

LCD11	CLA!IAC		/*JAH132* CURRENT RELOCATION MODE

	DAC	COMFLG		/*JAH132* WILL BE INIT COMMON BLK MODE

	JMP	CODE1		/RETURN TO PROCESS NEXT CODE WORD

/CODE 12 DATA WORD PROCESSOR - COMMON BLOCK DEFINITION

/

LCD12	TAD	M.32K		/*JAH131* COMMON BLOCK LONGER

	SMA			/*JAH131* THAN 32K-1 WORDS?

	JMP	ERROR6		/*JAH131* YES, GIVE .LOAD 6

	TAD	.32K		/*JAH131* NO, RESTORE TO PROPER LENGTH

	JMS	ENTCOM		/*JAH132* ENTER COMMON BLOCK SIZE IN SYMBOL TABLE

	LAC	COMFLG		/*JAH132* ARE WE IN BLOCK DATE (INIT

	SPA!SNA			/*JAH133* COOMON BLK ) RELOCATION MODE?

	JMP	CODE1		/*JAH133* RETURN FOR NEXT DATA CODE

	JMS	GETCOM		/*JAH132* YES, GO ALLOCATE COMMON BLK IF NECC

	LAC	SIZE		/*JAH133* 2'S COMP C.B. SIZE

	CMA!IAC			/*JAH133* CONVERT TO POS.

	TAD	LRELOC		/*JAH133* ADD IN START OF C.B.

	DAC	LIM		/*JAH133* LIMIT FOR INITIALIZATION

	JMP	CODE1		/*JAH132* RETURN FOR NEXT DATA CODE

	.TITLE COMMON BLOCK ROUTINES

/*JAH132*

/*JAH132* THIS SUBROUTINE SETS UP A SYMBOL TABLE ENTRY FOR A COMMON BLOCK. IF

/*EG132* AN ENTRY DOESN'T YET EXIST IT WILL CREATE ONE. IF AN ENTRY

/*EG132* ALREADY EXISTS IT WILL UPDATE THE SIZE IF APPROPRIATE (I.E.  IF THE

/*EG132* NEW SIZE IS LARGER THAN THE OLD SIZE CURRENTLY IN THE ENTRY).

/*EG132*

/*EG132* INPUTS:

/*EG132*

/*EG132*          AC     MINIMUM SIZE OF C. B. (ALSO REFERRED TO AS NEW SIZE)

/*EG132*          LSYM1, C. B. NAME IN RADIXE 50. IF SIGN BIT OF LSYM1 IS ZERO

/*EG132*          LSYM2  THAN LSYM2 IS IGNORED.

/*EG132*

/*EG132* OUTPUTS:

/*EG132*

/*EG132*          LSMW1  POINTS TO FIRST WORD OF C.B. ENTRY IN SYM TABLE

/*EG132*

/*EG132*          LCMCHN POINTS TO C.B. REF CHAIN WORD IN SYM TABLE ENTRY.

/*EG132*                 THE C.B. REFERENCE CHAIN WORD IS THE HEAD OF A LINKED

/*EG132*                 LIST (WITHIN THE SYM TABLE) OF REFS TO THIS C.B.

/*EG132*                EACH ENTRY IN THE LIST DEFINES A WORD WHICH IS TO BE SET UP

/*EG132*                AS A TRANSFER VECTOR TO SOME LOCATION WITH  THIS C.B.

/*EG132*

/*EG132*          LCMDEF POINTS TO C.B. DEFINITION WORD IN SYM TABLE ENTRY.

/*EG132*                 THE C.B. DEF WORD CONTAINS 0 IF THE C.B. HAS

/*EG132*                 NOT YET BEEN ALLOC OR THE BASE ADDR OF THE C.B IF

/*EG132*                IT HAS BEEN ALLOCATED.

/*EG132*

/*EG132* EFFECTS:

/*EG132*

/*EG132*	A SYMBOL TABLE ENTRY WILL BE CREATED IF NONE EXISTS ALREADY.

/*EG132*

/*EG132*	IF A SYMBOLT ABLE ENTRY ALREADY EXISTS AND THE C.B. SIZE IN IT IS

/*EG132*	LESS THAN THE C.B. SIZE PASSED THIS SUBR IN THE AC, THEN THE

/*EG132* 	SIZE IN THE SYM TABLE ENTRY IS UPDATED TO THE SIZE PASSED.

/*EG132*

/*JAH136*	THIS ROUTINE WILL JUMP TO ERROR6 IS AN ATTEMPT IS MADE TO EXTEND

/*EG132*	A C.B. WHICH IS ALREADY ALLOCATED. I.E. A SYMBOL TABLE ENTRY

/*EG132*	EXISTS, THE C.B. IS DEFINED (HAS MEMORY ALLOCATED TO IT), AND THE

/*EG132*	NEW LENGTH IS GREATER THAN THE OLD OR CURRENT LENGTH (FROM SYM TABLE)

/*JAH132*

ENTCOM	0			/*JAH132*

	DAC	LTEMP2		/*JAH131* STORE DATA WORD IN TEMPORARY STORAGE

	TAD	LFTSVN		/ADD COMMON BLOCK CODE TO BLOCK SIZE AND

	DAC	LSMDEF		/SET IT UP AS THE DEFINITION.

	JMS	LSMSCN		/SCAN SYMBOL TABLE TO DETERMINE IF BLOCK

	SZA			/NAME HAS BEEN PREVIOUSLY ENTERED.

	JMP	CD123		/YES

	JMS	LSMSTR		/NO, ENTER BLOCK NAME FOR FIRST TIME

	LAC	LSMEND

	DAC	LCMCHN		/SET ADDRESS OF COMMON CHAIN

	DZM*	LCMCHN		/INITIALIZE CHAIN TO SHOW NO MEMBERS

	JMS	LPTCNT

	LAC	LSMEND

	DAC	LCMDEF		/SET ADDRESS OF BLOCK DEFINITION

	JMS	LPTCNT

	DZM*	LCMDEF		/INITIALLY UNDEFINED COMMON BLOCK

	JMP*	ENTCOM		/*JAH132*

CD123	DAC	LTEMP1		/SAVE OLD BLOCK SIZE

	LAC	LSMPT		/INCREASE SYMBOL TABLE POINTER TO POINT

	TAD	(1		/TO COMMON CHAIN WORD START OF COMMON

	DAC	LCMCHN		/BLOCK ENTRY. STORE POINTER TO POINT AT

	TAD	(1		/BLOCK DEFINITION WORD.

	DAC	LCMDEF

CD124	LAC	LTEMP1		/COMPARE BLOCK LENGTHS TO SEE WHICH IS

	CMA			/GREATER.

	TAD	LTEMP2

	SPA

	JMP*	ENTCOM		/*JAH132* NEW C.B. SIZE IS NOT GREATER THAN OLD

CD125	LAC*	LCMDEF		/IS THIS COMMON BLOCK DEFINED. IF YES, GO TO

	SZA			/ERROR AS NEW BLOCK SIZE IS LARGER THAN

	JMP	ERROR6		/*JAH136* THE DEFINED BLOCK SIZE

	LAC	LSMDEF		/STORE NEW BLOCK SIZE INTO DEFINITIONS

	DAC*	LSMW1		/BLOCK SIZE WORD.

	JMP*	ENTCOM		/*JAH132*

	.EJECT			/*JAH132*

/*EG132*

/*EG132* SUBROUTINE GETCOM

/*EG132*

/*EG132* THIS SUBR SET UP LRELOCT TO CONTAIN THE BASE ASSR OF A C.B. AND

/*EG132* ALLOCATES MEMORY SPACE FOR THE C.B. IF NOT ALREADY DONE.

/*EG132* ALL OUTSTANDING REFERENCES TO THIS C.B. WILL BE RESOLVED ( THE

/*EG132* REFS. ARE KEPT IN A LINKED LIST WHOSE HEADER WORD IS POINTED 

/*EG132* TO BE LCMCHN. THIS HEADER WORD IS CLEARED AFTER EVERYTHING'S RESOLVED)

/*EG132*

/*EG132* INPUTS:

/*EG132*

/*EG132*

/*EG132*	LSMW1	POINTS TO 1ST WORD OF SYMBOL TABLE ENTRY FOR

/*EG132*		C.B. TO BE SET UP IN LRELOC

/*EG132*

/*EG132*	LCMCHN	POINTS TO C.B. REF CHAIN WORD IN SYM TABLE ENTRY FOR C.B.

/*EG132*

/*EG132*	LCMDEF	POINTS TO C.B. DEF WORD IN SYM TABLE ENTRY FOR C.B.

/*EG132*

/*EG132*	COMFLG	+ = INIT C.B. ; - = UNINIT C.B.

/*JAH132*

GETCOM	0		/*JAH132*

	LAC*	LSMW1		/*JAH132* NO, FETCH SIZE

	AND	(77777		/*JAH132* EXTRACT 15-BIT (<32K) C.B. SIZE

	CMA!IAC			/*JAH132* SAVE

	DAC	SIZE		/*JAH132* 2'S COMP OF C.B. LENGTH

	LAC*	LCMDEF		/*JAH132* C.B. BASE ADDR OR 0

	DAC	LRELOC		/*JAH132* SAVE BASE ADDR

	SZA			/*JAH132* C.B. ALLOCATED?

	JMP	GETCA		/*JAH132* YES

	JMS	FIT		/*JAH132* GO ALLOCATE

	LAC	LRELOC		/*JAH132* STORE C.B. BASE ADDR

	DAC*	LCMDEF		/*JAH132* IN SYMBOL TABLE

	CLA			/*JAH133* NORMAL MAP

	JMP	GETCB		/*JAH133* PRINTOUT

GETCA	LAC	TMPEND		/*JAH133* IS THIS FINAL

	SZA			/*JAH133* C.B. PASS

	JMP	GETCC		/*JAH133* YES, DO NOT TYPE INIT MESSAGE

	LAW	-1		/*JAH133* SPECIAL "INIT"

GETCB	DAC	MINC		/*JAH133* PRINTOUT

	JMS	MEMAP1		/*JAH132* PRINT C.B.

	LAC	(103		/*JAH132* STARTING ADDRESS

	LAC	LRELOC		/*JAH132* OR THE WORD "INIT"

GETCC	LAC*	LCMCHN		/*JAH133* LOAD FIRST WORD OF COMMON BLOCK DEFINI-

	DZM*	LCMCHN		/TION (CHAIN START ADDRESS). IF THE CHAIN

CD127	SNA			/ADDRESS IS ZERO, RETURN TO PROCESS NEXT

	JMP*	GETCOM		/DATA WORD.

	DAC	LCMCHN

	TAD	(1		/DETERMINE AND STORE ADDRESSES OF SECOND

	DAC	LCHN1		/(TRANSFER VECTOR ADDRESS) AND THIRD

	TAD	(1		/(RELATIVE ADDRESS) WORDS OF COMMON NAME

	DAC	LCHN2		/ENTRY TO BE ASSIGNED.

	LAC*	LCHN1

	DAC	LCHN1		/SET ADDRESS OF TRANSFER VECTOR

	LAC*	LCHN2		/LOAD RELATIVE ADDRESS OF THIS ENTRY.

	TAD*	LCMDEF		/ADD STARTING LOCATION OF THIS BLOCK.

	DAC*	LCHN1		/STORE ADDRESS IN LOCATION SPECIFIED BY

	LAC*	LCMCHN		/TRANSFER VECTOR ADDRESS. LOAD NEXT CHAIN

	AND	L77777		/MASK OFF ID BITS

	JMP	CD127		/REFERENCE AND RETURN.

	.TITLE CODE 13,14,15,16,17

/CODE 13 DATA WORD PROCESSOR - COMMON SYMBOL DEFINITION (REL. ADDR.)

/SAME AS CODE 08.

/

/CODE 14 DATA WORD PROCESSOR - COMMON SYMBOL REFERENCE DEFINITION

/(ADDRESS OF TRANSFER VECTOR)

/

LCD14	TAD	(400000		/ADD IN A ONE IN THE SIGN SO THIS ENTRY

	TAD	LRELOC

	DAC	LSYM1		/WILL LOOK LIKE A TWO WORD NAME IN THE

	LAC*	LCMDEF		/SYMBOL TABLE. CHECK IF THE COMMON BLOCK

	SZA			/WHICH THIS ENTRY IS RELATED, IS ASSIGNED.

	JMP	CD141		/IF IT IS, GO STORE THIS SYMBOL LOC. IN

	LAC*	LCMCHN		/THE TRANSFER VECTOR. IF NOT ASSIGNED,

/				/LINK SYMBOL TO THIS COMMON CHAIN. THIS IS

	TAD	(400000		/DONE BY PLACING THE ADDRESS AN THE CHAIN

	DAC	LSMDEF		/LOC. OF THE COM. BLK. DEF. IN THE CHAIN

	LAC	LSMEND		/ADDRESS OF THE NEW ENTRY, AND THE START

/				/ADDRESS OF THE NEW ENTRY IN THE COM.

	DAC*	LCMCHN		/BLK. CHAIN. THIS ENTRY IS THEN STORED BY

	JMP	LCD09A		/THE NORMAL SYMBOL STORE SUBROUTINE.

				/RETURN TO PROCESS NEXT DATA WORD.

				/COMMON BLOCK WAS ASSIGNED, THEREFORE,

CD141	TAD	LSYM2		/ADD THE LOCATION TO RELOCATION FACTOR,

	DAC*	LSYM1		/AND STORE IN TRANSFER VECTOR LOCATION.

	JMP	CODE1		/RETURN TO PROCESS NEXT DATA WORD

/CODE 15 DATA WORD PROCESSOR - DATA INITIALIZATION CONSTANT (1ST WORD)

/

LCD15	DAC	LDATA1		/STORE DATA WORD FOR FUTURE USE.

	JMP	CODE1		/RETURN TO PROCESS NEXT DATA WORD.

/

/CODE16 DATA WORD PROCESSOR - DATA INITIALIZATOOO'CONSTANT (2ND WORD)

/

LCD16	DAC	LDATA2		/STORE DATA WORD FOR FUTURE USE.

	JMP	CODE1		/RETURN TO PROCESS NEXT DATA WORD.

/

/CODE 17 DATA WORD PROCESSOR - DATA INITIALIZATION CONSTANT (3RD WORD).

/

LCD17	DAC	LDATA3		/STORE DATA WORD FOR FUTURE USE.

	JMP	CODE1		/RETURN TO PROCESS NEXT DATA WORD.

	.TITLE CODE 18,19

/

/CODE 18 DATA WORD PROCESSOR - DATA INITIALIZATION CONSTANT DEFINITION

/

LCD18	DAC	DEFBIT		/*JAH135* SAVE CODE BITS 1 & 2

	AND	(77777		/*JAH135* EXTRACT ADDR

	DAC	LTEMP1		/*JAH135* STORE DAT WORD IN TEMP STORAGE AND

	LAC	LBDF		/TEST IF BLOCK DATA FLAG IS SET. IF THE

	SNA			/BDF IS SET ADD THE ADDRESS OF THE LAST

	JMP	CD181		/COMMON BLOCK LOADED TO THE DATA WORD LOAD

	LAC*	LCMDEF		/ADDRESS, IF BDF NOT SET, ADD PRESENT RELO-

				/CATION FACTOR TO DATA WORD ADDRESS. STORE

	SKP			/THE ADJUSTED ADDRESS IN TEMPORARY STORAGE

CD181	LAC	LRELOC		/FOR FURTHUR REFERENCE.

	TAD	LTEMP1

	DAC	LTEMP1		/*JAH135*

	JMS	CHKLIM		/*JAH132* CHECK FOR LIMITS OF C.B.

	LAC	LDATA1		/STORE FIRST DATA INITIALIZATION CONSTANT.

	DAC*	LTEMP1

	IDX	LTEMP1		/INCREMENT STORAGE ADDRESS FOR NEXT CON-

	LAC	DEFBIT		/*JAH135* STANT, IF ANY TO BE STORED, EXTRACT OUT ALL

	AND	(300000		/BITS OF DEFINITION WORD EXCEPT BITS 1-2.

	SZA

	SAD	(300000		/TEST IF BITS 1-2 OF DATA WORD EQUAL 11

	JMP	CODE1		/IF SO RETURN TO PROCESS NEXT DATA WORD.

	LAC	LTEMP1		/*JAH132* FETCH CURRENT ADDR

	JMS	CHKLIM		/*JAH132* CHECK FOR LIMITS OF C.B.

	LAC	LDATA2		/STORE SECOND DATA WORD IN SPECIFIED ADDR.

	DAC*	LTEMP1

	IDX	LTEMP1		/INCREMENT STORE ADDRESS FOR NEXT DATA WD.

	LAC	DEFBIT		/*JAH135* TEST BIT 1-2 OF DEFINITION WORD. IF EQUAL

	AND	(300000		/TO 01 (REAL CONSTANT) RETURN TO PROCESS

	SAD	(100000		/NEXT CODE WORD. IF NOT EQUAL TO 01, SELECT

	JMP	CODE1		/AND STORE THIRD CONSTANT WORD AS CONSTANT

	LAC	LTEMP1		/*JAH132* FETCH CURRENT ADDR

	JMS	CHKLIM		/*JAH132* CHECK FOR LIMITS OF C.B.

	LAC	LDATA3		/MUST BE A DOUBLE PRECISION NUMBER

	DAC*	LTEMP1

	JMP	CODE1		/RETURN TO PROCESS NEXT DATA WORD

/CODE 19 DATA WORD PROCESSOR - INTERNAL SYMBOL DEFINITION/ PROGRAM NAME

/

LCD19	SPA			/IF BIT ZERO OF THE DATA WORD IS A ONE, IN-

	TAD	(200000		/DICATING PROGRAM NAME, SET CODE FLAG TO 6

	TAD	LRELOC		/ADD CURRENT RELOCATION FACTOR TO ADDRESS.

	DAC	LSMDEF		/STORE SYMBOL DEFINITION.

	RAL		/L=1, PROGRAM NAME.

	LAC	DDTMDE

	SPA!CMA

	JMP	CODE1		/DDT.

	SNL!RTL		/OUTPUT PROG NAME IN LDR. MEM. MAP

	JMP	LCD31

	LAC	COMFLG		/*JAH132* RELOCATION STATUS

	SMA!SZA!CLA		/*JAH132* BLOCK DATA (INIT COMMON)?

	IAC			/*JAH133* YES, PRINT "B DATA" NOT STARTING ADDR

	DAC	MINC		/*JAH132* PRINTOUT INDICATOR

	JMS	MEMAP1

	LAC	(120	/P

	LAC	LRELOC

	LAC*	(.SCOM+6

LCD31	SPA

	JMS	LSMSTR		/GO TO STORE SYMBOL AND DEFINITION

	JMP	CODE1		/NOT EVEN PROGRAM NAME IF NOT DDT

LLCTLP	CAL	775		/CR/LF AFTER ECHOING ^P

	6

	JMP	LL018

OUTBF2	014000			/*JAH131* INCREASE WORD COUNT

PER50	127400			/(.) IN RADIX 50(OCTAL)

CHRTP1	XX

	40		/SPACE

	00		/*JAH131* MAKE WORD COUNT EVEN

SYMBOL	.BLOCK	6

	40

EX1	.BLOCK	3

	40			/SPACE

OCTAL5	.BLOCK	6		/*JAH131* SIX DIGIT PRINTOUT

PLUS15	15			/C.R.

PLUS12	12			/L.F.

/*JAH132*

/*JAH132* ROUTINE TO VERIFY ADDR TO BE UPDATED IS WITHIN GIVEN MODULE

/*JAH132*

CHKLIM	0			/*JAH132*

	CMA!IAC			/*JAH132* CONVERT ADDR TO NEGATIVE

	TAD	LIM		/*JAH132* FIRST LOC BEYOND END OF MODULE

	SPA!SNA			/*JAH132* ATTEMPT TO UPDATE OUTSIDE RANGE?

	JMP	ERROR8		/*JAH132* YES .LOAD 8

	JMP* CHKLIM		/*JAH132*

	.TITLE RADIX 50 CONVERSION

/PUT RADIX 50 SYMBOL IN LSYM1 AND LSYM2

/JMS MEMAP1

/LAC (120	/P - 120;C - 103;G - 107

/LAC VALUE	/VALUE CONTAINS NUMBER TO BE OUTPUT

GSWCH	0

CSWCH	0

PSWCH	0

OPSWCH	0

OCT177	177

MINC	0			/*JAH132* PRINTOUT INDICATOR

				/*JAH132* 0 = NORMAL

				/*JAH132* - = "B DATA"

				/*JAH132* + = "INIT"

MEMAP1	0

	XCT*	MEMAP1

	SAD	PSWCH

	JMP	MEMAP2

	DZM	LSYM3

	SAD	CSWCH

	JMP	MEMAP2

	SAD	GSWCH

	SKP

	JMP*	MEMAP1

MEMAP2	LAC	LSYMBL

	DAC	LTEMP6

	CAL	775

	12		/.WAIT -3

	XCT*	MEMAP1

	DAC	CHRTP1

	ISZ	MEMAP1

	LAC	LSYM1

	AND	(177777

	JMS	CONWRD

	LAC	LSYM1

	SPA!CLA

	LAC	LSYM2

	JMS	CONWRD

	IDX	LTEMP6

	LAC	LSYM3

	JMS	CONWRD

	LAC	MINC		/*JAH132* PRINOUT INDICATOR

	SPA			/*JAH132* INIT?

	JMP	MINIT		/*JAH132* YES

	SZA			/*JAH132* BLOCK DATA?

	JMP	BDATA		/*JAH132* YES

	IDX	LTEMP6

	LAW	-6		/*JAH131* SIX DIGIT PRINOUT

	DAC	LTEMP2

	XCT*	MEMAP1

	RAL			/*JAH131* TAKE LINK INTO ACCOUNT

LCD015	RTL

	RAL

	DAC	LTEMP3

	AND	(7

	TAD	(60

	DAC*	LTEMP6

	IDX	LTEMP6

	LAC	LTEMP3

	ISZ	LTEMP2

	JMP	LCD015

MEMAP3	CAL	3775		/*JAH132*

	11

	OUTBF2

FFTSIX	56

	JMP*	MEMAP1

MINIT	LAC	(111		/*JAH132* I

	DAC	OCTAL5		/*JAH132*

	LAC	(116		/*JAH132* N

	DAC	OCTAL5+1	/*JAH132*

	LAC	(111		/*JAH132* I

	DAC	OCTAL5+2	/*JAH132*

	LAC	(124		/*JAH132* T

	DAC	OCTAL5+3	/*JAH132*

	LAC	(40		/*JAH132* SPACE

	DAC	OCTAL5+4	/*JAH132*

	DAC	OCTAL5+5	/*JAH132*

	JMP	MEMAP3		/*JAH132* GO PRINT LINE

BDATA	LAC	(102		/*JAH132* B

	DAC	OCTAL5		/*JAH132*

	LAC	(40		/*JAH132* SPACE

	DAC	OCTAL5+1	/*JAH131*

	LAC	(104		/*JAH132* D

	DAC	OCTAL5+2	/*JAH132*

	LAC	(101		/*JAH132* A

	DAC	OCTAL5+3	/*JAH132*

	LAC	(124		/*JAH132* T

	DAC	OCTAL5+4	/*JAH132*

	LAC	(101		/*JAH132* A

	DAC	OCTAL5+5	/*JAH132*

	JMP	MEMAP3		/*JAH132* GO PRINT LINE

/ENTER WITH RADIX 50(OCTAL)

/WORD IN AC

CONWRD	0

	JMS	DIVIDE

	TAD	M3100		/50X50

	LAC	LTEMP7		/REMAINDER

	JMS	DIVIDE

	TAD	M50

	LAC	LTEMP7		/3RD CODE CHAR.

	JMS	CONVER

	JMP*	CONWRD

/CALLING SEQUENCE:

/RADIX 50 (OCTAL) WORD IN AC.

/JMS DIVIDE

/TAD (-3100 OR -50)

/(RETURN)

DIVIDE	0

	DZM	LTEMP5		/INITIALIZE COUNTER.

DIV1	DAC	LTEMP7		/SAVE BACKUP NUMBER.

	XCT*	DIVIDE

	SPA

	JMP	DIV2		/DIVIDE WAS NOT POSSIBLE

	IDX	LTEMP5		/INDEX COUNTER

	JMP	DIV1

DIV2	LAC	LTEMP5		/OCTAL CODE

	JMS	CONVER

	IDX	DIVIDE

	JMP*	DIVIDE

	.EJECT

/ROUTINE TO CONVERT OCTAL CODE (RADIX 50)

/TO 7-BIT ASCII CHAR.

/CALLING SEQUENCE:

/	OCTAL CODE IN AC

/	JMS CONVER

/	(RETURN)

CONVER	0

	SNA

	LAW -40			/SPACE.

	SAD	(33

	LAW -33			/%.

	SAD	(34

	LAC (33			/.

	SAD	(47

	LAW -35			/#

	TAD .-5

	SPA

	TAD	(55		/A-Z

	TAD FFTSIX		/(56 FOR 0-9

	DAC*	LTEMP6		/SYMBOL BUFFER POINTER

	IDX	LTEMP6		/INDEX POINTER

	JMP*	CONVER

	.TITLE CODE 20,21

/CODE 20 DATA WORD PROCESSOR - STRING CODE (FIRST HALF)

/

LCD20	TAD	LRELOC		/ADD CURRENT RELOCATION FACTOR TO ADDRESS.

	DAC	LSTRNG		/AND STORE FOR FURTHUR USE.

	JMP	CODE1		/RETURN TO PROCESS NEXT DATA WORD.

	.TITLE CODE 22

/

/CODE 21 DATA WORD PROCESSOR - STRING CODE (SECOND HALF)

/

LCD21	JMS	LMOD13		/ADD THE PRESENT RELOCATION FACTOR (MODULO

	DAC	LTEMP1		/12/13 BITS) TO THE REPLACEMENT ADDRESS.

	.IFUND	PDP15

	LAW	0		/EXTRACT OUT THE LOW ORDER 12/13 BITTS OF THE

	.ENDC

	.IFDEF	PDP15

	LAW	10000

	.ENDC

	AND*	LSTRNG		/WORD WHOSE ADDRESS IS TO BE REPLACED BY

	TAD	LTEMP1		/THIS DATA WORD. ADD IN THIS DATA WORD AND

	DAC*	LSTRNG		/STORE ADJUSTED WORD BACK.

	JMP	CODE1		/RETURN DO PROCESS NEXT DATA WORD.

/CODE 22 DATA WORD PROCESSOR - .IODEV REQUEST.

/

LCD22	SPA

	JMP	IODALL		/.IODEV ALL.

	JMS	IOPROS		/PROCESS .IODEV REQUEST

	JMP	CODE1

/SUBROUTINE TO PROCESS .IODEV REQUESTS.

/.DAT SLOT NUMBER IN AC(9-17), 2'S COMP. WHEN NEG.

DATMI1	.DAT-1

DATM3	.DAT-3

DATM4	.DAT-4

DATM5	.DAT-5

DATM7	.DAT-7

IOPROS	0

	DAC	LTEMP1		/SAVE .DAT SLOT NUMBER.

	SNA

	JMP	IOERR2		/0 ILLEGAL .DAT SLOT.

	AND	(400

	SZA!CLA

TH777	LAW	17000		/NEGATIVE .DAT SLOT.

	XOR	LTEMP1

	TAD	DAT.

	DAC	LTEMP2		/ADDRESS OF .DAT SLOT.

	TAD	MDATND		/(-.DATND

	SMA

	JMP	IOERR2		/ILLEGAL .DAT SLOT.

MDATBG	-.DATBG		/LAW	-.DATBG

	TAD	LTEMP2

	SPA

	JMP	IOERR2		/ILLEGAL .DAT SLOT.

	LAC	LTEMP1		/*JAH138* REFETCH .DAT SLOT NUMBER

	SAD	(777		/*JAH138* .DAT SLOT = -1 ?

	JMP	IOSC07		/*JAH138* YES

	SAD	(774		/*JAH138* .DAT SLOT = -4 ?

	JMP	IOSC10		/*JAH138* YES

	SAD	(773		/*JAH138* .DAT SLOT = -5 ?

	JMP	IOSC11		/*JAH138* YES

	LAC*	LTEMP2

	AND	L77777

	SNA

	JMP*	IOPROS		/*JAH134* CONTENTS 0 - NON IS OK FOR .DAT SLOT

	SAD	(1

	JMP	IOTTY		/TT1.

	SAD*	(.SCOM+7

	JMP	IOSC07

	SAD*	(.SCOM+10

	JMP	IOSC10

	SAD*	(.SCOM+11

	JMP	IOSC11

	TAD*	IOCONF

	SMA!SZA			/NEG.  OR ZERO

	JMP*	IOPROS		/.DAT SLOT ALREADY SET UP.

	TAD	IOCONF		/PICK UP 1ST 3 CHARS. OF SYM.

	TAD	M1

	DAC	LSYM1

	LAC*	LSYM1

	DAC	LSYM1		/1ST 3 CHARS. OF SYMBOL.

	LAC	PER50		/4TH CHAR OF SYMBOL (.).

	DAC	LSYM2		/IN RADIX 50 (OCTAL).

	LAC	LTEMP2		/ADDRESS OF .DAT SLOT.

	TAD	(100000		/ADD CODE FLAG FOR VIRTUAL SYM. DEF.

	DAC	LSMDEF		/STORE IN TEMP. DEF. LOCATION.

	JMS	LSMSCN		/SCAN SYMBOL TABLE TO

	SZA			/DETERMINE IF THIS SYMBOL

	JMP	IOALIN		/HAS BEEN PREVIOUSLY ENTERED.

	JMS	LSMSTR		/STORE IN SYMBOL TABLE.

	LAC*	LTEMP2		/MAKE 1ST T.V. OF

	AND	LFTSVN		/STRING POINT TO

	XOR	LTEMP2		/ITSELF TO TERMINATE

IOPXIT	DAC*	LTEMP2		/RESOLUTION OF GLOBALS.

	JMP*	IOPROS		/EXIT.

IOALIN	DAC	LTEMP1		/ADDRESS OF LAST T.V. IN CHAIN.

	LAC* LSMW1		/IS HANDLER ALREADY LOADED?

	SPA			/	I.E., ALREADY DEFINED

	JMP IOPREU		/YES--GO INSERT ADDRESS IN .DAT SLOT

	LAC	LSMDEF

	DAC*	LSMW1

	JMP	IOPREU

IOERR2	LAW	17550		/ILLEGAL .DAT SLOT. - ASCII 4

	JMP	ERROUT

IOTTY	LAC*	DATM3		/ADDRESS OF TTY HANDLER.

	JMP	IOPXIT

IOSC07	LAC*	DATMI1		/.DAT-1

	AND	L77777		/MASK OFF UNIT NUMBER.

	DAC	LTEMP1

	LAC	LDSIZ		/PUT FIRST FREE ADDRESS ABOVE HANDLERS

				/INTO .SCOM+1

	DAC*	(.SCOM+1		/PRESERVE LINK. LOADER HANDLERS FOR USER.

IOPREU	LAC*	LTEMP2		/PRESERVE UNIT NUMBER.

	AND	LFTSVN

	XOR	LTEMP1

	JMP	IOPXIT

IOSC10	LAC*	DATM4		/.DAT-4

	JMP	IOSC07+1

IOSC11	LAC*	DATM5		/.DAT-5

	JMP	IOSC07+1

TMP1	0

IOCONF	0		/POINTER TO TOP OF IOC TABLE.

/PROCESS .IODEV ALL REQUEST.

/ALL POSITIVE .DAT SLOTS THAT DO NOT

/CONTAIN 0 ARE REQUESTED.

IODALL	DZM LTEMP4

	IDX LTEMP4

	LAC LTEMP4

	TAD DAT.

	DAC LTEMP2		/ADDRESS OF .DAT SLOT

	TAD	MDATND		/(-.DATND

	SMA!CLA

	JMP CODE1			/END OF .DAT TABLE.

	SAD* LTEMP2

	JMP IODALL+1		/BYPASS 0 SLOT.

	LAC LTEMP4

	JMS IOPROS

	JMP IODALL+1

	.TITLE CODE 23

/ CODE 23 DATA WORD PROCESSOR - END OF PROGRAM UNIT

/

LCD23	TAD	LRELOC		/*JAH132*  ADD RELOCATION FACTOR

	DAC	LTEMP1		/*JAH132* SAVE IN TEMPORARY

	LAC	NOLOAD		/DID THIS PROGRAM LOAD

	SZA			/YES

	DAC	LSMEND		/NO PUT BACK SYMBOL TABLE POINTER

	LAC	LTEMP1		/UFETCH START ADDRESS

	JMP*	LL000

	.TITLE CODE 28

/*JAH132*

/*JAH132* CODE 28 - ENTER OR EXIT COMMON BLK DATA INITIALIZATION MODE

/*JAH132*

LCD28	LAC	LSYM1		/*JAH132* FIRST 3 CHARS OF LAST DEFINED NAME

	SZA!CLA!CMA		/*JAH132* BLANK?

	JMP	LCD28A		/*JAH132* NO - ENTER COMMON BLK DATA INIT MODE

	SAD	SAVRLC		/*JAH132* HAS INITIAL PROGRAM CODE 1 OCCURRED?

	JMP	ERROR2		/*JAH132* NO, INPUT FILE ERROR

	DAC	LPLA		/*JAH132* NO CURRENT ADDR (INIDCATED BY -1)

				/*JAH132* EXIT CODE 28 MUST BE DIRECTLY

				/*JAH132* PROCEEDED BY CODE2 WITH CURRENT

				/*JAH132* VALUE OF PC

	LAC	SAVRLC		/*JAH132* RESTORE PROGRAM

	DAC	LRELOC		/*JAH132* BASE ADDR

	LAC	PLIM		/*JAH132* RESTORE PROGRAM

	DAC	LIM		/*JAH132* RANGE LIMIT

	DZM	CSIZE		/*JAH132* CLEAR SPECIAL CODE 1 C.B. SIZE INDICATOR

	JMP	CODE1		/*JAH132* GO SERVICE NEXT CODE

LCD28A	LAC	CSIZE		/*JAH132* SPECIAL CODE 1 SIZE OR ZERO

	JMS	ENTCOM		/*JAH132* ENTER C.B. SIZE IN SYM TABLE

	CLA!IAC			/*JAH132* INIT C.B. (BLOCK DATA)

	DAC	COMFLG		/*JAH132* INDICATOR

	JMS	GETCOM		/*JAH132* ALLOCATE C.B. IF NECC

	DZM	COMFLG		/*JAH132* RESTORE NORMAL ALLOCATION MODE

	LAC	SIZE		/*JAH132* 2'S COMP C. B. SIZE

	CMA!IAC			/*JAH132* MAKE POSITIVE

	TAD	LRELOC		/*JAH132* ADD BASE ADDR

	DAC	LIM		/*JAH132* FIRST LOC BEYOND END OF C.B.

	JMP	CODE1		/*JAH132* FETCH NEXT CODE

	.TITLE SYMBOL TABLE ROUTINES

/SYMBOL TABLE SCAN ROUTINE - THIS SUBPROGRAM SCANS THE SYMBOL TABLE

/   FOR EQUAL SYMBOLS AND RETURNS WITH THE SYMBOL DEFINITION

/   ENTRY IN ACCUMULATOR OR ALL ZEROS IN ACCUM.  IF NO MATCH FOUND.

/CALLING SEQUENCE

/	JMS	LSMSCN

LSMSCN	CAL	0

	LAC	LSMST		/ STORE SYMBOL TABLE STARTING ADDRESS IN

LSCN03	DAC	LSMW1		/ TEMPORARY POINTERS.

	DAC	LSMPT

	SAD	LSMEND		/ THE SYMBOL IS NOT IN THE TABLE IF ALL

	JMP	LSCN01		/ HAS BEEN SCANNED.

	LAC*	LSMW1

	XOR	LSMDEF		/ THE SYMBOL TO BE EXAMINED MUST BE THE

	AND	(300000		/ SAME TYPE AS THE SEARCH SYMBOL.

	SZA			/ I.E. GLOBAL VS. GLOBAL

	JMP	LSCN02		/ COMMON BLOCK NAME VS. SAME

	JMS	UFSMPT		/THE SYMBOL IS FOUND WHEN THE NAME

	SAD	LSYM1		/ WORK (S) MATCH.

	JMP	LSCN04

	JMP	LSCN02

LSCN04	SMA

	JMP	LSCN05

	JMS	UFSMPT

	SAD	LSYM2

	JMP	LSCN05		/ THEN A MATCH CANNOT BE MADE, THE SEARCH

LSCN02	JMS	NXCNT		/ ADDRESS IS UPDATED TO THE NEXT ENTRY IN

	JMP	LSCN03		/ THE TABLE.

LSCN05	LAC*	LSMW1

	AND	L77777		/THE DEFINITION OF THE SYMBOLL IS RETURNED

	JMP*	LSMSCN		/ AS A SIGNAL DAT THE NAME WAS FOUND.

LSCN01	CLA

	JMP*	LSMSCN		/ ZERO INDICATES THE SYMBOL WAS NOT FOUND.

/SUBROUTINE TO INCREMENT SYMBOL TABLE COUNTER

/ TO POINT TO NEXT ENTRY.

NXCNT	CAL	0

	LAC	LSMW1		/1ST WORD OF THIS ENTRY

	DAC	LSMPT

	JMS	UFSMPT		/ ALL ENTRIES IN THE SYMBOL TABLE ARE

	SPA			/ EITHER 2 OR 4 WORDS LONG (NOT COUNTING

	IDX	LSMPT		/ THE SECOND NAME WORD).

	IDX	LSMPT

	LAC*	LSMW1		/ ONLY ENTRIES FOR COMMON BLOCK NAMES

	AND	(300000		/ ARE 4 (5) WORDS IN LENGTH

	SAD	(300000		/ FOR CODES 7 AND 3

	JMP	NXCNT1

	JMP	NXCNT2

NXCNT1	IDX	LSMPT

	IDX	LSMPT		/ THE NEXT ENTRY ADDRESS IS RETURNED TO

NXCNT2	LAC	LSMPT		/ THE CALLING PROGRAM.

	JMP*	NXCNT

/SUBROUTINE TO STORE A SYMBOL AND ITS DEFINITION IN THE SYMBOL TABLE

/

LSMSTR	CAL	0

	LAC	LSMDEF		/STORE SYMBOL DEFINITION IN SYMBOL TABLE

	JMS	LSTSYM

	LAC	LSYM1		/ STORE 1ST 3 CHARS OF SYM. IN SYMTAB

	SMA			/ TEST TO SEE IF SYM.> 3 CHARS.

	JMP	SMSTR1

	JMS	LSTSYM

	LAC	LSYM2		/ STORE SECOND WORD OF SYMBOL IN TABLE.

SMSTR1	JMS	LSTSYM

	JMP*	LSMSTR		/ RETURN TO CALLING PROGRAM.

/SUBROUTINE TO INCREASE STORE ADDRESS FOR ENTERING A NEW SYMBOL IN

/SYMBOL TABLE AND CHECKING FOR SYMBOL TABLE OVERFLOW

/

LPTCNT	CAL	0

	IDX	LSMEND		/ INCREASE SYMBOL TABLE END POINTER

	LAC	LPRES

	CMA

	TAD	LSMEND		/ COMPARE SYMTAB END PTR TO END OF FREE STORAGE.

	SPA			/IF STORAGE HAS BEEN EXCEEDED, ERROR.

	JMP*	LPTCNT		/ RETURN TO CALLING PROGRAM

/MEMORY OVERFLOW

ERROR1=.

ERROR4	LAW	17542

	JMP	ERROUT

/ADD 12/13 BIT CURRENT RELOCATION FACTOR TO DATA WORD ADDRESS SUB-

/ROUTINE.

/CALLING SEQUENCE

/	JMS	LMOD13

/

	.IFDEF	PDP15

ADSWCH	7777

	.ENDC

LMOD13	CAL	0

	DAC	LTEMP1		/ STORE DATA WORD IN TEMP. STORAGE

	LAC	LRELOC		/ LOAD 15 BIT ADDRESS

	.IFUND	PDP15

	AND	L17777		/ EXTRACT OUT BITS (13) 14 AND 15

	.ENDC

	.IFDEF	PDP15

	AND	ADSWCH

	.ENDC

	TAD	LTEMP1		/ ADD DATA WORD TO 12/13 BIT ADDRESS

	JMP*	LMOD13		/ RETURN TO CALLING PROGRAM

	.EJECT

/SUBROUTINE TO UPDATE LSMPT AND FETCH

UFSMPT	0

	IDX	LSMPT

	LAC*	LSMPT

	JMP*	UFSMPT

/SUBR. TO STORE DATA IN SYMTAB AND UPDATE LSMEND.

LSTSYM	0

	DAC*	LSMEND

	JMS	LPTCNT

	JMP*	LSTSYM

	.TITLE .END, LITERALS

	.END	.LOAD
