What I have learned in this module

What I have learned in this module

by Anando Nath Rabidas -
Number of replies: 0


Conditional execution in assembly language is accomplished by several looping and branching instructions. These instructions can change the flow of control in a program. Conditional execution is observed in two scenarios −

Unconditional jump

This is performed by the JMP instruction. Conditional execution often involves a transfer of control to the address of an instruction that does not follow the currently executing instruction. Transfer of control may be forward, to execute a new set of instructions or backward, to re-execute the same steps.

Conditional jump

This is performed by a set of jump instructions j<condition> depending upon the condition. The conditional instructions transfer the control by breaking the sequential flow and they do it by changing the offset value in IP.

CMP Instruction

The CMP instruction compares two operands. It is generally used in conditional execution. This instruction basically subtracts one operand from the other for comparing whether the operands are equal or not. It does not disturb the destination or source operands. It is used along with the conditional jump instruction for decision making. 

JE/JZJump Equal or Jump ZeroZF
JNE/JNZJump not Equal or Jump Not ZeroZF
JG/JNLEJump Greater or Jump Not Less/Equal
JGE/JNLJump Greater/Equal or Jump Not Less
JL/JNGEJump Less or Jump Not Greater/Equal
JLE/JNGJump Less/Equal or Jump Not Greater

CMP	AL, BL
JE	EQUAL
CMP	AL, BH
JE	EQUAL
CMP	AL, CL
JE	EQUAL
NON_EQUAL:
EQUAL: