SlideShare a Scribd company logo
1 of 8
Microprocessor & its Applications
Module 3 Continued……
Dr. Girisha G S
Dept. of CSE
SoE, DSU, Bengaluru
1
Agenda
• Program Control Instructions
• Jump Group
- unconditional jump
- conditional jump
Program Control Instructions
- Program control instructions change or modify the flow of a program
Jump Group of instructions
Jump instructions are classified in to two groups
1. Unconditional Jump
- Control is transferred unconditionally to the
target label which points to the address of target
instruction
E.g. Jmp, call, ret
2. Conditional Jump
- Control is transferred to the target label if a certain
condition is met, otherwise execution continues
with next sequential instruction
- The condition are represented by flags
E.g. jc, jz, jnc, jnz
JMP - Unconditional Jump
• Three types : short jump, near jump, and far jump.
• The short jump is a two-byte instruction that allows jumps or branches
to memory locations within +127 and -128 bytes from the address
following the jump.
• A near jump is a three-byte instruction that allows a branch or jump
within ±32K bytes from the instruction in the current code segment.
• far jump is a 5 byte instruction that allows a jump to any memory
location within the real memory system.
• The short and near jumps are often called intrasegment jumps
• the far jumps are often called intersegment jumps.
The general form of the JMP instruction is
jmp label
where label is a program address indentifier
• This instruction unconditionally transfer control of the execution to the specified label
(address) using an 8 bit or 16 bit displacement or CS:IP.
• No flags are affected by this instruction.
• When this instruction is executed ,the CS & IP are unconditionally modified to a new
value of CS & IP corresponding to the location transferred
Short Jump
• Short jumps are called relative jumps because they can be moved to any
location in current code segment without a change
• A short jump to four
memory locations
beyond the address of
the next instruction.
• The short jump instruction appears in figure below.
• Example shows how short jump instructions
pass control from one part of the program
to another.
Example
jmp short next (use short directive to force short jump).
Near Jump
• The near jump is similar to the short jump, except that the distance is
farther.
• A near jump passes control to an instruction in the current code segment
located within ±32K bytes from the near jump instruction.
A near jump that adds the
displacement (0002H) to
contents of IP.
• The near jump is a 3-byte instruction that
contains an opcode followed by a signed
16-bit displacement.
E.g. jmp next
Far Jump
• A far jump instruction transfer control to the target location in different
code segment. This is performed by loading CS with segment address in
which the target exist & IP with the offset address of a instruction to
which control is to be transferred in the new code segment.
• The target address loaded in CS & IP are part of the instruction itself. This is a
5 byte instruction.
A far jump instruction replaces the contents of
both CS and IP with 4 bytes following the
opcode.
E.g. jmp far ptr skip
Conditional Jumps Instructions
• The conditional jump instruction transfer control to the address specified (target location)
if some condition is met or satisfied otherwise execution continues sequentially.
• The condition here means the status of the condition flags. The conditional jump
instructions test the following flag bits: sign(S), zero(Z), carry (C), parity(P), overflow(O).
Instruction Condition Tested Comment
JA C = 0 and Z = 0 Jump above
JAE C = 0 Jump above or equal to
JB C = 1 Jump below
JBE C = 1 or Z = 1 Jump below or equal to
JC C=1 Jump carry set
JE or JZ Z = 1 Jump equal to or jump zero
JG Z = 0 and S = 0 Jump greater than
JGE S = 0 Jump greater than or equal to
JL S ≠ 0 Jump less than
JLE Z = 1 or S ≠ 0 Jump less than or equal to
JNC C = 0 Jump carry cleared
JNE or JNZ Z = 0 Jump not equal to or jump not zero
JNO 0 = 0 Jump no overflow
JNS S = 0 Jump no sign
JNP/JPO P = 0 Jump no parity/jump parity odd
JO 0 = 1 Jump on overflow
JP/JPE P= 1 Jump on parity/jump parity even
JS S = 1 Jump on sign
If the condition under test is true, a branch to the label associated with the jump
instruction occurs..
If the condition is false, the next sequential instruction in the program executes.
For example, a JC will jump if the carry bit is set.

More Related Content

What's hot

instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle pptsheetal singh
 
Counters & time delay
Counters & time delayCounters & time delay
Counters & time delayHemant Chetwani
 
Stack organization
Stack organizationStack organization
Stack organizationchauhankapil
 
8085 interrupts
8085 interrupts8085 interrupts
8085 interruptsRam Babu
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output OrganizationKamal Acharya
 
Stack and its usage in assembly language
Stack and its usage in assembly language Stack and its usage in assembly language
Stack and its usage in assembly language Usman Bin Saad
 
