 Conditional Jump Instructions Unsigned Conditional Jump Inst Single-Flag Based Jump Instructions The Pentium instruction set provides two types of jump instructions that are based on testing a single flag. One type is for jumps taken if the flag is set and the other for jumps taken if the flag is clear. There are two instructions for each of the flags: CF, OF, SF, ZF, PF. The only flag, from the arithmetic flags, that does not have such instructions is the Auxiliary Flag. These instructions are summarized in the table below.

 Instruction Description Condition Aliases JC Jump if carry CF = 1 JB, JNAE JNC Jump if no carry CF = 0 JNB, JAE JZ Jump if zero ZF = 1 JE JNZ Jump if not zero ZF = 0 JNE JS Jump if sign SF = 1 JNS Jump if no sign SF = 0 JO Jump if overflow OF = 1 JNO Jump if no overflow OF = 0 JP Jump if parity PF = 1 JPE JPE Jump if parity even PF = 1 JP JNP Jump if no parity PF = 0 JPO JPO Jump if parity odd PF = 0 JNP

There are many applications for these instructions. For example, to check if the result is positive or negative, one can use the JNS and JS instructions. To check if the result of an operation on a signed number is correct or not, one can use the instructions JO and JNO. To check if the result is zero or not, one can use the instructions JZ and JNZ. To check if the result of comparing two values is equal or not, one can also use the JZ/JE and JNZ/JNE instructions. To check if the result of an operation on an unsigned number is correct or not, once can use the instructions JC and JNC. Furthermore, to check if the last bit shifted or rotated is 1 or 0, one can use the instructions JC and JNC.

The next example demonstrates the use of the JC instruction in counting the number of 0's in register AL and storing the count in register AH.

 Example: Use of the JC instruction. ``` XOR AH, AH ‎‎ MOV CX, 8‎ Next: ROL AL, 1 ‎ ‎ JC Skip‎ ‎ ‎ INC AH Skip: LOOP Next ‎```

In the next example, we demonstrate the use of the JNC instruction in displaying the binary content of register BX.

 Example: Use of the JNC instruction. ``` MOV AH, 2 ‎‎ MOV CX, 16 Next: MOV DL, 30H ROL BX, 1 ‎ ‎ JNC Skip‎ ‎ ‎ ADD DL, 1 Skip: INT 21H LOOP Next ‎```

The following example illustrates the use of the JNZ instruction. Notice that the loop is iterated until the content of BX becomes equal to zero and the zero flag (ZF) is set to one.
 Fig. m08070.1 Example of a Flag Based Jump Instruction