File: CCLDRV.MA of Disk: V50/Source/Source-Listing-2
(Source file text) 

/OVRDRV - OVERLAY DRIVER FOR CCL
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1977,1978 BY DIGITAL EQUIPMENT CORPORATION
/		 AND 1979  BY DATAPLAN GMBH
/
/
/
/
/
/
/
/
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE
/AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
/CORPORATION.  DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/FOR ANY ERRORS THAT MAY APPEAR IN THIS DOCUMENT.
/
/THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FURNISHED TO THE PURCHASER
/UNDER A LICENSE FOR USE ON A SINGLE COMPUTER SYSTEM AND CAN BE COPIED
/(WITH INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH
/SYSTEM, EXCEPT AS MAY OTHERWISE BE PROVIDED IN WRITING BY DIGITAL.
/
/DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY FOR THE USE
/OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY
/DIGITAL.
/
/
/
/
/
/
/
/
/
/

/OVERLAY DRIVER
/FOR LINKER PROGRAM MODULES
/VERSION=V4A


/THIS SECT IS TWO LOCATIONS AND CONTAINS THE TRANSFER VECTOR TO SWAPER
/AND A FLAG THAT INDICATES WHETHER A JMP (1) OR JMS (0) WAS PERFORMED
/TO THE TRANSFER VECTOR

/	.SECT	XFERV,Z
/	0			/FLAG, 1=JMP, 0=JMS
/	SWAPER			/TRANSFER VECTOR TO SWAP ROUTINE

	.NOLIST
	.INCLUDE OUT:CCLDEF.MA
	.LIST

/THIS IS THE MAIN DRIVER SECTION

	.SECT	SWAPER,R
	.GLOBAL	SWPTAB,TRANVC

/	.ZTERNAL XFERV
	FIELD	1

SWAP,	6401			/VERSION NUMBER
	DCA	AC		/SAVE CALLING AC
	RAL
	DCA	LINK		/AND LINK
	RDF			/GET CALLING DF
	TAD	(CDF		/FORM CDF
SWAP0,	JMP	ONCE		/DO ONCE ONLY CODE - REPLACED BY DCA EXIT
	CDF	.		/CHANGE TO THIS DATA FIELD
	TAD I	SWAP		/GET OVERLAY,LEVEL,FIELD
	DCA	BINDAT		/SAVE
	ISZ	SWAP		/BUMP POINTER
S1600,	TAD I	SWAP		/GET SUBROUTINE ADDRESS
	DCA	XITLOC		/SAVE
	TAD	BINDAT		/FORM CDF TO CALLED SUBROUTINE
	AND	(7
	RAL CLL
	RTL
	TAD	(CDF
	DCA	SWAP1A		/SAVE
	TAD	SWAP1A		/FORM CIF TO CALLED SUBROUTINE
	IAC
	DCA	EXIT+1		/SAVE FOR EXIT
/LOAD OVERLAY OF CALLED SUBROUTINE

LOAD,	TAD	BINDAT
	AND	S1600		/EXTRACT LEVEL OF CALLED SUBROUTINE
	BSW
	CLL RAL			/5 RIGHT
	DCA	PNTR		/SAVE
	TAD	PNTR
	TAD	(SWPTAB		/COMPUTE ENTRY INTO SWAP TABLE
	DCA	PFLD		/POINTS TO FIELD OF OVERLAY
	TAD	PNTR		/COMPUTE ENTRY INTO CURRENT OVERLAY TABLE
	RTR CLL
	TAD	(CURTAB
	DCA	PNTR
	TAD	BINDAT		/EXTRACT DESIRED OVERLAY NUMBER
	AND	(171		/REALLY 170 BUT 171=-7607
	RAR CLL			/THROW AWAY LEAST SIGNIFICANT
	RTR CLL			/RIGHT 3
	CIA			/NEGATE
	DCA	TEMP
	TAD	TEMP
	TAD I	PNTR		/COMPARE WITH CURRENT OVERLAY NUMBER FOR LEVEL
	SNA CLA			/SAME?
	JMP	SWAP1		/YES, NO READING NEEDED
LOAD1,	TAD	TEMP		/NO, SET TO NEW
	CIA
	DCA I	PNTR		/OVERLAY NUMBER
	TAD I	PFLD
	DCA	BINDAT		/SAVE FIELD OF OVERLAY
	ISZ	PFLD		/POINT AT ADDRESS
	TAD I	PFLD
	DCA	REDADD		/SAVE IN CALL LOCATION
	ISZ	PFLD		/POINT AT RELATIVE BLOCK #
	TAD I	PFLD
	DCA	REDBLK		/SAVE TEMPORARILY
	ISZ	PFLD		/POINT AT OVERLAY LENGTH
	TAD	TEMP		/TEST OVERLAY NUMBER
	SNA CLA			/0?
	JMP	LOAD2		/YES, NO MULTIPLICATION NEEDED
	TAD I	PFLD		/BLOCK NUMBER = (LENGTH OF OVERLAY)
	IAC			/TIMES (THE NUMBER OF THE OVERLAY)
	CLL RAR			/CONVERT PAGES TO BLOCKS
	DCA	REDCNT		/SAVE FOR MULTIPLY
	TAD	REDCNT		/MULTIPLY BLOCK LENGTH
	ISZ	TEMP		/BY OVERLAY NUMBER
	JMP	.-2
LOAD2,	TAD 	REDBLK		/PLUS (RELATIVE BLOCK OF LEVEL)
	TAD	STRBLK		/PLUS (STARTING BLOCK OF PROGRAM)
	DCA	REDBLK		/SAVE IN CALL LOCATION
	TAD	BINDAT		/GET FIELD
	AND	(7		/MASK
	CLL RTR
	RTR			/POSITION
	TAD I	PFLD		/GET LENGTH AGAIN
	BSW
	DCA	REDCNT		/FORM CONTROL WORD
	CIF	0
	JMS I	RESHAN		/CALL RESIDENT HANDLER TO READ IN OVERLAY
REDCNT,	7756		/FUNCTION CONTROL WORD (POINTS TO MREAD-1 FOR "ONCE"
REDADD,	7747		/BUFFER ADDRESS (POINTS TO SOFSET FOR "ONCE"
REDBLK,	0		/STARTING BLOCK NUMBER
	HLT		/ERROR RETURN ADDRESS

SWAP1,	TAD	XFERV		/GET JMP-JMS FLAG
	SZA CLA			/SET?
	JMP	SWAP2		/YES, EXECUTE A JMP
	CLA CLL CMA RTL		/-3
	TAD	SWAP		/BACK UP TO CALLER'S PC
	DCA	SWAP
	TAD I	SWAP
SWAP1A,	0			/CDF TO CALLED SUBROUTINE
	DCA I	XITLOC		/SAVE IN CALLED SUBROUTINE
	ISZ	XITLOC		/BUMP TRANSFER ADDRESS
	CDF	.
	TAD	(ISZ XFERV
	DCA I	SWAP		/SET BACK UP ENTRY IN XFER VECTOR TABLE
SWAP2,	DCA	XFERV		/CLEAR FLAG
	TAD	LINK		/RESTORE LINK AND AC
	RAR CLL
	TAD	AC
EXIT,	0			/SET DF TO CALLING FIELD
	0			/SET IF TO CALLED FIELD
	JMP I	XITLOC		/GO TO CALLED SUBROUTINE

/VARIABLE LOCATIONS
/SOME OF THE FOLLOWING LOCATIONS CONTAIN
/ONCE ONLY CODE TO SET UP STARTING BLOCK
/AND CHECK THAT FILE CAME FROM SYS:
CURTAB=.		/CURRENT OVERLAY IN LEVEL TABLE (8 ENTRIES)
STRBLK=.		/ENTRY 0 IS USED TO HOLD STARTING BLOCK OF FILE
ONCE,	DCA	EXIT		/SAVE CALLING FIELD
				/ALSO ENTRY 0
	TAD	.-1		/SET UP SO WON'T BE EXECUTED AGAIN
				/ALSO ENTRY 1
	DCA	SWAP0
				/ALSO ENTRY 2
	CDF	0
				/ALSO ENTRY 3
	TAD I	REDADD		/GET STARTING BLOCK FROM "SOFSET"
				/ALSO ENTRY 4
	DCA	STRBLK		/SAVE
				/ALSO ENTRY 5
	TAD I	REDCNT		/GET RESIDENT? ENTRY POINT
				/ALSO ENTRY 6
	DCA	RESHAN		/SAVE
				/ALSO ENTRY 7
	TAD	RESHAN		/CHECK ENTRY IS RESIDENT
PFLD,				/POINTS TO SWPTAB
	TAD	(-7607
BINDAT,				/CONTAINS OVERLAY,LEVEL,FIELD OF DESIRED SUBROUTINE
	SZL CLA			/RESIDENT ?
XITLOC,				/CONTAINS LOCATION TO GO TO IN DESIRED SUBROUTINE
	JMP	SWAP0+1		/YES, OK
PNTR,				/POINTS INTO CURTAB
	HLT			/NO, ERROR
TEMP,				/TEMP STORAGE
	JMP	.-1		/DON'T ALLOW CONTINUE

RESHAN,	7607			/OR SOME OTHER RESIDENT ENTRY POINT
AC,	0			/SAVED AC
LINK,	0			/SAVED LINK

	PAGE

/THIS AREA CONTAINS OVERLAY DATA FOR MAIN AND THE 7 LEVELS
/THE FORMAT OF EACH ENTRY IS:
/WORD1:	FIELD OF LEVEL
/WORD2:	ADDRESS OF LEVEL
/WORD3:	RELATIVE BLOCK OF 1ST OVERLAY IN LEVEL
/WORD4:	LENGTH OF THE LEVEL (ANY AND ALL OVERLAYS-EACH)
/	(ALL OVERLAYS IN A LEVEL ARE THE SAME LENGTH)

SWPTAB,

	*.+40

/THIS AREA CONTAINS THE TRANSFER VECTORS FOR EACH ENTRY POINT
/IN ALL THE OVERLAYS IN ALL THE LEVELS
/ITS SIZE SHOULD BE MODIFIED BY THE USER
/TO FIT THE MAXIMUM NUMBER OF TRANSFER VECTORS NEEDED
/EACH TRANSFER VECTOR OCCUPIES 4 LOCATIONS
/THE TABLE IS INITIALLY SET UP FOR 24(DEC) (30(OCT)) VECTORS
/THE MAXIMUM SIZE THIS TABLE CAN BE IS 3774 (OCT) LOCATIONS FOR
/511 (DEC) (777 (OCT)) VECTORS
/THE FORMAT OF EACH VECTOR ENTRY IS:
/WORD1:	ISZ	XFERV
/WORD2:	JMS I	XFERV+1
/WORD3:	LEVEL/OVERLAY/FIELD
/WORD4:	ADDRESS

TRANVC,

	SIZE=56.	/MODIFY THIS LINE TO CHANGE THE SIZE OF THE TABLE
			/SET FOR 24(DEC)

	*SIZE^4+.