Google
 

Trailing-Edge - PDP-10 Archives - tops20_v6_1_tcpip_distribution_tp_ft6 - galaxy-sources/glxini.mac
There are 31 other files named glxini.mac in the archive. Click here to see a list.
	TITLE GLXINI - Bootstrap code for GALAXY runtime system
	SUBTTL	Preliminaries

;
;
;	COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION
;	1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985
;
;     THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY  BE  USED
;     AND COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE
;     AND WITH THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.   THIS
;     SOFTWARE  OR ANY OTHER COPIES THEREOF MAY NOT BE PROVIDED OR
;     OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON.  NO  TITLE  TO
;     AND OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED.
;
;     THE INFORMATION  IN  THIS  SOFTWARE  IS  SUBJECT  TO  CHANGE
;     WITHOUT  NOTICE  AND SHOULD NOT BE CONSTRUED AS A COMMITMENT
;     BY DIGITAL EQUIPMENT CORPORATION.
;
;     DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
;     OF  ITS  SOFTWARE  ON  EQUIPMENT  WHICH  IS  NOT SUPPLIED BY
;     DIGITAL.


;This module is loaded in the low segment of any program
;	using the GALAXY library code, GLXLIB.

	SEARCH	GLXMAC			;SEARCH GLXMAC FOR SYMBOL DEFS
	PROLOG(GLXINI,INI)

	INIMAN==:21			;Maintenance edit number
	INIDEV==:25			;Development edit number
	VERSIN (INI)			;Generate edit number

;Only assemble the rest if we are building a rel library, otherwise
;the rest is meaningless.

IFE GLXPURE,<
	SUBTTL	Table of Contents


;		Table of Contents for GLXINI
;
;
;			   Section			      Page
;   1. Preliminaries. . . . . . . . . . . . . . . . . . . . .    1
;   2. Table of Contents. . . . . . . . . . . . . . . . . . .    2
;   3. Revision History . . . . . . . . . . . . . . . . . . .    3
;   4. User referenced entry vector . . . . . . . . . . . . .    4
;   5. I%INIT - Initialize the runtime system . . . . . . . .    5
;   6. ACQLIB - Acquire the run-time system . . . . . . . . .    6
;   7. CHKLIB - Routine to test if library is in place. . . .    7
;   8. TRYSEG - Routine to fetch runtime system . . . . . . .    8
SUBTTL	Revision History

COMMENT \

21			7/13/81
	Do not initialize the entry vector if already initialized.

*****  Release 4.2 -- begin maintenance edits  *****

*****  Release 5.0 -- begin development edits  *****

25	5.1002		28-Dec-82
	Move to new development area.  Clean up edit organization.  Update TOC.

\   ;End of revision history
SUBTTL	User referenced entry vector


; All references to the OTS by the user are through ENTVEC table
;
	ZZ==0				;;INITIALIZE COUNTER
DEFINE	CDO	(X),<			;;MACRO TO DEFINE ENTRY POINTS
	IFNB <X>,<X::>			;;DEFINE GLOBAL IF NOT NULL
	JRST	@.+1			;;DISPATCH
	EXP	ZZ			;;STORE INDEX INTO GLXOTS
	ZZ==ZZ+1			;;POINT TO NEXT ENTRY
>					;;END OF CDO MACRO

ENTVEC::LIBVEC				;DEFINE ALL ENTRY POINTS
	EXP	-1			;TERMINATE VECTOR

WORK:	BLOCK	20			;Get space for working
ARG:	BLOCK	6			;Get space for argument block...
					;Note: this space can also be used as
					;spillover from WORK

; Set up correct places to search for the library depending on the system.

TOPS10<
DSKDEV:	SIXBIT/DSK/
SYSDEV:	SIXBIT/SYS/
> ; End of TOPS10

TOPS20<
DSKDEV:	[ASCIZ/DSK:/]
SYSDEV:	[ASCIZ/SYS:/]
> ; End of TOPS20
SUBTTL I%INIT - Initialize the runtime system


;Entry point for segment and module initialization

;CALL IS:	S1/ Length of IB (Runtime Initialization Block)
;		S2/ Address of IB

	ENTRY	I%INIT

