The instructions in 8085 that are used to transfer the program control from one memory location to another memory location are grouped under branching instructions in 8085 microprocessor.
Branching Instructions in 8085
Opcode | Operand | Explanation of Instruction | Description | ||||||||||||||||||||||||||||
JMP | 16-bit address | Jump unconditionally | The program sequence is transferred to the memory location specified by the 16-bit address given in the operand. Example: JMP 2034H or JMP XYZ | ||||||||||||||||||||||||||||
| 16-bit address | Jump conditionally | The program sequence is transferred to the memory location specified by the 16-bit address given in the operand based on the specified flag of the PSW as described below. Example: JZ 2034H or JZ XYZ | ||||||||||||||||||||||||||||
CALL | 16-bit address | Call unconditionally | The CALL instruction pushes the current contents of the program counter (the address of the next instruction to be executed) onto the stack and then transfers control to the specified subroutine. Example: CALL 2050H | ||||||||||||||||||||||||||||
| 16-bit address | Unconditional subroutine call | The program sequence is transferred to the memory location specified by the 16-bit address given in the operand. Before the transfer, the address of the next instruction after CALL (the contents of the program counter) is pushed onto the stack. Example: CALL 2034H or CALL XYZ | ||||||||||||||||||||||||||||
RET | none | Return from subroutine unconditionally | The program sequence is transferred from the subroutine to the calling program. The two bytes from the top of the stack are copied into the program counter, and program execution begins at the new address. Example: RET | ||||||||||||||||||||||||||||
| none | Return from subroutine conditionally | The program sequence is transferred from the subroutine to the calling program based on the specified flag of the PSW as described below. The two bytes from the top of the stack are copied into the program counter, and program execution begins at the new address. Example: RZ | ||||||||||||||||||||||||||||
RST
| 0-7 | Restart | The RST instruction is equivalent to a 1-byte call instruction to one of eight memory locations depending upon the number. The instructions are generally used in conjunction with interrupts and inserted using external hardware. However these can be used as software instructions in a program to transfer program execution to one of the eight locations. The addresses are:
The 8085 has four additional interrupts and these interrupts generate RST instructions internally and thus do not require any external hardware. These instructions and their Restart addresses are:
|
Difference Between Call and Return Instruction in 8085 Microprocessor
Here is a table summarizing the differences between the CALL and RETURN instructions:
Instruction | CALL | RETURN |
Function | Jumps to a subroutine | Returns from a subroutine |
Syntax | CALL address | RET |
Operands | Address of subroutine | None |
Stack | Pushes the address of the next instruction onto the stack | Pops the return address from the stack into the program counter (PC) |
Execution | Non-conditional | Non-conditional |
Addressing mode | Immediate addressing | None |
Length | 3 bytes | 1 byte |
Timing | 17 cycles | 10 cycles |
Effect on flags | None | None |
In summary, the main differences between the CALL and RETURN instructions are:
- CALL is used to jump to a subroutine, while RETURN is used to return from a subroutine.
- CALL requires an operand, which is the address of the subroutine being called, while RETURN does not require any operands.
- CALL pushes the address of the next instruction onto the stack before jumping to the specified subroutine, while RETURN pops the return address from the stack and loads it into the program counter (PC).
- CALL uses immediate addressing mode, while RETURN does not use any addressing mode.
- CALL is a 3-byte instruction, while RETURN is a 1-byte instruction.
- CALL takes longer to execute than RETURN, requiring 17 cycles compared to 10 cycles for RETURN.
- Neither instruction affects the state of the flags register.
Recent posts
Related posts:
- Terminology Used in Microprocessor and Microcontroller
- CISC and RISC Processor Architecture
- Von Neumann and Harvard Architecture
- Basics of Microprocessor and Microcontroller
- Introduction to Microprocessor 8085
- Architecture of 8085 Microprocessor
- Pin Diagram of 8085 Microprocessor and Pin Description
- Addressing Modes in 8085 Microprocessor
- Data Transfer Instructions in 8085 Microprocessor
- Arithmetic Instructions in 8085 Microprocessor
- Logical Instructions in 8085 Microprocessor
- Machine Control Instructions in 8085 Microprocessor
- Timing Diagram of 8085 Instructions
- Stack and Subroutine in 8085 Microprocessor
- Interrupts in 8085 Microprocessor
- Assembler Directives of 8085 Microprocessor
- Simple Data Transfer Program in 8085 Microprocessor
- Microprocessor 8085 Addition and Subtraction Programs
- Programs on Logical Instructions in 8085 Microprocessor
- Multiplication Programs in 8085 Microprocessor
- Division Programs in 8085 Microprocessor
- Introduction to Assembly Language Programming
- 8085 Program to Find the Largest Number in an Array of Data
- 8085 Program to Count Negative Numbers | ALP to Count Negative Numbers
- 8085 Program to Find the Smallest Number in An Array of Data
- 8085 Program to Arrange an Array of Data in Ascending Order
- 8085 Program to Arrange an Array of Data in Descending Order
- 8085 Program to Find the Square of a Number from 0 to 9 Using a Table of Square