	.TITLE	IMNMX	MINIMUM-MAXIMUM FOR INTEGER ARGUMENTS
/
/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
/FOR PDP9, DEFINE %PDP9
/
/ EDIT 007 	23 OCTOBER 1972       T.A. MURRAY
/ EDIT 008	19-FEB-75	R.K. HYATT	REMOVED BANK/PAGE
/				DEPENDENT CODE
/ EDIT 009	20-AUG-75	M. HEBENSTREIT	DISCLAIMER
/
       .GLOBL MAX0,MIN0,AMAX0,AMIN0,.AW,.AZ

	.GLOBL IMNMX

	.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

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

	ARGNUM	MNXI,MNXI02,MNXI05,MNXI03,-3

       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	.DSA	0

MNXI03	.DSA	0

MNXI05 CAL    0              /N

MNXI08 CAL    0              /ANSWER

MNXI62 CAL    0              /ADDR OF ARG(N)

MNXI15        760100

	.END
