I wrote some assembly code on Keil where if an element in array is < 5, the program increments that element. Trouble is, the ARM code does not change the values of array1 in memory. What changes do I need to make in order to do so?
ADR r0, array1 ; loads address of 'a' to r0
MOV r1, #0 ; r1 = index
L0 CMP r1, #8
BGE stop
LDR r2, [r0, r1, LSL#2] ; load content of array1[index] to r2
CMP r2, #5
ADDLT r2, r2, #1 ; array1[index]++
STRLT r2, [r0, r1, LSL#2] ; store r2 as content of array1[index]
ADD r1, r1, #1 ; index++
B L0
stop B stop
array1 DCD 1, 7, 4, 9, 2, 3, 8, 6
END