Google
 

Trailing-Edge - PDP-10 Archives - AP-4178E-RM - swskit-sources/postld.mac
There are 51 other files named postld.mac in the archive. Click here to see a list.
;<3A.MONITOR>POSTLD.MAC.10, 22-Jun-78 20:34:53, Edit by ENGEL
;FIX XPUNGE
;<3A.MONITOR>POSTLD.MAC.9, 22-Jun-78 16:22:23, EDIT BY MILLER
;ADD AN "XPUNGE"
;<1BOSACK>POSTLD.MAC.1001, 15-Jun-78 15:36:36, EDIT BY BOSACK
;<1BOSACK>POSTLD.MAC.1000,  1-Jun-78 21:06:27, EDIT BY BOSACK
;CHANGES FOR MORE PSECTS
;<3A.MONITOR>POSTLD.MAC.7,  7-Mar-78 18:54:08, EDIT BY BOSACK
;<3A.MONITOR>POSTLD.MAC.6,  7-Mar-78 18:34:40, EDIT BY BOSACK
;<3A.MONITOR>POSTLD.MAC.5,  7-Mar-78 18:33:50, EDIT BY BOSACK
;OUTPUT TYPE OF BUGXXX IN BUGXXX LISTING
;<3A.MONITOR>POSTLD.MAC.4, 23-Jan-78 20:56:36, EDIT BY BOSACK
;<3A.MONITOR>POSTLD.MAC.3, 23-Jan-78 20:36:30, EDIT BY BOSACK
;MOVE BUGSTRINGS/POINTERS TO OVERLAP SWP PAGE VARS
;<3.SM10-RELEASE-3>POSTLD.MAC.2,  6-Dec-77 02:31:46, Edit by MCLEAN
;CROSSLANDS FIX IS BAD
;<3-MONITOR>POSTLD.MAC.147,  9-Nov-77 09:57:11, EDIT BY KIRSCHEN
;MORE COPYRIGHT UPDATING...
;<3-MONITOR>POSTLD.MAC.146, 26-Oct-77 23:49:18, EDIT BY CROSSLAND
;MAKE ROUTINE TO DELETE SYSMBOLS FOR A MODULE UNDERSTAND THAT FULL
;WORD OF ZERO IS A DELETED SYMBOL, NOT A PROGRAM NAME.
;<3-MONITOR>POSTLD.MAC.145, 10-Oct-77 14:12:15, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
;<3-MONITOR>POSTLD.MAC.144, 14-Sep-77 01:26:25, EDIT BY BOSACK
;<3-MONITOR>POSTLD.MAC.143, 13-Sep-77 00:11:08, EDIT BY BOSACK
;<3-MONITOR>POSTLD.MAC.142, 12-Sep-77 23:31:52, EDIT BY BOSACK
;<3-MONITOR>POSTLD.MAC.141,  7-Sep-77 15:28:59, EDIT BY BOSACK
;<3-MONITOR>POSTLD.MAC.140, 25-Aug-77 22:24:49, EDIT BY BOSACK
;LEAVE SOME SPACE FOR SYMTAB TO GROW
;<3-MONITOR>POSTLD.MAC.139, 23-Aug-77 15:39:36, EDIT BY BOSACK
;<3-MONITOR>POSTLD.MAC.138, 23-Aug-77 15:34:46, EDIT BY BOSACK
;DEFINE MDDT, CLEAR .JBHRL SO DDT ISN'T CONUFSED
;<3BOSACK>POSTLD.MAC.145, 23-Aug-77 03:34:11, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.144, 23-Aug-77 01:24:52, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.143, 23-Aug-77 01:19:27, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.142, 23-Aug-77 00:13:41, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.141, 23-Aug-77 00:02:12, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.140, 22-Aug-77 23:18:28, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.139, 22-Aug-77 23:16:19, EDIT BY BOSACK
;ADD INITCOD LOGIC
;PURIFY SYMTAB BEFORE MOVING IT
;<3BOSACK>POSTLD.MAC.138, 18-Aug-77 23:40:36, EDIT BY BOSACK
;ALWAYS FLUST EDDT,MDDT,POSTLD LOCALS
;<3BOSACK>POSTLD.MAC.137, 12-Aug-77 23:03:53, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.136, 12-Aug-77 23:02:27, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.1, 12-Aug-77 22:38:09, EDIT BY BOSACK
;SHUFFLE ADDRESS SPACE TO HAVE CODE LOWEST
;<3-MONITOR>POSTLD.MAC.135, 12-Aug-77 21:09:26, EDIT BY BOSACK
;<3-MONITOR>POSTLD.MAC.134, 12-Aug-77 02:03:06, EDIT BY BOSACK
;MAKE POSTLD LOAD IN ITS OWN PSECT.
;PRINT HEADING FOR FINAL SEG SIZES
;<3BOSACK>POSTLD.MAC.143,  9-Aug-77 03:11:53, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.142,  9-Aug-77 03:10:19, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.141,  9-Aug-77 02:31:36, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.140,  9-Aug-77 02:04:40, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.139,  9-Aug-77 01:48:11, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.138,  9-Aug-77 01:45:49, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.137,  9-Aug-77 01:42:24, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.136,  5-Aug-77 02:26:43, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.135,  5-Aug-77 02:15:15, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.134,  5-Aug-77 01:49:15, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.133, 24-Jun-77 22:50:35, EDIT BY BOSACK
;<3BOSACK>POSTLD.MAC.132, 24-Jun-77 20:41:20, EDIT BY BOSACK
;TCO 1832 - PSECT CHANGES
;<3-MONITOR>POSTLD.MAC.131, 10-May-77 15:48:12, EDIT BY HURLEY
;<3-MONITOR>POSTLD.MAC.130, 10-May-77 14:05:05, EDIT BY HURLEY
;FIX UP TITLES FOR THE VARIOUS ASSEMBLIES
;<3-MONITOR>POSTLD.MAC.129,  9-May-77 11:07:15, EDIT BY HURLEY
;<3-MONITOR>POSTLD.MAC.128,  2-May-77 18:35:48, EDIT BY HURLEY
;<3-MONITOR>POSTLD.MAC.127,  2-May-77 18:32:15, EDIT BY HURLEY
;<3-MONITOR>POSTLD.MAC.126,  3-Feb-77 23:01:50, Edit by MCLEAN
;<3-MONITOR>POSTLD.MAC.125, 30-Dec-76 02:30:33, Edit by MCLEAN
;<3-MONITOR>POSTLD.MAC.124, 27-Dec-76 17:36:30, EDIT BY HURLEY
;<2-MONITOR>POSTLD.MAC.123, 18-Aug-76 11:41:49, Edit by HESS
;<2-MONITOR>POSTLD.MAC.122, 16-Aug-76 19:12:35, EDIT BY MURPHY
;<2-MONITOR>POSTLD.MAC.121,  9-Aug-76 12:09:37, EDIT BY MURPHY
;TCO #1485 - CLEAR .JBHSM
;<1B-MONITOR>POSTLD.MAC.120, 16-Jun-76 15:17:28, EDIT BY OSMAN
;TCO 1430 REMOVE REFERENCE TO VERSIO.MAC - MAKE WAY FOR STANDARD VERSION
;<1B-MONITOR>POSTLD.MAC.119, 10-JUN-76 11:02:47, EDIT BY JMCCARTHY
;TCO 1369 - CLOSE BUGSTRINGS.TXT FILE PROPERLY
;<1B-MONITOR>POSTLD.MAC.118, 24-MAY-76 14:34:48, EDIT BY MURPHY
;TCO #1313 - REMOVE LOCAL SYMS PER LOCSF
;<1MONITOR>POSTLD.MAC.117, 26-FEB-76 18:09:18, EDIT BY MURPHY
;<1MONITOR>POSTLD.MAC.116, 26-FEB-76 17:35:00, EDIT BY MURPHY
;<2MONITOR>POSTLD.MAC.115, 16-FEB-76 17:54:23, EDIT BY MURPHY
;TCO #1097 - INCREASE FREE MONITOR VAS
;<2MONITOR>POSTLD.MAC.113, 26-JAN-76 15:23:12, EDIT BY HURLEY
;MCO 28 - CLOSE THE BUGSTRINGS.TXT FILE
;<2MONITOR>POSTLD.MAC.112, 23-DEC-75 13:08:08, EDIT BY LEWINE


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

	SEARCH PROLOG,MONSYM,MACSYM
	TITLE POSTLD
	ENTRY $POSTLD
	$POSTLD==:0
	SALL
	.PSECT NRCOD
	GGLOBS

