The Wayback Machine - https://web.archive.org/web/20240531223922/https://www.geeksforgeeks.org/branching-instructions-8085-microprocessor/
Open In App

Branching instructions in 8085 microprocessor

Last Updated : 07 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Branching instructions refer to the act of switching execution to a different instruction sequence as a result of executing a branch instruction. 

The three types of branching instructions are: 
 

  1. Jump (unconditional and conditional) 
     
  2. Call (unconditional and conditional) 
     
  3. Return (unconditional and conditional) 
     

1. Jump Instructions – The jump instruction transfers the program sequence to the memory address given in the operand based on the specified flag. Jump instructions are 2 types: Unconditional Jump Instructions and Conditional Jump Instructions. 

(a) Unconditional Jump Instructions: Transfers the program sequence to the described memory address. 

 

OPCODE OPERAND EXPLANATION EXAMPLE
JMP address Jumps to the address JMP 2050

(b) Conditional Jump Instructions: Transfers the program sequence to the described memory address only if the condition in satisfied. 

 

OPCODE OPERAND EXPLANATION EXAMPLE
JC address Jumps to the address if carry flag is 1 JC 2050
JNC address Jumps to the address if carry flag is 0 JNC 2050
JZ address Jumps to the address if zero flag is 1 JZ 2050
JNZ address Jumps to the address if zero flag is 0 JNZ 2050
JPE address Jumps to the address if parity flag is 1 JPE 2050
JPO address Jumps to the address if parity flag is 0 JPO 2050
JM address Jumps to the address if sign flag is 1 JM 2050
JP address Jumps to the address if sign flag 0 JP 2050

2. Call Instructions – The call instruction transfers the program sequence to the memory address given in the operand. Before transferring, the address of the next instruction after CALL is pushed onto the stack. Call instructions are 2 types: Unconditional Call Instructions and Conditional Call Instructions. 

(a) Unconditional Call Instructions: It transfers the program sequence to the memory address given in the operand. 
 

OPCODE OPERAND EXPLANATION EXAMPLE
CALL address Unconditionally calls CALL 2050

(b) Conditional Call Instructions: Only if the condition is satisfied, the instructions executes. 

OPCODE OPERAND EXPLANATION EXAMPLE
CC address Call if carry flag is 1 CC 2050
CNC address Call if carry flag is 0 CNC 2050
CZ address Calls if zero flag is 1 CZ 2050
CNZ address Calls if zero flag is 0 CNZ 2050
CPE address Calls if parity flag is 1 CPE 2050
CPO address Calls if parity flag is 0 CPO 2050
CM address Calls if sign flag is 1 CM 2050
CP address Calls if sign flag is 0 CP 2050

3. Return Instructions – The return instruction transfers the program sequence from the subroutine to the calling program. Return instructions are 2 types: Unconditional Jump Instructions and Conditional Jump Instructions. 

(a) Unconditional Return Instruction: The program sequence is transferred unconditionally from the subroutine to the calling program. 

 

OPCODE OPERAND EXPLANATION EXAMPLE
RET none Return from the subroutine unconditionally RET

(b) Conditional Return Instruction: The program sequence is transferred unconditionally from the subroutine to the calling program only is the condition is satisfied. 

OPCODE OPERAND EXPLANATION EXAMPLE
RC none Return from the subroutine if carry flag is 1 RC
RNC none Return from the subroutine if carry flag is 0 RNC
RZ none Return from the subroutine if zero flag is 1 RZ
RNZ none Return from the subroutine if zero flag is 0 RNZ
RPE none Return from the subroutine if parity flag is 1 RPE
RPO none Return from the subroutine if parity flag is 0 RPO
RM none Returns from the subroutine if sign flag is 1 RM
RP none Returns from the subroutine if sign flag is 0 RP

 

Advantages:

Enables conditional execution: The branching instructions in the 8085 microprocessor allow for conditional execution of code, which can help optimize program flow and improve overall efficiency.

Simplifies programming: The branching instructions in the 8085 microprocessor simplify programming by providing a set of dedicated instructions for branching to different memory locations based on conditions.

Supports a wide range of operations: The branching instructions in the 8085 microprocessor support a wide range of operations, including conditional branching, unconditional branching, and subroutine calls.

Allows for loop execution: The branching instructions in the 8085 microprocessor can be used to implement loops by branching to a memory location that contains a loop instruction.

Disadvantages:

Limited branching range: The 8085 microprocessor has a limited branching range, which can restrict the amount of memory that can be accessed. This can be a disadvantage for applications that require a large number of branching instructions.

Limited number of condition codes: The 8085 microprocessor has a limited number of condition codes, which can restrict the types of conditions that can be tested.

