Slide 11.2: Conditional jumps
Slide 11.4: Boolean instructions
Home

Conditional Jumps (Cont.)


Jumps Based on Unsigned Comparisons

The table on the right shows a list of jumps based on comparisons of unsigned integers.
Mnemonic Description
JA Jump if above (if leftOp > rightOp)
JNBE Jump if not below or equal (same as JA)
JAE Jump if above or equal (if leftOp ≥ rightOp)
JNB Jump if not below (same as JAE)
JB Jump if below (if leftOp < rightOp)
JNAE Jump if not above or equal (same as JB)
JBE Jump if below or equal (if leftOp ≤ rightOp)
JNA Jump if not above (same as JBE)

Jumps Based on Signed Comparisons

The table on the right shows a list of jumps based on comparisons of signed integers.
Mnemonic Description
JG Jump if greater (if leftOp > rightOp)
JNLE Jump if not less than or equal (same as JG)
JGE Jump if greater than or equal (if leftOp ≥ rightOp)
JNL Jump if not less (same as JGE)
JL Jump if less (if leftOp < rightOp)
JNGE Jump if not greater than or equal (same as JB)
JLE Jump if less than or equal (if leftOp ≤ rightOp)
JNG Jump if not greater (same as JLE)

 jecxz   ja   jg 
 .code
     mov    eax, 0
     mov    ecx, 10
 L1: add    eax, ecx
     dec    ecx
     jecxz  L2
     jmp    L1
 L2: call   WriteDec
 .code
     mov   al, -128
     cmp   al, 1
     ja    L1
     call  WaitMsg
 L1:
 .code
     mov   al, -128
     cmp   al, 1
     jg    L1
     call  WaitMsg
 L1:
 Output  Output  Output