;POST-LOADING ONE-SHOT INIT

EXTN <IEDDTF,ILOCSF,MONSNM,BGSTR,NRESBG,RESLOC,ZROCOR>
EXTN <INCDBG,MDDTX,BUGHLT,BUGCHK,BUGINF>
EXTN <JSLSTA,PSB1A,PSSPSA>
NPDL==100			;SIZE OF LOCAL PDL

;BIT DEFINITIONS IN SYMBOL TABLE ENTRIES

SYMDOB==1B0			;DELETE OUTPUT
SYMDIB==1B1			;DELETE INPUT
SYMLOC==1B2			;LOCAL
SYMGLO==1B3			;GLOBAL
;NO BITS - PROGRAM NAME
;SYMLOC+SYMGLO - BLOCK NAME

DEFINE TSTR ($MSG)<
	HRROI A,[ASCIZ \$MSG\]
	PSOUT>

DEFINE JSERR <
	JSP 2,JSEX0>

;GET FINAL VALUE OF LOAD PC'S
DEFINE FIXPC (PC,EPC)<
	.PSECT PC
EPC::	BLOCK 0
	.ENDPS PC
>

;FIXPC(RSCOD,RESEND)	;DEFINED LATER
FIXPC(INCOD,INCODZ)
FIXPC(RSVAR,RESVLZ)
FIXPC(PPVAR,PPRVLZ)
FIXPC(NRVAR,NRESLZ)
FIXPC(NRCOD,NRCODZ)
FIXPC(NPVAR,NRPLOZ)
FIXPC(BGSTR,BGSTRZ)
FIXPC(BGPTR,BGPTRZ)

