Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-05 - 43,50337/16/simrts.mac
There are 2 other files named simrts.mac in the archive. Click here to see a list.
;Edit: 260, 06-Sep-77 16:20/Lars Enderin
.DIRECTIVE SFCOND
	SEARCH	SIMMAC,SIMMCR,SIMRPA

IF1,<
	Q==777
	IFNDEF	QNHGH,<QNHGH=1	;;Default only one high segment
			QHGH==Q>
	IFNDEF	QHGH,<QHGH=Q>
	IFE	QHGH,<QHGH=Q>
>;;END IF1

	SALL
edit(253)
;[253] New hiseg names for version 4
IFG <QHGH-QNHGH>,<RTITLE	SIMR40 - Transfer vector>
IFE <QHGH-1>,<RTITLE	SIMR41 - Transfer vector and swap routine>
IFE <QHGH-2>,<RTITLE	SIMR42 - Transfer vector and swap routine>

X17=17
.JBOPS=135
.JBVER=137

	LOC	.JBOPS
	Z	;Informs OCSP that SIMRTS was loaded

	LOC	.JBVER
	VERRTS
	TWOSEG
	RELOC	400K
	MACINIT

DEFINE	%VERFLD(p,l)<<verrts_<p-^d35>>&<1_l-1>>

	RADIX	10
	VSIMRTS==%VERFLD(11, 9)	;;MAJOR SIMRTS VERSION NUMBER
	VRTUPD== %VERFLD(17, 6)	;;MAJOR SIMRTS EDIT NUMBER
	VRTEDI== %VERFLD(35,18)	;;SIMRTS EDIT LEVEL
	VRTCUS== %VERFLD( 2, 3)	;;CUSTOMER VERSION SIMRTS
	RADIX	8
	PURGE	%VERFLD
	DEFINE	VER(N,MA,MI,ED,WH)<PRINTX	SIMRT'N VERSION MA,MI(ED)-WH>
	IF2,<IFL <QHGH-QNHGH-1>,<VER(\QHGH,\VSIMRT,\VRTUPD,\VRTEDI,\VRTCUS)>
		IFG <QHGH-QNHGH>,<VER(S,\VSIMRT,\VRTUPD,\VRTEDI,\VRTCUS)>
	>
	SUBTTL	SIMRTS transfer vector

.SIMRT=	.
	IF1,<
	DEFINE	X(A,B,C,D)<IFG	<A-400k>,<
		IFN <A-400010-.+.SIMRT>,<CFAIL RTSYM A phase error>
		Q==1
		IFNB <B>,<Q==B>
		Q==Q&QHGH
		IFN	Q,<IFNB	<D>,<
			PORTAL	D'##
			>
			IFB	<D>,<
			PORTAL	.'A'##
			>>
		IFE	Q,<
		PUSHJ	XPDP,.OCSW	;A
			>
	>;;END X>

	DEFINE	Y(NAM,SEG,S,F)<IFDIF	<L>,<SEG>,<
		Q==1
		IFNB <SEG>,<Q==SEG>
		Q==Q&QHGH
		IFN Q,<D%'NAM>
		IFE Q,<E%'NAM>
>>;;END Y

	QRTSNM==SIXBIT/SIMR40/	;Default high segment name	;[253]
	IFE	<QHGH-1>,<QRTSNM=SIXBIT/SIMR42/>	;[253]
	IFE	<QHGH-2>,<QRTSNM=SIXBIT/SIMR41/>	;[253]
	;NOTE!!! THE OTHER name is needed to swap high segments!!!
>;;END IF1
	XALL
	RTSYMBOLS
	SALL
	SUBTTL	.OCSW - swap high segment

	IFG	<QNHGH-1>,<

	EXTERN	.JBREL,.JBHRL,.OCLA
	OPDEF	LEGAL	[PUSHJ XPDP,.OCLA]


Comment;

