0

I found that they work the same way, but yet it's not clear for me why.

I know that in the case of "JC Operand" the jump will happen if CF is set and "JB" means "jump if below".

Jester
  • 56,577
  • 4
  • 81
  • 125
  • 2
    `JB` is just a human friendly way to write `JC` based on the typical usage after a `CMP`. Since `CMP` is a subtraction, if it produces a carry then the first operand was below the second. There is no "below" flag in the cpu. – Jester Jan 28 '22 at 19:24
  • Why it produces a carry? – always_improve Jan 28 '22 at 19:31
  • 2
    Many operations produce a carry as that is a natural feature associated with addition: so operations like add, subtract, and compare produce a carry, either setting or clearing the carry bit. When we add 2 8-bit numbers, mathematically speaking the result is a 9-bit answer. The carry bit in the processor represents that 9th bit (or 17th or 33rd or 65th bit... depending on the size of the addition). – Erik Eidt Jan 28 '22 at 19:48
  • 1
    For an unsigned subtract, the carry flag represents a borrow bit on X86 processors. – rcgldr Jan 28 '22 at 20:49
  • http://teaching.idallen.com/dat2343/10f/notes/040_overflow.txt covers how carry works, but only a brief mention of is being a borrow out of the high bit for subtraction. Looks like a duplicate of [How is Carry Flag set when subtrahend is larger?](https://stackoverflow.com/q/41841768) - if not, please clarify in more detail what you're asking. – Peter Cordes Jan 29 '22 at 01:48

0 Answers0