NBUGP==BGPTRZ-BGPTR##
	.PSECT NRCOD
MDDT=:MDDTX

SWPF::				;DEFINE SWAPPABLE PATCH SPACE

	RESCD
INIMPN==3			;MAX SIZE OF INITCOD MAP

INIMAP:: XWD -INIMPN,.+1	;POINTER TO REGION TABLE
	BLOCK INIMPN		;TABLE - FILLED IN LATER IN POSTLD
NINIPG::BLOCK 1		;NUMBER OF INIT PAGES BELOW SWPCP0

EDDT=:DDTX			;DEFINE DDT START ADDRESS
	BLOCK 10		;LEAVE SOME SPACE AFTER LAST PROG
RESEND::			;DEFINES END OF CODE, SYMTAB MOVED TO HERE

;LOAD POSTLD WHERE IT WILL GET OVERLAYED BY RUNTIME STORAGE

	.ENDPS RSCOD
	.PSECT POSTCD

;LOCAL SYMBOL FLAG - RETAIN LOCALS IF NON-0

LOCSF:	ILOCSF
;START HERE AT COMPLETION OF LOADING

SYSG0:	MOVE P,[IOWD NPDL,PDL]
	GTAD			;GET TIME AND DATE OF NOW
	MOVEM A,SYSTAD		;REMEMBER IT IN SWPMON
	MOVE A,[RADIX50 0,SWPF]	;GET RADIX50 FOR SWAPPABLE PATCH SPACE
	CALL LOOKU5		;FIND IT IN SYMTAB
	 CALL LOOKXX		;FAILED
	HRRZ B,1(A)		;GET VALUE OF SWPF
	HRRM B,.JBHRL		;MAKE IT BE DEFINED END OF HISEG
	HRRZ 2,.JBHRL
	SUBI 2,1
	LSH 2,-PGSFT
	MOVEM 2,SWCEND
	MOVEM 2,SWCEN0
	HRROI 1,[ASCIZ /
ADDRESS SPACE AT LINK TIME:
/]
	PSOUT

;DEFINE LOCAL MACRO FOR SPACE PRINTOUTS
DEFINE PRSEG($START,$END,$NEXT,$STR1,$STR2)<
	HRROI A,[ASCIZ \
$STR1 START: \]
	PSOUT
	MOVEI B,$START
	CALL OCTOUT
	HRROI A,[ASCIZ /, END: /]
	PSOUT
	MOVEI B,$END
	CALL OCTOUT
	HRROI A,[ASCIZ \
  FREE SPACE TO $STR2: \]
	PSOUT
	MOVEI B,$NEXT
	SUBI B,$END
	CALL PRSVAL
>

;PRINT FREE SPACE IN WORDS OCTAL AND DECIMAL

	PRSEG (RSCDBG,RESEND,INCDBG,<RES MON>,<INIT CODE>)
	PRSEG (INCDBG,INCODZ,RESLOC,<INIT CODE>,<RES VARS>)
	PRSEG (RESLOC,RESVLZ,PPRMA,<RES VARS>,<PER PROC VARS>)
	PRSEG (PPRMA,PPRVLZ,NRESBG,<PER PROC VARS>,<SWP VARS>)
	PRSEG (NRESBG,NRESLZ,SWPMA,<SWP VARS>,<SWP MON>)
	PRSEG (SWPMA,NRCODZ,NRPLBG,<SWP MON>,<SWP PAGE VARS>)
	PRSEG (BGSTR,BGSTRZ,BGPTR,<BUGSTRINGS>,<BUGPOINTERS>)
	PRSEG (BGPTR,BGPTRZ,JSBPGA,<BUGPOINTERS>,<JSB>)
	PRSEG (NRPLBG,NRPLOZ,JSBPGA,<SWP PAGE VARS>,<JSB>)
	PRSEG (JSBPGA,JSLSTA,PSSPSA,<JSB>,<PSB>)
	PRSEG (PSSPSA,PSB1A+777,777777,<PSB>,<SEC 0 END>)
	JRST PLD1
;SUBROUTINE TO PRINT SPACE AS OCTAL AND DECIMAL

PRSNUM:	PUSH P,B		;SAVE SECOND ARG
	CALL LOOKU5		;LOOK "TO"
	 CALL LOOKXX		;FAILED
	MOVE A,1(A)		;GET VALUE OF "TO"
	EXCH A,0(P)		;SAVE IT, GET "FROM"
	CALL LOOKU5		;LOOKUP "FROM"
	 CALL LOOKXX		;FAILED
	POP P,B			;RECOVER VALUE OF "TO"
	SUB B,1(A)		;COMPUTE "TO" - "FROM"
PRSVAL:	MOVEI 1,101		;ENTRY WITH VAL IN B
	MOVEI 3,^D8
	NOUT			;PRINT QUANTITY IN OCTAL
	 JSERR
	HRROI 1,[ASCIZ /, =^D/]
	PSOUT
	MOVEI 1,101
	MOVEI 3,^D10
	NOUT			;PRINT QUANTITY IN DECIMAL
	 JSERR
	RET
