Google
 

Trailing-Edge - PDP-10 Archives - FORTRAN-10_V7wLink_Feb83 - lnk999.mac
There are 5 other files named lnk999.mac in the archive. Click here to see a list.
TITLE	LNK999 - EMERGENCY SEGMENT FOR LINK
SUBTTL	D.M.NIXON/DMN/JBC/JNG/DZN/PAH	11-Jan-83


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


SEARCH	LNKPAR,LNKLOW,MACTEN,UUOSYM,SCNMAC
SALL

ENTRY	LNK999
EXTERN	LNKCOR,LNKLOG


CUSTVR==0		;CUSTOMER VERSION
DECVER==5		;DEC VERSION
DECMVR==1		;DEC MINOR VERSION
DECEVR==2026		;DEC EDIT VERSION


VERSION

SEGMENT
SUBTTL	REVISION HISTORY


;START OF VERSION 1A
;64	REDUCE CORE SIZE IF ALL OF CORE IS TAKEN
;77	RESET VERBOSITY IF LNKERR GETSEG FAILS

;START OF VERSION 2

;START OF VERSION 2B
;363	UPDATE MINOR VERSION #

;START OF VERSION 3A
;560	Release on both TOPS-10 and TOPS-20 as LINK version 3A(560)

;START OF VERSION 4
;663	Save GS.FR over LNKCOR call.
;731	SEARCH MACTEN,UUOSYM
;765	Release on both TOPS-10 and TOPS-20 as LINK version 4(765)

;START OF VERSION 4A
;1174	Label and clean up error messages.
;1206	Fix a NO.COR that edit 1174 missed.
;1217	Clean up the listings for release.
;1220	Release on both TOPS-10 and TOPS-20 as version 4A(1220).

;Start of Version 5.1
;2026	Update copyright statements.
SUBTTL	EMERGENCY GETSEG


LNK999:
IFE FTSINGLE,<			;SO WE CAN ASSEMBLE WITH ONE CMD FILE
	JFCL	.+1
	MOVE	P,SAVEAC+P	;RESTORE PUSHDOWN POINTER
	MOVE	T1,['LNKERR']	;SEE WHICH SEGMENT WAS WANTED
	CAME	T1,SEGBLK+1	;AS LNKERR CAN CAUSE A LOOP
	JRST	.+4		;NO
	MOVEI	T1,V%M		;ONLY THIS MUCH
	CAMGE	T1,VERLVL	;BUT NO MORE
	MOVEM	T1,VERLVL	;AS WE WOULD LOOP
E$$EGD::.ERR.	(MS,,V%L,L%I,S%I,EGD,<Emergency GETSEG done>)
	HRRZ	T1,SEGBLK+2	;GET ERROR CODE
	CAIN	T1,ERNEC%	;NOT ENUF CORE?
	JRST	REDCOR		;YES, REDUCE SIZE
E01GSE::PUSH	P,[0]		;[1174] GETSEG ON CHAN 0
	.ERR.	(LRE,,V%L,L%F,S%F,GSE)
SUBTTL	REDUCE CORE


REDCOR:	MOVE	T1,GS.AB	;TOP OF ACTIVE CORE
	IOR	T1,.PGSIZ	;IN PAGES
	SUB	T1,.JBREL	;FIND WHATS FREE
	MOVM	T1,T1		;IN A POSITIVE WAY
	CAIL	T1,8*2000	;THIS SHOULD BE ENOUGH
	JRST	[MOVE	T1,.JBREL	;GET CURRENT TOP
		SUBI	T1,8*2000	;REMOVE ENOUGH
		JRST	CORUUO]
	PUSHJ	P,DY.GBC##	;RETURN ALL SPACE WE CAN
	PUSHJ	P,FX.GBC##
	MOVE	T1,GS.AB	;SAVE LENGTH OF GS AREA IN USE
	SUB	T1,GS.LB	;SINCE IT WILL MOVE AND GROW
	PUSH	P,T1		;DURING EXPANSION
	PUSH	P,GS.FR		;[663] SAVE # FREE WORDS
	PUSH	P,MAXCOR
	MOVE	T1,.JBREL	;DON'T ALLOW CORE TO EXPAND
	MOVEM	T1,MAXCOR	;INCASE NO ALL TAKEN YET
	MOVEI	P1,GS.IX
	MOVEI	P2,8*2000
	PUSHJ	P,LNKCOR##	;TRY TO GET ALL WE NEED
	  CAIA			;TRY AGAIN
	JRST	REDCR2		;GOT IT
	PUSHJ	P,FR.CNT##	;SEE WHATS LEFT
	ANDCM	T1,.PGSIZ	;IN PAGES OR K
	JUMPE	T1,E01GSE	;[1174] NO MEMORY AVAILABLE
	MOVE	P2,T1		;TRY FOR THIS
	PUSHJ	P,LNKCOR##
	  JRST	E$$MEF##	;[1206] CAN NOT FAIL
REDCR2:	POP	P,MAXCOR	;RESTORE FORMER LIMIT
	POP	P,GS.FR		;[663] RESTORE FREE WORD COUNT
	POP	P,T1		;GET LENGTH OF GS AREA BACK
	ADD	T1,GS.LB	;FIND END
	MOVEM	T1,GS.AB
CORUUO:	CORE	T1,		;CUT BACK
	  JFCL			;NEVER FAILS
	MOVE	T1,.JBREL	;END OF MEMORY
	MOVEM	T1,GS.UB
E02GSE::PUSH	P,[0]		;[1174] GETSEG ON CHAN 0
	.ERR.	(LRE,,V%L,L%W,S%W,GSE)
	MOVE	T1,SEGBLK+1	;GET NAME WE WANT
	JRST	@NXTSEG		;GET IT



>;END OF IFE FTSINGLE
SUBTTL	THE END


END	LNK999