I have some x86 code which looks like:
; The carry flag is set to 1 here
jae an_address ; The jump instruction does not take place
Does this make sense?
I thought the jump should take place because 1 is greater than or equal to 0, the definition of JAE
?
jae means Jump if above or equal. It will jump if the carry flag is equal to 0.
The carry flag (CF) is set when the result of an unsigned arithmetic operation is too large to fit into the destination. • The overflow flag (OF) is set when the result of a signed arithmetic operation is too large or too small to fit into the destination.
The MOV instruction never affects the flags. Whenever the destination operand equals Zero, the Zero flag is set. A flag is set when it equals 1. A flag is clear when it equals 0.
1. The carry flag is set if the addition of two numbers causes a carry out of the most significant (leftmost) bits added. 2. The carry (borrow) flag is also set if the subtraction of two numbers requires a borrow into the most significant (leftmost) bits subtracted.
jae
is the same as jnc
, i.e. jump if CF == 0. Choice between all 3 mnemonics (including jnb
) is up to programmer. CF isn't set here by mov
but by a previous instruction. The mnemonics jae
is recommended after compare instruction (cmp
) which does subtraction. You can get more details in Intel or AMD software developer manuals.
jae
means Jump if above or equal. It will jump if the carry flag is equal to 0.
You're looking for jnae
or jb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With