Slide 11.1: Conditional processing
Slide 11.3: Conditional jumps (cont.)
Home

Conditional Jumps


A conditional jump instruction branches to a destination label when a flag condition is true. If the flag condition is false, the instruction immediately following the conditional jump is executed. The syntax is
      Jcond  destination
cond refers to a flag condition identifying the state of one or more flags. The conditional jump instructions are partitioned into four groups:
  • Based on comparisons of unsigned operands.
  • Based on comparisons of signed operands.
Jumps Based on Flag Values
The table on the right shows a list of jumps based on specific CPU flag values: Zero, Carry, Overflow, Parity, and Sign.
Mnemonic Description Flags
JZ Jump if zero ZF = 1
JNZ Jump if not zero ZF = 0
JC Jump if carry CF = 1
JNC Jump if not carry CF = 0
JO Jump if overflow OF = 1
JNO Jump if not overflow OF = 0
JS Jump if signed SF = 1
JNS Jump if not signed SF = 0
JP Jump if parity (even) PF = 1
JNP Jump if not parity (odd) PF = 0

Mnemonic Description
JE Jump if equal (leftOp = rightOp)
JNE Jump if not equal (leftOp ≠ rightOp)
JCXZ Jump if CX = 0
JECXZ Jump if ECX = 0
Jumps Based on Equality Comparisons or the Values of CX or ECX

The notation leftOp and rightOp refers to the left (destination) and right (source) operands in a CMP instruction: CMP leftOp, rightOp