Computer architecture control unit
Computer architecture control unitComputer architecture control unit
Computer architecture control unitMazin Alwaaly
 
Types of Addressing modes- COA
Types of Addressing modes- COATypes of Addressing modes- COA
Types of Addressing modes- COARuchi Maurya
 
Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1deval patel
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorAshita Agrawal
 
Interfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorInterfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorVikas Gupta
 
MASTER SLAVE JK FLIP FLOP & T FLIP FLOP
MASTER SLAVE JK FLIP FLOP & T FLIP FLOPMASTER SLAVE JK FLIP FLOP & T FLIP FLOP
MASTER SLAVE JK FLIP FLOP & T FLIP FLOPSmit Shah
 
Architecture of 8085 microprocessor
Architecture of 8085 microprocessorArchitecture of 8085 microprocessor
Architecture of 8085 microprocessorAMAN SRIVASTAVA
 

What's hot (20)

Instruction format
Instruction formatInstruction format
Instruction format
 
instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle ppt
 
Instruction cycle
Instruction cycleInstruction cycle
Instruction cycle
 
Data transferschemes
Data transferschemesData transferschemes
Data transferschemes
 
Counters & time delay
Counters & time delayCounters & time delay
Counters & time delay
 
Stack organization
Stack organizationStack organization
Stack organization
 
8085 interrupts
8085 interrupts8085 interrupts
8085 interrupts
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output Organization
 
Stack and its usage in assembly language
Stack and its usage in assembly language Stack and its usage in assembly language
Stack and its usage in assembly language
 
Computer architecture control unit
Computer architecture control unitComputer architecture control unit
Computer architecture control unit
 
Instruction formats-in-8086
Instruction formats-in-8086Instruction formats-in-8086
Instruction formats-in-8086
 
Types of Addressing modes- COA
Types of Addressing modes- COATypes of Addressing modes- COA
Types of Addressing modes- COA
 
Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 Microprocessor
 
Interfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorInterfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessor
 
MASTER SLAVE JK FLIP FLOP & T FLIP FLOP
MASTER SLAVE JK FLIP FLOP & T FLIP FLOPMASTER SLAVE JK FLIP FLOP & T FLIP FLOP
MASTER SLAVE JK FLIP FLOP & T FLIP FLOP
 
ADDRESSING MODES
ADDRESSING MODESADDRESSING MODES
ADDRESSING MODES
 
8086 micro processor
8086 micro processor8086 micro processor
8086 micro processor
 
Architecture of 8085 microprocessor
Architecture of 8085 microprocessorArchitecture of 8085 microprocessor
Architecture of 8085 microprocessor
 
Interrupts and types of interrupts
Interrupts and types of interruptsInterrupts and types of interrupts
Interrupts and types of interrupts
 

Similar to Program control instructions

Chap3 program flow control instructions
Chap3 program flow control instructionsChap3 program flow control instructions
Chap3 program flow control instructionsHarshitParkar6677
 
Chapter3 program flow control instructions
Chapter3 program flow control instructionsChapter3 program flow control instructions
Chapter3 program flow control instructionsHarshitParkar6677
 
Jumps in Assembly Language.
Jumps in Assembly Language.Jumps in Assembly Language.
Jumps in Assembly Language.NA000000
 
program-control-instruction.pdf
program-control-instruction.pdfprogram-control-instruction.pdf
program-control-instruction.pdfBapanKar2
 
Flow control instructions
Flow control instructionsFlow control instructions
Flow control instructionsProdip Ghosh
 
Control Structures.pptx
Control Structures.pptxControl Structures.pptx
Control Structures.pptxssuserfb3c3e
 
Data transfer and manipulation
Data transfer and  manipulationData transfer and  manipulation
Data transfer and manipulationPreethaPreetha5
 
ppt-U2 - (Instruction Set of 8086, Simple programs).pptx
ppt-U2 - (Instruction Set of 8086, Simple programs).pptxppt-U2 - (Instruction Set of 8086, Simple programs).pptx
ppt-U2 - (Instruction Set of 8086, Simple programs).pptxRaviKiranVarma4
 
Chapter 9 - Loops in C++
Chapter 9 - Loops in C++Chapter 9 - Loops in C++
Chapter 9 - Loops in C++Deepak Singh
 

Similar to Program control instructions (12)

Al2ed chapter8
Al2ed chapter8Al2ed chapter8
Al2ed chapter8
 
Chap3 program flow control instructions
Chap3 program flow control instructionsChap3 program flow control instructions
Chap3 program flow control instructions
 
Chapter3 program flow control instructions
Chapter3 program flow control instructionsChapter3 program flow control instructions
Chapter3 program flow control instructions
 
Jumps in Assembly Language.
Jumps in Assembly Language.Jumps in Assembly Language.
Jumps in Assembly Language.
 
