VOOZH about

URL: https://www.geeksforgeeks.org/computer-organization-architecture/branching-instructions-8085-microprocessor/

⇱ Branching Mechanism: Unconditional - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Branching Mechanism: Unconditional

Last Updated : 29 Nov, 2025

Branching is the process of directing program control to a different memory location instead of executing instructions sequentially, and it can be either conditional or unconditional.

  • Unconditional branching specifically refers to instructions that always transfer control to another address regardless of any conditions or flag status.
  • This is achieved using Jump, Call, and Return instructions, all of which modify the Program Counter (PC) to redirect execution to a new memory location.
👁 flowchart_of_unconditional_branching

Types of Unconditional Branching Instructions

Following are three types of unconditional branching:

1. Unconditional Jump (JMP)

The JMP (Jump) instruction unconditionally transfers control to a specified memory address by updating the Program Counter (PC). For example, JMP 2050 redirects execution to address 2050. It is mainly used for creating loops, skipping code sections, or jumping to specific program routines.

OPCODEOPERANDEXAMPLE
JMPaddressJMP 2050

2. Unconditional Call (CALL)

The CALL instruction transfers control to a subroutine at a specified address while saving the current Program Counter (PC) on the stack. For example, CALL 2050 jumps to the subroutine at address 2050. It is mainly used in modular programming to execute reusable routines like input/output or display functions.

OPCODE

OPERAND

EXAMPLE
CALL

address

CALL 2050

3. Unconditional Return (RET)

The RET instruction returns program control from a subroutine to the calling function. When executed, it retrieves the saved return address from the stack and loads it into the Program Counter (PC), allowing execution to continue from where the subroutine was called. It is typically placed at the end of a subroutine to ensure proper program flow.

OPCODEOPERANDEXAMPLE
RETnoneRET

Working of Unconditional Branching

In unconditional branching, the Program Counter (PC) is updated to alter the normal sequence of execution. Some instructions also use the stack to save or restore return addresses when calling or exiting subroutines.

  • JMP: Updates the PC directly to the specified address.
  • CALL: Pushes the current PC onto the stack, then transfers control to a subroutine.
  • RET: Pops the saved address from the stack back into the PC to continue execution.

Usage of Branching in Programming and Microprocessors

Branching — both conditional and unconditional — is a fundamental aspect of program control flow. It allows programs to change the sequence of instruction execution, making decision-making, repetition, and modular code possible.

Use CaseExplanation
Loop CreationBranching enables loops like for, while, and do-while by controlling repeated execution.
Conditional ExecutionPrograms can execute specific blocks only if certain conditions are met (e.g., if-else).
Function and Subroutine HandlingAllows calling reusable blocks of code and returning after execution.
Program SegmentationBranching enables modular code by jumping between different code sections.
Error HandlingEnables jumping to error-handling routines based on specific conditions.
Code OptimizationUnreachable or unnecessary code can be skipped using branching logic.
Interrupt HandlingBranching is used in handling interrupts by jumping to interrupt service routines.
Comment

Explore