Flow control instructions are used to control the flow of a program.
Flow control instructions can be of two types: unconditional and conditional.
The JMP instruction is the only unconditional flow control instruction.

The conditional flow control instructions come in three types:

Jump instructions that test a single flag
Jump instructions after Unsigned Comparisons
Jump instructions after Signed Comparisons

Such Jump instructions are usually used after a compare (CMP) instruction, arithmetic, logic, or shift operations.

Another type of flow control instruction is the LOOP instruction that is usually used to get the same effect as a FOR loop in high level languages.

Main Topics

This unit covers the following topics:

CMP instruction
Unconditional jump instructions
Short, near and far jumps.
Direct and indirect jumps.
Conditional jump instructions
Loop instructions
High level decision structures

Conditional Jump Instructions

These consist of the following jump instructions:

Single Flag based jump instructions
Unsigned conditional jump
Signed conditional jump

High Level Conditional Structures

These consist of the following constructs:

Branches with compound conditions
For loop
While loop
Repeat Until loop