This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Could you explain BCC command to me?

Hi,

I find C code not executing in the desired way. Then I step in assembly code of Tiva-C M4F core. Below is the disassembly code:

$C$L5:   nop

0000033a:   280A     CMP             R0, #10

0000033c:   D3C9     BCC             $C$L5

here_label:

R0 is '0'. It is found that after BCC exec, the core  goes $C$L5, not goes to here_label.

In xPSR, 'C' is '0'. I want to know BCC in detail, but the found description online is ambiguous to me. Especially the last column comments on Arithmetic. Could you explain the disassembly code running when flag 'C'=0, it goes to $C$L5, not here_label?


Thanks,

BCSC=1Carry setArithmetic operation gave carry out
BCCC=1Carry clearArithmetic operation did not produce a carry
Parents
  • From Jens Bauer's reply:

    > Normally, an assembly-programmer would not use BCC and BCS with CMP.

    What causes confusion is this:

    the condition that the CMP and the succeeding conditional branch evaluates is if R0 is (unsigned) lower than 10.

    Unfortunately, the disassembler would not know, or would not want to know , about the context and it opted to disassemble to BCC. It could have been easier for you to analyze the code if BLO, instead of BCC, was chosen in the disassembly.

Reply
  • From Jens Bauer's reply:

    > Normally, an assembly-programmer would not use BCC and BCS with CMP.

    What causes confusion is this:

    the condition that the CMP and the succeeding conditional branch evaluates is if R0 is (unsigned) lower than 10.

    Unfortunately, the disassembler would not know, or would not want to know , about the context and it opted to disassemble to BCC. It could have been easier for you to analyze the code if BLO, instead of BCC, was chosen in the disassembly.

Children
No data