Complex addressing modes: The addressing modes used in the branching instructions can be complex, which can make programming more difficult.

Limited instruction set: The 8085 microprocessor has a limited instruction set, which can limit the types of branching instructions that can be used. This can be a disadvantage for applications that require complex program flow.

Applications :

Looping: Branching instructions such as JMP, JZ, JNZ, JC, and JNC are used to implement loops in programs. This allows the program to repeat a set of instructions until a specific condition is met.

Decision-making: Conditional branching instructions are used to implement decision-making in programs. This allows the program to make decisions based on the current state of the microprocessor and branch to different parts of the program accordingly.

Subroutine calls: Call instructions, such as CALL and RET, are used to call subroutines in programs. This allows the program to reuse code and execute common tasks in a modular manner.

Interrupt handling: Branching instructions are used in interrupt handling to transfer control to an interrupt service routine. This involves branching to a different part of the program to handle the interrupt, and then returning to the main program after the interrupt is serviced.

Program flow control: Branching instructions are used to control the flow of programs by transferring control to different parts of the program based on specific conditions or events. This allows the program to execute specific tasks at specific times and in a specific order.


Previous Article
Next Article

Similar Reads

Arithmetic instructions in 8085 microprocessor
Arithmetic Instructions are the instructions which perform basic arithmetic operations such as addition, subtraction and a few more. In 8085 microprocessor, the destination operand is generally the accumulator. Following is the table showing the list of arithmetic instructions: OpcodeOperandExplanationExampleADDRA = A + RADD BADDMA = A + McADD 2050
4 min read
Logical instructions in 8085 microprocessor
Introduction : Logical instructions in the 8085 microprocessor are a set of instructions that perform logical operations on data in registers and memory. Logical operations are operations that manipulate the bits of data without affecting their numerical value. These operations include AND, OR, XOR, and NOT. The logical instructions in the 8085 mic
6 min read
Data transfer instructions in 8085 microprocessor
Data transfer instructions are the instructions that transfer data in the microprocessor. They are also called copy instructions. Here is the following is the table showing the list of logical instructions: OPCODEOPERANDEXPLANATIONNo. of bytesMachine cyclesNo. of T-statesEXAMPLEMOVRd, RsRd = Rs11 opcode fetch4MOV A, BMOVRd, MRd = Mc1 1 opcode fetch
4 min read
Difference between SIM and RIM instructions in 8085 microprocessor
Introduction : The SIM (Set Interrupt Mask) and RIM (Read Interrupt Mask) instructions are two instructions in the 8085 microprocessor that are used to control interrupts. The SIM instruction allows the microprocessor to selectively enable or disable interrupts by setting the appropriate bits in the Interrupt Mask Register (IMR). The IMR is a regis
3 min read
Arithmetic instructions in 8086 microprocessor
Arithmetic Instructions are the instructions which perform basic arithmetic operations such as addition, subtraction and a few more. Unlike in 8085 microprocessor, in 8086 microprocessor the destination operand need not be the accumulator. Following is the table showing the list of arithmetic instructions: OPCODE OPERAND EXPLANATION EXAMPLE ADD D,
2 min read
Logical instructions in 8086 microprocessor
Introduction : Logical instructions in the 8086 microprocessor are instructions that perform logical operations on data stored in registers or memory locations. These instructions can manipulate bits within a byte, set or clear individual bits, or perform Boolean operations such as AND, OR, XOR, and NOT. Some of the commonly used logical instructio
5 min read
Data transfer instructions in 8086 microprocessor
Introduction : Data transfer instructions in the 8086 microprocessor are used to move data between memory locations, registers, and input/output (I/O) devices. These instructions are essential for manipulating data within a program, as well as for communicating with external devices. Data transfer instructions are a fundamental part of programming
4 min read
Process control instructions in 8086 microprocessor
Process control instructions are the instructions which control the processor's action by setting(1) or resetting(0) the values of flag registers. Following is the table showing the list of process control instructions: OPCODEOPERANDEXPLANATIONEXAMPLESTCnonesets carry flag to 1STCCLCnoneresets carry flag to 0CLCCMCnonecompliments the carry flagCMCS
1 min read
Program execution transfer instructions in 8086 microprocessor
Prerequisite - Branching instructions in 8085 microprocessor Program execution transfer instructions are similar to branching instructions and refer to the act of switching execution to a different instruction sequence as a result of executing a branch instruction. The two types of program execution transfer instructions are: Unconditional Conditio
3 min read
Machine Control Instructions in Microprocessor
Introduction Microprocessors are electronic devices that process digital information using instructions stored in memory. Machine control instructions are a type of instruction that control machine functions such as Halt, Interrupt, or do nothing. These instructions alter the different type of operations executed in the processor. In this article,
4 min read