Trailing-Edge
-
PDP-10 Archives
-
decuslib10-05
-
43,50337/12/o2rk.mac
There are 2 other files named o2rk.mac in the archive. Click here to see a list.
; ********
SUBTTL * O2RK *
; ********
COMMENT;
AUTHOR: REIDAR KARLSSON
VERSION: 4 [2,4,27,43,147]
CONTENTS: O2DB, O2DB1-7, O2GA, O2GEN, O2GF, O2GR,
O2GW, O2GWD, O2IC2, O2IC2T, O2REL
;
SEARCH SIMMC2,SIMMAC
CTITLE O2RK
IFN QDEBUG,< INTERNAL O2DB,O2DB1,O2DB2,O2DB3,O2DB4,O2DB5,O2DB6,O2DB7
EXTERN DBRTMA,DBRTMU
>
INTERNAL O2GA, O2GF, O2GR, O2GW, O2GWD
INTERNAL O2IC2, O2IC2T
edit(43)
INTERNAL O2IC2P, O2IC2Z ;[43]
IFN QDEBUG,<
INTERNAL YO2NOR
>
EXTERNAL O2ERO,O2ERL,O2ERE,O2ERU,O2ERR,O2ERI
EXTERNAL O2DF,O2DFTE, EXDF
IFN QDEBUG,< EXTERNAL YBHDEB >
EXTERNAL YBHREL, YBHIC2
EXTERNAL YGAP, YQRELT, YQRELL, YQRELR, YQREL
EXTERNAL YRELCD, YRELPT, YRELLT, YRELST
EXTERNAL O2AB
EXTERNAL YNOREL, YFXTAB, YBREAK, YRELCN
IFN QDEBUG,<
EXTERNAL YO2DB,DBMN
>
EXTERNAL YO2CDP, YO2PTP, YO2LTP, YO2STP, YO2ITB ;[43] YO2IC2 REMOVED
EXTERNAL YO2CDB, YO2PTB, YO2LTB, YO2STB
EXTERNAL YO2CNB, YO2ACN, YO2LII, YO2LIB, YO2LIR
EXTERNAL YO2IQB, YO2IQI
edit(2)
EXTERNAL YO2FIX ;[2]
EXTERNAL YO2CIQ ;[43] CURRENT IQ BUFFER POINTER
edit(4)
EXTERNAL YRELBL ;[030406] Counts block on rel file
OPDEF DEFIX [PUSHJ XPDP,O2DF]
SALL
DF ZQREL,0,3,2 ;RELOC. CODE BITS IN LEFT HALF
DF ZQRER,0,3,20 ;RELOC. CODE BITS IN RIGHT HALF
DEFINE IOER(F)=<
L X1,[ASCIZ/F/]
>
MACINIT
QRELI2= 7 ;******* TEMPORARY
;RELATIVE ADDRESSES IN PARAMETER BLOCK
QPOINT= 0 ;BUFFER POINTER FOR IDPB INST.
QCOUNT= 1 ;COUNTER FOR WORDS REMAINING IN BUFFER
QRWP= 2 ;BYTEPOINTER FOR RELOC. WORD
QRGC= 3 ;RELOC. GROUP COUNTER
TWOSEG
RELOC 400K
IFN QDEBUG,<
YO2NOR: SIXBIT / / ;RELOC. COUNTERS TO EDIT INTO THE DEBUG OUTPUT
SIXBIT /CN/
SIXBIT /CD/
SIXBIT /PT/
SIXBIT /LT/
SIXBIT /ST/
SIXBIT /ID/
SIXBIT /I2/
> ;END OF IFN QDEBUG,
SUBTTL O2DB
COMMENT;
PURPOSE: HANDLE DEBUG FILE OUTPUT
ENTRY: O2DB, O2DB1-7
INPUT ARGUMENTS: WHEN CALLING O2DB A SWITCH CODE IS PASSED IN X1
WHEN CALLING O2DB1-7 ONE TO SEVEN HALFWORDS ARE
PASSED IN THE XPDP STACK
NORMAL EXIT: RETURN
CALL FORMAT: EXEC O2DB
EXEC O2DB1
: :
EXEC O2DB7
;
IFN <QDEBUG>,<
O2DB: ;SET DEBUG SWITCH WITH THE NUMBER PASSED IN X1
; OR IF X1=0 RESET ALL SWITCHES
;OR IF X1=1, SET ALSO M2 SWITCHES
IF
JUMPE X1,FALSE
THEN
LI X0,1
ASH X0,(X1)
IORM X0,YO2DB
CAIN X1,1
SETOM YM2DB
ELSE
SETZM YO2DB
FI
RETURN
BEGIN
L1(): IF ;OUTPUT BUFFER TO THE DEBUG FILE
OUT QCHDEB,
GOTO FALSE
THEN
IOER DEB
EXEC O2ERU
FI
L2(): ;PUT X0 RIGHT IN THE OUT BUFFER
SOSGE YBHDEB+2
GOTO L1 ;OUTPUT FULL BUFFER TO DEBUG FILE
IDPB X0,YBHDEB+1
RETURN
O2DB7: STACK X0
HLR X0,-5(XPDP)
EXEC L2
HRR X0,-5(XPDP)
EXEC L2
SKIPA
O2DB5: STACK X0
HLR X0,-4(XPDP)
EXEC L2
HRR X0,-4(XPDP)
EXEC L2
SKIPA
O2DB3: STACK X0
HLR X0,-3(XPDP)
EXEC L2
HRR X0,-3(XPDP)
EXEC L2
SKIPA
O2DB1: STACK X0
HLR X0,-2(XPDP)
EXEC L2
GOTO O2DB0
O2DB6: STACK X0
HLR X0,-4(XPDP)
EXEC L2
HRR X0,-4(XPDP)
EXEC L2
SKIPA
O2DB4: STACK X0
HLR X0,-3(XPDP)
EXEC L2
HRR X0,-3(XPDP)
EXEC L2
SKIPA
O2DB2: STACK X0
HLR X0,-2(XPDP)
EXEC L2
HRR X0,-2(XPDP)
EXEC L2
O2DB0: UNSTK X0
RETURN
ENDD
> ;END OF IFN QDEBUG,
SUBTTL O2GA, O2GEN
COMMENT;
PURPOSE: O2GA: TO GENERATE AN ABSOLUTE INSTRUCTION WORD INTO ONE OF
THE OUTPUT STREAM BUFFERS
O2GEN: A CODE SEQUENCE COMMON TO O2GA, O2GF AND O2GR IS
PLACED IN CONNECTION TO O2GA BECAUSE O2GA CALLS
ARE MOST FREQUENT
THIS CODE WILL PUT GENERATED WORDS INTO LOCAL CODE
STREAM BUFFERS IN A FORMAT THAT COULD BE ACCEPTED
BY LINK 10 (THE LOADER) AFTER A SLIGHT MODIFICATION
IN PASS 3.
THE FORMAT FOR EACH CODE STREAM BUFFER IS:
-----------------------------------------
HEADER WORD [ 1013 , 1014 OR 1015 ,, N ]
-----------------------------------------
1:ST RELOCATION WORD [ ^D18 2-BIT BYTES ]
ADDR. OF 1:ST DATA W. [ 0 ,,RELOC.CODE(3BITS) ADDR.(^D15BITS) ]
1:ST DATA WORD [ ]
: [ ^D17 DATA WORDS ]
17:TH DATA WORD [ ]
-----------------------------------------
2:ND RELOCATION WORD [ ^D18 2-BIT BYTES ]
18:TH DATA WORD [ ]
: [ ^D18 DATA WORDS ]
35:TH DATA WORD [ ]
-----------------------------------------
: [ 4 RELOCATION GROUPS OF ]
: [ ^D19 WORDS EACH ]
-----------------------------------------
7:TH RELOCATION WORD [ ^D18 2-BIT BYTES ]
DATA WORD [ ]
: [ ^D12 DATA WORDS ]
LAST DATA WORD IN BUFFER[ ]
-----------------------------------------
THE SYMBOL TABLE HAS BLOCK ITEM TYPE 1014
THE LINE NUMBER TABLE 1015
THE OTHERS 1013
N IS NUMBER OF WORDS IN BUFFER EXCLUDING HEADER WORD BUT
INCLUDING RELOCATION WORDS
ALL DATA WORDS INCLUDING THE START ADDRESS ARE RELOCATED AS
SPECIFIED BY THE RELOCATION BYTE IN THE RELOCATION WORD AS FOLLOWS:
RELOC. BYTE MEANING
0 NO RELOCATION
1 RIGHT HALF RELOCATED AS SPECIFIED
BY THE RELOC. CODE IN THE FIRST 3
BITS IN THE RIGHT HALF OF THE
DATA WORD
2 LEFT HALF RELOCATED AS SPECIFIED
BY THE RELOC. CODE IN THE FIRST 3
BITS IN THE LEFT HALF OF THE
DATA WORD
3 BOTH HALVES RELOCATED ( AS 1+2 )
FOR A FULL BUFFER THE LAST 6 RELOCATION BYTES IN THE LAST
RELOCATION WORD ARE NOT USED
EACH CODE STREAM BUFFER HAS A PARAMETER BLOCK ( 4 WORDS )
[ POINT ]
[ COUNT ]
[ RWP ]
[ RGC ]
WHERE POINT IS A BYTE POINTER SUITED FOR AN IDPB INSTRUCTION
TO PUT NEXT WORD INTO THE BUFFER
COUNT IS A COUNTER OF REMAINING WORDS IN THE BUFFER
RWP IS A RELOCATION WORD BYTE POINTER SUITED FOR AN
IDPB INSTRUCTION TO PUT NEXT RELOC. BYTE
INTO THE RELOCATION WORD
RGC IS A RELOCATION GROUP COUNTER OF REMAINING
WORDS IN A RELOCATION GROUP
ENTRIES: O2GA
O2GEN FOR THE CODE SEQUENS COMMON TO
O2GA, O2GF AND O2GR
INPUT ARGUMENTS: O2GA: X0 CONTAINS THE WORD TO BE OUTPUT
YGAP CONTAINS THE TARGET STREAM RELOCATION CODE
O2GEN: X0 CONTAINS THE WORD TO BE OUTPUT WITH ITS
RELOCATION CODE BITS SET
X1 CONTAINS THE RELOCATION BYTE (I.E. 0 IF
NO RELOC. , 1 IF RIGHT, 2 IF LEFT
AND 3 IF BOTH HALVES ARE RELOCATED
X2 CONTAINS THE TARGET RELOCATION CODE
NORMAL EXIT: RETURN
CALL FORMAT: EXEC O2GA (GENABS)
BRANCH O2GEN
USED SUBROUTINES: O2IC2, O2DB1-7
;
O2GA: PROC
IFN QDEBUG,<EXEC DBRTMU>
SAVE <X2,X3> ;MUST BE SAME AS FOR O2GF AND O2GR
SETZ X1, ;NO RELOCATION
L X2,YGAP ;TARGET STREAM RELOC. CODE
O2GEN: ASSERT< CAIL X2,QRELCD
CAILE X2,QRELST
RFAIL WRONG TARGET RELOC CODE IN O2GEN
>
IFN QDEBUG,<EXEC DBRTMA>
;X3 := TARGET PARAMETER BLOCK ADDRESS
LI X3,-QRELCD(X2)
XCT [LI X3,YO2CDP ;LITERAL INDEXED BY X3
LI X3,YO2PTP
LI X3,YO2LTP
LI X3,YO2STP](X3)
;CHECK IF A NEW RELOC. WORD MUST BE INSERTED
;[43]
WHILE
SOSG QRGC(X3)
GOTO FALSE
DO
;CHECK IF BUFFER FILLED
IF
L1(): SOSG QCOUNT(X3)
GOTO FALSE
THEN
;PUT GENERATED WORD WITH ITS RELOC. INFORMATION
; INTO THE TARGET BUFFER AND INCREMENT TARGET
; RELOCATION COUNTER
IDPB X0,QPOINT(X3)
IDPB X1,QRWP(X3)
AOS YNOREL(X2)
;IN DEBUG VERSION HANDLE DEBUG OUTPUT BEFORE RETURN
IFN QDEBUG,<GOTO O2GENX>
RETURN
FI
;LET X1 POINT TO START OF ACTUAL TARGET BUFFER AND CALL
; O2IC2 TO WRITE IT ON IC2
;REINITIALIZE TARGET BUFFER AND PARAMETER BLOCK
STACK X1
HRREI X1,-<QBUFS-4>
ADD X1,QPOINT(X3) ;BUFFER BYTE POINTER
; = POINT 36,YO2??B,35
EXEC O2IC2
EXEC O2RTBP ;[43] REINITIALIZE TARGET BUFFER AND PARAMETER BLOCK
UNSTK X1
OD
;UPDATE THE RELOCATION WORD POINTER AND GROUP COUNTER
; AND PUT A ZERO WORD (RELOCATION WORD) INTO THE BUFFER
STACK X1
LI X1,^D18
ST X1,QRGC(X3)
ADDM X1,QRWP(X3)
SETZ X1,
SOSLE QCOUNT(X3)
IDPB X1,QPOINT(X3)
UNSTK X1
GOTO L1
IFN QDEBUG,<
;EDIT THE DEBUG OUTPUT IF THE DEBUG SWITCH SO2D1 IS SET
O2GENX:
IF
L X3,YO2DB
IFOFFA SO2D1(X3)
GOTO FALSE
THEN
STACK X4
EXEC O2DB1,<<[XWD 020000,0]>> ;NEW LINE
HLR X3,YO2NOR(X2)
HRLI X3,616600 ;616600,,'RT'
LI X4,' '
HRL X4,YNOREL(X2) ;YRELT-1,,' '
SUB X4,[1,,0]
SETZ X2,
IF
CAIGE X1,2
GOTO FALSE
THEN
;LEFT HALF RELOCATED
LF X2,ZQREL(,X0)
TLZ X0,700K
FI
L X2,YO2NOR(X2) ;'RL ',,
EXEC O2DB5,<X3,X4,X2>
HRLI X2,116000
HLR X2,X0 ;116000,,X0(L)
SETZ X3,
IF
TRNN X1,1
GOTO FALSE
THEN
;RIGHT HALF RELOCATED
LF X3,ZQRER(,X0)
TRZ X0,700K
FI
HLR X3,YO2NOR(X3)
HRL X3,X0 ;X0(R),,'RR'
EXEC O2DB4,<X2,X3>
SETZB X1,X2
ROTC X0,9 ;OPCODE FIELD
EXCH X0,X1 ; TO X0
EXEC DBMN ;RETURN MNEMONIC SIXBIT CODE
ROTC X1,1 ;AC FIELD
TRNE X2,1
ADDI X2,20
ROT X2,3
ROTC X1,3
ADDI X2,20
L X3,X2 ;,,AC
SETZ X2,
ROTC X1,1 ;INDIRECT BIT
ADDI X2,20
ROT X2,^D11 ;SHIFT TO LEFT HALF
ROTC X1,1 ;INDEX FIELD
TRNE X2,1
ADDI X2,20
ROT X2,3
ROTC X1,3
ADDI X2,20
ROT X2,^D12
; X2= INDIRECT BIT,INDEX AC
MOVSI X4,464100
HLR X4,X0
HRL X3,X0
EXEC O2DB7,<X4,X3,X2,X1>
UNSTK X4
IF
IFOFF SO2D4
GOTO FALSE
THEN
LI (SIXBIT /* /)
HRLI 600000
EXEC O2DB2,<X0>
SETOFF SO2D4
FI
FI
RETURN
> ;END OF IFN QDEBUG,
EPROC
SUBTTL O2GF
COMMENT;
PURPOSE: TO GENERATE AN INSTRUCTION WITH A FIXUP INDEX IN THE
ADDRESS FIELD INTO ONE OF THE OUTPUT BUFFERS AND
TO UPDATE THE FIXUP TABLE
ENTRY: O2GF
INPUT ARGUMENTS: X0 CONTAINS THE INSTRUCTION TO BE OUTPUT WITH
THE FIXUP INDEX IN THE RIGHT HALF
YGAP CONTAINS THE TARGET STREAM RELOCATION CODE
NORMAL EXIT: RETURN VIA BRANCH O2GEN
CALL FORMAT: EXEC O2GF (GENFIX)
USED SUBROUTINE: O2GEN
;
O2GF: PROC
IFN QDEBUG,<EXEC DBRTMU
>
TRNE X0,-1
TRNE X0,400K
BRANCH O2GA ;GENABS IF NO FIXUP INDEX IN X0 RIGHT
SAVE <X2,X3> ;MUST BE SAME AS FOR O2GA AND O2GR
HRRZ X3,X0
ADD X3,YFXTAB ;FIXUP ENTRY
LF X2,ZFXTYP(X3)
IF ;TYPE QB?
CAIE X2,QB
GOTO FALSE
THEN ;CHANGE TYPE TO QD AND OUTPUT
; ZERO WITH NO RELOC IN THE RIGHT HALF
LI X1,QD
SF X1,ZFXTYP(X3)
ZF ZFXVAL(,X0)
SETZ X1,
ELSE
ASSERT <CAILE X2,QA ;QA,QF AND QG NOT ALLOWED
CAILE X2,QE1
RFAIL (WRONG FIXUP TYPE FOUND IN O2GF)
>
;FETCH THE RIGHT HALF OF THE WORD TO BE
; OUTPUT AND ITS RELOC.CODE FROM THE FIXUP ENTRY
HRR X0,(X3)
LF X1,ZFXCOD(X3)
ASSERT< SKIPL X1
CAILE X1,QRELI2
RFAIL WRONG ZFXCODE IN O2GF
>
IF
JUMPE X1,FALSE
THEN
SF X1,ZQRER(,X0)
LI X1,1
FI
FI
IF ;NOT QE1?
CAIN X2,QE1
GOTO FALSE
THEN ;CHANGE THE VALUE AND THE RELOC CODE IN THE
; FIXUP ENTRY SO THAT IT POINTS TO
; THE WORD TO BE OUTPUT
L X2,YGAP
SF X2,ZFXCOD(X3)
L X2,YNOREL(X2)
SF X2,ZFXVAL(X3)
FI
L X2,YGAP
IFN QDEBUG,<
L X3,YO2DB
SETONA SO2D4(X3)
ST X3,YO2DB
>
BRANCH O2GEN
EPROC
SUBTTL O2GR
COMMENT;
PURPOSE: TO GENERATE A WORD THAT COULD BE RELOCATED
IN BOTH HALVES INTO ONE OF THE OUTPUT STREAM
BUFFERS
ENTRY: O2GR
INPUT ARGUMENTS: X0 CONTAINS THE WORD TO BE OUTPUT
YQRELT CONTAINS THE TARGET STREAM RELOC CODE
YQRELL -"- -"- RELOC CODE FOR LEFT HALF
YQRELR -"- -"- -"- -"- -"- RIGHT -"-
NORMAL EXIT: RETURN VIA BRANCH O2GEN
CALL FORMAT: EXEC O2GR (GENREL)
USED SUBROUTINE: O2GEN
;
O2GR: PROC
IFN QDEBUG,<EXEC DBRTMU
>
SAVE <X2,X3> ;MUST BE SAME AS FOR O2GA AND O2GF
SETZ X1, ;ASSUME NO RELOCATION
IF
SKIPN X2,YQRELR
GOTO FALSE
THEN
;RELOCATION OF RIGHT HALF
LI X1,1
ASSERT< SKIPL X2
CAILE X2,QRELI2
RFAIL WRONG YQRELR IN O2GR
>
SF X2,ZQRER(,X0)
FI
IF
SKIPN X2,YQRELL
GOTO FALSE
THEN
;RELOCATION OF LEFT HALF
ORI X1,2
ASSERT< SKIPL X2
CAILE X2,QRELI2
RFAIL WRONG YQRELL IN O2GR
>
SF X2,ZQREL(,X0)
FI
L X2,YQRELT ;TARGET RELOCATION CODE
BRANCH O2GEN
EPROC
SUBTTL O2GW
COMMENT;
PURPOSE: TO OUTPUT A CONSTANT WORD TO THE REL FILE
AND TO RETURN ITS ADDRESS RELATIVE PROGRAM BREAK. A LINEARY
SEARCH FOR A MATCH IN CURRENT LITERAL TABLE IS DONE
ENTRY: O2GW
INPUT ARGUMENTS: THE WORD TO BE OUTPUT IS PASSED IN X0
NORMAL EXIT: RETURN
OUTPUT ARGUMENTS: X0 CONTAINS THE ADDRESS RELATIVE PROGRAM BREAK
CALL FORMAT: EXEC O2GW (GENWRD)
USED SUBROUTINE: O2REL
;
O2GW: PROC
SAVE <X2>
SETZ X2, ;X2=0
LOOP
IF ;END OF CURRENT LIT. TABLE
CAME X2,YO2LII
GOTO FALSE
THEN ;NO MATCH IN CURRENT LIT. TABLE
; HAS BEEN FOUND. A NEW WORD MUST BE
; PUT INTO THE TABLE
ST X0,YO2LIB(X2)
EXEC O2REL ;ALSO IN OUT BUFFER
ADD X2,YO2LIR ;X0=REL. AD. IN CONSTANT STREAM
AOS X1,YO2LII ;INCREMENT INDEX POINTING TO
; NEXT FREE WORD
IF ;LIT. TABLE FULL?
CAIE X1,QO2LIS
GOTO FALSE
THEN
;UPPDATE REL. AD. OF CURRENT LIT. TABLE START
; AND CLEAR THE TABLE
ADDM X1,YO2LIR
SETZM YO2LII
FI
GOTO L1
FI
AS
CAMN X0,YO2LIB(X2)
GOTO FALSE ;MATCH FOUND
AOJ X2,
GOTO TRUE ;GO ON SEARCH FOR A MATCH
SA
ADD X2,YO2LIR ;X2=REL. AD. IN CONSTANT STREAM
L1(): L X0,X2 ;X0=REL. AD. IN CONSTANT STREAM
RETURN
EPROC
SUBTTL O2GWD
COMMENT;
PURPOSE: TO GENERATE A DOUBLE WORD CONSTANT
ENTRY: O2GWD
INPUT ARGUMENTS: X0-X1 CONTAINS THE DOUBLE WORD
NORMAL EXIT: RETURN
OUTPUT ARGUMENTS: X0 CONTAINS THE ADDRESS RELATIVE PROGRAM BREAK
CALL FORMAT: EXEC O2GWD
USED SUBROUTINE: O2REL
;
O2GWD: PROC
;PUT THE DOUBLE WORD CONSTANT IN X0-X1 AT THE
; FIRST FREE WORD IN THE LITERAL TABLE
; WITHOUT ANY SEARCH FOR A MATCH AND BRING
; THE RELATIVE ADDRESS BACK IN X0
SAVE <X2>
STACK X1 ;SAVE SECOND WORD TO BE OUTPUT
L X2,YO2LII
ST X0,YO2LIB(X2) ;PUT THE FIRST WORD IN THE LIT. TABLE
EXEC O2REL ;AND IN THE OUT BUFFER
AOJ X2,
IF ;LITERAL TABLE FULL?
CAIE X2,QO2LIS
GOTO FALSE
THEN
ADDM X2,YO2LIR
SETZ X2,
FI
UNSTK X0 ;X0 = SECOND WORD TO BE OUTPUT
ST X0,YO2LIB(X2) ;PUT THE SECOND WORD IN THE LIT.TABLE
EXEC O2REL ;AND IN THE OUT BUFFER
AOJ X2,
IF ;LITERAL TABLE FULL?
CAIE X2,QO2LIS
GOTO FALSE
THEN
ADDM X2,YO2LIR
SETZ X2,
FI
ST X2,YO2LII
ADD X2,YO2LIR
SUBI X2,2 ;X2 = LITERAL ADDRESS OF FIRST WORD
L X0,X2 ;X0 = LITERAL ADDRESS OF FIRST WORD
RETURN
EPROC
SUBTTL O2RTBP [43]
edit(43)
COMMENT;
PURPOSE: TO REINITIALIZE TARGET BUFFER AND PARAMETER BLOCK
ENTRY: O2RTBP
NORMAL EXIT: RETURN
CALL FORMAT: EXEC O2RTBP
INPUT PARAMETER: X3 = PARAMETER BLOCK ADDRESS
X2 = RELOCATION CODE
;
O2RTBP: PROC
SAVE <X0,X1>
HRREI X1,-<QBUFS-4>
ADD X1,QCOUNT(X3)
ADDB X1,QPOINT(X3) ;BUFFER BYTE POINTER
LI X0,<QBUFS-4>
HRRM X0,(X1) ;LENGTH OF BLOCK ITEM IF BUFFER FILLED
LI X1,1(X1)
HRLI X1,420200
ST X1,QRWP(X3) ;RELOCATION BYTE POINTER
; = POINT 2,YO2??B+1,1
MOVSI X1,200K ;RELOCATION BYTE START ADDRESS
IDPB X1,QPOINT(X3) ;RELOCATION WORD
L X1,YNOREL(X2)
SF X2,ZQRER(,X1) ;START ADDRESS RELOCATION CODE BITS
IDPB X1,QPOINT(X3) ;START ADDRESS
edit(43)
LI X1,^D18 ;[43]
ST X1,QRGC(X3) ;RELOCATION GROUP COUNTER
LI X1,QBUFS-5 ;[43]
ST X1,QCOUNT(X3) ;BUFFER WORD COUNTER
RETURN
EPROC
SUBTTL O2IC2
COMMENT;
PURPOSE: TO OUTPUT THE CONTENTS OF A BUFFER TO THE IC2 FILE
ENTRY: O2IC2
INPUT ARGUMENTS: X1 CONTAINS THE BUFFER ADDRESS
NORMAL EXIT: RETURN
CALL FORMAT: EXEC O2IC2
;
O2IC2: PROC
SAVE <X2,X3>
IF ;FIRST TIME THE BUFFER IS EMPTY AND THE FIRST
; OUT WILL ONLY INITIALIZE THE BUFFER RING
OUT QCHIC2,
GOTO FALSE
THEN
IOER IC2
EXEC O2ERU
FI
edit(43)
;[43] CODE REMOVED
HRRZ X2,YBHIC2+1
AOJ X2, ;X2= 0 ,,ADR 1:ST DATA WORD IN THE OUTPUT BUFFER
HRRZI X3,QBUFS-4 ;X3= 0 ,,NUMBER OF WORDS TO BE TRANSFERED - 1
ADD X3,X2 ;X3= 0 ,,ADR LAST WORD IN THE OUTPUT BUFFER
HRL X2,X1 ;X2= ADR FIRST WORD IN FETCH BUFFER,,
; ,,ADR FIRST DATA WORD IN OUTPUT BUFFER
BLT X2,(X3)
HRRZ X2,(X1) ;X2= NUMBER OF WORDS PUT IN THE OUTPUT BUFFER
ADDM X2,YBHIC2+1 ;UPDATE BUFFER POINTER IN BUFFER HEADER
SETZM YBHIC2+2 ;INDICATE BUFFER FULL
;[43] CODE REMOVED
RETURN
EPROC
SUBTTL O2IC2T
COMMENT;
PURPOSE: TO OUTPUT PARTLY FILLED LOCAL BUFFERS TO IC2
ENTRY: O2IC2T
NORMAL EXIT: RETURN
CALL FORMAT: EXEC O2IC2T
USED SUBROUTINE: IC2T
SUBROUTINE IC2T
PURPOSE: TO OUTPUT ONE PARTLY FILLED LOCAL BUFFER TO IC2
ENTRY: IC2T
INPUT ARGUMENTS: X1 POINTS TO THE PARAMETER BLOCK FOR ACTUAL CODE STREAM
X2 = RELOCATION CODE FOR ACTUAL CODE STREAM
NORMAL EXIT: RETURN
CALL FORMAT: EXEC IC2T
;
IC2T:
edit(43)
STACK X2 ;[43] SAVE RELOC CODE
L X3,X1 ;[43] PUT ARG TO O2RTBP IN X3
LI X2,QBUFS-3
SUB X2,QCOUNT(X1)
IF
CAIG X2,2
GOTO FALSE ;NO DATA IN BUFFER
THEN
SOS QCOUNT(X1) ;[43] CORRECT QCOUNT FOR O2RTBP
L X1,QPOINT(X1)
SUBI X1,(X2)
HRRM X2,(X1) ;SET LENGTH OF BLOCK ITEM IN HEADERWORD
EXEC IC2TO ;[43]
L X2,(XPDP) ;[43] GET RELOC CODE FROM SAVED X2
EXEC O2RTBP ;[43]
FI
UNSTK X2 ;[43] RESTORE X2
RETURN
edit(43)
COMMENT;[43]
SUBROUTINE IC2TO [43]
PURPOSE: TO OUTPUT X2 WORDS STARTING AT X1 TO IC2 BUFFER
ENTRY: IC2TO
INPUT ARGUMENTS: X1 = START ADDRESS
X2 = LENGTH
NORMAL EXIT: RETURN
CALL FORMAT: EXEC IC2TO
;
IC2TO: PROC
LOOP
;OUTPUT ACTUAL PART OF LOCAL CODE STREAM BUFFER
L X0,(X1)
IF
SOSL YBHIC2+2 ;BUFFER FILLED?
GOTO FALSE
THEN
IF
OUT QCHIC2,
GOTO FALSE
THEN
IOER IC2
EXEC O2ERU
FI
SOS YBHIC2+2
FI
IDPB X0,YBHIC2+1
AS
AOJ X1,
SOJGE X2,TRUE
SA
RETURN
EPROC
edit(43)
COMMENT;[43]
SUBROUTINE O2IC2Z
PURPOSE: TO FILL THE REST OF THE IC2 BUFFER WITH A COMMENT BLOCK TYPE 0
ENTRY: O2IC2Z
NORMAL EXIT: RETURN
ERROR EXIT: EXEC O2ERU
CALL FORMAT: EXEC O2IC2Z
;
O2IC2Z: PROC
HRRZ X2,YBHIC2+2 ;NUMBER OF WORDS LEFT IN THE BUFFER CONTAINING ZEROES
edit(147)
IF ;[147] Buffer not full
SOJL X2,FALSE
THEN ;Fill it with a comment block
IDPB X2,YBHIC2+1 ;Type 0,,length
ADDM X2,YBHIC2+1 ;UPDATE BUFFER POINTER
SETZM YBHIC2+2 ;UPDATE BUFFER COUNTER
FI ;[147]
RETURN ;NEXT SOSL YBHIC2+2 WILL SKIP AND OUTPUT THE BUFFER
EPROC
edit(43)
COMMENT;[43]
SUBROUTINE O2IC2P
PURPOSE: TO OUTPUT ALL PARTLY FILLED LOCAL CODE STREAM BUFFERS
ENTRY: O2IC2P
NORMAL EXIT: RETURN
CALL FORMAT: EXEC O2IC2P
USED SUBROUTINES: IC2T
;
O2IC2P: PROC
LI X1,YO2CDP
LI X2,QRELCD
EXEC IC2T ;CODE STREAM
LI X1,YO2PTP
LI X2,QRELPT
EXEC IC2T ;PROTOTYPE STREAM
LI X1,YO2LTP
LI X2,QRELLT
EXEC IC2T ;LINE NUMBER TABLE
LI X1,YO2STP
LI X2,QRELST
EXEC IC2T ;SYMBOL TABLE
RETURN
EPROC
O2IC2T: PROC
SAVE <X2>
;TEST IF GENERATED CODE STREAMS TOO LONG (GRE 100000 OCTAL)
IF
L X1,YRELCN
CAIL X1,100K
GOTO TRUE
L X1,YRELCD
CAIL X1,100K
GOTO TRUE
L X1,YRELPT
CAIL X1,100K
GOTO TRUE
L X1,YRELLT
CAIL X1,100K
GOTO TRUE
L X1,YRELST
CAIL X1,100K
GOTO TRUE
GOTO FALSE
THEN
ERROR2 53,PROGRAM TOO LARGE CAPACITY LIMIT EXCEEDED
BRANCH O2AB
FI
edit(2)
EXEC O2DFTE ;[2] OUTPUT LAST DEFINED FIXUP IN YOSLAS
; AND YO2LAS+1 IF YO2FIX IS NONZERO
L X1,YRELCN ;UPPDATE CODE ITEM COUNTER IN REL FILE
SUB X1,@YO2ACN ; HEADER WORD
AOJ X1,
HRRM X1,@YO2ACN
edit(43)
;[43] START
EXEC O2IC2P ;OUTPUT PARTLY FILLED COD BUFFERS
EXEC O2IC2Z ;ZERO REST OF IC2 BUFFER
;OUTPUT DEFINE FIXUP TABLE(S) (IQ BUFFERS)
L X1,YO2CIQ ;CURRENT IQ BUFF
IF
CAIE X1,YO2ITB
GOTO FALSE
THEN ;OUTPUT FILLED YO2IQB FIRST
LI X1,YO2IQB
EXEC O2IC2
LI X1,YO2ITB ;YO2ITB IS THE LAST
FI
;OUTPUT THE LAST IQ BUFF
HRRZ X2,(X1)
ST X2,1(X1) ;SET COUNT
L X2,YO2IQI
SUBI X2,1 ;NUMBER OF WORDS TO OUTPUT
IF
CAIGE X2,2 ;DATA IN LAST IQ BUFF
GOTO FALSE
THEN
EXEC IC2TO ;OUTPUT LAST IQ BUFF
EXEC O2IC2Z ;ZERO THE REST OF THE IC2 BUFF
FI
;[43] END
; OUTPUT AS YET UNDEFINED FIXUPS AS NAME BLOCKS
L [XWD 2,0]
ST YO2IQB
edit(43)
LI X3,YO2IQB ;[43] SET CURRENT IQ BUFF TO YO2IQB
ST X3,YO2CIQ ;[43]
LI X3,1
ST X3,YO2IQI
SETZM YQREL
LI X2,QFTFX
LOOP
L X1,YFXTAB
ADD X1,X2
LF ,ZFXTYP(X1)
IF CAIN QC
GOTO TRUE
CAIE QD
GOTO FALSE
THEN L X1,X2
DEFIX
FI
AS SOJG X2,TRUE
SA
EXEC EXDF ; OUTPUT USER DEFINED EXTERNAL REQUEST
;[43] START
LI X1,YO2IQB
L X2,YO2IQI
SUBI X2,1 ;NUMBER OF WORDS LEFT IN YO2IQB
CAIL X2,1 ;NO DATA WORDS
EXEC IC2TO ;OUTPUT THE REST IN YO2IQB
;[43] END
RETURN
EPROC
SUBTTL O2REL
COMMENT;
PURPOSE: TO PUT A WORD INTO THE OUT BUFFER FOR THE REL FILE
UNDER A FORMAT ACCEPTABLE TO LINK 10
ENTRY: O2REL
INPUT ARGUMENTS: THE WORD TO BE OUTPUT IS PASSED IN X0
NORMAL EXIT: RETURN
CALL FORMAT: EXEC O2REL
USED SUBROUTINES: O2DB1-7
;
PROC
;O2REL PROCEDURE
;ENTRY POINT IS O2REL
;X0 CONTAINS WORD TO BE GENERATED THAT IS
;CODE ITEM (TYPE 1) IS WRITTEN TO THE REL FILE
LOOP
;CORRECT CODE ITEM COUNTER WHEN BUFFER FILLED
L X1,YRELCN
SUB X1,@YO2ACN
AOJ X1,
HRRM X1,@YO2ACN
edit(4)
AOS X1,YRELBL ;[4] Account for the block
edit(27)
REPEAT 0,< ;[27] This change is not correct, suspended until
; better understood
edit(4)
IF ;[4] Not main program
JUMPGE X1,FALSE
THEN ;Special buffer treatment
IF ;[030406] This is the first buffer
HRRZ X1,X1
CAIE X1,1
GOTO FALSE
THEN ;Suspend output until next is filled
L X1,@YBHREL ;Next buffer
HRRM X1,YBHREL
ADDI X1,1
ST X1,YBHREL+1 ;Byte pointer
LI X1,200
ST X1,YBHREL+2 ;Bytes left
GOTO L2
FI
IF ;Second buffer now
CAIE X1,2
GOTO FALSE
THEN ;Output first buffer
L X1,@YBHREL
OUT QCHREL,(X1)
SKIPA
GOTO L1
FI FI
> ;[27] End repeat 0
IF OUT QCHREL,
GOTO FALSE
THEN
L1():! IOER REL
EXEC O2ERU
FI ;[030406]
;INITIALIZE BUFFER FOR CODE ITEM
L2():! LI X1,^D17
ST X1,YO2CNB ;ROOM FOR 17 WORDS
SOS YBHREL+2
L X1,YRELCN
HRLI X1,1 ;FIRST ENTRY OF CODE ITEM
;COUNTER CORRECTED BEFORE OUT
IDPB X1,YBHREL+1 ;GENERATE FIRST ENTRY
L X1,YBHREL+1
HRRZM X1,YO2ACN ;SAVE ADDRESS OF COUNTER
SOS YBHREL+2
HRLZI X1,200000
IDPB X1,YBHREL+1 ;GENERATE RELOCATION ENTRY
SOS YBHREL+2
L X1,YRELCN
IDPB X1,YBHREL+1 ;GENERATE LOAD ADDRESS
O2REL: AS SOSGE YBHREL+2
GOTO TRUE ;BUFFER FILLED
SA
IF SOSL YO2CNB
GOTO FALSE ;BLOCK NOT FILLED
THEN ;START NEW BLOCK
LI X1,0
IDPB X1,YBHREL+1 ;GENERATE RELOCATION WORD
LI X1,^D18
ST X1,YO2CNB
GOTO O2REL ;GENERATE CALLED WORD
FI
AOS YRELCN ;COUNT NUMBER OF GENERATED WORDS
IDPB X0,YBHREL+1 ;GENERATE CALLED WORD
IFN QDEBUG,<
L X1,X0 ;SAVE X0
IF ;DEBUG OUTPUT?
IFOFF SO2D1
GOTO FALSE
THEN
L X0,X1 ;RESTORE X0
EXEC O2DB1,<<[020000,,]>> ;NEW LINE
HRL X1,YRELCN
SUB X1,[1,,0]
EXEC O2DB3,<<[610000,,'CN ']>,X1>
HRLI X1,110000
HLR X1,X0
HRL X0,X0
EXEC O2DB3,<X1,X0>
FI
> ;END OF IFN QDEBUG,
RETURN
EPROC
LIT
END