Addressing Modes of 8085 Microprocessor

1
614

Introduction to Addressing Modes

In this article we will be discussing the addressing modes of microprocessor. Every instruction consists of two parts. That is what operation is to be performed (called operation code or opcode), and on what this operation is to be performed (called operands). For example, in case of A + B, the sign is the opcode, and A and B are the operands.

Each instruction performs an operation on the particular data called operand. An operand should be specified for an instruction to be executed. The operand. may be in the general purpose register, accumulator or in a memory location. The way in which the operand is specified in an instruction is called addressing mode. Various addressing modes used in microprocessor 8085 are:

Addressing Modes

  • Immediate addressing
  • Register addressing
  • Direct addressing
  • Register indirect addressing
  • Implicit addressing

Immediate Addressing

In immediate addressing mode, the operands are specified in the instruction itself. The instruction format of instructions with immediate addressing mode is in Figure below.

Instruction format of the instruction with immediate addressing modes
Instruction format of the instruction with immediate addressing modes

Examples of immediate addressing mode
MVI A, 05H : Move 05H in the accumulator.
ADI 06 : Add 06H to the contents of the accumulator.
LXI H, 2500H : Load HL pair with 2500H

When microprocessor executes the MVI A,05H instruction, the processor fetches the first instruction byte and determines that it must fetch one more byte from the next memory location. Similarly, when microprocessor executes the LXI H, 2500H instruction, the processor fetches the first instruction byte and deterimines that it must fetch two more bytes from the nex two memory locations.

Register Addressing

In register addressing mode, the operands are in the general purpose registers. We specify the register in our instruction. The instruction format of instructions with immediate addressing mode is in Figure below.

Instruction format of the instruction with register addressing mode
Instruction format of the instruction with register addressing mode

Most of the instructions that uses register to register addressing deal with 8-bit values. However, some of these instructions deal with 16-bit register pairs. For example, the SPHL instruction moves the contents of the H and L registers to SP.

Examples of register addressing mode are as follows:
MOV A, B : This instruction moves the contents of register B to register A or accumulator.
ADD B : Add the contents of B register to accumulator.

Direct Addressing

The direct addressing mode is used when the operand is available or required at some memory an 10 location. In direct addressing mode, the address of the operand (data) is in the instruction itself. The instruction format of direct addressing mode is in Figure below.

Instruction format of the instruction with direct addressing mode
Instruction format of the instruction with direct addressing mode

Instructions that include a direct address require three-bytes of storage, one for the instruction code, and two for the 16-bit address in case of memory related operations and require of address two bytes, for the instruction code, and other for 8-bit IO address.

Examples of direct addressing mode are as follows:
STA 2500H : Store the content of the accumulator to memory location 2500H.
IN 02H : Input the data from input port 02H in accumulator.

Register Indirect Addressing

This addressing mode is used only in concern with memory. In register indirect addressing mode, the address of the operand (data) is specified by a register pair. The instruction format of direct addressing mode is in Figure.

Instruction format of the instruction with register indirect addressing mode
Instruction format of the instruction with register indirect addressing mode

Example of indirect addressing mode are as follows:
LXI H. 2500H : Load HL pair with 2500H.
MOV A, M : Move the contents of memory to the accumulator.
HLT : Stop the program.

In this program, MOV A, M is the example of register indirect addressing because the address of the memory location M is specified by HL pair.

STAX B

This is another example of register indirect addressing. Here, the instruction MOV A, M moves the contents of the memory address stored in the H and L register pair to accumulator. The instruction STAX B stores the accumulator in the memory location specified by the address in the B and C register pair.

lmplicit Addressing

There are certain instructions which operate on the content or the accumulator directly; these instructions do not require specifying the operands. The instruction format of implied addressing mode is in Figure below.

Instruction format of the instruction with register indirect addressing mode
Instruction format of the instruction with implicit addressing mode

Examples of implicit addressing mode are as follows:
CMA : Compliment the contents of the accumulator.
RAR : Rotate the contents of the accumulator to the right by one bit.
RAL : Rotate the contents of the accumulator to the left by one bit.

TIMING EFFECTS OF ADDRESSING MODES

The execution time of both an instruction and the memory space required depend on the addressing modes used. As an example, the instructions having register or implicit addressing will be executing much faster as compared to other addressing modes. This is because both these addressing modes deal directly with the processor’s hardware. Or you can say that with the data already present in the hardware registers.

Also in these addressing modes, the instruction is always of one-byte and is fetches in a single machine cycle. Similarly, register indirect addressing mode is faster than direct addressing mode.

As most of the time of the execution of an instruction is wasted in getting a data from the memory or on how many machine cycles are required to execute that instruction. Also the number of machine cycles depends on the number of bytes required to represent that instruction. Hence, as the number of bytes required representing an instruction increases. Then the execution time will also increase.

Examples of Timing of Timing Effect of Addressing Modes

For example, a three-byte instruction requires more time for execution as compared to a two-byte or a one-byte instruction. So, we can say that the number of memory accesses required is the most important factor in determining execution timing.

For example, the CALL instruction, which is a three-byte instruction requires five machine cycles. In which three to access the complete instruction and two more to push the contents of the program counter onto the stack. Now the same CALL operation can be performed by one-byte RSTn instruction. This instruction will be executes in just three memory cycles.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here