/COPYRIGHT 1970, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/EDIT 04P  10-14-70
       .TITLE DMNMX  MINIMUM-MAXIMUM FOR DOUBLE ARGUMENTS
       .GLOBL DMAX1,DMIN1,.AP,.AO,.AU,.AB
	.GLOBL DMNMX
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)
/
/      .TITLE DMAX1  MAXIMUM WITH DOUBLE ANSWER
DMAX1  CAL    0              /ENTRY-EXIT
       LAW    0              /SET FOR SMA (MAX)
       JMS    MNXD           /DETERMINE MIN-MAX
       JMP*   DMAX1          /EXIT
/      .TITLE DMIN1  MINIMUM WITH DOUBLE ANSWER
DMIN1  CAL    0              /ENTRY-EXIT
       LAW    1000           /SET FOR SPA (MIN)
       JMS    MNXD           /DETERMINE MIN-MAX
       JMP*   DMIN1          /EXIT
       .EJECT
MNXD   CAL    0              /ENTRY-EXIT-
       TAD    MNXD15         /CONSTRUCT SMA(MAX) OR SPA(MIN) INSTRUCTIO
       DAC    MNXD01         /STORE SWITCH
       LAC    MNXD           /MASK OFF POSSIBLE
       AND    MNXD07         /SIGN BIT SET FROM
       DAC    MNXD           /LINK DURING JMS
       LAW    -3             /GET SUBR RETURN ADDR
       TAD    MNXD
       DAC    MNXD02
       LAC*   MNXD02
       AND    MNXD07         /CLEAR LINK
       DAC    MNXD02
       AND     MNXD03       /SAVE BANK BIT
       XOR*     MNXD02       /PICK-UP -JUMP AROUND ARGS-INSTRUCTION
       AND     MNXD07       /KEEP ADDR ONLY
       CMA                   /GET TWO@S COMP +1
       TAD    MNXD04         /(ADD 2)
       TAD    MNXD02         /ADD START ADDR OF ARGS FOR -N
       DAC    MNXD05         /STORE -N
       ISZ    MNXD02         /SET POINTER TO FIRST ARG
       JMS    MNXD06         /GET ARG
MNXD16 JMS*   .AP            /STORE DOUBLE (.AP)
       .DSA    MNXD08         / AS ANSWER
MNXD09 ISZ    MNXD05         /SET N=N+1
       JMP    MNXD10         /MORE ARGS-CONTINUE
       JMS*   .AO            /LOAD DOUBLE (.AO)
       .DSA   MNXD08         / (ANSWER)
       JMP*   MNXD           /EXIT
MNXD10 JMS    MNXD06         /GET NEXT ARG
       JMS*   .AU            /REVERSE SUBTRACT DOUBLE (.AU)
       .DSA   MNXD08         /  (ANS-ARG(N))
       LAC*   .AB            /GET SIGN WORD (.AB)
MNXD01 CAL    0              /OPERATE SWITCH (SMA IF MAX,SPA IF MIN)
       JMP    MNXD09         /BACK IF NOT MIN OR MAX
       JMS*   .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 DAC    MNXD62
       JMS*   .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
MNXD03	70000		/MASK FOR PDP15 BK AND PG BITS
MNXD04        2
MNXD05 CAL    0              /N
MNXD07        77777          /ADDRESS MASK
MNXD08 CAL    0              /ANSWER STORAGE 1
       CAL    0              /               2
       CAL    0              /               3
MNXD15        760100
       .END
