Quote:
ldr r4, Limit
ldrb r5, D @We can actually use .byte for these (: thus it becomes ldrb, not ldr. If you were using a 16-bit value it would be ldrh.
ldrb r8, M
ldr r1, Dresser
ldrh r2, [r1] @forgot your brackets here.. we want to load the halfword at r1 into r2
ldr r3, Mail
ldrh r3, [r3] @need to load the value from Mail before we can store it!
strh r3, [r2]
@we dont need the branch to Fred as it will automatically go to it.
Fred:
add r1, r1, r5
ldrh r2, [r1] @once again, forgot our brackets (:
add r3, r3, r8
strh r3, [r2]
cmp r1, r4
ble Fred @no need for John, we can just redirect it back to Fred from here (:
bx lr
Limit:
.long 0x021ec214
Dresser:
.long 0x021ec200
Mail:
.long 0x021d8014
D:
.byte 0x02
M:
.byte 0xf4
I'm assuming your math is right, hopefully this helped you also you dont need to remove the notes i put in there to compile. The compiler will ignore anything after @ on that line. (: Any questions? ;P I hope I didn't miss anything.. kinda rusty on ASM :(