Google
 

Trailing-Edge - PDP-10 Archives - CFS_TSU04_19910205_1of1 - update/cblsrc/covrly.mac
There are 7 other files named covrly.mac in the archive. Click here to see a list.
; UPD ID= 1259 on 6/7/83 at 12:41 PM by HOFFMAN                         
TITLE	COVRLY FOR COBOTS		
SUBTTL	OVERLAY ROUTINE		AL BLACKINGTON/CAM

	SEARCH COPYRT
	SALL

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

	SEARCH	LBLPRM
IFN	TOPS20,<	SEARCH	MONSYM, MACSYM>
IFE	TOPS20,<	SEARCH	MACTEN>

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

	HISEG
	.COPYRIGHT		;Put standard copyright statement in REL file

;THIS ROUTINE IS CALLED BY A PUSHJ PP,OVLAY.
;IT ASSUMES THAT A FILE HAS BEEN INITIALIZED ON CHANNEL 1 ON TOPS-10
; OR ON OVRJFN JFN ON TOPS-20
; 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
IFN TOPS20,<
EXTERN	OVRJFN	;JFN OF OVERLAY FILE
>

ENTRY OVLAY.

IFN TOPS20,<
DEFINE	OUTSTR	(TEXT)<
	HRROI	T1,TEXT
	PSOUT%
>
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:
IFE TOPS20,<
	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
>
IFN TOPS20,<
	MOVE	T1,OVRJFN	;JFN
	MOVEI	T2,-1(BL)	;GET BLOCK NUMBER IN 1
	LSH	T2,7		;CONVERT TO WORDS
	SFPTR%			;SET ON IT
	  HALT
	PUSH	PP,T3		;SAVE WD
>
	PUSHJ	PP,GETOVR	;GET FIRST DATA BLOCK
IFN TOPS20,<
	POP	PP,T3
>
	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:
IFE TOPS20,<
	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.
>

IFN TOPS20,<
	MOVE	T1,OVRJFN	;JFN
	MOVE	T2,OVRBF.	;36 BIT BYTE POINTER
	MOVNI	T3,400		;2 TOPS-10 BLOCKS AT A TIME
	MOVEM	T2,OVRBF.+1	;RESET POINTER
	MOVMM	T3,OVRBF.+2	;AND COUNT
	SIN%
	  ERJMP	[MOVEI	T1,.FHSLF
		GETER%
		  TRN
		HRRZ	T2,T2		;Error only
		MOVE	T1,OVRJFN
		CAIE	T2,IOX4		;End of File?
		JRST	SINERR		;No
		ADDB	T3,OVRBF.+2	;Adjust count
		JUMPE	T3,ERROR1	;No data read at all
		JRST	.+1]
	POPJ	PP,

SINERR:	PUSH	P,T1
	MOVEI	T1,.PRIOU
	HRLOI	T2,.FHSLF
	SETZ	T3,
	ERSTR%
	  TRN
	  TRN
	POP	PP,T2
	SETZB	T3,T4
	JFNS%
	  ERJMP	.+1
	HALT
>

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
TA=1			;TEMPORARY
TB=2			;TEMPORARY
WD=3			;WORD # FROM FINE TABLE, OR NEW INPUT WORD
LC=4			;CONTAINS IN RH, THE NEXT LOCATION FOR DATA
			;         IN LH, NUMBER OF WORDS TO GO (NEGATIVE)
BL=5			;BLOCK # FROM FINE TABLE
CT=6			;COUNTER
RW=7			;TO HOLD RELOCATION BITS
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

IFN TOPS20,<
T1==TA
T2==TB
T3==WD
T4==T3+1
>

IFE TOPS20,<
;INPUT DEVICE

OVR=1		;[342]

;MONITOR INTERFACE

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

	END