Branching and Machine Control Instructions

undefined
Branching & Machine control Instructions
There are three types
JUMP (JMP)
CALL
RETURN (RET)
 
JUMP
 
i) Unconditional
 
ii) Conditional
CALL
 
i) Unconditional
 
ii) Conditional
RETURN
 
i) Unconditional
 
ii) Conditional
JMP addr 16
  
PC       addr 16
 
It is unconditional jump instruction. When
the instruction is executed, the address given in
the instruction is moved to the program
counter. Now, the processor starts executing
the instruction stored in this address.
 
J <condition> addr 16
If <condition> is TRUE then,    PC         addr 16
It is conditional jump instruction. The conditional
jump instruction will check a flag condition.
If the flag condition is true, then the address
given in the instruction is moved to the program
counter.
Thus the program control is branced to the jump
address.
If the flag condition is false, then the next
instruction is executed.
Stack is a group of memory locations.
Used for storage of binary information during
execution of the program
Stacks follows LIFO                                                
LIFO
                                                     SP
PUSH (incremented-insertion)
POP  (decremented-deletion)
CALL addr 16
It is unconditional CALL used to call a subroutine
program.
When this instruction is executed, the address of
the next instruction in the program is pushed to
the stack.
The 16-bit address in the instruction is loaded in
the program counter.
 Now the processor will start executing the
instructions stored in this call address.
RET
It is an unconditional return instruction. This
instruction is placed at the end of the
subroutine program, in order to return t0 the
main program. When this instruction is
executed, the top of the stack is poped to
(located in) the program counter.
I/O instructions
To communicate with the outside world, the
processor uses input ports and output ports.
The 8085 microprocessor uses IN instruction to
input a byte from an input port to the
accumulator.
An OUT instruction is used to output a byte from
the accumulator to the output port. These
instructions will be used in the I/O interface.
 
Machine control instructions
Machine control instructions only control the
processor operations and do not perform any
operation on data. They are all single byte
instructions.
Halt instructions (HLT)
No operation instruction (NOP)
Interrupt related instructions
EI-enable interrupt
DI-disable interrupt
SIM-set interrupt mask
RIM-read interrupt mask
 
HLT
This instruction is placed at the end of the program.
When this instruction is 
 
executed the processor suspends program execution
and bus will be in idle 
 
state. 
 
It is 1-byte instruction.
 
NOP
The instruction NOP performs no operation. It is a dummy operation.
This is an useful instruction for producing software delay and reserve memory
spaces for future software modifications.
DI
When this instruction is executed all the interrupts except TRAP are disabled.
 
EI
This instruction is used (or executed) to allow the interrupts after disabling.
The interrupts except TRAP are disabled after processor reset or after execution
of DI instruction.
When we want to allow the interrupt, we have to execute the instruction.
 
 
 
SIM INSTRUCTION
 
SIM 
stands for set interrupt mask. This is a 1-
byte instruction. Using this instruction any one
of the interrupts can be masked.It is also used to
send data through SOD line. The execution of
SIM instruction uses the content of the
accumulator to perform the following functions.
Program the interrupt mask, for the hardware
interrupts RST 5.5, RST 6.5 and RST 7.5
Reset the edge-triggered RST 7.5 input latch.
Load the SOD output latch.
 
 
RIM INSTRUCTION
 
The RIM instruction is used to check whether
an interrupt is masked or not. It is also used
read data from SID line.
When RIM instruction is executed the
accumulator is loaded with 8-bit data.
 
Slide Note
Embed
Share

This content delves into the intricate details of branching and machine control instructions in programming. It explains the three main types of instructions - JUMP (JMP), CALL, and RETURN - along with their subtypes and functionalities. The unconditional and conditional aspects of JUMP, CALL, and RETURN instructions are explored with illustrative examples. Additionally, the concept of stack memory and its role in program execution are discussed, emphasizing the PUSH and POP operations. The content also covers conditional jump instructions based on flag conditions like zero, carry, sign, and parity. Overall, it provides a comprehensive insight into how processors execute instructions to control program flow efficiently.

  • Branching Instructions
  • Machine Control
  • Program Execution
  • Conditional Jumps
  • Stack Memory

