Trailing-Edge
-
PDP-10 Archives
-
BB-H138B-BM
-
language-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 Irwin L. Goverman/ILG/PJT/DC 2-Jul-79
;
;
; COPYRIGHT (c) 1975,1976,1977,1978,1979
; DIGITAL EQUIPMENT CORPORATION
;
; 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)
INIEDT==7 ;EDIT LEVEL FOR MODULE
SUBTTL Table of Contents
; TABLE OF CONTENTS FOR GLXINI
;
;
; SECTION PAGE
; 1. Table of Contents......................................... 2
; 2. Revision History.......................................... 3
; 3. Global Storage............................................ 4
; 4. Local Definitions......................................... 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........... 8
; 8. TRYSEG - Routine to fetch runtime system.................. 9
SUBTTL Revision History
COMMENT \
Revision History
EDIT GCO DISCRIPTION
0002 Changed I%INIT so it can accept a zero length IB and
to pass the major change level in S2 instead of IB.PID
0004 Changed PROLOG to process GLXINI as a library component
0005 Pull PFH out of GLXINI. It now lives in the sharable
high segment
0006 using stkvars to provide space for string for gtjfn
change tryseg to get the entire exe file instead of
certain pages
0007 Define %%.GLX external to pick it up from the main program
\ ;end of revision history
SUBTTL Local Definitions
SYSPRM PSOUT,<TTCALL 3,0(S1)> ;TOPS-10 STRING OUTPUT
SYSPRM HALTF,<EXIT 1,> ;EXIT
OTSLEN==^D20 ;LENGTH OF OTS BUFFER ON THE -20
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: JFCL .+1 ;ACCEPT NEW STYLE $CALL ENTRY
PUSH P,S1 ;SAVE INPUT ARGS AWAY
PUSH P,S2 ;
PUSHJ P,ACQLIB ;ACQUIRE THE LIBRARY SYSTEM
POP P,S2 ;RESTORE ARGUMENTS
POP P,S1 ;
HRLI S2,%%.GLX## ;LOAD MAJOR CHANGE LEVEL
SEGIN:
TOPS20<
PUSHJ P,I%INI1 ;CONTINUE INITIALIZATION
>;END TOPS20
TOPS10<
MOVE T1,[XWD -2,.GTUPM] ;Get UPM word for our high seg
GETTAB T1, ;Ask the monitor
HRLI T1,CORG ;Monitor won't give it, assume 400000
HLRZS T1 ;Get high seg start adr
PUSHJ P,I%INI1-CORG(T1) ;Fire up the library, wherever it is
>;END TOPS10
$RETT ;RETURN TO CALLER
SUBTTL ACQLIB - Acquire the run-time system
;If the OTS segment is not in place, we must go out and find it
;CALL IS: No arguments
;
;TRUE RETURN: Always, since everthing else is fatal
ACQLIB: PUSHJ P,CHKLIB ;SEE IF LIBRARY "PRE-LOADED"
JUMPT .RETT ;IF THERE, DON'T GET IT NOW
TOPS10 <
SKIPN DEBUGW ;CHECK IF WE ARE DEBUGGING...
JRST ACQL.0 ;IF NOT,,LOAD THE LIBRARY FROM SYS.
SETOM S1 ;WE WANT FIRST STRUCTURE IN SEARCH LIST.
MOVE S2,[1,,1] ;SET UP JOBSTR PARMS.
JOBSTR S2, ;GET STRUCTURE.
JRST ACQL.0 ;FAILED,,TRY SYS.
SETZM S2 ;SET UP PARM FOR TRYSEG.
PUSHJ P,TRYSEG ;TRY TO LOAD THE LIBRARY
JUMPT ACQL.3 ;IF SUCCESSFULL,, RETURN.
ACQL.0: HRROI S1,.GTRDV ;GET RUN DEVICE
GETTAB S1, ;
SETZ S1, ;IF FAILS, CLEAR IT
JUMPE S1,ACQL.1 ;IF NO NAME OR FAILED, TRY OTHER PLACES
HRROI S2,.GTRDI ;AND DIRECTORY
GETTAB S2, ;
SETZ S2, ;IF GETTAB FAILS, ZERO RESULT
JUMPE S2,ACQL.1 ;IF FAILS, OR ZERO, TRY OTHER PLACES
PUSHJ P,TRYSEG ;TRY TO GET HIGH SEGMENT
JUMPT ACQL.3 ;IF IT WORKS, RETURN
ACQL.1: DMOVE S1,[EXP SIXBIT/DSK/,0] ;TRY DSK:
PUSHJ P,TRYSEG ;
JUMPT ACQL.3 ;IF IT WORKS,RETURN NOW
ACQL.2: DMOVE S1,[EXP SIXBIT/SYS/,0] ;TRY TO GET IT FROM SYS:
PUSHJ P,TRYSEG ;
JUMPT ACQL.3 ;IF IT WORKED, WE ARE SET
OUTSTR [ASCIZ \? GLXINI - Unable to obtain run-time system
\]
EXIT 1, ;GIVE A STOP
JRST .-1 ;DONT CONTINUE
ACQL.3: PUSHJ P,MRGDAT ;And get the data space for it too!
POPJ P,
> ;END TOPS10 CONDITIONAL
TOPS20 <
MOVE S1,[OTSLEN,,OTSLEN] ;ALLOCATE
ADD P,S1 ; OTSLEN WORDS
PUSH P,[EXP [MOVE S1,[OTSLEN,,OTSLEN] ; ON THE
SUB P,S1 ; STACK AND
POPJ P, ]] ; RELEASE THEM WHEN DONE
MOVX S1,.FHSLF ;FOR MYSELF,
GEVEC ;GET THE ENTRY VECTOR WORD
PUSH P,S2 ;AND SAVE IT
PUSH P,T1 ;ALSO USE T1 IN JFNS BELOW
MOVEI S1,. ;get THIS ADDRESS
ADR2PG S1 ;CONVERT TO A PAGE NUMBER
ACQL.1: HRLI S1,.FHSLF ;FOR THIS PROCESS, THIS PAGE
RMAP ;OBTAIN THE FILE HANDLE
HLRZ S2,S1 ;GET JFN ISOLATED
ANDI S1,-1 ;GET PAGE NUMBER ISOLATED
CAXN S2,.FHSLF ;IF PAGE IS NOT MAPPED,
SOJGE S1,ACQL.1 ;TRY NEXT LOWER PAGE
JUMPL S1,ACQL.2 ;IF NO PAGES MAPPED, GIVE UP
HRROI S1,-OTSLEN(P) ;POINT TO BUFFER TO CREATE INTO
MOVX T1,<INSVL.(.JSAOF,JS%DEV)+INSVL.(.JSAOF,JS%DIR)+JS%PAF>
JFNS ;CREATE DEV:<DIRECTORY> STRING
ERJMP ACQL.2 ;IF CANNOT CREATE STRING, TRY CURRENT DIR.
HRROI S2,-OTSLEN(P) ;GET PTR TO THE START OF THE FILE BUFFER
PUSHJ P,TRYSEG ;TRY TO GET THE OTS THERE
JUMPT ACQL.3 ;DID IT WORK?
ACQL.2: MOVEI S1,-OTSLEN(P) ;POINT TO THE DEV:<DIRECTORY> STRING
TLO S1,(POINT 7,0) ;GEN A BYTE POINTER TO IT
HRROI S2,-OTSLEN(P) ;GET PTR TO THE START OF THE FILE BUFFER
PUSHJ P,TRYSEG ;LOOK UP THE SEGMENT
JUMPT ACQL.3 ;FOUND IN CURRENT DIRECTORY
MOVE S1,[ASCIZ .SYS:.] ;NEXT TRY "SYS"
MOVEM S1,-OTSLEN(P)
MOVEI S1,-OTSLEN(P) ;POINT TO THE DEV:<DIRECTORY> STRING
TLO S1,(POINT 7,0,27) ;GEN A BYTE POINTER TO IT
HRROI S2,-OTSLEN(P) ;GET PTR TO THE START OF THE FILE BUFFER
PUSHJ P,TRYSEG ;TRY TO GET SYS:LIBRARY
JUMPT ACQL.3 ;THATS THE LAST PLACE WE LOOK
HRROI S1,[ASCIZ \? GLXINI - Unable to obtain run-time system
\]
PSOUT
HALTF
JRST .-1 ;DO NOT CONTINUE
ACQL.3: POP P,T1 ;RESTORE CALLERS T1
POP P,S2 ;RESTORE ENTRY VECTOR WORD
MOVX S1,.FHSLF ;FOR OURSELF, IT WAS DESTROYED
SEVEC ;BY THE "GET" ON THE LIBRARY
HLLOS 115 ;TELL DDT THAT SYMBOLS ARE THERE
$RETT ;THEN TAKE SUCCESSFUL RETURN
> ;END TOPS20 CONDITIONAL
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 <
MOVX S1,CORG/PAGSIZ ;FIRST PAGE OF LIBRARY
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
POPJ P, ;RETURN
> ;END TOPS10 CONDITIONAL
SUBTTL TRYSEG - Routine to fetch runtime system
;CALL IS: S1/ Device to get runtime system from
; S2/ Directory to get runtime system from
;TRUE RETURN: Segment is in place
;FALSE RETURN: Segment could not be obtained
TOPS10 <
TRYSEG: MOVEM S1,RUNB+0 ;STORE DEVICE
MOVEM S2,RUNB+4 ; AND DIRECTORY
MOVE S1,[0,,RUNAC+0] ;BLT THE ACS AWAY
BLT S1,RUNAC+17 ;STORE THEM
MOVX S1,OTSNAM ;NAME OF OTS
MOVEM S1,RUNB+1 ;STORE THE FILE NAME
SETZM RUNB+2 ;CLEAR EXT
SETZM RUNB+3 ;AND OTHER STUFF
SETZM RUNB+5
MOVEI S1,RUNB ;GET LOCATION OF BLOCK
GETSEG S1,
TDZA TF,TF ;IF FAILS, FAKE A FALSE
MOVX TF,TRUE ;ELSE LOAD A "TRUE"
MOVE S1,[RUNAC+S2,,S2] ;RESTORE SOME ACS
BLT S1,17 ;
POPJ P, ;RETURN IT
RUNB: BLOCK 6 ;GETSEG BLOCK
RUNAC: BLOCK 20 ;ACS
;On the -10, MRGDAT finishes up the GET of the library space.
MRGDAT: MOVE 0,[XWD 0,RUNAC+0] ;Make a BLT ptr
BLT 0,RUNAC+17 ;Dump the ACs
MOVEI S1,RUNB ;Aim at arg block that succeeded
MERGE. S1, ;Slurp in the dirty pages
$STOP (MUF,MERGE. UUO Failed)
MOVE S1,[RUNAC+S2,,S2] ;RESTORE SOME ACS
BLT S1,17 ;
POPJ P, ;RETURN IT
> ;END TOPS10 CONDITIONAL
;CALL IS: S1/ Byte pointer to store OTS name
; S2/ The DEV:<DIRECTORY>FILE-NAME string address
;
;TRUE RETURN: Segment is in place
;FALSE RETURN: Segment could not be obtained
TOPS20 <
TRYSEG: MOVE T1,S1 ;GET THE OUTPUT BYTE POINTER IN T1
MOVE TF,S2 ;SAVE THE POINTER TO THE FILE BUFFER
MOVE S2,[POINT 7,OTSNAM] ;GET POINTER TO LIBRARY NAME
TRYS.1: ILDB S1,S2 ;GET A BYTE OF OTS NAME
IDPB S1,T1 ;STORE IT INTO NAME
JUMPN S1,TRYS.1 ;REPEAT TILL NAME IS DONE
MOVX S1,GJ%SHT+GJ%OLD ;SHORT GTJFN, OLD FILE
MOVE S2,TF ;RESTORE THE PTR TO THE FILE NAME
GTJFN ;TRY TO GET A HANDLE ON THE FILE
JRST TRYS.2 ;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.2 ;IF GET FAILS, RETURN FALSE
MOVX TF,TRUE ;IF GET WORKS, GIVE A
SKIPA ;GOOD RETURN
TRYS.2: MOVX TF,FALSE ;HERE FOR FALSE RETURN
POPJ P, ;AND RETURN
> ;END TOPS20 CONDITIONAL
INI%L:
END