Trailing-Edge
-
PDP-10 Archives
-
BB-D868D-BM
-
language-sources/lnkovs.mac
There are 38 other files named lnkovs.mac in the archive. Click here to see a list.
TITLE LNKOVS - COMMON SUBROUTINES FOR OVERLAY MODULES
SUBTTL D.M.NIXON/DMN/JBC/JNG/DZN 24-Aug-79
;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, 1979 BY DIGITAL EQUIPMENT CORPORATION
SEARCH LNKPAR,LNKLOW,MACTEN,UUOSYM,SCNMAC
SALL
ENTRY TR.WLK
CUSTVR==0 ;CUSTOMER VERSION
DECVER==4 ;DEC VERSION
DECMVR==1 ;DEC MINOR VERSION
DECEVR==1220 ;DEC EDIT VERSION
VERSION
SEGMENT
SUBTTL REVISION HISTORY
;START OF VERSION 2
;135 ADD OVERLAY FACILITY
;136 FIX VARIOUS BUGS
;174 MAKE RELOCATABLE OVERLAYS WORK
;START OF VERSION 2B
;363 UPDATE MINOR VERSION #
;START OF VERSION 2C
;557 Clean up listing for release.
;START OF VERSION 3A
;560 Release on both TOPS-10 and TOPS-20 as LINK version 3A(560)
;START OF VERSION 4
;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 all error messages.
;1217 Clean up the listings for release.
;1220 Release on both TOPS-10 and TOPS-20 as version 4A(1220).
SUBTTL TREE WALK ROUTINE
;ENTER WITH REQUIRED LINK IN P1 (RH)
;START AT FSTLNK
;SCAN ALL TREE UNTIL REQUIRED LINK IS FOUND
;RETURNS ADDRESS IN P1 (LH), LINK # IN (RH)
;RETURNS TOTAL NO. OF LINKS IN SUB-TREE IN P2
;ADDRESS IN P1 IS EITHER THAT OF REQUIRED NODE
; OR ITS FATHER IF REQUIRED NODE IS TERMINAL
TR.WLK: MOVE T2,BRNMAX ;LONGEST POSSIBLE BRANCH
ADDI T2,1 ;SPACE FOR TERMINATOR
PUSHJ P,DY.GET## ;GET SPACE FOR PD STACK
SPUSH <T1,T2> ;SAVE SO WE CAN GIVE BACK
MOVN T2,T2 ;-LENGTH
HRL T1,T2 ;FORM PDP
MOVE P2,T1 ;SAFE PLACE
PUSH P2,[0] ;START WITH A ZERO TERMINATOR
MOVE T1,FSTPTR ;GET START
TRWLK1: HLL T1,(T1) ;FORM AOBJN
ADD T1,[2,,2] ;BYPASS HEADER AND BACK PTR
TRWLK2: MOVS T2,(T1) ;PTR ,, #
CAIN P1,(T2) ;ONE WE WANT?
JRST TRWLKF ;YES
TLNE T2,-1 ;IS IT A TOP LINK?
JRST TRWLK3 ;NO, FOLLOW IT
AOBJP T1,.+3 ;GET NEXT ITEM IN LIST
SKIPE (T1) ;UNLESS NULL
JRST TRWLK2 ;TRAVEL ITS PATH
POP P2,T1 ;GET TOP ITEM OFF STACK
JUMPE T1,TRWLKZ ;NOT IN TREE (MIGHT BE SUB-TREE)
JRST TRWLK2 ;AND FOLLOW PREVIOUS
TRWLK3: MOVE T2,T1 ;GET A COPY TO PLAY WITH
AOBJP T2,.+3 ;SEE IF WE NEED TO STACK
SKIPE (T2)
PUSH P2,T2 ;YES, RETURN HERE
MOVE T1,(T1) ;GET ADDRESS
JRST TRWLK1 ;AND FOLLOW
TRWLKF: SETZ P2, ;HOLD COUNT OF NODES IN SUB-TREE
TLNN T2,-1 ;IS IT TERMINAL?
AOJA P2,.+2 ;YES, ACCOUNT FOR IT
HLR T1,T2 ;NO, USE PTR
SKIPL (T1) ;POINTING TO AOBJN WORD
SOJA T1,.-1 ;NOT YET
HRL P1,T1 ;SAFE PLACE
SPOP <T2,T1>
PUSHJ P,DY.RET## ;RETURN STACK
MOVS T1,P1 ;GET POINTER
HRRZ T2,(T1) ;GET LINK#
JUMPE T2,CPOPJ ;FINISHED WHEN BACK TO 0
MOVE T1,1(T1) ;GET NEXT
AOJA P2,.-3 ;LOOP
TRWLKZ: SETZB P1,P2 ;NO DEPTH, NO PTR
SPOP <T2,T1>
PJRST DY.RET## ;RETURN STACK AND GIVE UP
SUBTTL RELOCATABLE OVERLAY ROUTINES
;RT.P2 - ROUTINE TO SETUP RT.PT AND MAKE SURE ENOUGH SPACE
;ENTER WITH
;P2 = UPPER ADDRESS
;P3 = LOWER ADDRESS
;USES T1, T2
RT.P2:: MOVE T1,P2 ;GET UPPER ADDRESS
SUB T1,PH.ADD ;MINUS BASE
IDIVI T1,^D18 ;2 BITS PER BYTE
SKIPE T2 ;REMAINDER?
ADDI T1,1 ;YES
SUB T1,OVLOFF ;INCASE BASE NOT IN CORE
ADD T1,RT.LB ;MAKE ABS
CAMG T1,RT.AB ;WILL IT FIT?
JRST RT.P3 ;YES, SET BYTE PTR
PUSHJ P,RT.INC ;NO, EXPAND
JRST RT.P2 ;MAKE SURE ITS OK NOW
;RT.P3 - ROUTINE TO SETUP RT.PT (BYTE PTR TO STORE RELOCATION INFO)
;ENTER WITH
;P3 = LOWER ADDRESS
;USES T1, T2
RT.P3:: MOVE T1,P3 ;GET LOWER ADDRESS
SUB T1,PH.ADD ;MINUS BASE
IDIVI T1,^D18 ;2 BITS PER BYTE
SUB T1,OVLOFF ;INCASE BASE NOT IN CORE
IOR T1,RTBTAB(T2) ;GET CORRECT BYTE
ADD T1,RT.LB ;MAKE ABS
MOVEM T1,RT.PT ;NEW IDPB PTR
POPJ P,
SALL
RTBTAB: POINT 2,
ZZ==1
REPEAT ^D17,<
POINT 2,0,ZZ
ZZ==ZZ+2>
RT.INC::PUSHJ P,.SAVE2## ;SAVE P1 & P2
MOVEI P1,RT.IX ;AREA
MOVEI P2,.IPS ;SIZE
PUSHJ P,LNKCOR## ;EXPAND
PUSHJ P,E$$MEF## ;[1174] SHOULD NOT HAPPEN
HRLI T1,(POINT 2) ;RESET BYTE PTR
HLLM T1,RT.PT
MOVEI T1,^D18*.IPS ;AND BYTE COUNT
MOVEM T1,RT.FR
CPOPJ: POPJ P,
SUBTTL COMMON MESSAGES
;IOWD FOR PREAMBLE SECTION
IFN FTKIONLY,<
PHIOWD::IOWD PH.ZZ,PH.HDR
0
>
E$$IOV::PUSH P,[OC] ;[1174]
.ERR. (ST,,V%L,L%F,S%F,IOV,<Input error for overlay file>)
E$$OOV::PUSH P,[OC] ;[1174]
.ERR. (ST,,V%L,L%F,S%F,OOV,<Output error for overlay file>)
E$$LNM::.ERR. (MS,.EC,V%L,L%F,S%F,LNM,<Link number >) ;[1174]
.ETC. (DEC,.EC!.EP,,,,P2)
.ETC. (STR,,,,,,< not in memory>) ;[1174]
SUBTTL THE END
END