/
/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
/EDIT 009  9-13-71
/ EDIT 010	19-FEB-75	R.K. HYATT	REMOVED PAGE/BANK DEPENDECIES
/ EDIT 011	20-AUG-75	M. HEBENSTREIT	DISCLAIMER
/
/FOR HARDWARE FLOATING POINT PROCESSOR (FPP), DEFINE % FPP,
/FOR PDP9, DEFINE %PDP9
/ FOR ADSS, DEFINE %V5B

       .TITLE DMNMX  MINIMUM-MAXIMUM FOR DOUBLE ARGUMENTS

	.GLOBL DMAX1,DMIN1

	.GLOBL DMNMX

	.IFUND %FPP

	.GLOBL .AP,.AO,.AU,.AB

	.ENDC

DMNMX=.

/             CALLING SEQUENCE

/      JMS*   (DMAX1,DMIN1)   SUBR CALL

/      JMP    .+(N+1)         SUBR RETURN

/      CAL/XCTADDR(1)         ADDR OF ARG1

/      CAL/XCTADDR(2)         ADDR OF ARG2

/

/

/      CAL/XCTADDR(N)         ADDR OF ARG(N)

	.IFUND %FPP

	.DEFIN UNDST%,A		/UNNORM. DOUBLE STORE (.AP)

	JMS* A

	.ENDM

	.ENDC

	.IFDEF %FPP

UNDST=713770

	.DEFIN UNDST%

	UNDST

	.ENDM

	.ENDC

	.IFUND %FPP

	.DEFIN DLD%,A	/DOUBLE LOAD (.AO)

	JMS* A

	.ENDM

	.ENDC

	.IFDEF %FPP

DLD=713150

	.DEFIN DLD%

	DLD

	.ENDM

	.ENDC

	.IFUND %FPP

	.DEFIN DRS%,A	/DOUBLE REVERSE SUBTRACT (.AU)

	JMS* A

	.ENDM

	.ENDC

	.IFDEF %FPP

DRS=711140

	.DEFIN DRS%

	DRS

	.ENDM

	.ENDC

/FPP INSTRUC. ASS.

	.IFDEF %FPP

BPA=716604

BMA=716602

	.ENDC

	.DEFIN	.ADDAC	ARG

	.IFUND	%PDP9

	AAC	ARG

	.ENDC

	.IFDEF	%PDP9

	TAD	(ARG

	.ENDC

	.ENDM

	.DEFIN	ARGNUM	ENTRY,CALLER,NUMADR,TEMP,OFFSET,OFFST2

	LAC	ENTRY

	.ADDAC	OFFSET

	DAC	CALLER

	LAC*	CALLER

	DAC	CALLER

	AND	(7777

	DAC	TEMP

	LAC*	CALLER

	AND	(7777

	CMA

	.ADDAC	2

	TAD	TEMP

	SMA

	TAD	(770000

	DAC	NUMADR

	.ENDM

/

/      .TITLE DMAX1  MAXIMUM WITH DOUBLE ANSWER

DMAX1  CAL    0              /ENTRY-EXIT

	.IFUND %FPP

       LAW    0              /SET FOR SMA (MAX)

	.ENDC

	.IFDEF %FPP

	LAC	MNXD15		/LOAD BR ON NEG.

	.ENDC

       JMS    MNXD           /DETERMINE MIN-MAX

       JMP*   DMAX1          /EXIT

/      .TITLE DMIN1  MINIMUM WITH DOUBLE ANSWER

DMIN1  CAL    0              /ENTRY-EXIT

	.IFUND %FPP

       LAW    1000           /SET FOR SPA (MIN)

	.ENDC

	.IFDEF %FPP

	LAC	MNXD18		/LOAD BR ON POS.

	.ENDC

       JMS    MNXD           /DETERMINE MIN-MAX

       JMP*   DMIN1          /EXIT

       .EJECT

MNXD   CAL    0              /ENTRY-EXIT-

	.IFUND %FPP

       TAD    MNXD15         /CONSTRUCT SMA(MAX) OR SPA(MIN) INSTRUCTIO

	.ENDC

       DAC    MNXD01         /STORE SWITCH

	ARGNUM	MNXD,MNXD02,MNXD05,MNXD03,-3

       ISZ    MNXD02         /SET POINTER TO FIRST ARG

       JMS    MNXD06         /GET ARG

MNXD16 UNDST%   .AP            /STORE DOUBLE (.AP)

       .DSA    MNXD08         / AS ANSWER

MNXD09 ISZ    MNXD05         /SET N=N+1

       JMP    MNXD10         /MORE ARGS-CONTINUE

       DLD%   .AO            /LOAD DOUBLE (.AO)

       .DSA   MNXD08         / (ANSWER)

       JMP*   MNXD           /EXIT

MNXD10 JMS    MNXD06         /GET NEXT ARG

       DRS%    .AU            /REVERSE SUBTRACT DOUBLE (.AU)

       .DSA   MNXD08         /  (ANS-ARG(N))

	.IFUND %FPP

       LAC*   .AB            /GET SIGN WORD (.AB)

	.ENDC

MNXD01 CAL    0              /OPERATE SWITCH (SMA IF MAX,SPA IF MIN)

	.IFDEF %FPP

	MNXD17

	.ENDC

       JMP    MNXD09         /BACK IF NOT MIN OR MAX

MNXD17	DLD%    .AO            /LOAD DOUBLE (.AO)

       .DSA   MNXD62+400000  / (ARG(N))

       JMP    MNXD16         /GO TO STORE AS ANSWER
MNXD06 CAL    0              /ENTRY-EXIT
       LAC*   MNXD02         /GET ARG ADDR
       SMA                   /IS INDIRECT
       JMP    MNXD61         /NO
       DAC    MNXD62
       LAC*   MNXD62
MNXD61=.
	.IFDEF	%V5B
	.IFDEF	%FPP
	AND	(477777		/AND OFF MODE BITS FOR FPP
	.ENDC
	.ENDC
	DAC    MNXD62
       DLD%    .AO            /LOAD DOUBLE (.AO)

       .DSA   MNXD62+400000  / (ARG(N))

       ISZ    MNXD02         /BUMP POINTER

       JMP*   MNXD06         /EXIT

MNXD62 CAL    0              /ADDR OF ARG(N)

MNXD02 CAL    0              /POINTER

MNXD04	2

MNXD03	70000		/MASK FOR PDP15 BK AND PG BITS

MNXD05 CAL    0              /N

MNXD08 CAL    0              /ANSWER STORAGE 1

       CAL    0              /               2

       CAL    0              /               3

	.IFUND %FPP

MNXD15        760100

	.ENDC

	.IFDEF %FPP

MNXD15	BMA			/BR ON NEG.

MNXD18	BPA			/BR ON POS.

	.ENDC

       .END
