numbers1 DCD 50, 10, 40, 30, 20 ; short array for initial testing ;longer arrays (at least 10 numbers each) ;numbers1 DCD longer sorted array ; works=Yes/No ;numbers1 DCD longer reversed array ; works=Yes/No ;numbers1 DCD longer scrambled array ; works=Yes/No LDR R0, =numbers1 ; R0 has the base address (beginning) of the array MOV R1, #5 ; R1 is number of items MOV R2, #0 ; R2 is the final sum MOV R3, #0 ; R3 is the current index LOOP CMP R3, R1 ; compare index against size (no <, >, == at this point) BEQ DONE ; leave when done (pick the right comparison for DONE) LDR R4, [R0, R3, LSL #2] ; R4 is current item from memory, R4=*(R0+R3*4), in C ADD R2, R2, R4 ; update sum (R1) with the item (R4) ADD R3, R3, #1 ; update the index by 1 for next cell BAL LOOP ; go back to check if done DONE