	.TITLE	JMNMX	MIN.-MAX. FOR J ARGS.
/
/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 HARDWARE FLOATING POINT PROCESSOR (FPP), DEFINE 90 FPP,
/FOR PDP9, DEFINE %PDP9
/ FOR ADSS, DEFINE %V5B
/EDIT #003  9-13-71
/ EDIT 004	19-FEB-75	R.K. HYATT	REMOVED PAGE/BANK DEPENDECIES
/ EDIT 005	AUG-20-75	M. HEBENSTREIT	DISCLAIMER

	.IFUND %FPP
	.GLOBL .JH, .JG, .JM

	.ENDC

	.GLOBL	JMNMX, JMAX0, JMIN0,

	.IFUND	%FPP

	.DEFIN	EST%,A

	JMS*	A		/EXTENDED INTEGER STORE (.JH)

	.ENDM

	.ENDC

	.IFDEF %FPP

EST=713700

	.DEFIN EST%

	EST

	.ENDM

	.ENDC

	.IFUND	%FPP

	.DEFIN	ELD%,A

	JMS*	A		/EXTENDED INTEGER LOAD (.JG)

	.ENDM

	.ENDC

	.IFDEF	%FPP

ELD=713100

	.DEFIN	ELD%

	ELD

	.ENDM

	.ENDC

	.IFUND	%FPP

	.DEFIN	ERS%,A

	JMS*	A		/EXTENDED INTEGER REV. SUB. (.JM)

	.ENDM

	.ENDC

	.IFDEF	%FPP

ERS=711100

	.DEFIN	ERS%

	ERS

	.ENDM

	.ENDC

	.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

JMNMX=.

/             CALLING SEQUENCE

/	JMS*	(JMAX0, JMIN0)

/      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 JMAX0  MAXIMUM WITH DOUBLE INTEGER ANSWER

JMAX0   CAL    0              /ENTRY-EXIT

	.IFUND %FPP

       LAW    0              /SET FOR SMA (MAX)

	.ENDC

	.IFDEF %FPP

	LAC MNXJ63	/LD BR ON POS.

	.ENDC

       JMS    MNXJ           /DETERMINE MIN-MAX

       JMP*   JMAX0           /EXIT

/      .TITLE JMIN0   MINIMUM WITH DOUBLE INTEGER ANSWER

JMIN0   CAL    0              /ENTRY-EXIT

	.IFUND %FPP

       LAW    1000           /SET FOR SPA (MIN)

	.ENDC

	.IFDEF %FPP

	LAC MNXJ64	/LD BR ON NEG.

	.ENDC

       JMS    MNXJ           /DETERMIN MIN-MAX

       JMP*   JMIN0           /EXIT

MNXJ   CAL    0              /ENTRY-EXIT-

	.IFUND %FPP

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

	.ENDC

       DAC    MNXJ01         /STORE SWITCH

	ARGNUM	MNXJ,MNXJ02,MNXJ05,MNXJ03,-3

       ISZ    MNXJ02         /SET POINTER TO FIRST ARG

       JMS    MNXJ06         /GET ARGUMENT

MNXJ16	EST%	.JH		/STORE AS ANSWER

	.DSA	MNXJ08

MNXJ09	ISZ	MNXJ05		/SET N=N+1

       JMP    MNXJ10         /MORE ARGS-CONTINE

	ELD%	.JG		/DONE-PICK UP ANSW.

	.DSA	MNXJ08

       JMP*   MNXJ           /EXIT

MNXJ10 JMS    MNXJ06         /GET NEXT ARG

	ERS%	.JM		/REV. SUBTRACT D.INT.

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

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

	.IFUND %FPP

       JMP    MNXJ09         /NOT MIN OR MAX,CYCLE

	.ENDC

	.IFDEF %FPP

	MNXJ09

	.ENDC

	ELD%	.JG		/LD. J:NEW MIN. OR MAX.

	.DSA	MNXJ62+400000	/PICK UP ARG(N) AGAIN

       JMP    MNXJ16         /BACK TO STORE ARG(N) AS ANS
MNXJ06 CAL    0              /ENTRY-EXIT
       LAC*   MNXJ02         /GET ARG ADDR(PNTR)
       SMA                   /IF NEG (XCT) GET ADDR INDIRECT
       JMP    MNXJ61
       DAC    MNXJ62
       LAC*   MNXJ62
MNXJ61=.
	.IFDEF	%V5B
	.IFDEF	%FPP
	AND	(477777		/AND OFF MODE BITS FOR FPP
	.ENDC
	.ENDC

	DAC    MNXJ62         /STORE ARG ADDR

	ELD%	.JG		/LD. J:GET ARG

	.DSA	MNXJ62+400000

       ISZ    MNXJ02         /BUMP PNTR

       JMP*   MNXJ06         /EXIT

MNXJ04	2

MNXJ02 CAL    0              /POINTER FOR ARG(N)

MNXJ03	70000		/MASK FOR PDP15 BK AND PG BITS

MNXJ08 CAL    0              /ANSWER

	0

MNXJ62 CAL    0              /ADDR OF ARG(N)

MNXJ05	0		/N

	.IFUND %FPP

MNXJ15        760100

	.ENDC

	.IFDEF %FPP

MNXJ63	BPA

MNXJ64	BMA

	.ENDC

       .END
