The second feature that processors have is the ability to change the execution flow of a program based on a given condition. In every assembly language, there are multiple comparison instructions and flow control instructions. The flow control instructions can be divided into the following categories:
- Unconditional jump: This is a type of instruction that forcefully changes the flow of the execution to another address (without any given condition).
- Conditional jump: This is like a logical gate that switches to another branch based on the given condition (such as equal to zero, greater than, or lower than), as shown in the following figure:
Figure 2: An example of a conditional jump
- Call: This changes the execution to another function and saves the return address to be restored later if necessary.