program-control-instruction.pdf
program-control-instruction.pdfprogram-control-instruction.pdf
program-control-instruction.pdf
 
Flow control instructions
Flow control instructionsFlow control instructions
Flow control instructions
 
microcontroller.ppt
microcontroller.pptmicrocontroller.ppt
microcontroller.ppt
 
Branching
BranchingBranching
Branching
 
Control Structures.pptx
Control Structures.pptxControl Structures.pptx
Control Structures.pptx
 
Data transfer and manipulation
Data transfer and  manipulationData transfer and  manipulation
Data transfer and manipulation
 
ppt-U2 - (Instruction Set of 8086, Simple programs).pptx
ppt-U2 - (Instruction Set of 8086, Simple programs).pptxppt-U2 - (Instruction Set of 8086, Simple programs).pptx
ppt-U2 - (Instruction Set of 8086, Simple programs).pptx
 
Chapter 9 - Loops in C++
Chapter 9 - Loops in C++Chapter 9 - Loops in C++
Chapter 9 - Loops in C++
 

More from Dr. Girish GS

unix- Sort, uniq,tr,grep
unix- Sort, uniq,tr,grepunix- Sort, uniq,tr,grep
unix- Sort, uniq,tr,grepDr. Girish GS
 
unix- the process states, zombies, running jobs in background
unix-  the process states, zombies, running jobs in backgroundunix-  the process states, zombies, running jobs in background
unix- the process states, zombies, running jobs in backgroundDr. Girish GS
 
Customizing the unix environment
Customizing the unix environmentCustomizing the unix environment
Customizing the unix environmentDr. Girish GS
 
File systems and inodes
File systems and inodesFile systems and inodes
File systems and inodesDr. Girish GS
 
Basic regular expression, extended regular expression
Basic regular expression, extended regular expressionBasic regular expression, extended regular expression
Basic regular expression, extended regular expressionDr. Girish GS
 
Loop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progamLoop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progamDr. Girish GS
 
Logic instructions part 1
Logic instructions part 1Logic instructions part 1
Logic instructions part 1Dr. Girish GS
 
Bcd arithmetic instructions
Bcd arithmetic instructionsBcd arithmetic instructions
Bcd arithmetic instructionsDr. Girish GS
 
Bcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructionsBcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructionsDr. Girish GS
 
Ascii arithmetic instructions
Ascii arithmetic instructionsAscii arithmetic instructions
Ascii arithmetic instructionsDr. Girish GS
 

More from Dr. Girish GS (14)

Unix- the process
Unix-  the processUnix-  the process
Unix- the process
 
unix- Sort, uniq,tr,grep
unix- Sort, uniq,tr,grepunix- Sort, uniq,tr,grep
unix- Sort, uniq,tr,grep
 
unix- the process states, zombies, running jobs in background
unix-  the process states, zombies, running jobs in backgroundunix-  the process states, zombies, running jobs in background
unix- the process states, zombies, running jobs in background
 
Unix - Filters
Unix - FiltersUnix - Filters
Unix - Filters
 
Customizing the unix environment
Customizing the unix environmentCustomizing the unix environment
Customizing the unix environment
 
File systems and inodes
File systems and inodesFile systems and inodes
File systems and inodes
 
Basic regular expression, extended regular expression
Basic regular expression, extended regular expressionBasic regular expression, extended regular expression
Basic regular expression, extended regular expression
 
Loop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progamLoop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progam
 
Logic instructions part 1
Logic instructions part 1Logic instructions part 1
Logic instructions part 1
 
Bcd arithmetic instructions
Bcd arithmetic instructionsBcd arithmetic instructions
Bcd arithmetic instructions
 
Bcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructionsBcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructions
 
Ascii arithmetic instructions
Ascii arithmetic instructionsAscii arithmetic instructions
Ascii arithmetic instructions
 
Rotate instructions
Rotate instructionsRotate instructions
Rotate instructions
 
Memory interface
Memory interfaceMemory interface
Memory interface
 

Recently uploaded

Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 

Recently uploaded (20)

Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 

