(SRCTools Version 3.1.1) HexLoc DecLoc MachWord Label Instruction Comment ; ; CPE 221 Assembly Example ; ; This program finds the maximum value in an array ; .org 200 size: .equ 1 000000c8 0000000200 max: .dw 1 000000cc 0000000204 00000005 array: .dc 5, 3, -1, 2, 4, 37, -100, 13, -5, 0 000000d0 0000000208 00000003 000000d4 0000000212 ffffffff 000000d8 0000000216 00000002 000000dc 0000000220 00000004 000000e0 0000000224 00000025 000000e4 0000000228 ffffff9c 000000e8 0000000232 0000000d 000000ec 0000000236 fffffffb 000000f0 0000000240 00000000 orig: .org 1000 000003e8 0000001000 37800040 lar r30, done 000003ec 0000001004 37400014 lar r29, loop 000003f0 0000001008 37000030 lar r28, inc 000003f4 0000001012 32bffcd4 lar r10, array ; pointer to first element of array 000003f8 0000001016 28400001 la r1, size ; holds size of array 000003fc 0000001020 08940000 ld r2, 0(r10) ; max = num[0] 00000400 0000001024 29000001 la r4, 1 ; r4 = 0, index1 into array 00000404 0000001028 71481000 loop: sub r5, r4, r1 ; Check to see whether index < size. 00000408 0000001032 403c5004 brpl r30, r5 ; If not, done. 0000040c 0000001036 e1880002 shl r6, r4, 2 ; Multiply index by 4 to access entry ; in array by byte address. 00000410 0000001040 618ca000 add r6, r6, r10 ; Add index to base array pointer. 00000414 0000001044 09cc0000 ld r7, 0(r6) ; Load array[index] into r7. 00000418 0000001048 720e2000 sub r8, r7, r2 0000041c 0000001052 40388005 brmi r28, r8 00000420 0000001056 688e0000 addi r2, r7, 0 00000424 0000001060 69080001 inc: addi r4, r4, 1 00000428 0000001064 403a0001 br r29 0000042c 0000001068 188000c8 done: st r2, max 00000430 0000001072 f8000000 stop --- Symbol Table --- max: 200 done: 1068 loop: 1028 size: 1 inc: 1060 orig: 1000 array: 204