Purpose:	If the called routine is not in the present high segment,
		.OCSW is called to swap in the other high segment
		and transfer control to the corresponding entry.

Entry:		Called with a PUSHJ	XPDP,.OCSW from the
		transfer vector (or from itself on a return).

Function:	All ac's are saved in YUUOAC(XLOW).
		A GETSEG UUO changes high segment and returns to the
		proper place in the new high segment. Channel 0 must now be 
		restored since it was used by GETSEG and released.
		The proper entry in the current high segment is found
		via XPDP.
		If the call to the transfer vector was a PUSHJ,
		the ultimately called routine must first return to .OCSW
		to swap back the other high segment, then return to caller.
		.OCSW is called to effect this swap.
		Otherwise, if control was passed with a branch,
		the registers are restored and control is relinquished
		to the invoked routine.
;

	OPDEF	LINKBUFF	[PUSHJ XPDP,.OCIND]
	EXTERN	.OCIND

.OCSW::	PROC
	SAVEALLACS(YACSAV)	;;[242]
	HRRZ	X1,-1(XPDP)	;Check next lower element in stack

	IF
		LEGAL
		GOTO	FALSE
	THEN
		STACK	-1(X1)	;Save what should be calling instr
	ELSE
		STACK	[0]
	FI
	LOWADR
	SETZ	X1,
		edit(63)
	IF	;[63] Channel zero is active
		DEVCHR	X1,
		JUMPE	X1,FALSE
	THEN	;Save its status (with -1 in left half)
		GETSTS	X1
		HRROS	X1
	FI	;[63]
	STACK	X1	;[63] or zero
	L	X1,[QRTSNM]
	JSR	@YOCGS(XLOW)	;Get the other hiseg
				EDIT(260)
	PORTAL	.+1		;[260]
					edit(242)
	L	XPDP,YACSAV+XPDP(XLOW)	;[242]
	;Retrieve calling instr from stack top+1
	L	X10,1(XPDP)
	IF	;Channel 0 was active before swap
		L	X1,2(XPDP)	;[63] Old status or zero
		JUMPE	X1,FALSE
		L	X4,YOCBST(XLOW)
		JUMPE	X4,FALSE
	THEN	;Restore it,  OPEN UUO arg's in X1-X3
		HRRZS	X1	;[63] Clear left half of status word
		MOVSI	X2,'TTY'
		HRRI	X3,1(X4)	;Input buffer address
		HRLI	X3,52+1(X4)	;Output buffer address
		OPEN	0,X1
		HALT
		LI	X6,23		;Buffer length
		LI	X7,2		;Number of buffers
		HRRI	X1,-1(X3)	;Input buffer address
		LINKBUFF
		HLRZ	X1,X3
		HRRI	X1,-1(X1)	;Output buffer address
		LINKBUFF
	FI

	UNSTK	X1		;Find address of called entry (in transfer
				;vector or L6)
	SUBI	X1,1
	HRLI	X1,(PUSHJ XPDP,);X1 has expected instruction
			EDIT(41)
	HRRZ	X1	;[41] Destination address
	IF	;This was the instruction
		CAMN	X10,X1	;[41]
		GOTO	TRUE
		CAIE	OCUU	;[41] or OCUU or OCTR was entered
		CAIN	OCTR
		GOTO	TRUE
		GOTO	FALSE
	THEN	;Prepare return to a new swap
		STACK	[L6()]
	FI
	STACK			;[41] Put destination on stack
	MOVSI	X16,YACSAV(XLOW) ;[242] Restore ac's
	BLT	X16,X16
	RETURN

	IFE <QHGH-1>,<
L6():!	EXEC	.OCSW
	POPJ	XPDP,
>
	IFE <QHGH-2>,<
	POPJ	XPDP,
L6():!	EXEC	.OCSW
>
	EPROC
>;;END IFG


	ERRMAC(OC)
.PDERR::OCERR	1,Pushdown list underflow
	EXIT	1,

	END