Uploaded on Oct 02, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Branching & Machine control Instructions

  2. There are three types JUMP (JMP) CALL RETURN (RET)

  3. JUMP i) Unconditional ii) Conditional CALL i) Unconditional ii) Conditional RETURN i) Unconditional ii) Conditional

  4. JMP addr16 PC addr16 It is unconditional jump instruction. When the instruction is executed, the address given in the instruction is moved to the program counter. Now, the processor starts executing theinstructionstoredinthisaddress.

  5. J <condition> addr 16 If <condition> is TRUE then, PC addr 16 It isconditional jump instruction.Theconditional jump instruction will checka flag condition. If the flag condition is true, then the address given in the instruction is moved to the program counter. Thus the program control is branced to the jump address. If the flag condition is false, then the next instructionis executed.

  6. JZ addr16 Jump on zero Jump if zero flag =1 JNZ addr16 Jump on not zero Jump if zero flag =0 JC addr16 Jump on carry Jump if carry flag =1 JNC addr16 Jump on no carry Jump if carry flag =0 JM addr16 Jump on minus Jump if sign flag =1 JP addr16 Jump on positive Jump if sign flag =0 JPE addr16 Jump on parity even Jump if parity flag =1 JPOaddr16 Jump on parity odd Jump if parity flag =0

  7. Stack is a group of memory locations. Used for storage of binary information during execution of the program Stacks follows LIFO LIFO C SP B A PUSH (incremented-insertion) POP (decremented-deletion)

  8. CALL addr 16 It is unconditional CALL used to call a subroutine program. When this instruction is executed, the address of the next instruction in the program is pushed to the stack. The 16-bit address in the instruction is loaded in theprogramcounter. Now the processor will start executing the instructionsstored in this call address.

  9. CZ addr16 Call on zero Call if zero flag =1 CNZ addr16 Call on not zero Call if zero flag =0 CC addr16 Call on carry Call if carry flag =1 CNC addr16 Call on no carry Call if carry flag =0 CM addr16 Call on minus Call if sign flag =1 CP addr16 Call on positive Call if sign flag =0 CPE addr16 Call on parity even Call if parity flag =1 CPO addr16 Call on parity odd Call if parity flag =0

  10. RET It is an unconditional return instruction. This instruction is placed at the end of the subroutine program, in order to return t0 the main program. When executed, the top of the stack is poped to (locatedin)theprogramcounter. this instruction is

  11. RZ addr16 Return on zero Return if zero flag =1 RNZ addr16 Returnon not zero Return if zero flag =0 RC addr16 Return on carry Return if carry flag =1 RNC addr16 Return on no carry Return if carry flag =0 RM addr16 Return on minus Return if sign flag =1 RP addr16 Return on positive Return if sign flag =0 RPE addr16 Return on parity even Return if parity flag =1 RPOaddr16 Return on parity odd Return if parityflag =0

  12. I/O instructions To communicate with the outside world, the processoruses inputportsand outputports. The 8085 microprocessor uses IN instruction to input a byte from an input port to the accumulator. An OUT instruction is used to output a byte from the accumulator to the output port. These instructionswill beused in theI/Ointerface.

  13. Machine control instructions Machine control processor operations and do not perform any operation on data. They instructions. instructions only control the are all single byte Halt instructions (HLT) No operation instruction (NOP) Interrupt related instructions EI-enable interrupt DI-disable interrupt SIM-set interrupt mask RIM-read interrupt mask

  14. HLT This instructionisplaced at the endof the program. When thisinstructionis executed the processor suspends program execution and buswillbe inidle state. It is1-byte instruction. NOP The instructionNOPperformsno operation. Itisa dummyoperation. This is an useful instruction for producing software delay and reserve memory spacesfor future software modifications. DI When thisinstructionisexecuted all the interruptsexceptTRAPare disabled. EI This instructionisused (or executed)to allow the interruptsafter disabling. The interrupts except TRAP are disabled after processor reset or after execution of DI instruction. When we want to allow the interrupt,we have to execute the instruction.

  15. SIM INSTRUCTION SIM stands for set interrupt mask. This is a 1- byte instruction. Using this instruction any one of the interrupts can be masked.It is also used to send data through SOD line. The execution of SIM instruction uses the content of the accumulator to perform the following functions. Program the interrupt mask, for the hardware interrupts RST 5.5, RST 6.5 and RST 7.5 Reset the edge-triggered RST 7.5 input latch. Load the SOD output latch.

  16. RIM INSTRUCTION The RIM instruction is used to check whether an interrupt is masked or not. It is also used read data from SID line. When RIM instruction is executed the accumulator is loaded with 8-bit data.

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#