There is 1 other file named maxmin.mac in the archive. Click here to see a list.
TITLE MAXMIN - Routine to find MAX and MIN of an array
SUBTTL Disassebled from OLD:FORLIB.REL by Joe Smith, 8-Sep-83
; SUBROUTINE MAXMIN(ARRAY,ISIZE,ARMAX,ARMIN)
; DIMENSION ARRAY(ISIZE)
; ARMAX = ARRAY(1)
; ARMIN = ARRAY(1)
; DO 2 I=1,ISIZE
; IF(ARRAY(I).LT.ARMIN) ARMIN=ARRAY(I)
; IF(ARRAY(I).GT.ARMAX) ARMAX=ARRAY(I)
; ARRAY, ARMAX, and ARMIN can all be INTEGER or all be REAL.
; In order to run very fast on a PDP-10 model KA, the main loop is
; executed out of the fast memory in the accumulators.
ENTRY MAXMIN ;Name of subroutine
SIXBIT /MAXMIN/ ;Mark the entry point
MAXMIN: MOVN 14,@1(16) ;Get negative of size of array
MOVSI 14,(14) ;Put in LH for AOBJN
HRRI 14,@(16) ;Addr of 1st element in the array
MOVSI 13,.+2 ;Put routine into the ACs
BLT 13,12 ; 0 thru 12
;The next 13 words are executed in the accumulators, locations 00 to 12
MOVE 13,(14) ;00 Get next entry in the array
CAMG 11,13 ;01 Larger than previous max?
MOVE 11,13 ;02 Yes, set new max
CAML 12,13 ;03 Smaller than previous min?
MOVE 12,13 ;04 Yes, set new min
AOBJN 14,00 ;05 Loop thru array
MOVEM 11,@2(16) ;06 Store max in 3rd arg
MOVEM 12,@3(16) ;07 Store min in 4th arg
POPJ 17, ;10 Return from MAXMIN
XWD 400000,000001 ;11 Start with MAX=-INFINITY
XWD 377777,777777 ;12 Start with MIN=+INFINITY