I have a (large) piece of code I am debugging, and am stuck on something that seems fairly simple, but doesn’t work.
The snip of code is as follows:
1d64: ff82f7ff bl 1c6c <mySubrouteen>
1d68: 1c04 mov r4, r0 (add r4, r0, #0)
1d6a: 2800 cmp r0, #0
1d6c: d141 bne 1df2 <errorOut>
When I step through the code, I see the following:
1d64: ff82f7ff bl 1c6c <mySubrouteen>
-- routeen returns with value ZERO in r0
cpsr is 0xd3
1d68: 1c04 mov r4, r0 (add r4, r0, #0)
---- r4 now set to zero
cpsr set to 0x400000d3 (Zero bit set)
1d6a: 2800 cmp r0, #0
---- No change - zero would be set, but was already set.
1d6c: d141 bne 1df2 <errorOut>
Now here's where it goes wrong - as zero is set, you wouldn't
expect it to branch - but it does!
If I jump back to this instruction and manually set cpsr to 0xd3
(i.e. clear the zero bit) - it still branches.
Am I totally missing something???
:x
-BKG