SlideShare a Scribd company logo
3
Most read
8
Most read
10
Most read
ASSEMBLY LANGUAGE
COURCE CODE#CSC221
JUMPS
BY:
NADEEM AHMED
JUMP
 A jump is a instruction used to control the flow of
program.
Types of jumps:
1. Unconditional Jump
2. Conditional Jump
Unconditional Jump
 A jump without using any condition is known as
unconditional jump.
Or
Jump to label without any condition.
syntax:
JMP label_name
Example:
Label1:
mov dl,'a'
mov ah,02
int 21h
jmp Label1
Conditional Jump
 A jump with using condition is known as
conditional jump.
Or
Jump to label with condition.
syntax:
J<condition> label_name
(Let us discuss the CMP instruction before discussing the
conditional instructions.)
CMP Instruction
 Compares the destination operand to the source operand
Nondestructive subtraction of source from destination (destination
operand is not changed)
Syntax:
CMP destination, source
Note:
Cmp reg, reg Cmp dl,aI
Cmp reg, constant Cmp dl, 3
Cmp reg, [memory address] Cmp dl, [sI]
(1 of 3)
CMP Instruction
• Case 3: destination > source
mov al,6
mov bl,5
cmp al,bl
; ZF = 0, CF = 0
(2 of 3)
mov al,5
mov bl,5
cmp al,bl
; Zero flag set
Case 1: destination == source
mov al,4
mov bl,5
cmp al,bl
; Carry flag set
• Case 2: destination < source
The comparisons shown here are performed with “Unsigned"
integers.
CMP Instruction (3 of 3)
• Case 1: destination >source
mov al,5
Mov bl,-2
cmp al,bl
; Sign flag == Overflow flag
• Case 2 : destination < source
mov al,-1
Mov bl,5
cmp al,bl
; Sign flag != Overflow flag
The comparisons shown here are performed with "signed"
integers.
Conditional Jump For Unsigned Numbers
 Following are the conditional jump instructions used on
unsigned data used for logical operations −
Instruction Description Flags tested
JE/JZ Jump Equal or Jump Zero ZF
JNE/JNZ Jump not Equal or Jump Not Zero ZF
JA/JNBE Jump Above or Jump Not Below/Equal CF, ZF
JAE/JNB Jump Above/Equal or Jump Not Below CF
JB/JNAE Jump Below or Jump Not Above/Equal CF
JBE/JNA Jump Below/Equal or Jump Not Above AF, CF
Conditional Jump For Signed Numbers
 Following are the conditional jump instructions used on
unsigned data used for logical operations −
Instruction Description Flags tested
JE/JZ Jump Equal or Jump Zero ZF
JNE/JNZ Jump not Equal or Jump Not Zero ZF
JG/JNLE Jump Greater or Jump Not Less/Equal OF, SF, ZF
JGE/JNL Jump Greater/Equal or Jump Not Less OF, SF
JL/JNGE Jump Less or Jump Not Greater/Equal OF, SF
JLE/JNG Jump Less/Equal or Jump Not Greater OF, SF, ZF
Conditional Jump With Flags
 The following conditional jump instructions have special
uses and check the value of flags −
Instruction Description Flags tested
JC Jump If Carry CF
JNC Jump If No Carry CF
JO Jump If Overflow OF
JNO Jump If No Overflow OF
JP/JPE Jump Parity or Jump Parity Even PF
JNP/JPO Jump No Parity or Jump Parity Odd PF
JS Jump Sign (negative value) SF
JNS Jump No Sign (positive value) SF
Any Question?

More Related Content

PPT
Assembly language programming_fundamentals 8086
PPTX
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
PDF
Assembly language 8086
PPTX
Addressing modes
PPT
Assembly Language Basics
PPTX
Assembly 8086
POT
Arrays and addressing modes
PPTX
MACRO PROCESSOR
Assembly language programming_fundamentals 8086
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly language 8086
Addressing modes
Assembly Language Basics
Assembly 8086
Arrays and addressing modes
MACRO PROCESSOR

What's hot (20)

