In this exercise I have to set to 0 all even numbers in this array, but when I run the program I got a segmentation fault. Can someone help me? And also, how can I print the result on my raspberry pi? Thank you!
Edit: I have changed comments from italian to english. Hope it is more understandable!
.data
v: .word 1,2,3,4,5,6,7,8 @ at the end I have to get 1,0,3,0,5,0,7,0
.text
.global main
main: mov r0, #8 @ dimension of my array
ldr r1, =v @ address of my array
push {lr}
mov r3, #4 @ index = 1
loop: cmp r3, #32 @ condition of the loop
bge exit @ if r3 is greather or equal exit from the loop
ldr r1, [r1, r3] @ load the element of my array of index r3 in r1
mov r1, #0 @ set my even element to 0
str r1, [r1, r3]
add r3, r3, #8 @ increment my index of 2 position
b loop @ back to loop function
exit: pop {pc} @ quit from my loop function and back to main
mov r1, #0. PS: learn to use a debugger. - Jester