I%INIT:	PUSH	P,S1			;SAVE INPUT ARGS AWAY
	PUSH	P,S2			;
	PUSHJ	P,CHKLIB		;SEE IF THE LIBRARY IS ALREADY THERE
	JUMPT	INIT.2			;IT IS - SKIP LOTS OF STUFF
	PUSHJ	P,ACQLIB		;ACQUIRE THE LIBRARY SYSTEM
	SKIPE	ENTVEC+1		;Is the entry vector initialized?
	JRST	INIT.2			;Yes, don't do it again.
	SETZM	S2			;Set up index

INIT.1:	ADDM	S1,ENTVEC+1(S2)		;ADJUST INDEX INTO GLXOTS
	ADDI	S2,2			;ACCOUNT FOR TWO WORD ENTRIES
	SKIPL	ENTVEC(S2)		;END OF VECTOR ?
	JRST	INIT.1			;NO - LOOP

INIT.2:	POP	P,S2			;RESTORE USER'S S2
	POP	P,S1			;RESTORE USER'S S1

SEGIN::	HRLI	S1,%%.GLX		;LOAD VERSION
	PUSHJ	P,ENTVEC		;CONTINUE INITIALIZATION
	$RETT				;RETURN TO CALLER
SUBTTL	ACQLIB - Acquire the run-time system


; Here if the OTS is not in place.  If this is a debugging world,
; look first in DSK:.  If that fails, or if we are not debugging,
; look in SYS:.  If not found, give an error message and quit.
; If found, return the address of the dispatch table for the library
; in S1.
;
; Call:		No arguments
;
; Return:	S1 / Address of OTS dispatch table (returned from TRYSEG)
;
ACQLIB:	SKIPN	DEBUGW			;Debugging ?
	JRST	ACQL.1			;Nope - skip checking on DSK
	MOVE	S1,DSKDEV		;Try generic DSK
	PUSHJ	P,TRYSEG		;Try it again
	JUMPT	ACQL.2			;If sucessful - finish up

ACQL.1:	MOVE	S1,SYSDEV		;Try SYS
	PUSHJ	P,TRYSEG		;One more time
	JUMPT	ACQL.2			;If sucessful - finish up

TOPS10<
	OUTSTR	[ASCIZ	|? GLXINI - Unable to obtain run-time system|]
	MONRT.				;Stop
> ; End of TOPS10

TOPS20<
	HRROI	S1,[ASCIZ \? GLXINI - Unable to obtain run-time system
\]
	PSOUT
	HALTF
> ; End of TOPS20

	JRST	.-1			;We really don't want to continue

ACQL.2:	POPJ	P,			;Return
SUBTTL CHKLIB - Routine to test if library is in place

;CHKLIB	looks for the first page of the OTS library. If this page
;	is there, it is assumed that the library was loaded with the
;	calling program, or has been pre-merged.

;CALL IS:	No arguments
;
;TRUE RETURN:	Library is in place
;
;FALSE RETURN:	Library is not there

CHKLIB:

TOPS10 <
	HRRZ	S1,.JBHRL		;Get highest addr in high seg
	SKIPN	S1			;Is there a segment? Yes, skip
	TDZA	TF,TF			;LOAD "FALSE" INTO TF
	MOVX	TF,TRUE			;ELSE ITS THERE
	POPJ	P,			;RETURN IN EITHER CASE
> ;END TOPS10 CONDITIONAL

TOPS20 <
	MOVE	S1,.JBHSO		;FIRST PAGE OF LIBRARY
	JUMPE	S1,[MOVX TF,FALSE	;If zero, then not set up
		    JRST CHKL.1]	;Return false
	HRLI	S1,.FHSLF		;FOR THIS PROCESS,
	RPACS				;READ THE ACCESS BITS
	  ERJMP .+2			;IF FAILS, SAY OTS NOT THERE
	TXNN	S2,PA%PEX		;CHECK FOR PAGE'S EXISTENCE
	TDZA	TF,TF			;IF PAGES DON'T EXIST, RETURN
	MOVX	TF,TRUE			;ELSE TRUE,INDICATING OTS IN PLACE
CHKL.1:	POPJ	P,			;RETURN
> ;END TOPS20 CONDITIONAL
SUBTTL TRYSEG - Routine to fetch runtime system

;CALL IS:	S1/ Device to get runtime system from in SIXBIT (TOPS10)
;		    Address of device string (TOPS20)
;
;TRUE RETURN:	Segment is in place
;  with		S1/ Address of dispatch table
;FALSE RETURN:	Segment could not be obtained

TOPS10 <

	JS.XO==2000			;EXECUTE-ONLY BIT IN JOB STATUS WORD

