Addressing modes in 8085 microprocessor
Prerequisite – Addressing modes
The 8085 microprocessor has several addressing modes that are used to access memory locations. Some of the most commonly used addressing modes in the 8085 microprocessor are:
The way of specifying data to be operated by an instruction is called addressing mode.
Types of addressing modes –
In 8085 microprocessor there are 5 types of addressing modes:
- Immediate Addressing Mode –
In immediate addressing mode the source operand is always data. If the data is 8-bit, then the instruction will be of 2 bytes, if the data is of 16-bit then the instruction will be of 3 bytes.Examples:
MVI B 45 (move the data 45H immediately to register B)
LXI H 3050 (load the H-L pair with the operand 3050H immediately)
JMP address (jump to the operand address immediately) - Register Addressing Mode –
In register addressing mode, the data to be operated is available inside the register(s) and register(s) is(are) operands. Therefore the operation is performed within various registers of the microprocessor.Examples:
MOV A, B (move the contents of register B to register A)
ADD B (add contents of registers A and B and store the result in register A)
INR A (increment the contents of register A by one) - Direct Addressing Mode –
In direct addressing mode, the data to be operated is available inside a memory location and that memory location is directly specified as an operand. The operand is directly available in the instruction itself.Examples:
LDA 2050 (load the contents of memory location into accumulator A)
LHLD address (load contents of 16-bit memory location into H-L register pair)
IN 35 (read the data from port whose address is 35) - Register Indirect Addressing Mode –
In register indirect addressing mode, the data to be operated is available inside a memory location and that memory location is indirectly specified by a register pair.Examples:
MOV A, M (move the contents of the memory location pointed by the H-L pair to the accumulator)
LDAX B (move contents of B-C register to the accumulator)
STAX B (store accumulator contents in memory pointed by register pair B-C) - Implied/Implicit Addressing Mode –
In implied/implicit addressing mode the operand is hidden and the data to be operated is available in the instruction itself.Examples:
CMA (finds and stores the 1’s complement of the contents of accumulator A in A)
RRC (rotate accumulator A right by one bit)
RLC (rotate accumulator A left by one bit)
6.Relative Addressing Mode:
In this mode, the operand is a memory location specified by the contents of the program counter plus a constant value.
example:
MOV R0,#05H
AGAIN:
MVI A,#55H
ADD A,R0
JMP AGAIN
In this example, the instruction JMP AGAIN uses the Relative Addressing Mode. The instruction jumps to the label AGAIN by adding the contents of the program counter with the specified constant value. The constant value is calculated based on the distance between the current instruction and the label AGAIN.
In this case, the instruction JMP AGAIN is executing a loop that loads the accumulator with the value 55H, adds the contents of the register R0 to the accumulator, and then jumps back to the label AGAIN to repeat the loop.
Advantages of Addressing Modes in 8085 Microprocessor:
Versatility: The 8085 microprocessor supports several addressing modes, which allows for a wide range of memory access and manipulation options.
Efficient memory usage: Different addressing modes allow for efficient use of memory, reducing the memory footprint of programs and making the best use of available memory.
Easy to use: The addressing modes are easy to use, making it simple for programmers to write and execute complex programs.
Improved performance: The use of different addressing modes can improve the performance of programs, as the correct addressing mode can be chosen to match the specific requirements of the program.
Disadvantages of Addressing Modes in 8085 Microprocessor:
Complexity: The various addressing modes can be complex, making it difficult for programmers to choose the correct mode for a given task.
Overhead: The use of different addressing modes can result in additional overhead, as the microprocessor must perform additional operations to access memory.
Debugging difficulties: Debugging programs that use multiple addressing modes can be difficult, as the programmer must keep track of the different modes used in each memory access.
Limitations: The addressing modes are limited by the size of the program counter and the memory address space, which can impact the performance of large programs.
Please Login to comment...