Hello there, while trying to get my head around block transfers in ARM asm i noticed that ldmib (inc before) doesnt change the location in Rd yet ldmdb does.
This doesn't make sense to me because ldmdb is supposed to be dec BEFORE. Here's my code:
.syntax unified
@-----------
.global main
main:
push {ip,lr}
adr r5, words+16
ldmia r5, {r1-r4} @ gives 0x1 0x2 0x3
ldmda r5, {r1-r4} @ gives 0x-3 0x-2 0x-1
ldr r0,=message
bl printf
mov r0,#0
pop {ip,pc}
.align 2
words:
.word -4, -3, -2, -1
.word 0, 1, 2, 3, 4
message:
.asciz "Value: 0x%d 0x%d 0x%d\n"
Please note that commenting out the first ldmia gives the same result (I don't update Rd with the '!' operator).
Can anyone explain to me why ldmib acts like this? Thanks!