TRYSEG:	MOVEM	S1,ARG+0		;STORE DEVICE NAME
	MOVE	S1,[0,,WORK+0]		;BLT THE ACS AWAY
	BLT	S1,WORK+17		;STORE THEM
	MOVX	S1,OTSNAM		;NAME OF OTS
	MOVEM	S1,ARG+1		;STORE THE FILE NAME
	HRROI	S2,.GTSTS		;GET JOB STATUS
	GETTAB	S2,			;FROM THE MONITOR
	  SETZ	S2,			;CAN'T - ASSUME NOT EXECUTE ONLY
	TRNN	S2,JS.XO		;EXECUTE ONLY?
	  TDZA	S2,S2			;NO
	MOVX	S2,UU.PHY		;YES - SET FOR PHYSICAL ONLY GETSEG
	TXO	S2,<GETSEG S1,>		;FORM INSTRUCTION
	MOVEI	S1,ARG			;GET LOCATION OF BLOCK
	XCT	S2			;ATTACH HIGH SEGMENT
	  TDZA	TF,TF			;IF FAILS, FAKE A FALSE
	MOVX	TF,TRUE			;ELSE LOAD A "TRUE"
	MOVE	S1,[WORK+S2,,S2]	;RESTORE SOME ACS
	BLT	S1,17			;
	SKIPN	TF,			;True?
	JRST	TRYS.1			;No, go return

	MOVE	S1,[XWD -2,.GTUPM]	;Get UPM word for our high seg.
	GETTAB	S1,			;Ask the monitor
	  HRLI	S1,.JBHGH		;Monitor won't give it, assume 400000
	HLRZS	S1			;Get high seg start adr
	ADDI	S1,.JBHDA		;Point past JOBDAT

TRYS.1:	POPJ	P,			;RETURN

> ;END TOPS10 CONDITIONAL
TOPS20 <

TRYSEG:	MOVE	TF,S1			;Save device string a second
	MOVX	S1,.FHSLF		;For self
	GEVEC				;Get entry vector word
	PUSH	P,S2			;And save it
	MOVE	S1,TF			;Restore s1

	HRLI	S1,(POINT 7,0)		;Make the address a byte pointer
	MOVE	S2,[POINT 7,WORK]	;Generate a pointer to destination for
					;  string
TRYS.1:	ILDB	TF,S1			;Get a byte of the device string
	JUMPE	TF,TRYS.2		;Done?
	IDPB	TF,S2			;No, save the byte
	JRST	TRYS.1			;Go get another

TRYS.2:	MOVE	S1,[POINT 7,OTSNAM]	;Get the name of the OTS

TRYS.3:	ILDB	TF,S1			;Get a byte of the OTS name
	IDPB	TF,S2			;Save the byte
	JUMPN	TF,TRYS.3		;Get till done

	MOVX	S1,GJ%SHT+GJ%OLD	;SHORT GTJFN, OLD FILE
	MOVE	S2,[POINT 7,WORK]	;Get the pointer to the beginning of
					;  the string
	GTJFN				;TRY TO GET A HANDLE ON THE FILE
	  JRST	TRYS.4			;FAKE A FALSE RETURN
	TXO	S1,GT%ADR		;SET BIT FOR ADDRESS SELECTION
	HRLI	S1,.FHSLF		;FOR MYSELF
	MOVE	S2,[1,,760]		;ALL PAGES FROM 1 TO 760
	GET				;GET THE SEGMENT
	  ERJMP	TRYS.4			;IF GET FAILS, RETURN FALSE

	MOVX	S1,.FHSLF		;For self
	GEVEC				;Get entry vector word for OTS
	HRRZS	S2,S2			;Get only the address
	MOVE	TF,S2			;Save it
	ADR2PG	S2			;Make a page number
	MOVEM	S2,.JBHSO		;Save it for DDT and CHKLIB
	HLLOM	S2,.JBHRL##		;Convince DDT to use the symbols
	POP	P,S2			;Restore entry vector word
	SEVEC				;Set it back
	MOVE	S1,TF			;Get address of dispatch vector
	MOVX	TF,TRUE			;We are ok
	JRST	TRYS.5			;go to return

TRYS.4:	MOVX	TF,FALSE		;HERE FOR FALSE RETURN
	POP	P,S2			;Restore stack
TRYS.5:	POPJ	P,			;AND RETURN
> ;END TOPS20 CONDITIONAL
INI%L:
>  ;End of IFE GLXPURE
	END