;FLUSH CERTAIN SYMBOLS WHICH CAN BE RECOGNIZED AS CONSTRUCTED
;BY MACROS, ETC.

PLD1:	SKIPL 7,.JBSYM		;GET SYMTAB PTR
SR3:	AOBJP 7,SR2		;JUMP IF DONE SCANNING TABLE
	MOVE 1,0(7)		;GET SYMBOL
	CALL R50TO6		;CONVERT RADIX 50 TO SIXBIT
	LDB 2,[POINT 6,1,5]	;LOOK AT FIRST CHAR
	CAIE 2,'%'		;SPECIAL?
	CAIN 2,'$'
SRDEL:	JRST [	SETZM 0(7)	;YES, DELETE IT
		AOBJN 7,SR3]	;ALWAYS JUMP
	LDB 2,[POINT 12,1,11]
	CAIN 2,'..'
	JRST SRDEL
	SETZ 2,
	LSHC 1,-^D6		;GET LAST CHAR
	JUMPN 2,.+2		;JUMP IF GOT IT
	JUMPN 1,.-2		;KEEP SKIPPING BLANKS
	CAIE 2,'%'		;SPECIAL?
	CAIN 2,'$'
	SETZM 0(7)		;YES, DELETE IT
	AOBJN 7,SR3		;ALWAYS JUMP
;REMOVE REDUNDANT SYMBOLS FROM TABLE

SR2:	SKIPL 7,.JBSYM
SS2:	AOBJP 7,SS8		;JUMP IF DONE
	MOVE 1,0(7)		;GET SYMBOL
	TLCE 1,14B23		;PROGRAM NAME, OR
	TLCN 1,14B23		;BLOCK NAME?
	AOBJN 7,SS2		;YES (ALWAYS JUMP)
	SKIPN LOCSF		;FLUSH LOCAL SYMBOLS?
	TXNN T1,SYMLOC		;YES, THIS A LOCAL?
	TXNE T1,SYMDIB		;THIS A NO-INPUT SYMBOL?
	JRST SS6		;YES, FLUSH IT
	MOVE 2,1(7)		;GET VALUE
	CAIGE 2,20		;VALUE 0-17?
	JUMPGE 2,[TLNN 1,(04B5)	;GLOBAL?
		AOBJN 7,SS2	;NO, LEAVE AS IS (ALWAYS JUMP)
		JRST SS22]	;YES, HANDLE NORMALLY
;		TLO 1,(40B5)	;GLOBAL AND 0-17, MAKE NO OUTPUT
;		MOVEM 1,0(7)
;		AOBJN 7,SS2]	;(ALWAYS JUMP)
	CAIGE 2,1000		;IF VALUE 20-XXX
	JUMPGE 2,[TLO 1,40B23	;MAKE SYMBOL NO-OUTPUT
		MOVEM 1,0(7)
		JRST .+1]
SS22:	AOBJN 7,SS2		;NOP THIS TO INCLUDE FOLLOWING CODE
;***************************************************
	MOVE 3,1
	TLZ 1,14B23		;FLUSH LOCAL-GLOBAL BITS
	MOVE 6,7		;SETUP INNER LOOP TO SCAN FOR
	AOBJP 6,.+1		;OTHER OCCURRANCES
SS1:	AOBJP 6,SS61		;JUMP IF DONE
	CAMN 2,1(6)		;VALUE THE SAME?
	SKIPN 4,0(6)		;SYMBOL NOT PREVIOUSLY DELETED?
	AOBJN 6,SS1		;NO (ALWAYS JUMP)
	TLCE 4,14B23		;PROGRAM NAME, OR
	TLCN 4,14B23		;BLOCK NAME?
	AOBJN 6,SS1		;YES (ALWAYS JUMP)
	XOR 4,3
	TDNE 4,[XWD 037777,-1]	;SYMBOL EQUAL (EXCLUDING BITS)?
	AOBJN 6,SS1		;NO (ALWAYS JUMP)
	PUSH P,1
	PUSH P,2
	MOVEI D,CPBOUT
	MOVE A,0(6)		;GET SYMBOL
	TLZ A,(74B5)		;FLUSH BITS
	CALL R50T1		;TYPE IT
	MOVEI A," "
	PBOUT
	POP P,2
	POP P,1
	SETZM 0(6)		;YES, DELETE SYMBOL
	TLON 1,04B23		;AND MAKE ORIGINAL GLOBAL
	MOVEM 1,0(7)
	AOBJN 6,SS1		;(ALWAYS JUMP)

CPBOUT:	PBOUT
	RET
SS6:	SETZM 0(7)		;DELETE NO-INPUT SYMBOL
SS61:	AOBJN 7,SS2

SS8:	HRROI 1,[ASCIZ /
REMOVING SYMBOLS FOR:
/]
	PSOUT
	MOVSI 16,-NPNMS		;SETUP TO REMOVE CERTAIN PRG SYMBOLS
