	.TITLE	.DA	GET ARGS FOR INTRINSIC FUNCS.
/
/COPYRIGHT (C) 1975
/DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
	.EJECT
/ ASSEMBLE WITH %PDP9=0 FOR PDP9 ONLY CODE
/ ASSEMBLE WITH %VB5=0 FOR ADSS SYSTEMS
/EDIT 011  11-8-71
/	EDIT 012 21-FEB-75	R.K. HYATT	REMOVED BANK/PAGE DEPENDENT CODE
/ EDIT 013	20-AUG-75	M. HEBENSTREIT	DISCLAIMER
/
/ MACRO DEFN'S
/
	.DEFIN	ADDAC	NUM
	.IFDEF	%PDP9
	TAD	( NUM
	.ENDC
	.IFUND	%PDP9
	AAC	NUM
	.ENDC
	.ENDM
	.DEFIN	INCAC
	.IFDEF	%PDP9
	TAD	(1
	.ENDC
	.IFUND	%PDP9
	IAC
	.ENDC
	.ENDM
	.DEFIN	TCAADD	ARG
	.IFDEF	%PDP9
	CMA
	ADDAC	ARG
	.ENDC
	.IFUND	%PDP9
	TCA
	IAC
	.ENDC
	.ENDM

/FOR RSX SYSTEM,DEFINE RSX
/WITH RSX,CALLER DETERMINES NUM OF ARGS TO PASS IF ITS ARG STRING

/IS LESS THAN OR EQUAL TO THAT OF THE CALLEE!!!!!!  IF GREATER THAN

/STRING OF CALLEE,OF COURSE CALLEE SHUTS DOWN ARG PASSING. 

	.IFDEF RSX
	.GLOBL .DAA

	.ENDC

       .GLOBL .DA

/             CALLING SEQUENCE

/FNTN  CAL    0               FWA-1 OF LIST OF ARGUMENT ADDRESSES

/      JMS*   (.DA)           SUBR CALL

/      JMP    .+(N+1)         SUBR RETURN

/      CAL    0               STORAGE FOR ADDR OF ARG(1)

/      CAL    0                        .          ARG(2)

/       .     .                        .            .

/       .     .                        .            .

/      CAL    0                        .          ARG(N)

/

	.IFDEF RSX
.DAA=.
	.ENDC
.DA    CAL    0              /ENTRY-EXIT
	LAC	.DA		/PICK UP POINTER TO CALLEE
	INCAC		/FORM TOPTR
	DAC	TOPTR
	ADDAC	-3		/FORM POINTER TO CALLER
	DAC	CALLER
	ADDAC	2		//READJUST AND FORM LOW 12 BITS
	AND	(7777		/OF BASE
	DAC	NUMEE		/TEMP STORE
	LAC*	.DA		/GET CALLEE'S JMP INSTRUCTION
	AND	(7777		// FORM BASE+N+1
	TCAADD	2		/TWO'S COMPILMENT AND SUB 1
	TAD	NUMEE		/NO HAVE -N MOD 4096
	SMA			/CHECK TO SEE IF ARG LIST CROSSES PAGE BOUNDRY
	TAD	(770000		/YES WE DO - SO ADD -4096
	DAC	NUMEE
	LAC*	CALLER		/FORM -FROM- POINTER
	.IFDEF	RSX
	DAC	CALLER		/KEEP POINTER FOR LATER
	.ENDC
	INCAC			/FORM FROM POINTER
	DAC	FRMPTR		/FORM FROM POINTER
	.IFDEF	RSX
/ COMPUTE CALLER'S ARG COUNT
	ADDAC	-1		/ADJUST POINTER BACK TO CALLER'S JMP INST.
	AND	(7777		/LOW 12 BITS FORMS BASE
	DAC	NUMER		/TEMP STORE
	LAC*	CALLER		/GET JMP INST. TO FORM OFFSET
	AND	(7777		/NOW HAVE BASE+N+1 MOD 4096
	TCAADD	2		/TWO'S COMPLIMENT AND SUB 1
	TAD	NUMER		/NOW HAVE -N MOD 4096
	SMA			/DO WE CROSS A PAGE BOUNDARY
	TAD	(770000		/YES - ADD -4096
	DAC	NUMER		/NO SO JUST STORE IT
	TCA
	TAD	NUMEE		/DETERMINE WHO SHUTS DOWN ARG TRANSFER
	SMA			/IF <0 THEN CALLER SHUTS DOWN
	JMP	GARG02		/JUST GO AND DO IT
	LAC	NUMER		/CALLER SHUTS IT DOWN
	DAC	NUMEE		/SO CHANGE AGR COUNTS
	.ENDC
/
/ MAIN LOOP FOR PASSING ARG ADDR'S
/
GARG02	LAC	TOPTR		/SEE IF INDIRECT ON STORE
	DAC	TOTMP
	LAC*	TOTMP
	SPA			/ TEST FOR INDIRECT
	DAC	TOTMP		/ STORE INDIRECT POINTER
	LAC*	FRMPTR		/CHECK FOR INDIRECT ON -FROM- POINTER
	SMA
	JMP	GARG03		/NOOP
	DAC	FRMTMP		/YEEP DO A TEMP STORE
	LAC*	FRMTMP		/AND FETCH ADDR
	.IFUND	%V5B
GARG03	DAC*	TOTMP		/STORE ARG ADDR
	.ENDC
	.IFDEF	%V5B
GARG03	AND	(477777		/AND OFF MODE BITS IN CASE FPP
	DAC*	TOTMP		/STORE AGR ADDR
	.ENDC
	ISZ	TOPTR		/ BUMP -TO- POINTER
	ISZ	FRMPTR		/ BUMP -FROM- POINTER
	ISZ	NUMEE		/ BUMP COUNT AND CHECK FOR SHUT DOWN
	JMP	GARG02		/STILL MORE ARGS
	JMP*	.DA		/EXIT
/
/ STORAGE AREA
/
TOPTR	.DSA	0		/ -TO- POINTER
FRMPTR	.DSA	0		/ -FROM- POINTER
TOTMP	.DSA	0		/ TEMPORARY FOR -TO- POINTER
FRMTMP	.DSA	0		/ TEMPORARY FOR -FROM- POINTER
NUMEE	.DSA	0 	/ CALLEE'S AGR COUNT
NUMER	.DSA	0		/ CALLER'S ARG COUNT
CALLER	.DSA	0		/POINTER TO CALLER
	.END
	