Program control instructions

  • 1. Microprocessor & its Applications Module 3 Continued…… Dr. Girisha G S Dept. of CSE SoE, DSU, Bengaluru 1
  • 2. Agenda • Program Control Instructions • Jump Group - unconditional jump - conditional jump
  • 3. Program Control Instructions - Program control instructions change or modify the flow of a program Jump Group of instructions Jump instructions are classified in to two groups 1. Unconditional Jump - Control is transferred unconditionally to the target label which points to the address of target instruction E.g. Jmp, call, ret 2. Conditional Jump - Control is transferred to the target label if a certain condition is met, otherwise execution continues with next sequential instruction - The condition are represented by flags E.g. jc, jz, jnc, jnz
  • 4. JMP - Unconditional Jump • Three types : short jump, near jump, and far jump. • The short jump is a two-byte instruction that allows jumps or branches to memory locations within +127 and -128 bytes from the address following the jump. • A near jump is a three-byte instruction that allows a branch or jump within ±32K bytes from the instruction in the current code segment. • far jump is a 5 byte instruction that allows a jump to any memory location within the real memory system. • The short and near jumps are often called intrasegment jumps • the far jumps are often called intersegment jumps. The general form of the JMP instruction is jmp label where label is a program address indentifier • This instruction unconditionally transfer control of the execution to the specified label (address) using an 8 bit or 16 bit displacement or CS:IP. • No flags are affected by this instruction. • When this instruction is executed ,the CS & IP are unconditionally modified to a new value of CS & IP corresponding to the location transferred
  • 5. Short Jump • Short jumps are called relative jumps because they can be moved to any location in current code segment without a change • A short jump to four memory locations beyond the address of the next instruction. • The short jump instruction appears in figure below. • Example shows how short jump instructions pass control from one part of the program to another. Example jmp short next (use short directive to force short jump).
  • 6. Near Jump • The near jump is similar to the short jump, except that the distance is farther. • A near jump passes control to an instruction in the current code segment located within ±32K bytes from the near jump instruction. A near jump that adds the displacement (0002H) to contents of IP. • The near jump is a 3-byte instruction that contains an opcode followed by a signed 16-bit displacement. E.g. jmp next
  • 7. Far Jump • A far jump instruction transfer control to the target location in different code segment. This is performed by loading CS with segment address in which the target exist & IP with the offset address of a instruction to which control is to be transferred in the new code segment. • The target address loaded in CS & IP are part of the instruction itself. This is a 5 byte instruction. A far jump instruction replaces the contents of both CS and IP with 4 bytes following the opcode. E.g. jmp far ptr skip
  • 8. Conditional Jumps Instructions • The conditional jump instruction transfer control to the address specified (target location) if some condition is met or satisfied otherwise execution continues sequentially. • The condition here means the status of the condition flags. The conditional jump instructions test the following flag bits: sign(S), zero(Z), carry (C), parity(P), overflow(O). Instruction Condition Tested Comment JA C = 0 and Z = 0 Jump above JAE C = 0 Jump above or equal to JB C = 1 Jump below JBE C = 1 or Z = 1 Jump below or equal to JC C=1 Jump carry set JE or JZ Z = 1 Jump equal to or jump zero JG Z = 0 and S = 0 Jump greater than JGE S = 0 Jump greater than or equal to JL S ≠ 0 Jump less than JLE Z = 1 or S ≠ 0 Jump less than or equal to JNC C = 0 Jump carry cleared JNE or JNZ Z = 0 Jump not equal to or jump not zero JNO 0 = 0 Jump no overflow JNS S = 0 Jump no sign JNP/JPO P = 0 Jump no parity/jump parity odd JO 0 = 1 Jump on overflow JP/JPE P= 1 Jump on parity/jump parity even JS S = 1 Jump on sign If the condition under test is true, a branch to the label associated with the jump instruction occurs.. If the condition is false, the next sequential instruction in the program executes. For example, a JC will jump if the carry bit is set.

Editor's Notes

  1. Controlling the program flow is a very important thing, this is where your program can make decisions according to certain conditions Program control instructions change or modify the flow of a program.i.e. transfers control from the normal sequential execution to the specified destination or target instruction. There are two type of program control instructions Unconditional - The JMP instruction transfers control unconditionally (independent of any condition)to another instruction.  Conditional Jump Instructions: Transfers the program sequence to the described memory address only if the condition in satisfied. Branches to a lable when specific flags condition are met  JMP is able to transfer control both forward and backward
  2. Control will go to the given address in any condition. Address for the jump instruction can be either sort, near or far After the jump the program will execute instructions at the jump label and will not return. Program instructions will not return to the next sequential instruction after the jup Near jump: a near jump passes control to an instruction in the current code segment located within +-32Kbytes from the near jump instruction Short jump address of the target must be within -128 to +127 bytes of the current IP Far address may be with in the same segment or in another segment
  3. Short jumps are called relative jumps because they can be moved to any location in current code segment without a change. This is because the jump address is not stored with the opcode. Instead of a jump address, a distance or displacement follows the opcode. The short jump displacement is a distance represented by a 1-byte signed number whose value ranges between +127 and -128. When the microprocessor executes a short jump, the displacement is sign extended and added to the instruction pointer (IP/EIP) to generate the jump address within the current code segment. The short jump instruction branches to this new address for the next instruction in the program;