Trailing-Edge
-
PDP-10 Archives
-
BB-4157D-BM
-
sources/relbuf.bli
There are 26 other files named relbuf.bli in the archive. Click here to see a list.
!THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
! OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
!COPYRIGHT (C) 1974,1977 BY DIGITAL EQUIPMENT CORPORATION
!AUTHOR: S. MURPHY
MODULE RELB(RESERVE(0,1,2,3), SREG=#17,FREG=#16,VREG=#15,DREGS=4)=
BEGIN
GLOBAL BIND RELBV=2^24 + 0^18 + 30; !VERSION DATE: 15-FEB-74
%(REVISION HISTORY
21 ----- ----- MOVE THE DECLARATIONS FOR THE STRUCTURES RELBUFF
AND PRELBUFF TO A REQUIRE FILE.
22 ----- ----- PUT A NUMBER OF UTILITY ROUTINES USED IN MAKING
LISTINGS THAT WERE REPEATED IN BOTH THE MODULES
"LISTOU" AND "OUTMOD" INTO THIS MODULE
ROUTINES ARE: ZOUTMSG,ZOUTSYM,ZOUTOCT,RADIX50,
ZOUDECIMAL,ZOUOFFSET
24 ----- ----- MOVE THE ROUTINE "DMPRLBLOCK" INTO THIS MODULE
25 ----- ----- MOVE THE ROUTINE "LSTRLWD" FROM LISTOU INTO THIS MODULE
26 ----- ----- SHOULD BE SHIFTING RELOCATION BITS LEFT BY (35-COUNT)
RATHER THAN (36-COUNT)
29 ----- ----- SHOULD BE SHIFTING RELOC BITS BY (36-COUNT*2)
30 ----- ----- MAKE "DMPMAINRLBF" INTO A GLOBAL ROUTINE RATHER
THAN LOCAL TO "ZOUTBLOCK"
)%
SWITCHES NOLIST;
REQUIRE FIRST.BLI;
REQUIRE TABLES.BLI;
REQUIRE REQREL.BLI;
SWITCHES LIST;
SWITCHES LIST;
EXTERNAL SYMRLBF, !BUFFER FOR REL FILE BLOCKS OF TYPE 2
! WHICH INCLUDES BOTH SYMBOLS AND GLOBAL REQUESTS
LOCRLBF, !BUFFER FOR REL FILE BLOCKS OF TYPE
! "LOCAL REQUEST" (USED WHEN A LABEL IS
! DEFINED FOR WHICH THERE WERE FORWARD REFS)
MAINRLBF; !MAIN REL FILE BUFFER - USED FOR CODE AND DATA
! AND ALSO FOR MISC (E.G. HISEG,END, ETC)
MAP RELBUFF SYMRLBF:LOCRLBF:MAINRLBF;
FORWARD DMPRLBLOCK;
EXTERNAL HILOC; !RELATIVE LOC OF THE WD OF HISEG CODE/DATA
! CURRENTLY BEING BUFFERED
GLOBAL ROUTINE ZOUTBLOCK(ZBLKTYPE,RELBITS)=
%(***************************************************************************
ROUTINE TO BUFFER ONE DATA WORD THAT IS TO BE OUTPUT TO THE
REL FILE.
CALLED WITH THE GLOBAL "RDATWD" CONTAINING THE DATA WORD.
CALLED WITH THE ARGS:
ZBLKTYPE - THE REL FILE BLOCK TYPE OF THE BLOCK INTO
WHICH THIS DATA WORD SHOULD BE PLACED
RELBITS - THE 2 RELOCATION BITS THAT SHOULD BE ASSOCIATED
WITH THIS DATA WORD
WE MAINTAIN THE SEPARATE REL FILE BUFFERS:
1."SYMRLBF" - FOR REL FILE BLOCK TYPE 2 - THIS TYPE CODE IS USED FOR
SYMBOL DEFINITIONS AND GLOBAL REQUESTS
2."LOCRLBF" - FOR REL FILE BLOCK TYPE 10 - THIS TYPE CODE IS USED
FOR LOCAL REQUESTS (IE DEFINITION OF LABELS TO
WHICH THERE WERE FORWARD REFERENCES)
3."MAINRLBF" - FOR ALL OTHER BLOCK TYPES (PRIMARILY THIS WILL
BE BLOCK TYPE 1 - CODE AND DATA - BUT IT WILL
ALSO BE USED FOR OTHER MISC BLOCK TYPES)
WHEN EITHER "SYMRLBF" OR "LOCRLBF" IS FULL, WE MUST FIRST OUTPUT
ANYTHING IN "MAINRLBF" BEFORE OUTPUTING THE CONTENTS OF THE FULL BUFFER
(SINCE A LOCAL OR GLOBAL FIXUP CANNOT PRECEDE THE WORD OF DATA
IT REFERS TO)
***************************************************************************)%
BEGIN
EXTERNAL RDATWD;
EXTERNAL DMPMAINRLBF;
ROUTINE BUFFOUT(BUFFER,RELBITS)=
%(********************
ROUTINE TO PUT THE DATA WORD CONTAINED IN THE GLOBAL
"RDATWD" INTO THE REL FILE BUFFER INDICATED BY "BUFFER".
"PRLOCPTR" POINTS TO THE BYTE POINTER TO BE USED TO STORE
THE RELOCATION BITS FOR THIS DATA WORD, "RELBITS" SPECIFIES
THE RELOCATION BITS.
IF "BUFFER" IS FULL, THE CONTENTS OF THE MAIN REL-FILE BUFFER "MAINRLBF"
WILL BE OUTPUT TO THE REL FILE, FOLLOWED BY THE CONTENTS OF "BUFFER".
*************************)%
BEGIN
MAP PRELBUFF BUFFER; !"BUFFER" IS A PTR TO A REL FILE BUFFER
IF .BUFFER[RDATCNT] EQL RBLKSIZ-2 !IF BUFFER IS FULL
THEN
BEGIN
DMPMAINRLBF(); !OUTPUT THE CONTENTS OF "MAINRLBF"
! AND REINITIALIZE MAINRLBF
DMPRLBLOCK(.BUFFER,RBLKSIZ); !OUTPUT THE CONTENTS OF "BUFFER"
%(**INITIALIZE "BUFFER"***)%
BUFFER[RDATCNT]_0;
BUFFER[RRELOCWD]_0;
END;
BUFFER[RDATCNT]_.BUFFER[RDATCNT]+1;
BUFFER[RRELOCWD]_.BUFFER[RRELOCWD] OR .RELBITS^(36-.BUFFER[RDATCNT]*2); !STORE THE RELOC BITS
BUFFER[.BUFFER[RDATCNT],RLDATWD]_.RDATWD; !STORE THE DATA WORD
END; !END OF ROUTINE "BUFFOUT"
SELECT .ZBLKTYPE OF NSET
RSYMBOL:
%(***FOR A GLOBAL REQUEST OR SYMBOL DEFINITION**)%
BUFFOUT(SYMRLBF,.RELBITS);
RLOCAL:
%(***FOR A LOCAL REQUEST***)%
BUFFOUT(LOCRLBF,.RELBITS);
OTHERWISE:
%(***FOR CODE AND DATA, AND FOR ALL OTHER BLOCK TYPES***)%
BEGIN
IF (.MAINRLBF[RDATCNT] EQL RBLKSIZ-2) !IF THE MAIN BUFFER IS FULL
OR
(.MAINRLBF[RTYPE] NEQ .ZBLKTYPE) ! OR IS BEING USED FOR SOME OTHER
! BLOCK TYPE THAN THIS DATA WORD SHOULD GO INTO
THEN
BEGIN
DMPMAINRLBF(); !OUTPUT THE CONTENTS OF MAINRLBF AND
! REINITIALIZE IT
MAINRLBF[RTYPE]_.ZBLKTYPE;
END; !OF ROUTINE "DMPMAINRLBF"
%(**THE FIRST DATA WORD OF A BLOCK OF TYPE 1 (IE CODE/DATA)
SHOULD CONTAIN THE REL ADDRESS FOR THE 1ST WD OF CODE/DATA**)%
IF (.ZBLKTYPE EQL RCODE) AND (.MAINRLBF[RDATCNT] EQL 0)
THEN
BEGIN
MAINRLBF[1,RLDATWD]_.HILOC;
MAINRLBF[RDATCNT]_1;
MAINRLBF[RRELOCWD]_RELRI^34; !RELOC BITS FOR THE ADDR ("RELOC RIGHT")
END;
MAINRLBF[RDATCNT]_.MAINRLBF[RDATCNT]+1; !INCR CT OF DATA WDS
MAINRLBF[.MAINRLBF[RDATCNT],RLDATWD]_.RDATWD; !BUFFER THE DATA WD
MAINRLBF[RRELOCWD]_ !PUT THE RELOC BITS FOR THIS DATA WD INTO
.MAINRLBF[RRELOCWD] OR .RELBITS^(36-.MAINRLBF[RDATCNT]*2); ! THE RELOC WD
END;
TESN;
END; !END OF "ZOUTBLOCK"
GLOBAL ROUTINE DMPMAINRLBF=
%(***************************************************************************
ROUTINE TO OUTPUT THE CONTENTS OF THE MAIN
REL FILE BUFFER TO THE REL FILE AND REINITIALIZE
THE BUFFER. IF THE BUFFER IS EMPTY, DOES NOTHING
***************************************************************************)%
BEGIN
IF .MAINRLBF[RDATCNT] EQL 0 THEN RETURN; !IF THERE ARE NO DATA WORDS
DMPRLBLOCK(MAINRLBF,.MAINRLBF[RDATCNT]+2); !OUTPUT THE CONTENTS OF "MAINRLBF"
%(***INITIALIZE THE BUFFER**)%
MAINRLBF[RDATCNT]_0;
MAINRLBF[RRELOCWD]_0;
END;
GLOBAL ROUTINE INIRLBUFFS=
%(***************************************************************************
ROUTINE TO INITIALIZE ALL REL FILE BUFFERS
***************************************************************************)%
BEGIN
%(**INIT BUFFER USED FOR SYMBOL DEFS AND GLOBAL REQS**)%
SYMRLBF[RTYPE]_RSYMBOL; !BLOCK TYPE CODE USED BOTH FOR
! SYM DEFS AND GLOBAL REQS
SYMRLBF[RDATCNT]_0; !CT OF DATA WDS IN THIS BLOCK
SYMRLBF[RRELOCWD]_0; !RELOCATION BITS FOR THIS BLOCK
%(**INIT BUFFER USED FOR LOCAL REQS**)%
LOCRLBF[RTYPE]_RLOCAL; !BLOCK TYPE FOR LOCAL REQUESTS
LOCRLBF[RDATCNT]_0;
LOCRLBF[RRELOCWD]_0;
%(**INIT BUFFER USED FOR CODE/DATA AND FOR ALL OTHER BLOCK TYPES**)%
MAINRLBF[RDATCNT]_0;
MAINRLBF[RRELOCWD]_0;
END;
GLOBAL ROUTINE DMPRLBLOCK(RLBLK,WDCT)=
%(***************************************************************************
ROUTINE TO OUTPUT A BLOCK OF REL CODE POINTED TO BY "RLBLK" TO THE RELFILE.
WDCT IS THE NUMBER OF WORDS (INCLUDING HEADER WDS) IN THE BLOCK.
***************************************************************************)%
BEGIN
EXTERNAL LSTOUT; !TO LIST A CHAR
EXTERNAL LSTRLWD; !LIST A WD OF THE REL FILE IN THE REL-EXPANDED LISTING
EXTERNAL RELOUT; !ROUTINE TO WRITE A WIRD IN THE REL FILE
STR