Branching instructions are important for programming a microprocessor. These instructions can transfer control of execution from one memory location to another. In this post, we will discuss ‘Branching instructions in 8085 Microprocessor‘ and how these instructions operate. We will learn 2 types of Branching operations [based on the return of execution control]. Also, we will find conditional and unconditional branching instructions of the 8085 microprocessor.
2 types of Branching operations in 8085 [based on the return of execution control]
Branching operation in 8085 microprocessor can take place in the following two ways, based on the return of execution control:
(i) In one type of Branching execution control cannot return to the point of branching.
Example: Jump instructions.
JUMP <Address> – this instruction is used to transfer the execution from one location in the program to a new location.
(ii) In another type of branching, execution control can return to the point of branching (i.e. to the main program from the subprogram). Return instructions are used for this purpose.
Example: Subroutine instructions.
CALL <Address> – this instruction is used to call a subroutine specified by the address.
RET instruction, is used to return from a subroutine to the main program.
Conditional and Unconditional branching in 8085
Branching in 8085 microprocessor can take place in the following two ways: Conditionally or unconditionally.
Unconditional branching is shown using 3 instructions.
JMP Address – This JMP instruction is used to Jump to the address specified (to Go to the new location).
CALL Address – This CALL instruction is used to Jump to the address specified but treats it as a subroutine.
RET – This RET instruction is used to Return from a subroutine.
Conditional Branching is used to go to a new location if a specified condition is met. 6 different instructions are shown below as examples of conditional branching, with a description of each.
JZ Address – (Jump on Zero), Go to the address specified if the Zero flag is set.
JNZ Address – (Jump on NOT Zero), Go to the address specified if the Zero flag is not set.
JC Address – (Jump on Carry), Go to the address specified if the Carry flag is set.
JNC Address – (Jump on No Carry), Go to the address specified if the Carry flag is not set.
JP Address – (Jump on Plus), Go to the address specified if the Sign flag is not set
JM Address – (Jump on Minus) Go to the address specified if the Sign flag is set.
NOTE: The addresses supplied to all branch operations must be 16 bits.
Author of this post
This post is co-authored by Professor Saraswati Saha, who is an assistant professor at RCCIIT, a renowned degree engineering college in India. Professor Saha teaches subjects related to digital electronics & microprocessors.