|
Jcc -- Jump if Condition is Met
Opcode | Instruction | Clocks |
Description | Example |
77 cb | ja rel8 | 7+m,3 |
Jump short if above (CF=0 and ZF=0) | ja rel8_0 |
73 cb | jae rel8 | 7+m,3 |
Jump short if above or equal (CF=0) | jae rel8_1 |
72 cb | jb rel8 | 7+m,3 |
Jump short if below (CF=1) | jb rel8_2 |
76 cb | jbe rel8 | 7+m,3 |
Jump short if below or equal (CF=1 or ZF=1) | jbe rel8_3 |
72 cb | jc rel8 | 7+m,3 |
Jump short if carry (CF=1) | jc rel8_4 |
E3 cb | jcxz rel8 | 9+m,5 |
Jump short if CX register is 0 | jcxz rel8_5 |
E3 cb | jecxz rel8 | 9+m,5 |
Jump short if ECX register is 0 | jecxz rel8_6 |
74 cb | je rel8 | 7+m,3 |
Jump short if equal (ZF=1) | je rel8_7 |
74 cb | jz rel8 | 7+m,3 |
Jump short if 0 (ZF=1) | jz rel8_8 |
7F cb | jg rel8 | 7+m,3 |
Jump short if greater (ZF=0 and SF=OF) | jg rel8_9 |
7D cb | jge rel8 | 7+m,3 |
Jump short if greater or equal (SF=OF) | jge rel8_10 |
7C cb | jl rel8 | 7+m,3 |
Jump short if less (SF< | jl rel8_11 |
7E cb | jle rel8 | 7+m,3 |
Jump short if less or equal (ZF=1 and SF< | jle rel8_12 |
76 cb | jna rel8 | 7+m,3 |
Jump short if not above (CF=1 or ZF=1) | jna rel8_13 |
72 cb | jnae rel8 | 7+m,3 |
Jump short if not above or equal (CF=1) | jnae rel8_14 |
73 cb | jnb rel8 | 7+m,3 |
Jump short if not below (CF=0) | jnb rel8_15 |
77 cb | jnbe rel8 | 7+m,3 |
Jump short if not below or equal (CF=0 and ZF=0) | jnbe rel8_16 |
73 cb | jnc rel8 | 7+m,3 |
Jump short if not carry (CF=0) | jnc rel8_17 |
75 cb | jne rel8 | 7+m,3 |
Jump short if not equal (ZF=0) | jne rel8_18 |
7E cb | jng rel8 | 7+m,3 |
Jump short if not greater (ZF=1 or SF< | jng rel8_19 |
7C cb | jnge rel8 | 7+m,3 |
Jump short if not greater or equal (SF< | jnge rel8_20 |
7D cb | jnl rel8 | 7+m,3 |
Jump short if not less (SF=OF) | jnl rel8_21 |
7F cb | jnle rel8 | 7+m,3 |
Jump short if not less or equal (ZF=0 and SF=OF) | jnle rel8_22 |
71 cb | jno rel8 | 7+m,3 |
Jump short if not overflow (OF=0) | jno rel8_23 |
7B cb | jnp rel8 | 7+m,3 |
Jump short if not parity (PF=0) | jnp rel8_24 |
79 cb | jns rel8 | 7+m,3 |
Jump short if not sign (SF=0) | jns rel8_25 |
75 cb | jnz rel8 | 7+m,3 |
Jump short if not zero (ZF=0) | jnz rel8_26 |
70 cb | jo rel8 | 7+m,3 |
Jump short if overflow (OF=1) | jo rel8_27 |
7A cb | jp rel8 | 7+m,3 |
Jump short if parity (PF=1) | jp rel8_28 |
7A cb | jpe rel8 | 7+m,3 |
Jump short if parity even (PF=1) | jpe rel8_29 |
7B cb | jpo rel8 | 7+m,3 |
Jump short if parity odd (PF=0) | jpo rel8_30 |
78 cb | js rel8 | 7+m,3 |
Jump short if sign (SF=1) | js rel8_31 |
74 cb | jz rel8 | 7+m,3 |
Jump short if zero (ZF = 1) | jz rel8_32 |
0F 87 cw/cd | ja rel16/32 | 7+m,3 |
Jump near if above (CF=0 and ZF=0) | ja rel16 |
0F 83 cw/cd | jae rel16/32 | 7+m,3 |
Jump near if above or equal (CF=0) | jae rel16 |
0F 82 cw/cd | jb rel16/32 | 7+m,3 |
Jump near if below (CF=1) | jb rel16 |
0F 86 cw/cd | jbe rel16/32 | 7+m,3 |
Jump near if below or equal (CF=1 or ZF=1) | jbe rel16 |
0F 82 cw/cd | jc rel16/32 | 7+m,3 |
Jump near if carry (CF=1) | jc rel16 |
0F 84 cw/cd | je rel16/32 | 7+m,3 |
Jump near if equal (ZF=1) | je rel16 |
0F 84 cw/cd | jz rel16/32 | 7+m,3 |
Jump near if 0 (ZF=1) | jz rel16 |
0F 8F cw/cd | jg rel16/32 | 7+m,3 |
Jump near if greater (ZF=0 and SF=OF) | jg rel16 |
0F 8D cw/cd | jge rel16/32 | 7+m,3 |
Jump near if greater or equal (SF=OF) | jge rel16 |
0F 8C cw/cd | jl rel16/32 | 7+m,3 |
Jump near if less (SF< | jl rel16 |
0F 8E cw/cd | jle rel16/32 | 7+m,3 |
Jump near if less or equal (ZF=1 and SF< | jle rel16 |
0F 86 cw/cd | jna rel16/32 | 7+m,3 |
Jump near if not above (CF=1 or ZF=1) | jna rel16 |
0F 82 cw/cd | jnae rel16/32 | 7+m,3 |
Jump near if not above or equal (CF=1) | jnae rel16 |
0F 83 cw/cd | jnb rel16/32 | 7+m,3 |
Jump near if not below (CF=0) | jnb rel16 |
0F 87 cw/cd | jnbe rel16/32 | 7+m,3 |
Jump near if not below or equal (CF=0 and ZF=0) | jnbe rel16 |
0F 83 cw/cd | jnc rel16/32 | 7+m,3 |
Jump near if not carry (CF=0) | jnc rel16 |
0F 85 cw/cd | jne rel16/32 | 7+m,3 |
Jump near if not equal (ZF=0) | jne rel16 |
0F 8E cw/cd | jng rel16/32 | 7+m,3 |
Jump near if not greater (ZF=1 or SF< | jng rel16 |
0F 8C cw/cd | jnge rel16/32 | 7+m,3 |
Jump near if not greater or equal (SF< | jnge rel16 |
0F 8D cw/cd | jnl rel16/32 | 7+m,3 |
Jump near if not less (SF=OF) | jnl rel16 |
0F 8F cw/cd | jnle rel16/32 | 7+m,3 |
Jump near if not less or equal (ZF=0 and SF=OF) | jnle rel16 |
0F 81 cw/cd | jno rel16/32 | 7+m,3 |
Jump near if not overflow (OF=0) | jno rel16 |
0F 8B cw/cd | jnp rel16/32 | 7+m,3 |
Jump near if not parity (PF=0) | jnp rel16 |
0F 89 cw/cd | jns rel16/32 | 7+m,3 |
Jump near if not sign (SF=0) | jns rel16 |
0F 85 cw/cd | jnz rel16/32 | 7+m,3 |
Jump near if not zero (ZF=0) | jnz rel16 |
0F 80 cw/cd | jo rel16/32 | 7+m,3 |
Jump near if overflow (OF=1) | jo rel16 |
0F 8A cw/cd | jp rel16/32 | 7+m,3 |
Jump near if parity (PF=1) | jp rel16 |
0F 8A cw/cd | jpe rel16/32 | 7+m,3 |
Jump near if parity even (PF=1) | jpe rel16 |
0F 8B cw/cd | jpo rel16/32 | 7+m,3 |
Jump near if parity odd (PF=0) | jpo rel16 |
0F 88 cw/cd | js rel16/32 | 7+m,3 |
Jump near if sign (SF=1) | js rel16 |
0F 84 cw/cd | jz rel16/32 | 7+m,3 |
Jump near if 0 (ZF=1) | jz rel16 |
Notes
The first clock count is for the true condition (branch taken); the second clock count is for the false condition (branch not taken). rel16/32 indicates that these instructions map to two; one with a 16-bit relative displacement, the other with a 32-bit relative displacement, depending on the operand-size attribute of the instruction.
Operation
IF condition
THEN
EIP := EIP + SignExtend(rel8/16/32);
IF OperandSize = 16
THEN EIP := EIP AND 0000FFFFH;
FI;
FI;
Description
Conditional jumps (except JCXZ) test the flags which have been set by a previous instruction. The conditions for each mnemonic are given in parentheses after each description above. The terms "less" and "greater" are used for comparisons of signed integers; "above" and "below" are used for unsigned integers.
If the given condition is true, a jump is made to the location provided as the operand. Instruction coding is most efficient when the target for the conditional jump is in the current code segment and within -128 to +127 bytes of the next instruction's first byte. The jump can also target -32768 thru +32767 (segment size attribute 16) or -2^(31) thru +2^(31) -1 (segment size attribute 32) relative to the next instruction's first byte. When the target for the conditional jump is in a different segment, use the opposite case of the jump instruction (i.e., JE and JNE), and then access the target with an unconditional far jump to the other segment. For example, you cannot code--
JZ FARLABEL;
You must instead code--
JNZ BEYOND;
JMP FARLABEL;
BEYOND:
Because there can be several ways to interpret a particular state of the flags, ASM386 provides more than one mnemonic for most of the conditional jump opcodes. For example, if you compared two characters in AX and want to jump if they are equal, use JE; or, if you ANDed AX with a bit field mask and only want to jump if the result is 0, use JZ, a synonym for JE.
JCXZ differs from other conditional jumps because it tests the contents of the CX or ECX register for 0, not the flags. JCXZ is useful at the beginning of a conditional loop that terminates with a conditional loop instruction (such as LOOPNE TARGET LABEL). The JCXZ prevents entering the loop with CX or ECX equal to zero, which would cause the loop to execute 64K or 32G times instead of zero times.
Flags Affected
None
Protected Mode Exceptions
#GP(0) if the offset jumped to is beyond the limits of the code segment
Real Address Mode Exceptions
None
Virtual 8086 Mode Exceptions
None
[Home Page dell'ITIS "Fermi"]
[80386 Programmer's Reference Manual Index]
[Previous]
[Next]
|