Trailing-Edge
-
PDP-10 Archives
-
decuslib20-03
-
decus/20-0078/rts/ocsp.mac
There are 2 other files named ocsp.mac in the archive. Click here to see a list.
SUBTTL OCSP - Start a SIMULA program
SUBTTL Lars Enderin /LE/ 11-Oct-1972
X17=17
.JBREN=124
.JBOPS=135
SEARCH SIMMAC,SIMMCR,SIMRPA
SALL
RTITLE OCSP
INTERN OCSPVR
edit(303)
OCSPVR==VERRTS ;[303]
EXTERN .JBFF,.JBOPC,.JBREL,.JBSA
EXTERN .MAIN,.MAINL
LOC .JBOPS
BYTE (6)1(12)VSIMRT(18)0
LOC .JBREN
Z .OCRE0
MACINIT
IF1,<
IFNDEF QNHGH,<;[225]
IFN QDEC20,<QNHGH==1>
IFE QDEC20,<QNHGH==2>
>
IFE QNHGH,<QNHGH==1>
QRTHGH==SIXBIT/SIMR00/+VSIMRT_6
IFE <QNHGH-2>,<QRTHGH==QRTHGH+2>
>
Comment;
.OCSP (start program)
Purpose
-------
To set up the environment for a SIMULA program. Called by a SIMULA
main program at its entry point.
Input conditions
----------------
XCB = outermost program block address. X1 = 0 or address of area
where SIMDDT is (to be) loaded. According to the calling sequence:
JSP XFP,.OCSP
JFCL runswitches address
the address of a file specification string is passed as an inline
parameter following a JSP.
Function
--------
If X1 = 0, load X1 from YOCDDT, which is non-zero if SIMDDT
was loaded at a previous program start or reenter after GET
or LOAD. If X1 was non-zero, save it in YOCDDT for future
use. To guard against any breakpoint UUO's being left
around from a possible call on SIMDDT in the previous
execution, call OCSPDR, which makes sure there are no
breakpoints left. Save all accumulators in dynamic core.
GETSEG SIMRTS, if it was not loaded together with the object
code from the SIMULA compilation. If .OCSP was loaded, but
not SIMRTS, .JBOPS left half will be non-zero as a result of
a direct assignment in the OCSP module. SIMRTS, which must
be loaded after .OCSP, sets .JBOPS to zero at load time. At
load time, define the reentry point (.JBREN) as the address
of the code used to load SIMDDT.
Clear the static area. Initialize lookup and GETSEG info for
SIMDDT and the high segments. Set X2 to the address of
.YXAC (first pseudo ac), X3 = address (.MAINL) of the main
program line number table. When the selected run time
system is safely in core, pass control to .OCIN in SIMRTS by
a JRST instruction. .OCIN will finish the initialization
needed to start a SIMULA program.
Exit conditions
---------------
All registers are saved in YACSAV[0-17](XLOW) as they were
on entry to OCSP. X2 contains the address of the first
pseudo ac location. X3 = .MAINL, the address of the main
program line number table.
X4 = address of .OCGS. The saved X16 value gives the
return to object code after RTS initialization, and the
saved value of X1 indicates where SIMDDT is (to be) loaded,
if it was requested by REENTER or the DEBUG command. The
cell .JBOPS has the address of the low segment STATIC area,
which is to be addressed via the register XLOW designated by
the LOWADR and SETLOW macros. Exit from OCSP is via a
branch to OCIN, which will eventually branch to OCEI, that
returns to object code.
Error exits
-----------
If GETSEG of the high segment fails, return to monitor level
with monitor message Cannot GET SIMR??. If CORE
is scarce, EXIT 1, after ZYQNEC message. If the core limits
can be increased, CONTINUE will cause the core request to be
re-issued.
;
SUBTTL .OCSP - Routine to get the SIMULA RTS high segment
RELOC 0
ENTRY .OCSP ;Main entry from a SIMULA main program to initialize RTS
edit(242)
.OCSP: L X10,XFP ;[242] Save return for OCIN
SKIPN X1
SKIPN X1,YOCDDT
ST X1,YOCDDT ;Save SIMDDT base or zero
JSR OCSPDR ;Reset any breakpoints in code
LI .OCRE1 ;Change reentry point
edit(303)
SKIPE .JBREN ;[303] If it was not set, leave it
ST .JBREN ; undefined
RESET ;Reset all software channels
;and set .JBFF = .JBSA<LH>
HRRZ X17,.JBFF ;Get first free lowseg location
HRRM X17,.JBOPS ;Save as a base for STATIC area
LI X17,YLOW ;Space at least for STATIC area
ADDB X17,.JBFF ;Update .JBFF
ADDI X17,QPOLMI+1000
IF ;Additional core is needed
CAMG X17,.JBREL
GOTO FALSE
THEN ;try to get it
CORE X17,
GOTO RESERR ;Hard luck, must quit
FI
SETLOW ;Standard base reg XLOW
L XLOW,.JBOPS ;Get base of STATIC area and left flags
; - Clear STATIC area -
HRRI X2,YACSAV+21(XLOW)
HRLI X2,-1(X2)
SETZM YACSAV+20(XLOW)
BLT X2,@.JBREL
ST X1,YDSBA1(XLOW) ;[242]
ST XCB,YOCXCB(XLOW) ;[242]
;Initialize GETSEG-LOOKUP info
edit(225)
TOPS10,<;[225]
L [QDEPPN]
ST YDEPPN(XLOW)
L [QHEPPN]
ST YHEPPN(XLOW)
L [QRTPPN]
ST YRTPPN(XLOW)
>
L [QSYSDEV]
ST YOCDEV(XLOW)
edit(277)
IF ;[277] No hiseg or not correct initial hiseg
L [-2,,.GTPRG] ;[277] Get hiseg name
GETTAB
GOTO TRUE ;No hiseg
tops10,<
JUMPE FALSE ;Hiseg from same file as lowseg
> ;tops10
CAMN [QRTHGH]
GOTO FALSE ;Correct hiseg already
HRROI X1,.GTPRG ;Lowseg name
GETTAB X1,
GOTO TRUE
CAMN X1 ;Load if not same as hiseg
GOTO FALSE
THEN ;GETSEG initial hiseg
L X1,[QRTHGH]
ST X1,YRTHGH(XLOW)
ST X10,YACSAV+X10(XLOW) ;[242]
JSR .OCGS
L X10,YACSAV+X10(XLOW) ;[242]
ELSE ;[277] May have to use SETUWP to avoid store traps
edit(277)
LI X2,.MAIN
IF ;Main prog in hiseg
CAIG X2,400K
GOTO FALSE
THEN ;Remove write protection
SETZ X2,
SETUWP X2,
CAI ;Ignore error ret (take a chance)
FI FI
HRRZS XLOW,.JBOPS ;[242] Clear .JBOPS<LH> to show hiseg loaded
LI X2,.YXAC ;First pseudo ac location
LI X3,.MAINL ;Line number table for SIMDDT
LI X4,.OCGS
IFN QDEBUG,<
OCINIT::
>
BRANCH OCIN ;Do rest of initialization
RESERR: CLEARO
OUTSTR [ASCIZ/
?ZYQNCA No core available - can not proceed
/]
EXIT 1,
GOTO .OCSP ;Try again if CONTINUE command given
SUBTTL OCGS - Get a high segment; [1C]
Comment;
Purpose: To GETSEG a high segment initially or at segment swap
Entry conditions:
X1 = SIXBIT name of wanted hiseg. Standard XLOW loaded.
Call: By JSR .OCGS or JSR @YOCGS(XLOW)
Function: Prevent REENTER by changing .JBREN.
Clear any previously loaded hiseg by CORE.
Try to GETSEG the high segment from YOCDEV(XLOW) with ppn=0.
If that fails, try same device with ppn=YOCPPN(XLOW).
On failure, the monitor gives an error message because of
the HALT placed after the last GETSEG.
Exit: To saved return address with new high segment loaded.
Error exit: To monitor on final GETSEG failure.
;
SETLOW ;Use standard XLOW
.OCGS:: BEGIN
Z ;Call by JSR
ST X1,YOCHNM(XLOW) ;Hiseg name
LI .OCRE1 ;Save and change .JBREN
EXCH .JBREN
ST YOCREN(XLOW)
MOVSI X1,1 ;Set flag to clear any previously loaded hiseg
CORE X1,
NOP ;Ignore errors
SETZM YOCPPN(XLOW) ;Try own area or sys first
LI X1,YOCGSB(XLOW)
GETSEG X1, ;Get the high segment
SKIPA
GOTO L9 ;Found first time
LOWADR
L X1,YRTPPN(XLOW);Try standard ppn if not found on own area
ST X1,YOCPPN(XLOW)
LI X1,YOCGSB(XLOW)
GETSEG X1,
HALT ;Give up, cannot find requested hiseg
L9():! LOWADR
L YOCREN(XLOW) ;Restore .JBREN
EXCH .JBREN
BRANCH @.OCGS
ENDD