perm filename FUNCT.FAI[NEW,AIL] blob sn#408286 filedate 1979-01-08 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	TITLE FUNCT.  SAIL "OBJECT TIME SYSTEM" INTERFACE
C00005 ENDMK
C⊗;
TITLE FUNCT.  SAIL "OBJECT TIME SYSTEM" INTERFACE
ENTRY FUNCT.
EXTERNAL CORGET,CORREL,GETCHAN,RELEASE,JOBHRL,GOGTAB,CHANS,INIACS
F.CBC←←12
P←←17
TEMP←←14
A←←1
USER←←15

	TWOSEG
	RELOC	400000
FUNCT.:	MOVE	TEMP,-1(P)	;POINTER TO ARGLIST
	MOVE	A,@(TEMP)	;FUNCTION CODE
	CAIL	A,0
	CAILE	A,F.CBC
	SETZ	A,
	JRST	@.+1(A)
	.ILL
	.GAD
	.COR
	.RAD
	.GCH
	.RCH
	.GOT
	.RAD		;.ROT SAME AS .RAD
	.RNT
	.IFS
	.CBC

DEFINE ERRCOD<@1(TEMP)>
DEFINE STATUS<@2(TEMP)>
DEFINE ARG1  <@3(TEMP)>
DEFINE ARG2  <@4(TEMP)>
DEFINE ARG3  <@5(TEMP)>

.ILL:	MOVNI	A,1
	JRST	DONE

.GAD:	MOVE	A,ARG1		;BASE ADDRESS
	CAILE	A,400000
	 JRST	[ADD	A,ARG2	;GET LWA(LAST WORD ADDRESS)+1
		CAILE	A,777777
		 JRST	[MOVEI	A,3
			JRST	DONE]
		HRRZ	TEMP,JOBHRL	;CURRENT LEGAL MAX
		CAIGE	A,(TEMP)
		 MOVEI	A,(TEMP)	;NEVER DECREASE
		MOVSI	A,(A)		;INTO LEFT HALF
		CORE	A,
		 JRST	[MOVEI	A,1
			JRST	DONE]
		JRST	ZSTAT]
	MOVEI	A,2		;NO CAN DO OTHERWISE
	JRST	DONE

.COR:	MOVE	3,ARG2		;SIZE
	PUSHJ	P,CORGET
	 SKIPA	A,[1]		;FAILURE
	SETZ	A,		;SUCCESS
	MOVE	TEMP,-1(P)
	MOVEM	2,ARG1		;STORE ADDRESS
	JRST	DONE

.RAD:	MOVE	2,ARG1		;ADDRESS
	CAIGE	2,400000	;DON'T GIVE BACK HIGHSEG STUFF
	 PUSHJ	P,CORREL
	JRST	ZSTAT

.GCH:	PUSHJ	P,GETCHAN
	MOVE	TEMP,-1(P)
	MOVEM	A,ARG1
	JUMPGE	A,.+3
	MOVEI	A,1		;NO CAN DO
	JRST	DONE
	MOVE	USER,GOGTAB
	ADD	USER,[XWD A,CHANS]
	SETOM	@USER		;MAKE SURE SAIL DOESN'T PULL THE RUG OUT
	JRST	ZSTAT		;ALL'S WELL

.RCH:	PUSH	P,ARG1
	PUSH	P,[0]
	PUSHJ	P,RELEASE
	JRST	ZSTAT

.GOT:	MOVEI	A,2		;NO CAN DO
	JRST	DONE

.RNT:	SETZ	A,
	RUNTIM	A,
	MOVEM	A,ARG1
	JRST	ZSTAT

.IFS:	MOVE	A,INIACS+11	;DEVICE
	MOVEM	A,ARG1
	MOVE	A,INIACS+0	;FILE
	MOVEM	A,ARG2
	MOVE	A,INIACS+7	;PPN
	MOVEM	A,ARG3

ZSTAT:
.CBC:	SETZ	A,

DONE:	MOVE	TEMP,-1(P)
	MOVEM	A,STATUS
	SUB	P,[XWD 2,2]
	JRST	@2(P)
	END