
/
/COPYRIGHT 1969, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
	.IFUND	%NDOUB
	.TITLE DOUBLE
/DOUBLE PRECISION FLOATING POINT PACKAGE
/
/
/
/
/	DLAC		LOAD
/	DDAC		STORE
/	DFAD		ADD
/	DSUB		SUBTRACT
/	DDVD		DIVIDE
/	DMPY		MULTIPLY
/	DDVR		REVERSE DIVIDE
/	DSBR		REVERSE SUBTRACT
/
/
/
/REQUIRED PROGRAMS: FPOINT- GENERAL FLOATING POINT ARITHMETIC
/
/
/
/
/--------------------
/
/DOUBLE PRECISION FLOATING POINT LOAD (DLAC)
/CALLING SEQUENCE:
/
/	JMS	DLAC	/SUBR CALL (XCT IF INDIRECT).
/	XCT	ADDR	/ADDRESS OF DOUBLE PRECISION
/	NEXT INSTRUCTION	/RETURN ARO IN FLT ACC
/
/
DLAC	0
	JMS	%FG.		/GET ADDRESS OF ARGUMENT
%DP1	0			/ARGUMENT ADDRESS
	LAC*	%DP1		/FIRST WORD
	DAC	%FAC1		/EXPONENT
	ISZ	%DP1		/POINT TO SECOND WORD
	LAC*	%DP1
	AND	(377777
	DAC	%FAC2
	LAC*	%DP1
	AND	(400000
	DAC	%J4
	ISZ	%DP1
	LAC*	%DP1		/LOW-ORDER MANTISSA
	DAC	%FAC3
	LAC	%FAC2
	TAD	%J4
	DAC	%FAC2
	JMP*	DLAC
/
/--------------------
/
/DOUBLE PRECISION FLOATING STORE	(DDAC)
/CALLING SEQUENCE:
/
/	JMS	DDAC	/SUBR CALL(VALUE IN FLOATING ACC)
/	XCT	ADDR	/ADDR OF ARG (XCT IF INDIRECT)
/	NEXT INSTRUCTION	/SUBR RETURN (VALUE IN ARG AND FLOATING ACC)
/
/
DDAC	0
	JMS	%FG.		/GET ADDRESS
%DP2	0
	LAC	%FAC1		/EXPONENT
	DAC*	%DP2
	ISZ	%DP2
	LAC	%FAC2		/2ND WORD
	DAC*	%DP2
	ISZ	%DP2		/3RD WORD
	LAC	%FAC3
	DAC*	%DP2
	JMP*	DDAC
/
/--------------------
/
/DOUBLE PRECISION FLOATING POINT SUBTRACT (DSUB)
/CALLING SEQUENCE:
/
/	JMS	DSUB	/MINUEND IN FLOATING ACC
/	XCT	ADDR	/ADDR OF SUBTRAHEND (XCT IF INDIRECT)
/	NEXT INSTRUCTION	/SUBR RETURN (DIFFERENCE IN FLOATING AC)
/
/
/
DSUB	0
	JMS	%FG.		/GET ADDRESS OF SUBTRAHEND
%DP3	0			/STORED ADDRESS OF SUBTRAHEND
	JMS	%FNEG.		/NEGATE MINUEND (SUBTRAHEND-MINUED)
	JMS	DFAD		/DOUBLE PRECISION ADD
	XCT	%DP3		/INDIRECT ADDRESS (XCT) OF ARG
	JMS	%FNEG.		/NEGATE RESULT (MINUEND-SUBTAHEND)
	JMP*	DSUB		/EXIT
/
/--------------------
/
/DOUBLE PECISION FLOATING POINT MULTIPLY (DMPY)
/CALLING SEQUENCE:
/
/	JMS	DMPY	/SUBR CALL (MULTIPLICAND IN FLATING ACC)
/	XCT	ADDR	/ADDR OF MULTIPLIER (XCT IF INDIRECT)
/	NEXT INSTRUCTION	/SUBR RETURN (PRODUCT IN FLOATING ACC)
/
DMPY	0
	JMS	%FG.		/GET ADDRESS OF MULTIPLIER AND
%DP4	0			/STORE HERE
	JMS	%FH.		/HOLD FLOATING ACC.
	JMS	DLAC
	.DSA	%DP4+400000	/MULTIPLIER
	JMS	%FM.		/GENERAL MULTIPLY
	JMS	%FIR.		/ROUND AND SIGN
		1		/ROUND OFF BIT
		777776		/MASK
	JMP*	DMPY		/EXIT
/
/--------------------
/
/DOUBLE PRECISION FLOATING POINT REVERSE DIVIDE (DDVR)
/CALLING SEQUENCE:
/
/	JMS	DDVR		/SUBR CALL (DIVISOR IN FLT ACC)
/	XCT	ADDR		/ADDRESS OF DIVIDEND
/	NEXT	INSTRUCTION	/RETURN (QUOTIENT) IN FLOATING ACCUMULATOR)
/
DDVR	0
	JMS	%FG.		/GET ADDRESS OF DIVIDEND
%DP5	0
	JMS	DDAC		/STORE DOUBLE
	.DSA	%J1
	JMS	DLAC		/LOAD DOUBLE
	.DSA	%DP5+400000	/DIVIDEND
	JMS	DDVD		/DIVIDE
	.DSA	%J1
	JMP*	DDVR		/EXIT
/
/--------------------
/
/DOUBLE PRECISHON FLOATING POINT DIVIDE (DDVD)
/CALLING SEQUENCE:
/
/	JMS	DDVD	/SUBR CALL (DIVIDEND IN FLOATING ACC)
/	XCT	ADDR	/XCT IF INDIRECT (ADDR OF DOUBLE PRECISION DIVISOR)
/	NEXT INSTRUCTION	/RETURN (QUOTIENT IN FLOATING ACC)
/
DDVD	0
	JMS	%FG.		/GET ADDRESS OF ARGUMENT
%DP6	0			/ADDRESS OF DIVISOR
	JMS	%FH.		/HOLD DIVIDEND
	JMS	DLAC
	.DSA	%DP6+400000
	JMS	%FD.		/GENERAL FLOATING DIVIDE
		-44		/36 BIT AUOTIENT
		1		/LEAST SIGNIFICANT QUOTIENT BIT
	JMS	%FIR.		/ROUND AND INSERT SIGN
		1		/ROUND OFF BIT
		777776		/MASK
	JMP*	DDVD		/EXIT
/
/--------------------
/
/DOUBLE PRECISION FLOATING POINT REVERSE SUBTRACT (DSBR)
/CALLING SEQUENCE:
/
/	JMS	DSBR	/SUBTRAHEND IN FLOATING ACC.
/	XCT	ADDR	/ADDRESS OF MINUEND
/	NEXT INSTRUCTION	/DIFFERENCE IN FLOATING ACC.
/
DSBR	0
	JMS	%FG.
%DP7	0
	JMS	%FNEG.		/NEGATE SUBTRAHEND
	JMS	DFAD		/ADD DOUBLE
	.DSA	%DP7+400000	/MINUEND-SUBTRAHEND
	JMP*	DSBR
/
/--------------------
/
/DOUBLE PRECISION FLOATING POINT ADD (DFAD)
/CALLING SEQUENCE:
/
/	JMS	DFAD	/AUGEND IN FLOATING ACC
/	.DSA	ADDR+400000	/XCT IF INDIRECT
/	NEXT INSTRUCTION	/SUBR RETURN (SUM IN FLOATING ACC)
/
DFAD	0
	JMS	%FG.		/GET ADDRESS OF ADDEND
%DP9	0			/STORE ADDRESS
	JMS	%FH.		/HOLD FLOATING ACC
	JMS	DLAC
	.DSA	%DP9+400000
	JMS	%FA.		/GENERAL FLOATING ADD
		42		/MAX SHIFT
	JMS	%FIR.		/ROUND AND SIGN
		1		/LEAST SIGNIFICANT BIT
		777776		/MASK
	JMP*	DFAD
	.ENDC
/
/
/--------------------
/
/
	.IFUND	%NSING
	.TITLE SINGLE
/SINGLE PRECISION FLOATING POINT PACKAGE
/
/
/				SINGLE PRECISION
/
/
/	FLAC			LOAD
/	FDAC			DEPOSIT
/	FAD			ADD
/	FSUB			SUBTRACT
/	FMPY			MULTIPLY
/	FDVD			DIVIDE
/	FSBR			REVERSE SUBTRACT
/	FDVR			REVERSE DIVIDE
/
/
/
/REQUIRED PROGRAMS: FPOINT(GENERAL FLOATING ARITHMETIC)
/
/TERMS:	1. A-REG PDP-15 HARDWARE ACCUMULATOR
/	2. FLT ACC FLOATING ACCUMULATOR (%FAC1,%FAC,%FAC3)
/	3. HELD ACC HELD ACCUMULATOR (%HAC1, %HAC2,%HAC3)
/
/
/--------------------
/
/FLOATING POINT LOAD (FLAC)
/CALLING SEQUENCE:
/	JMS	FLAC		/SUBR CALL
/	.DSA	ADDR+400000	/ADDR OF S.P. FLOATING POINT NUMBER
/	NEXT INSTRUCTION		/SUBR RETURN
/
/
FLAC	0
	JMS	%FG.	/GET ADDRESS
%SP1	0		/(ADDRESS OF SINGLE PRECISION WORD)
	LAC*	%SP1	/HIGH-ORDER WORD AND SPLIT
	AND	(777000	/GET LOW-ORDER MANTISSA
	DAC	%FAC3
	LAC*	%SP1	/SPLIT AGAIN
	AND	(000777	/GET EXPONENT
	XOR	(000400	/EXTEND SIGN BIT TO FILL OUT EXPONENT WORD.
	TAD	(777400
	DAC	%FAC1
	ISZ	%SP1	/BUMP TO SECOND WORD
	LAC*	%SP1
	AND	(377777
	DAC	%FAC2
	LAC*	%SP1
	AND	(400000
	DAC	%J4
	LAC	%FAC2
	TAD	%J4
	DAC	%FAC2
	JMP*	FLAC	/EXIT
/
/--------------------
/
/FLOATING POINT STORE
/CALLING SEQUENCE:
/	JMS	FDAC		/SUBR CALL
/	XCT	ADDR		/ADDR+400000(IF INDIRECT)
/	NEXT INSTRUCTION			/RETURN
/
/
FDAC	0
	JMS	%FG.	/GET ADDRESS
%SP2	0		/(ADDRESS OF SINGLE PRECISION WORD)
	LAC	%FAC1	/GET EXPONENT
	AND	(000777	/STRIP OFF LEFT HALF
	DAC*	%SP2	/STORE  EXPONENT
	LAC	%FAC3	/GET LOW-ORDER MANTISSA
	AND	(777000	/STRIP OF RIGHT HALF
	TAD*	%SP2	/MERGE WITH EXPONENT
	DAC*	%SP2	/STORE COMPLETED WORD
	ISZ	%SP2	/POINT TO NEXT RECEIVING ARDA.
	LAC	%FAC2	/HIGH-ORDER MANTISSA
	DAC*	%SP2	/STORE IT
	JMP*	FDAC	/EXIT
/
/--------------------
/
/FLOATING POINT ADD			(FAD)
/CALLING SEQUENCE:
/	JMS	FAD		/SUBR CALL
/	XCT	ADDR		/(XCT IF INDIRECT)
/	NEXT INSTRUCTION		/RETURN HERE
/
/THIS SUBROUTINE DOES THE SET-UP WORK FOR SUBROUTINE %FA.
/THE AUGEND IS STORED IN THE HELD ACCUMULATOR AND
/THE ADDEND IS LOADED INTO THE FLOATING ACCUMULATOR,
/ROUNDED AND THE SIGN IS INSERTED.
/
/
FAD	0
	JMS	%FG.	/GET ADDRESS
%SP3	0		/(ADDRESS OF SINGLE PRECISION ADDEND)
	JMS	%FH.	/MOVE FLOATING ACC TO HELD ACC.
	JMS	FLAC	/LOAD FLOATING AC
	XCT	%SP3
	JMS	%FA.	/GENERAL FLOATING ADD
		32
	JMS	%FIR.	/FLOATING INSERT AND ROUNT
		400	/ROUND
		777000	/MASK
	JMP*	FAD	/RETURN
/
/--------------------
/
/FLOATING POINT SUBTRACT
/CALLING SEQUENCE:
/	JMS	FSUB	/SUBR CALL
/	XCT	ADDR	/XCT IF INDIRECT
/	NEXT INSTRUCTION	/SUBR RETURN
/
/FLOATING POINT SUBTRACT DOES THE SETUP WORK REQUIRED TO
/PERFORM THE FLOATING POINT ADD INSTRUCTION. THE MINUEND
/IS NEGATED AND UPON RETURNING FROM %FA. THE SUM IS
/NEGATED. THIS IS DONE TO TAKE FULL ADVANTAGE OF %FA. AND
/TO MINIMIZE CORE.
/
FSUB	0
	JMS	%FG.	/GET ADDRESS OF SUBTRAHEND
%SP4	0		/STORE ADDRESS
	JMS	%FNEG.	/NEGATE FLOATING ACC
	JMS	FAD
	XCT	%SP4	/.DSA % SP4+400000 (INDIRECT)
	JMS	%FNEG.	/CHANGE BACK TO CORRECT SIGN
	JMP*	FSUB	/EXIT
/
/--------------------
/
/FLOATING POINT MULTIPLY (FMPY)
/CALLING SEQUENCE:
/	JMS	FMPY	/ENTRY-EXIT
/	XCT	ADDR	/ADDRESS OF MULTIPLIER(XCT IF INDIRECT)
/	NEXT INSTRUCTION	/RETURN HERE
/
/FMPY DOES THE SETUP WORK NECESSARY TO EXECUTE THE GENERAL
/FLOATING POINT MULTIPLY INSTRUCTION: NAMELY,STORING THE
/MULTIPLICAND IN THE HELD ACCUMULATOR AND
/LOADING THE FLOATING POINT ACCUMULATOR WITH
/MULTIPLIER
/
FMPY	0
	JMS	%FG.	/GET ADDRESS
%SP5	0		/ADDRESS OF SINGLE PRECISION MULTIPLICAND.
	JMS	%FH.	/STORE IN HELD ACC.
	JMS	FLAC	/LOAD MULTIPLIER
	XCT	%SP5	/INDIRECT ADDRESS
	JMS	%FM.	/GENERAL FLOATING POINT MULTIPLY
	JMS	%FIR.	/ROUND AND INSERT SIGN OF PRODUCT
		400
		777000	/MASK FOR ROUND OFF
	JMP*	FMPY	/EXIT
/
/--------------------
/
/FLOATING POINT DIVIDE (FDVD)
/CALLING SEQUENCE:
/	JMS	FDVD	/SUBR CALL
/	XCT	ADDR		/ADDR. OF DIVISOR
/	NEXT INSTRUCTION	/SUBR RETURN
/
/FDVD DOES THE SET UP FOR %FD. THE GENERAL PURPOSE FLOATING
/POINT INSTRUCTION. IT DOES THIS BY
/STORING THE DIVIDEND IN THE HELD ACC AND BY STORING
/DIVISOR IN THE FLOATING ACC.
/
/
FDVD	0
	JMS	%FG.	/GET ADDRESS OF DIVISOR
%SP6	0		/ADDRESS OF DIVISOR
	JMS	%FH.	/HOLD IT
	JMS	FLAC
	XCT	%SP6	/LOAD DIVISOR
	JMS	%FD.	/GENERAL FLOATING DIVIDE
	LAW	-34	/28-BITS
		400	/QUOTIENT BIT
	JMS	%FIR.	/INSERT SIGN,ROUNDOFF
		400
		777000
	JMP*	FDVD
/
/---------------------
/
/REVERSE SUBTRACT	(FSBR)
/CALLING SEQUENCE:
/	JMS	FSBR	/SUBR CALL
/	XCT	ADDR	/ADDR OF MINUEND(XCT IF INDIRECT)
/	NEXT INSTRUCTION	/SUBR RETURN DIFFERENCE IN FLOATING ACC.
/
/
FSBR	0
	JMS	%FG.	/GET ADDRESS OF MINUEND
%SP7	0
	JMS	%FNEG.	/NEGATE SUBTRAHEND
	JMS	FAD	/ADD
	XCT	%SP7	/MINUEND-SUBTRAHEND
	JMP*	FSBR
/
/
/--------------------
/
/REVERSE DIVIDE (FDVR)
/CALLING SEQUENCE:
/	JMS	FDVR	/CALL.DIVISOR IN FLOATING ACC.
/	XCT	ADDR	/ADDR OF DIVIDEND(ACT IF INDIRECT)
/	NEXT INSTRUCTION	/SUBR RETURN(QUOTIENT IN FLOATING ACC.)
/
/
FDVR	0
	JMS	%FG.	/GET ADDRESS OF DIVIDEND
%SP8	0
	JMS	FDAC	/SAVE DIVISOR
	.DSA	%J1	/USE HELD ACCUMULATOR TEMPORARILY
	JMS	FLAC
	.DSA	%SP8+400000	/(DIVIDEND)
	JMS	FDVD
	.DSA	%J1	/(ADDR OF DIVISOR)
	JMP*	FDVR
	.ENDC
/
/
/-----------------------
/
/
	.EOT
*U*5
"