PPTX
Flag Registers (Assembly Language)
PPTX
Stack and its usage in assembly language
PPT
Computer Organization and Assembly Language
PPTX
Microoperations
PDF
Chapter 6 Flow control Instructions
PPTX
Direct memory access (dma)
PPTX
Computer registers
PPT
Assembly Language Lecture 1
PPTX
Instruction codes
PPTX
Register transfer language
PDF
Computer Organization Lecture Notes
PPTX
Signed Addition And Subtraction
PPTX
Unit 4-booth algorithm
PDF
Symbol table in compiler Design
PPT
1.1 binary tree
PPT
Instruction cycle
PPT
Types of instructions
PDF
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
PDF
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
PPTX
Theory of Computation Unit 1
Flag Registers (Assembly Language)
Stack and its usage in assembly language
Computer Organization and Assembly Language
Microoperations
Chapter 6 Flow control Instructions
Direct memory access (dma)
Computer registers
Assembly Language Lecture 1
Instruction codes
Register transfer language
Computer Organization Lecture Notes
Signed Addition And Subtraction
Unit 4-booth algorithm
Symbol table in compiler Design
1.1 binary tree
Instruction cycle
Types of instructions
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
Theory of Computation Unit 1
Ad

Similar to Jumps in Assembly Language. (20)

PPT
Al2ed chapter8
PPT
microcontroller.ppt
PPTX
Chapter3 program flow control instructions
PPTX
Chap3 program flow control instructions
PPTX
Jump&Loop instruction
PPTX
Assembly jmp presentation
PPTX
PPTX
Program control instructions
PPT
Chapt 06
PPT
Chapt 06
PPTX
Branch instructions in 8051 micrcocontroller
PPTX
Conditional jump
PDF
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
PPT
Assembly Language Lecture 5
PPT
chapt5 and 06assemblylanguagecodesandmachinelanguage.ppt
PPTX
Flow control instructions
PPT
3_JumpAndCall_v21_presenatationb also.ppt
PPTX
Microprocessor Week 7: Branch Instruction
PPT
1344 Alp Of 8086
PPTX
LECTURE_5 Program Control Instructions.pptx
Al2ed chapter8
microcontroller.ppt
Chapter3 program flow control instructions
Chap3 program flow control instructions
Jump&Loop instruction
Assembly jmp presentation
Program control instructions
Chapt 06
Chapt 06
Branch instructions in 8051 micrcocontroller
Conditional jump
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Lecture 5
chapt5 and 06assemblylanguagecodesandmachinelanguage.ppt
Flow control instructions
3_JumpAndCall_v21_presenatationb also.ppt
Microprocessor Week 7: Branch Instruction
1344 Alp Of 8086
LECTURE_5 Program Control Instructions.pptx
Ad

More from NA000000 (17)

PDF
JAVA Naming Conventions By NADEEM AHMED FROM DEPALPUR
PPTX
Line Of Code(LOC) In Software Engineering By NADEEM AHMED FROM DEPALPUR
PPTX
Critical Path Method In Software Engineering By NADEEM AHMED
PPTX
COCOMO Modal In Software Engineering By NADEEM AHMED
PPT
LEGACY SYSTEM In Software Engineering By NADEEM AHMED
PPTX
Modal Driven Architecture In Software Engineering By NADEEM AHMED
PPTX
Software Testing By NADEEM AHMED FROM DEPALPUR
PPTX
Software Inspection By NADEEM AHMED FROM DEPALPUR
PPTX
Cleanroom Software Engineering By NADEEM AHMED FROM DEPALPUR
PPTX
UML Diagrams By NADEEM AHMED FROM DEPALPUR
DOCX
Biometrics
PPTX
Computer Networks By NADEEM AHMED
PPTX
Cloud computing by NADEEM AHMED
DOCX
Iot proposal by nadeem ahmed
PPTX
Biomatric
DOCX
Assignment#1
DOC
Project proposal oop
JAVA Naming Conventions By NADEEM AHMED FROM DEPALPUR
Line Of Code(LOC) In Software Engineering By NADEEM AHMED FROM DEPALPUR
Critical Path Method In Software Engineering By NADEEM AHMED
COCOMO Modal In Software Engineering By NADEEM AHMED
LEGACY SYSTEM In Software Engineering By NADEEM AHMED
Modal Driven Architecture In Software Engineering By NADEEM AHMED
Software Testing By NADEEM AHMED FROM DEPALPUR
Software Inspection By NADEEM AHMED FROM DEPALPUR
Cleanroom Software Engineering By NADEEM AHMED FROM DEPALPUR
UML Diagrams By NADEEM AHMED FROM DEPALPUR
Biometrics
Computer Networks By NADEEM AHMED
Cloud computing by NADEEM AHMED
Iot proposal by nadeem ahmed
Biomatric
Assignment#1
Project proposal oop

