/COPYRIGHT 1970, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/EDIT 03P  10-14-70
       .TITLE IMNMX  MINIMUM-MAXIMUM FOR INTEGER ARGUMENTS
       .GLOBL MAX0,MIN0,AMAX0,AMIN0,.AW,.AZ
	.GLOBL IMNMX
IMNMX=.
/             CALLING SEQUENCE
/      JMS*   (MAX0,MIN0,AMAX0,AMIN0)  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) (XCT IF INDIRECT)
/
/      .TITLE MAX0  MAXIMUM WITH INTEGER ANSWER
MAX0   CAL    0              /ENTRY-EXIT
       LAW    0              /SET FOR SMA (MAX)
       JMS    MNXI           /DETERMINE MIN-MAX
       JMP*   MAX0           /EXIT
/      .TITLE MIN0   MINIMUM WITH INTEGER ANSWER
MIN0   CAL    0              /ENTRY-EXIT
       LAW    1000           /SET FOR SPA (MIN)
       JMS    MNXI           /DETERMIN MIN-MAX
       JMP*   MIN0           /EXIT
/      .TITLE AMAX0  MAXIMUM WITH REAL ANSWER
AMAX0  CAL    0              /ENTRY-EXIT
       LAW    0              /SET FOR SMA (MAX)
       JMS    MNXI           /DETERMINE MIN-MAX
       JMS*   .AW            /FLOAT ANSWER (.AW)
       JMP*   AMAX0          /EXIT
/      .TITLE AMIN0  MINIMUM WITH REAL ANSWER
AMIN0  CAL    0              /ENTRY-EXIT
       LAW    1000           /SET FOR SPA (MIN)
       JMS    MNXI           /DETERMINE MIN-MAX
       JMS*   .AW            /FLOAT ANSWER (.AW)
       JMP*   AMIN0          /EXIT
       .EJECT
MNXI   CAL    0              /ENTRY-EXIT-
       TAD    MNXI15         /CONSTRUCT SMA(MAX) OR SPA(MIN) INSTRUCTIO
       DAC    MNXI01         /STORE SWITCH
       LAC    MNXI           /MASK OFF POSSIBLE
       AND    MNXI07         /SIGN BIT SET FROM
       DAC    MNXI           /LINK DURING JMS
       LAW    -3             /GET SUBR RETURN ADDR
       TAD    MNXI
       DAC    MNXI02
       LAC*   MNXI02
       AND    MNXI07         /CLEAR LINK
       DAC    MNXI02
       AND     MNXI03       /SAVE BANK BIT
       XOR*     MNXI02       /PICK UP -JUMP AROUND ARGS-INSTRUCTION
       AND       MNXI07       /KEEP ADDR ONLY       (AND MNXI07)
       CMA                   /GET TWO@S COMP+1
       TAD    MNXI04         /(ADD 2)
       TAD    MNXI02         /ADD START ADDR OF ARGS FOR -N
       DAC    MNXI05         /STORE -N
       ISZ    MNXI02         /SET POINTER TO FIRST ARG
       JMS    MNXI06         /GET ARGUMENT
MNXI16 DAC    MNXI08         /STORE AS ANSWER
MNXI09 ISZ    MNXI05         /SET N=N+1
       JMP    MNXI10         /MORE ARGS-CONTINE
       LAC    MNXI08         /DONE-PICKUP ANSWER
       JMP*   MNXI           /EXIT
MNXI10 JMS    MNXI06         /GET NEXT ARG
       JMS*   .AZ            /REVERSE SUBTRACT INTEGER (.AZ)
       LAC    MNXI08         / (ANS-ARG(N))
MNXI01 CAL    0              /OPERATE SWITCH (SMA IF MAX,SPA IF MIN)
       JMP    MNXI09         /NOT MIN OR MAX,CYCLE
       LAC*   MNXI62         /NEW MIN OR MAX-PICK UP ARG(N) AGAIN
       JMP    MNXI16         /BACK TO STORE ARG(N) AS ANS
MNXI06 CAL    0              /ENTRY-EXIT
       LAC*   MNXI02         /GET ARG ADDR(PNTR)
       SMA                   /IF NEG (XCT) GET ADDR INDIRECT
       JMP    MNXI61
       DAC    MNXI62
       LAC*   MNXI62
MNXI61 DAC    MNXI62         /STORE ARG ADDR
       LAC*   MNXI62         /GET ARG
       ISZ    MNXI02         /BUMP PNTR
       JMP*   MNXI06         /EXIT
MNXI02 CAL    0              /POINTER FOR ARG(N)
MNXI03	70000		/MASK FOR PDP15 BK AND PG BITS
MNXI04        2
MNXI05 CAL    0              /N
MNXI07        77777          /ADDRESS MASK
MNXI08 CAL    0              /ANSWER
MNXI62 CAL    0              /ADDR OF ARG(N)
MNXI15        760100
       .END
