;searching for highest value COUNT RN R0 ;COUNT is the new name of R0 MAX RN R1 ;MAX is the new name of R1 ;(MAX has the highest value) POINTER RN R2 ;POINTER is the new name of R2 NEXT RN R3 ;NEXT is the new name of R3 AREA PROG_4_1D, DATA, READONLY MYDATA DCD 69,87,96,45,75 AREA PROG_4_1, CODE, READONLY ENTRY MOV COUNT,#5 ;COUNT = 5 MOV MAX,#0 ;MAX = 0 LDR POINTER,=MYDATA ;POINTER = MYDATA ( address of first data ) AGAIN LDR NEXT,[POINTER] ;load contents of POINTER location to NEXT CMP MAX,NEXT ;compare MAX and NEXT BHS CTNU ;if MAX > NEXT branch to CTNU MOV MAX,NEXT ;MAX = NEXT CTNU ADD POINTER,POINTER,#4 ;POINTER=POINTER+4 to point to the next SUBS COUNT,COUNT,#1 ;decrement counter BNE AGAIN ;branch AGAIN if counter is not zero HERE B HERE END