0% found this document useful (0 votes)
235 views5 pages

Renamed Conditional Jumps: COAL-CS-255-A - 2

This is my assignment on Conditional Jumps from Computer Organization and assembly language subject.

Uploaded by

Usama Raheem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
235 views5 pages

Renamed Conditional Jumps: COAL-CS-255-A - 2

This is my assignment on Conditional Jumps from Computer Organization and assembly language subject.

Uploaded by

Usama Raheem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

MAY 24, 2021

RENAMED CONDITIONAL JUMPS


COAL-CS-255-ASSIGNMENT-2
Submitted to: Mr. Tanveer-Arshad

USAMA RAHEEM-002 🍁
CS-19-A
University of Gujrat-Hafiz-Hayat-Campus
RENAMED CONDITIONAL JUMPS

Contents
1.Conditional Jumps Instructions ..................................................................................................................................2
1.1 Unconditional jump......................................................................................................................................2
1.2 Conditional jump ..........................................................................................................................................2
2. How to Use Conditional Jumps ..................................................................................................................................2
3. Conditional Jump Syntax ...........................................................................................................................................2
4. Conditional Jumps List ...............................................................................................................................................3
5. Jumps Based on CX and ECX ......................................................................................................................................3
6. Signed Jumps Comparison .........................................................................................................................................3
7. Unsigned Jumps Comparison .....................................................................................................................................4
8. Renamed Conditional Jumps .....................................................................................................................................4

COAL-CS-255 19011519-002

USAMA RAHEEM-002 🍁 1
RENAMED CONDITIONAL JUMPS

1.Conditional Jumps Instructions


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 can be performed or observed in two scenarios. These scenarios are given below:
1.1 Unconditional Jumps
1.2 Conditional Jumps

1.1 Unconditional jump


This is performed by the JMP instruction. Conditional execution 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 or to re-execute the
same steps.

1.2 Conditional jump


This Jump 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.

2. How to Use Conditional Jumps


There are no high-level control structures in assembly language. The most common way to
transfer control in assembly language is to use a conditional jump. This is a two-step process
which I’m going to describe below:
Steps:
1. First test the condition.
2. Then jump if the condition is true or continue if it is false.
• Note: Conditional jump instructions can be divided into four groups
3. Jumps based on the value of a single arithmetic flag
4. Jumps based on the value of CX or ECX
5. Jumps based on comparisons of signed operands
6. Jumps based on comparisons of unsigned operands

3. Conditional Jump Syntax


Conditional Jump instructions have the following syntax:
Syntax: Jcond destination ;cond is the jump condition
This is the Conditional jump instructions syntax, which is being used in assembly language. Below,
I’m going to describe briefly the renamed conditional jump instructions. First of all, I’m going to
quote, what we’re studied about these Renamed conditional jumps then, later on, trying to
explain these conditional jumps with description.
COAL-CS-255 19011519-002

USAMA RAHEEM-002 🍁 2
RENAMED CONDITIONAL JUMPS

4. Conditional Jumps List


Below I’m going to demonstrate the list of Jumps, which are based on the zero, carry,
Overflow, sign and last of them the Parity flag.
Table.1
Mnemonics Description Flags
JZ, JE Jump if Zero, Jump if Equal ZF=1
JNZ, JNE Jump if Not Zero, Jump if Not Equal ZF=0
JC Jump if Carry CF=1
JNC Jump if No Carry CF=0
JO Jump if Overflow OF=1
JNO Jump if No Overflow OF=0
JS Jump if Signed (Negative) SF=1
JNS Jump if Not Signed (Positive or Zero) SF=0
JP, JPE Jump if Parity, jump if Parity is Even PF=1
JNP, JPO Jump if Not Parity, jump if Parity is Odd PF=0

5. Jumps Based on CX and ECX


The table given below simply demonstrate the Jumps based on the value of CX and ECX.
Table.2

Mnemonics Description/Demonstration
JCXZ This Jumps if CX = 0
JECXZ And this Jumps if ECX = 0

6. Signed Jumps Comparison


Next, I am going to elaborate the signed and unsigned Jumps. The following table given below
shows a list of signed jumps based on comparison of signed operands.
Table.3

Mnemonics Description Condition Tested


JG, JNLE Jump if Greater, Jump if Not Less or equal ZF=0 & SF=OF
JGE, JNL Jump if Greater or Equal, Jump if not less SF=OF
JL, JNGE Jump if Less, Jump if not Greater or Equal SF not equal to OF
JLE, JNG Jump if Less or Equal, Jump if Not Greater ZF=1 or SF not equal OF

COAL-CS-255 19011519-002

USAMA RAHEEM-002 🍁 3
RENAMED CONDITIONAL JUMPS

7. Unsigned Jumps Comparison


There’s a list of Unsigned jumps based on the comparisons of Unsigned Operands. The
comparison is given below:
Table.3

Mnemonics Description Condition Tested


JA, JNBE Jump if Above, Jump if Not below or Equal ZF=0 and CF=0
JAE, JNB Jump if above or equal, jump if not below CF=0
JB, JNAE Jump if below, jump if not Above or equal CF=1
JBE, JNA Jump if Below or Equal, Jump if not Above ZF=1 or CF=1

8. Renamed Conditional Jumps


Table.4

OLD Name New Name Description


JNBE JA Jump Not Below/Equal or Jump
Above
JNB JAE Jump Not Below or Jump Above
Equal
JNAE JB Jump Not Above/Equal or Jump
Below
JNA JBE Jump Not Above or Jump
Below/Equal
JZ JE Jump Equal or Jump Zero

JNLE JG Jump Not Less/Equal or Jump


Greater
JNL JGE Jump Not Less or Jump Greater
/Equal
JNGE JL Jump Not Greater / Equal or
Jump Less
JNG JLE Jump not Greater or Jump Less
/Equal
JNZ JNE Jump Not Equal or Jump Not
Zero
JPO JNP Jump Parity Odd or Jump No
Parity
JPE JP Jump Parity Even or Jump Parity

----------------------------
COAL-CS-255 19011519-002

USAMA RAHEEM-002 🍁 4

You might also like