Google
 

Trailing-Edge - PDP-10 Archives - BB-H506D-SM_1983 - cobol/source/covrly.mac
There are 7 other files named covrly.mac in the archive. Click here to see a list.
; UPD ID= 639 on 12/14/77 at 5:04 PM
TITLE	COVRLY FOR LIBOL		
SUBTTL	OVERLAY ROUTINE		AL BLACKINGTON/CAM



;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, 1981 BY DIGITAL EQUIPMENT CORPORATION

; EDIT 342	USE CHANNEL 0 AS LAST RESORT, SO OVERLAY ON 1.

	HISEG

;THIS ROUTINE IS CALLED BY A PUSHJ PP,OVLAY.
;IT ASSUMES THAT A FILE HAS BEEN INITIALIZED ON CHANNEL 1
; CONTAINING THE FOLLOWING DATA:
; THE FIRST TWO BLOCKS CONTAIN FINE-TABLE INFO FOR
;THE SEGMENTS. BLOCK 1 AND THE FIRST 72 WORDS OF BLOCK 2
;CONTAIN 2-WORD ENTRIES, ONE FOR EACH SEGMENT (0-99):
;	WORD1,	BITS 0-28 - RELATIVE BLOCK # FOR SEGMENT.
;		BITS 29-35 - RELATIVE WORD # WITHIN BLOCK FOR
;		FIRST WORD OF SEGMENT.
;	WORD2,	BITS 18-35 - SIZE OF THE SEGMENT (NEGATIVE)
;THE NEXT 50 WORDS OF BLOCK 2 CONTAIN "ALTER" INFORMATION
;FOR SEGMENTS 50-99:
;	BITS  0-17 - LOCATION (RELATIVE TO BEGINNING OF
;	             NON-RESIDENT SEGMENT) OF A LIST OF
;	             ADDRESSES USED TO PRESET "ALTER" TABLE.
;	BITS 18-35 - SIZE OF "ALTER" TABLE FOR THIS SEGMENT
;
;THE DATA IS GROUPED IN BLOCKS OF 19 WORDS. THE FIRST
; WORD CONTAINS RELOCATION INFO FOR THE NEXT 18
; DATA WORDS, IN 2-BIT BYTES:
;	BIT 1 - RELOCATE LH

;	    2 - RELOCATE RH
;THE FOLLOWING LOCATIONS ARE USED BY THIS ROUTINE:

EXTERNAL SEGWD.	;LH IS ADDRESS OF FIRST WORD IN RESIDENT
		;AREA, RH IS ADDRESS OF FIRST WORD IN
		;OVERLAY AREA.
EXTERNAL ALTER.	;XWD <ADDRESS OF IMPURE BASE>,<ADDRESS OF "ALTER" TABLE>
EXTERNAL SEGNO.	;SEGMENT NUMBER OF SEGMENT CURRENTLY IN CORE
EXTERNAL AINFO.	;CONTAINS INFO FOR THIS SEGMENT TAKEN
		;FROM FINE-TABLE
EXTERNAL OVRBF.	;3-WORD BUFFER HEADER USED BY OVERLAY FILE
EXTERNAL OVRIX.	;POINTER TO THE INDEX TABLE, SET UP BY "RESET"
EXTERNAL KILL.	;ROUTINE WHICH TERMINATES RUN ON ERROR
		;CONDITION

ENTRY OVLAY.
OVLAY.:	MOVS	TA,0(PA)	;SET RETURN ADDRESS
	HRRM	TA,(PP)

	LDB	TA,CURSEG	;CURRENT SEGMENT AND OVERLAY SEGMENT THE SAME?
	LDB	TB,OVRSEG
	CAMN	TA,TB
	POPJ	PP,		;YES
	JUMPE	TB,CPOPJ	;NO--IS NEXT SEGMENT RESIDENT?
	CAMN	TB,SEGNO.	;CURRENT SEGMENT?
	JRST	LOADED		;YES--NO I/O REQUIRED

;GET INFORMATION FROM INDEX TABLE

OVLY.9:	MOVEM	TB,SEGNO.	;RESET CURRENT SEGMENT NUMBER

	LSH	TB,1		;MULTIPLY SEGMENT NUMBER BY 2
	ADD	TB,OVRIX.	;ADD IN BASE OF INDEX
	LDB	WD,[POINT 7,0(TB),35]	;PICK UP RELATIVE WORD#
	LDB	BL,[POINT 29,0(TB),28]	;PICK UP RELATIVE BLOCK#
	MOVS	LC,1(TB)	;PICK UP SEGMENT SIZE
	JUMPGE	LC,NOSEGM	;IF EMPTY--TROUBLE

	MOVE	TB,SEGNO.	;SEGMENT > 49?
	CAIG	TB,^D49
	JRST	LOADIT		;NO--DO NOT NEED MORE INFO

	ADD	TB,OVRIX.	;ADD IN BASE
	MOVE	TB,^D200-^D50(TB)
	MOVEM	TB,AINFO.
;LOAD THE SEGMENT

LOADIT:	SETSTS	OVR,14		;CLEAR "SYNCHRONOUS" BIT
	USETI	OVR,(BL)	;SET UP BLOCK # FOR READ

	WAIT	OVR,		;WAIT FOR ALL I/O TO CEASE
	MOVE	TA,OVRBF.	;IF THERE IS
	MOVE	TA,(TA)		; SOMETHING IN
	SKIPGE	(TA)		; NEXT BUFFER ALREADY,
	INPUT	OVR,		; SKIP OVER IT

	PUSHJ	PP,GETOVR	;GET FIRST DATA BLOCK
	ADDM	WD,OVRBF.+1	;START AT CORRECT WORD
	SUBI	WD,1
	MOVNS	WD
	ADDM	WD,OVRBF.+2
	HRR	LC,SEGWD.

	HLRZ	PR,SEGWD.	;GET PURE RELOCATOR
	HLRZ	IR,ALTER.	;GET IMPURE RELOCATOR


;LOAD AN 18-WORD BLOCK

BLOKIN:	MOVEI	CT,^D18		;SET COUNT
	PUSHJ	PP,GETWRD	;PICK UP RELOCATION
	MOVE	RW,WD

WORDIN:	PUSHJ	PP,GETWRD	;PICK UP A DATA WORD
	JUMPGE	RW,WORDI1	;DOES LEFT-HALF NEED RELOCATION?
	TLZE	WD,(1B0)	;BY PURE BASE?
	SKIPA	TA,PR		;YES
	MOVEI	TA,(IR)		;NO
	MOVSI	TA,(TA)		;TO LEFT HALF
	ADD	WD,TA		;RELOCATE LEFT HALF

WORDI1:	TLNN	RW,1B19		;IS RIGHT HALF RELOCATABLE?
	JRST	WORDI2		;NO
	TRZE	WD,1B18		;BY PURE BASE?
	SKIPA	TA,PR		;YES
	MOVEI	TA,(IR)		;NO
	ADDI	WD,(TA)		;RELOCATE RIGHT HALF

WORDI2:	MOVEM	WD,(LC)		;STORE IT

	LSH	RW,2

	AOBJP	LC,NEWSEG	;JUMP WHEN DONE
	SOJG	CT,WORDIN	;LOOP
	JRST	BLOKIN
;SEGMENT IS IN CORE

NEWSEG:	PUSHJ	PP,	@SNRBP.##	;GO SEE IF WE HAVE TO SET ANY BREAK POINTS.
LOADED:	MOVE	TA,SEGNO.	;SEGMENT # > 49?
	CAIG	TA,^D49
	POPJ	PP,		;NO--EXIT

;RESET THE ALTER TABLE

	MOVE	TA,ALTER.	;PICK UP ADDRESS OF ALTER TABLE
	HLLZ	TB,AINFO.	;PICK UP RELOCATION LOC OF RESET INFO
	ADD	TA,TB		;ADD IN LOC OF NON-RESIDENT
	HRRZ	TB,AINFO.	;SET TB TO # OF WORDS
	JUMPE	TB,CPOPJ	;IF NONE--FORGET IT
	ADDI	TB,(TA)		;RELOCATE TB
	BLT	TA,-1(TB)	;MOVE INFO

CPOPJ:	POPJ	PP,		;RETURN
;GET A DATA WORD

GETWRD:	SOSG	OVRBF.+2
	PUSHJ	PP,GETOVR
	ILDB	WD,OVRBF.+1
	POPJ	PP,

;GET A BUFFER FULL

GETOVR:	IN	OVR,
	  POPJ	PP,

	GETSTS	OVR,ER		;ERROR--GET STATUS
	TRNN	ER,$ERAS	;END--FILE?
	JRST	ERROR1		;YES
	OUTSTR	[ASCIZ "Read error on overlay device"]
	JRST	KILL.

ERROR1:	OUTSTR	[ASCIZ "End-of-file on overlay device"]
ERROR2:	OUTSTR	[ASCIZ " -- compiler error"]
	JRST	KILL.

;EMPTY SEGMENT (COUNT WAS NOT NEGATIVE)

NOSEGM:	OUTSTR	[ASCIZ "No segment to load"]
	JRST	ERROR2
;BYTE POINTERS TO SEGMENT NUMBERS IN PARAMETERS

CURSEG:	POINT 7,0(PA),26	;CURRENT SEGMENT
OVRSEG:	POINT 7,0(PA),35	;DESIRED SEGMENT

;ACCUMULATORS
LC=1			;CONTAINS IN RH, THE NEXT LOCATION FOR DATA
			;         IN LH, NUMBER OF WORDS TO GO (NEGATIVE)
WD=2			;WORD # FROM FINE TABLE, OR NEW INPUT WORD
BL=3			;BLOCK # FROM FINE TABLE
CT=4			;COUNTER
RW=5			;TO HOLD RELOCATION BITS
TA=6			;TEMPORARY
TB=7			;TEMPORARY
ER=10			;ERROR BITS FOR INPUT FILE
IR=13			;IMPURE RELOCATION
PR=14			;RESIDENT RELOCATION
PA=16			;SEGMENT NUMBER IN RH
PP=17			;PUSH-DOWN POINTER

;INPUT DEVICE

OVR=1		;[342]

;MONITOR INTERFACE

$ERAS=17B21		;ERROR FLAGS FOR I/O

	END