Search code examples
assembly68000

How does the carry flag work on the 68000?


So I'm a bit confused about how the carry flag works, specifically on the 68000 processor (but it may not matter).

My main question is as follows:

move.b (a0),d0
moveq #7,d1
cmp.b d1,d0
bcc.s DATAErr3

Obviously the byte at A0 is being copied to D0, and then D0 is being compared to 7. But then, there is a branch to DATAErr3 if the carry flag is set ("bcc"). In this operation, what values of D0 would cause the carry flag to be set? What values would cause it to not be set?

Thanks!


Solution

  • BCC branches if d0 >= d1, in an unsigned comparison. In this case, the BCC instruction will branch if d0 is greater than or equal to 7, or is negative.

    http://www.easy68k.com/paulrsm/doc/trick68k.htm