SR1:	MOVEI 1,0(16)
	SKIPL PNAMES+1(16)	;THIS AN ALWAYS REMOVE?
	CALL CSS		;YES
	AOBJN 16,.+1
	AOBJN 16,SR1
	MOVE 7,.JBSYM		;SCAN TABLE AND COMPACT
	MOVEI 6,0(7)		;WILL BE NEW TABLE POINTER
SS5:	SKIPN 1,0(7)		;DELETED?
	JRST SS4		;YES
	MOVEM 1,0(6)
	MOVE 1,1(7)
	MOVEM 1,1(6)
	ADD 6,[XWD -2,2]	;MOVE TO NEW POSITION
SS4:	AOBJN 7,.+1
	AOBJN 7,SS5
	HLLM 6,.JBSYM		;STORE NEW COUNT
	CALL FIXLEN		;FIXUP LENGTH OF PROGRAM BLOCKS
;MOVE SYMBOL TABLE FROM END OF HIGHSEG TO END OF LOWSEG

	MOVEI 1,RESVLZ+60	;SETUP NEW LOC OF SYMTAB
	HLRE 2,.JBUSY		;GET LENGTH OF UNDEF SYMTAB
	JUMPGE 2,PLD2		;JUMP IF NO UNDEF TABLE
	HRLZ 3,.JBUSY		;SETUP BLT PTR - SOURCE
	HRRM 1,.JBUSY		;STORE NEW LOC OF USY
	HRR 3,1			;BLT PTR - DEST
	SUB 1,2			;CALC FINAL ADR (ORG-(-LENGTH))
	BLT 3,-1(1)		;MOVE UNDEF SYMTAB TO RES AREA
PLD2:	HLRE 2,.JBSYM		;GET LENGTH OF SYMTAB
	HRLZ 3,.JBSYM		;SET BLT PTR - SOURCE
	HRRM 1,.JBSYM		;STORE NEW LOC OF SYMTAB
	HRR 3,1			;BLT PTR - DEST
	SUB 1,2			;CALC FINAL ADR (ORG-(-LENGTH))
	BLT 3,-1(1)		;MOVE SYMTAB TO RES AREA
	HRRZM 1,.JBFF		;SET END OF LOW CODE
	HRLM 1,.JBSA

;SET ENTRY VECTOR AND START ADDRESS

	MOVE 2,[JRST EVGO]	;MAIN START LOCATION
	HRRM 2,.JBSA
	SETOM DDTPRS		;NOTE DDT PRESENT
	MOVEI 1,IEDDTF		;INIT EDDTF
	MOVEM 1,EDDTF
	MOVEI 1,.FHSLF
	SEVEC
	; ..
;SORT THE BUG TABLE BY BUG ADDRESS, AFTER WHICH TABLE WILL BE COMPACT

	MOVSI 7,-NBUGP
BUGSR4:	MOVSI 5,-NBUGP(7)	;SCAN FROM HERE TO END
	HRRI 5,0(7)
	HRLOI 3,377777		;INITIAL MINIMUM
BUGSR1:	HLRZ 1,BGPTR(5)	;BUG ADDRESS
	JUMPE 1,BUGSR2		;IGNORE ZEROS
BUGSR5:	MOVE 2,1(1)		;GET NEXT WORD FROM BLOCK
	TLNN 2,770000		;FOUND THE SIXBIT NAME?
	AOJA 1,BUGSR5		;NO, LOOP BACK UNTIL FOUND
	TXC 2,1B0		;SO COMPARE WORKS ON SIXBIT NAME
	CAML 2,3		;MIN SO FAR?
	JRST BUGSR2		;NO
	MOVE 3,2		;YES, REMEMBER THIS VALUE
	MOVEI 4,0(5)		;AND LOCATION
BUGSR2:	AOBJN 5,BUGSR1
	CAMN 3,[377777,,777777]	;FOUND A MIN?
	JRST BUGSR3		;NO, NOTHING BUT ZEROS LEFT
	MOVE 1,BGPTR(4)	;INTERCHANGE MIN WITH TOP OF TABLE
	EXCH 1,BGPTR(7)
	MOVEM 1,BGPTR(4)
	AOBJN 7,BUGSR4		;(ALWAYS JUMP)
;DUMP BUG STRINGS TO FILE, SETUP BUGTABLE IN SWPMON

BUGSR3:	HRRZM 7,NBUGTP		;SAVE COUNT OF POINTER ENTRIES
	MOVNI 1,0(7)		;CONSTRUCT ABOJN PTR
	HRLM 1,BUGTP
	HRRZ 1,.JBHRL		;FOR BUG TABLE AS MOVED TO AREA
	ADDI 1,100		;AFTER SWAPMON, ALLOWING 100 WDS FOR
	HRRM 1,BUGTP		;PATCH SPACE
	MOVX T1,GJ%FOU+GJ%SHT
	HRROI 2,[ASCIZ /BUGSTRINGS.TXT/]
	GTJFN
	 JSERR
	MOVE 2,[7B5+1B20]
	OPENF
	 JSERR
	SETZ 3,
	HRROI 2,TSVN		;SYSTEM VERSION TEXT
	SOUT
	HRROI 2,[ASCIZ /
BUGHLT AND BUGCHK NAMES AND DESCRIPTIONS

/]
	SOUT

