	.TITLE	RMNMX	MINIMUM-MAXIMUM FOR REAL 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
/
/ EDIT 011	23 OCTOBER 1972      T.A. MURRAY
/ EDIT 012	19-FEB-75	R.K. HYATT	REMOVED PAGE/BANK DEPENDENCES
/ EDIT 013	20-AUG-75	M. HEBENSTREIT	DISCLAIMER
/ EDIT 014	24-NOV-75	R. K. BLACKETT	REMOVE RSX CONDITIONALS
/
/
/FOR HARDWARE FLOATING POINT PROCESSOR (FPP), DEFINE % FPP,
/FOR PDP9, DEFINE %PDP9
/ FOR ADSS, DEFINE %V5B
/
	.GLOBL	AMAX1,AMIN1,MAX1,MIN1,.AX

	.IFUND	%FPP

	.GLOBL	.AH,.AG,.AM,.AB

	.ENDC

	.GLOBL RMNMX

RMNMX=.

/             CALLING SEQUENCE

/      JMS*   (AMAX1,AMIN1,MAX1,MIN1)  SUBR CALL

/      JMP    .+(N+1)                  SUBR RETURN

/      /      CAL/XCTADDR(1)           ADDR OF ARG1

	.IFUND %FPP

	.DEFIN FLD%,A		/FLOATING LOAD (.AG)

	JMS* A

	.ENDM

	.ENDC

	.IFDEF %FPP

FLD=713050

	.DEFIN FLD%

	FLD

	.ENDM

	.ENDC

	.IFUND %FPP

	.DEFIN FRS%,A		/FLOATING REVERSE SUBTRACT (.AM)

	JMS* A

	.ENDM

	.ENDC

	.IFDEF %FPP

FRS=711040

	.DEFIN FRS%

	FRS

	.ENDM

	.ENDC

	.IFUND %FPP

	.DEFIN FST%,A		/FLOATING STORE (.AH)

	JMS* A

	.ENDM

	.ENDC

	.IFDEF %FPP

FST=713640

	.DEFIN FST%

	FST

	.ENDM

	.ENDC

/FPP INSTR. 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

/      CAL/XCTADDR(2)                  ADDR OF ARG2

/

/

/      CAL/XCTADDT(N)                  ADDR OF ARG(N) (XCT IF INDIRECT)

/

/      .TITLE AMAX1  MAXIMUM WITH REAL ANSWER

AMAX1  CAL    0              /ENTRY-EXIT

	.IFUND %FPP

       LAW    0              /SET FOR SMA(MAX)

	.ENDC

	.IFDEF %FPP

	LAC	MNXR15		/LOAD BR ON NEG.

	.ENDC

       JMS    MNXR           /DETERMINE MIN-MAX

       JMP*   AMAX1          /EXIT

/      .TITLE AMIN1  MINIMUM WITH REAL ANSWER

AMIN1  CAL    0              /ENTRY-EXIT

	.IFUND %FPP

       LAW    1000           /SET FOR SPA(MIN)

	.ENDC

	.IFDEF %FPP

	LAC	MNXR18		/LOAD BR ON POS.

	.ENDC

       JMS    MNXR           /DETERMINE MIN-MAX

       JMP*   AMIN1          /EXIT

/      .TITLE MAX1   MAXIMUM WITH INTEGER ANSWER

MAX1   CAL    0              /ENTRY-EXIT

	.IFUND %FPP

       LAW    0              /SET FOR SMA(MAX)

	.ENDC

	.IFDEF %FPP

	LAC MNXR15		/LOAD BR ON NEG.

	.ENDC

       JMS    MNXR           /DETERMINE MIN-MAX

       JMS*   .AX            /FIX ANSWER TO INTEGER(.AX)

       JMP*   MAX1           /EXIT

/      .TITLE MIN1   MINIMUM WITH INTEGER ANSWER

MIN1   CAL    0              /ENTRY-EXIT

	.IFUND %FPP

       LAW    1000           /SET FOR SPA (MIN)

	.ENDC

	.IFDEF %FPP

	LAC MNXR18		/LOAD BR ON POS.

	.ENDC

       JMS    MNXR           /DETERMINE MIN-MAX

       JMS*   .AX            /FIX ANSWER TO INTEGER (.AX)

       JMP*   MIN1           /EXIT

       .EJECT

MNXR   CAL    0              /ENTRY-EXIT-

	.IFUND %FPP

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

	.ENDC

       DAC    MNXR01         /STORE SWITCH

	ARGNUM	MNXR,MNXR02,MNXR05,MNXR03,-3

       ISZ    MNXR02         /SET POINTER TO FIRST ARG

       JMS    MNXR06         /GET ARG

MNXR16 FST%   .AH            /STORE REAL (.AH)

       .DSA   MNXR08         / AS ANSWER

MNXR09 ISZ    MNXR05         /SET N=N+1

       JMP    MNXR10         /MORE ARGS-CONTINUE

       FLD%   .AG            /LOAD REAL (.AG)

       .DSA   MNXR08         / (ANSWER)

       JMP*   MNXR           /EXIT

MNXR10 JMS    MNXR06         /GET NEXT ARG

       FRS%   .AM            /REVERSE SUBTRACT REAL (.AM)

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

	.IFUND %FPP

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

	.ENDC

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

	.IFDEF %FPP

	MNXR17

	.ENDC

       JMP    MNXR09         /NOT MIN OR MAX, CYCLE

MNXR17	FLD%   .AG            /LOAD REAL (.AG)

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

       JMP    MNXR16         /GO TO STORE AS ANSWER
MNXR06 CAL    0              /ENTRY-EXIT
       LAC*   MNXR02         /GET ARG ADDR
       SMA                   /IF NEG (XCT) GET ADDR INDIRECT
       JMP    MNXR61
       DAC    MNXR62
       LAC*   MNXR62
MNXR61=.
	.IFDEF	%V5B
	.IFDEF	%FPP
	AND	(477777		/AND OFF MODE BITS IN CASE FPP
	.ENDC
	.ENDC
	DAC    MNXR62         /STORE ARG ADDR

       FLD%   .AG            /LOAD REAL (.AG)

       .DSA   MNXR62+400000  / (ARG)

       ISZ    MNXR02         /BUMP POINTER

       JMP*   MNXR06         /EXIT
/	.IFUND	RSX		/(RKB-014)
MNXR02 CAL    0              /POINTER

	.IFUND %PDP9

MNXR03	70000		/MASK FOR PDP15 BK AND PG BITS

	.ENDC

	.IFDEF %PDP9

MNXR03	60000			/BK BITS

	.ENDC

MNXR05 CAL    0              /N

MNXR08 CAL    0              /ANSWER STORAGE 1
       CAL                   /               2
/	.ENDC			/(RKB-014)
	.IFUND %FPP

MNXR15        760100

	.ENDC

MNXR62 CAL    0              /ADDR OF ARG(N)

MNXR04	2

MNXR07	77777		/ADDRESS MASK.

	.IFDEF %FPP

MNXR15	BMA			/BR ON NEG.

MNXR18	BPA			/BR ON POS.

	.ENDC

       .END