Recently uploaded (20)

PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PDF
Open folder Downloads.pdf yes yes ges yes
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Introduction-to-Social-Work-by-Leonora-Serafeca-De-Guzman-Group-2.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Pharma ospi slides which help in ospi learning
PDF
Insiders guide to clinical Medicine.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Abdominal Access Techniques with Prof. Dr. R K Mishra
Renaissance Architecture: A Journey from Faith to Humanism
Basic Mud Logging Guide for educational purpose
Microbial diseases, their pathogenesis and prophylaxis
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
TR - Agricultural Crops Production NC III.pdf
The Final Stretch: How to Release a Game and Not Die in the Process.
Open Quiz Monsoon Mind Game Final Set.pptx
Open folder Downloads.pdf yes yes ges yes
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Introduction-to-Social-Work-by-Leonora-Serafeca-De-Guzman-Group-2.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Pharma ospi slides which help in ospi learning
Insiders guide to clinical Medicine.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf

Jumps in Assembly Language.

  • 2. JUMP  A jump is a instruction used to control the flow of program. Types of jumps: 1. Unconditional Jump 2. Conditional Jump
  • 3. Unconditional Jump  A jump without using any condition is known as unconditional jump. Or Jump to label without any condition. syntax: JMP label_name Example: Label1: mov dl,'a' mov ah,02 int 21h jmp Label1
  • 4. Conditional Jump  A jump with using condition is known as conditional jump. Or Jump to label with condition. syntax: J<condition> label_name (Let us discuss the CMP instruction before discussing the conditional instructions.)
  • 5. CMP Instruction  Compares the destination operand to the source operand Nondestructive subtraction of source from destination (destination operand is not changed) Syntax: CMP destination, source Note: Cmp reg, reg Cmp dl,aI Cmp reg, constant Cmp dl, 3 Cmp reg, [memory address] Cmp dl, [sI] (1 of 3)
  • 6. CMP Instruction • Case 3: destination > source mov al,6 mov bl,5 cmp al,bl ; ZF = 0, CF = 0 (2 of 3) mov al,5 mov bl,5 cmp al,bl ; Zero flag set Case 1: destination == source mov al,4 mov bl,5 cmp al,bl ; Carry flag set • Case 2: destination < source The comparisons shown here are performed with “Unsigned" integers.
  • 7. CMP Instruction (3 of 3) • Case 1: destination >source mov al,5 Mov bl,-2 cmp al,bl ; Sign flag == Overflow flag • Case 2 : destination < source mov al,-1 Mov bl,5 cmp al,bl ; Sign flag != Overflow flag The comparisons shown here are performed with "signed" integers.
  • 8. Conditional Jump For Unsigned Numbers  Following are the conditional jump instructions used on unsigned data used for logical operations − Instruction Description Flags tested JE/JZ Jump Equal or Jump Zero ZF JNE/JNZ Jump not Equal or Jump Not Zero ZF JA/JNBE Jump Above or Jump Not Below/Equal CF, ZF JAE/JNB Jump Above/Equal or Jump Not Below CF JB/JNAE Jump Below or Jump Not Above/Equal CF JBE/JNA Jump Below/Equal or Jump Not Above AF, CF
  • 9. Conditional Jump For Signed Numbers  Following are the conditional jump instructions used on unsigned data used for logical operations − Instruction Description Flags tested JE/JZ Jump Equal or Jump Zero ZF JNE/JNZ Jump not Equal or Jump Not Zero ZF JG/JNLE Jump Greater or Jump Not Less/Equal OF, SF, ZF JGE/JNL Jump Greater/Equal or Jump Not Less OF, SF JL/JNGE Jump Less or Jump Not Greater/Equal OF, SF JLE/JNG Jump Less/Equal or Jump Not Greater OF, SF, ZF
  • 10. Conditional Jump With Flags  The following conditional jump instructions have special uses and check the value of flags − Instruction Description Flags tested JC Jump If Carry CF JNC Jump If No Carry CF JO Jump If Overflow OF JNO Jump If No Overflow OF JP/JPE Jump Parity or Jump Parity Even PF JNP/JPO Jump No Parity or Jump Parity Odd PF JS Jump Sign (negative value) SF JNS Jump No Sign (positive value) SF