;MOVE AND COMPACT STRINGS TO AREA IMMEDIATELY AFTER POINTERS

	HRRZ 5,BUGTP		;GET START OF TABLE
	ADD 5,NBUGTP		;COMPUTE START OF STRINGS AREA
	HLLZ 7,BUGTP		;SETUP NEG COUNT
	HRRZ 4,BUGTP		;SETUP POINTER TO DEST POINTER AREA
BUGD1:	MOVE 6,BGPTR(7)	;TABLE ENTRY
	MOVEM 6,0(4)		;MOVE IT TO NEW PLACE
	HRRM 5,0(4)		;SET NEW ADDRESS OF STRING
	ADDI 4,1		;BUMP PTR ADDRESS
	HLRZ 2,6		;ADDRESS
BUGD2:	MOVE 3,1(2)		;GET NEXT WORD FROM BLOCK
	TLNN 3,770000		;FOUND THE SIXBIT NAME YET?
	AOJA 2,BUGD2		;NO, LOOP UNTIL IT IS FOUND
BUGD4:	SETZ 2,			;NOW TYPE OUT NAME
	LSHC 2,6		;GET NEXT CHARACTER
	ADDI 2," "		;MAKE IT ASCII
	BOUT			;OUTPUT IT
	JUMPN 3,BUGD4		;LOOP UNTIL NAME IS FINISHED
	HLRZ 3,6		;GET ADDRESS
	HRRZ 3,(3)		;GET BUGXXX ADDRESS
	HRROI 2,[ASCIZ /	[UNK] /]
	CAIN 3,BUGHLT		;BUGHLT?
	HRROI 2,[ASCIZ /	[HLT] /]
	CAIN 3,BUGCHK		;BUGCHK
	HRROI 2,[ASCIZ /	[CHK] /]
	CAIN 3,BUGINF		;BUGINF?
	HRROI 2,[ASCIZ /	[INF] /]
	MOVEI 3,0
	SOUT			;OUTPUT DESCRIPTION
;	MOVEI 2,.CHTAB		;END WITH A TAB
;	BOUT
	HRROI 2,0(6)
	SETZ 3,
	SOUT			;PRINT THE STRING
	HRROI 2,[ASCIZ /
/]
	SOUT
BUGD3:	MOVE 2,0(6)		;MOVE STRING TO COMPACTING AREA
	MOVEM 2,0(5)
	ADDI 5,1
	TRNE 2,177B34		;UNTIL (LAST) CHAR OF 0 ENCOUNTERED
	AOJA 6,BUGD3
	AOBJN 7,BUGD1
	CLOSF			;CLOSE BUGSTRINGS.TXT
	JFCL
	HRRM 5,.JBHRL		;UPDATE NEW END OF SWPMON
	; ..

;UPDATE HIGHSEG END

	HRRZ 1,.JBHRL		;UPDATE HISEG END
	SUBI 1,1		;COMPUTE LAST PAGE USED
	LSH 1,-PGSFT
	MOVEM 1,SWCEND
	; ..
;REMOVE PAGES AFTER SWPMON WHERE SYMTAB WAS

	SETO T1,
	MOVE T2,SWCEND
	ADD T2,[.FHSLF,,1]	;START WITH PAGE AFTER SWCEND
	MOVEI T3,777		;TO END OF VAS
	SUBI T3,0(T2)		;COMPUTE NUMBER PAGES
	HRLI T3,(1B0)
	PMAP
;SET LOWSEG BOUNDARIES

	MOVEI 1,RESVLZ		;END OF RESIDENT STORAGE AREA
	MOVEM 1,ZROEND		;SET AS END OF AREA ZEROED ON STARTUP
	MOVEI 1,RESEND		;INITIALIZE END OF MONITOR CORE
	ADDI 1,PGSIZ-1		; ...
	LSH 1,-PGSFT
	MOVEM 1,MONCOR		; STORE
	MOVE 3,.JBSYM		;MOVE POINTER TO EXEC DDT LOCATION
	MOVEM 3,36
	HRRZ 3,.JBFF		;END OF SYMTAB
	ADDI 3,PGSIZ-1		;ADJUST TO NEXT PAGE BOUNDARY
	LSH 3,-PGSFT		;NUMBER OF FIRST PAGE AFTER SYMTAB
	MOVEM 3,SWPCP0		;SETUP FIRST SWAP PAGE

