In this example im trying to figure out what the BLO is comparing. I know it branches if the carry flag is not set. Is it comparing r1 with old r1 (the instruction above it?) As the code doesn't branch at BGE. Thanks so much.
LDR r0,=0X3
LDR r1, =0X8F
CMP r0,r1
BGE a_label
SUBS r1,r1,#0XC9
a_label BLO stop
SUBS r1,r1,#0X7D
stop
It can be tricky to interpret condition codes in the absence of a CMP
instruction, because the mnemonics were written to make interpretation easy when there's a CMP
. But in this example, it's not so bad: remember that CMP
is just SUBS
with the result discarded, so
SUBS r1, r1, #0xC9
BLO stop
represents the same condition as
CMP r1, #0xC9
BLO stop
but leaves a different result in r1
. The condition therefore is that it will branch when r1
(old value) is lower than 0xC9, in an unsigned sense -- in other words when the SUBS
results in a wrap of the unsigned value of r1
.