Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 8

Assembly Language

Lecture#12
Flow Control Instructions
Flow control instructions for jumps, loops and
conditional jumps allow us to control the
execution of program statements and to build high-
level programming structures such as if-else
statements and loops in assembler programs.
Compare instruction
The compare instruction is used to compare two
numbers.

Example:
CMP AX, BX
Jump Instructions
The jump instructions are used to transfer the flow
of the program to the indicated operator.

The Unconditional Jump


The unconditional jump may be used to make
infinite loops.

Example:
JMP unconditional
The Conditional Unsigned Jump
Instructions
Used after comparisons of unsigned numbers.

Instruction Meaning (Jump If)


JA JNBE above (not below or equal)
JAE JNB above or equal (not below)
JB JNAE below (not above or equal)
JBE JNA below or equal (not above)
The Conditional Signed Jump Instructions

Instruction Meaning (Jump If)


JG JNLE greater (not lower or equal)
JGE JNL greater or equal (not lower)
JL JNGE lower (not greater or equal)
JLE JNG lower or equal (not greater)
JCXZ LOOP CX register is zero
The Conditional Signed/Unsigned Jump
Instructions
These instructions are used for comparing both signed
and unsigned numbers

Instruction Meaning
JE JZ Jump if zero flag set. i.e. last result
equal 0
JNE JNZ Jump if zero flag not set. i.e. last
result not equal 0

You might also like