;BUILD MAP OF CODE TO UNLOCK AFTER SWPMON LOAD

	MOVE Q1,INIMAP		;GET POINTER TO TABLE
	MOVEI T1,INCDBG		;GET START OF INITCD
	ADDI T1,PGSIZ-1		;ROUND UP TO NEXT PAGE
	ANDI T1,777000		;MASK TO PAGE
	HRLZM T1,(Q1)		;STORE AS START OF THIS REGION
	MOVEI T2,INCODZ		;GET END OF INIT CODE
	ANDI T2,777000		;MASK TO PAGE BOUNDRY
	HRRM T2,(Q1)		;FINISH POINTER
	SUB T2,T1		;COMPUTE NUMBER OF PAGES
	LSH T2,-PGSFT		; ...
	ADDI T2,1		; ...
	MOVE Q2,T2		;ACCUMULATE IN Q2
	AOBJN Q1,.+1		;INCREMENT
	HRRZ T1,.JBSYM		;GET START OF SYMTAB
	ADDI T1,PGSIZ-1		;ROUND TO NEXT PAGE
	ANDI T1,777000		; ...
	HRLZM T1,(Q1)		;STORE START OF THIS REGION
	MOVE T2,SWPCP0		;GET FIRST FREE PAGE
	SUBI T2,1		;GET LAST PAGE IN SYMTAB
	LSH T2,PGSFT		;AS AN ADDRESS
	HRRM T2,(Q1)		;STORE IN TABLE
	SUB T2,T1		;GET SIZE OF REGION
	LSH T2,-PGSFT		;AS A PAGE
	ADDI T2,1		; ...
	ADD Q2,T2		;ACCUMULATE
	MOVEM Q2,NINIPG		; SAVE FOR PGRINI

;PRINT FINAL SEGMENT SIZES
	HRROI A,[ASCIZ /
SEGMENTS AFFECTED BY POSTLD:
/]
	PSOUT


DEFINE PRSEG($START,$END,$NEXT,$STR1,$STR2)<
	HRROI A,[ASCIZ \
$STR1 START: \]
	PSOUT
	HRRZ B,$START
	CALL OCTOUT
	HRROI A,[ASCIZ /, END: /]
	PSOUT
	HRRZ B,$END
	CALL OCTOUT
	HRROI A,[ASCIZ \
  FREE SPACE TO $STR2: \]
	PSOUT
	HRRZ B,$NEXT
	HRRZ A,$END
	SUB B,A
	CALL PRSVAL
>

	PRSEG ([0],.JBFF,[PPRMA],<RESIDENT SEGMENT>,<PER PROC VARS>)
	PRSEG ([NRESBG],.JBHRL,[NRPLBG],<SWAPPABLE SEGMENT>,<SWP PAGE VARS>)
	HRROI 1,[ASCIZ /
/]
	PSOUT
	SETZM .JBHRL		;SO DDT DOESN'T GET CONFUSED

	; ..
;CREATE THE EXE FILE CONTAINING THE MONITOR

	MOVX A,GJ%FOU+GJ%SHT	;GET NEXT VERSION OF MONITOR FILE
	HRROI B,MONSNM		;GET NAME TO SAVE AS
	GTJFN
	 JSERR
	PUSH P,A
	TSTR <SAVING MONITOR AS >
	MOVEI A,101
	HRRZ B,0(P)
	SETZ C,
	JFNS
	POP P,A
	HRLI A,.FHSLF		;CONSTRUCT  FORKH,,JFN  FOR SSAVE
	MOVEI B,1(P)		;BUILD SSAVE LIST ON STACK

DEFINE SSEG($START,$END)<
	..NSG==..NSG+1
	HRRZ C,$END
	SUB C,$START
	ADDI C,777
	TLZ C,-1
	LSH C,-PGSFT
	MOVN C,C
	HRRZ D,$START
	LSH D,-PGSFT
	TRO D,1B18!1B20!1B22
	HRL D,C
	PUSH P,D
>
	..NSG==0

	SSEG([EXP 0],[EXP ZROCOR-1])
	SSEG([EXP RESVLZ&777000],.JBFF)
	SSEG([EXP SWPMA&777000],.JBHRL)

	PUSH P,[0]		;TERMINATE LIST WITH 0
	SETZ C,
	SSAVE
	SUB P,[XWD ..NSG+1,..NSG+1] ;FLUSH ARG LIST FROM STACK
	TSTR <
>				;NOTE SUCCESSFUL COMPLETION
;ALL USEFUL STUFF HAS BEEN WRITTEN, FLUSH THIS ADR SPACE

	SETO T1,
	MOVE T2,[.FHSLF,,1]	;FLUSH PAGES 1-777
	MOVE T3,[1B0+777]
	MOVE 16,[CLRPRG,,5]	;THIS CODE WILL VANISH IN THE CLEARING,
	BLT 16,16		;SO PUT THE CLEAR LOOP IN THE AC'S
	JRST 5

CLRPRG:	PHASE 5
	PMAP
	HALTF
	JRST .-1
	DEPHASE
;PROGRAM AND BLOCK NAMES TO FLUSH LOCAL SYMS

	DEFINE PNX (A)<
	RADIX50 0,A
	XWD 0,[ASCIZ /A/]>

PNAMES:	PNX <EDDT>		;FLUSH ALL SYMS OF EDDT
	PNX <MDDT>
	PNX <POSTLD>
NPNMS==.-PNAMES
;REMOVE LOCAL SYMBOLS FROM BLOCK OR PROGRAM
;INDEX TO PNAMES TABLE GIVEN IN 1
;CALLED WITH CALL CSS

CSS:	MOVEI 4,0(1)
	MOVE 5,PNAMES(1)	;GET RADIX50 OF NAME
	HRRO 1,PNAMES+1(1)	;GET ASCIZ OF NAME
	PSOUT			;SO WE KNOW WHAT WAS CRUNCHED
	MOVE 7,.JBSYM		;SCAN WHOLE TABLE
	MOVE 6,7		;REMEMBER START OF CURRENT PRG
CSS1:	SKIPN 1,0(7)
;	JRST CSS3		;IF ZERO A DELETED SYMBOL
	JFCL
	TLCE 1,(14B5)		;PRG OR
	TLCN 1,(14B5)		;BLOCK NAME?
	JRST CSS2		;YES
CSS3:	AOBJN 7,.+1
	AOBJN 7,CSS1		;KEEP SCANNING TABLE
	HRROI 1,[ASCIZ / - NOT FOUND
/]
	PSOUT
	RET

CSS2:	TLZ 1,(74B5)		;CLEAR TYPE BITS
	CAMN 1,5		;DESIRED NAME?
	JRST CSS4		;YES
	MOVE 6,7		;NO, REMEMBER LOC OF END OF BLOCK
	ADD 6,[XWD 2,2]
	JRST CSS3
;FOUND DESIRED BLOCK, NOW REMOVE LOCAL SYMBOLS

CSS4:	MOVE 5,6
CSS6:	CAMN 5,7		;SCANNED WHOLE BLOCK?
	JRST CSS8		;YES
	MOVE 1,0(5)		;GET NEXT SYMBOL
	SKIPGE PNAMES+1(16)	;FLUSHING ALL SYMS THIS PGM, OR
	TLNE 1,(10B5)		;LOCAL?
	SOJA 10,[SOJG 10,CSS5	;ELIMINATED EXCESS SYMBOLS YET?
		SKIPL PNAMES+1(16) ;YES, REMOVING ALL OF PGR BLOCK?
		JRST CSS5	;YES, KEEP REMOVING
		ADD 5,[XWD 2,2]	;YES
		JRST CSS8]	;FINISH UP
	MOVEM 1,0(6)		;NOT LOCAL, MOVE IT
	MOVE 1,1(5)
	MOVEM 1,1(6)		;MOVE VALUE
	ADD 6,[XWD 2,2]		;UPDATE 'TO' POINTER
CSS5:	ADD 5,[XWD 2,2]		;UPDATE 'FROM' POINTER
	JRST CSS6

CSS8:	MOVSI 1,0(5)		;MOVE REST OF TABLE WITH BLT
	HRRI 1,0(6)
	HLRE 2,5		;COMPUTE NEW END OF TABLE
	MOVEI 3,0(6)		;AS AMOUNT LEFT TO MOVE PLUS
	SUB 3,2			;CURRENT 'TO' LOCATION
	BLT 1,-1(3)		;MOVE REST OF TABLE
	MOVEM 3,.JBFF		;UPDATE LOWER CORE
	HRLM 3,.JBSA
	HRRZ 2,.JBSYM		;CALC NEW LENGTH AS
	SUB 2,3			;BEG-END
	HRLM 2,.JBSYM
CSSRET:	MOVEI 1,.CHLFD
	PBOUT
	RET
;LOCAL SUBROUTINES

;RADIX-50 TO SIXBIT CONVERSION
; 1/ RADIX-50 SYMBOL
;	CALL R50TO6
; RETURN +1,
; 1/ SYMBOL IN SIXBIT

R50TO6:	LDB A,[POINT 32,A,35]	;GET SYMBOL ONLY
	PUSH P,[0]		;INIT PLACE TO BUILD SIXBIT
	MOVSI C,(<POINT 6,0>)	;BUILT BYTE PTR TO IT
	HRRI C,0(P)
	MOVEI D,R50T3		;ROUTINE TO CALL FOR EACH CHAR
	CALL R50T1		;DO CONVERSION
	POP P,A			;RECOVER SIXBIT
	RET

;LOCAL ROUTINE SPECIFIED BY ABOVE TO 'OUTPUT' CHARS

R50T3:	SUBI A,40		;CONVERT TO SIXBIT FROM ASCII
	IDPB A,C
	RET

;RADIX-50 SYMBOL 'PRINTER' - DOES RECURSIVE RADIX OUTPUT
;ASSUMES:
; D/ ADDRESS OF ROUTINE TO CALL TO 'OUTPUT' EACH CHAR

R50T1:	IDIVI A,50		;SEPARATE OUT LOW-ORDER CHARACTER
	HRLM B,0(P)		;SAVE IT ON STACK
	JUMPE A,R50T2		;DONE IF NO MORE CHARACTERS
	CALL R50T1		;RECURSE FOR REMAINING CHARS
R50T2:	HLRZ A,0(P)		;RECOVER CHARACTER
	JUMPE A,[RET]		;FLUSH NULLS
	ADDI A,60-1		;CONVERT TO AS