Addressing Modes: Instructions consist of op-code and operands (data or address). The operand may be the source only, a destination only, or both of them. The source of these instructions might be a register, memory, or an input port. A register, a memory location, or an output port can all be used as destinations.
The techniques by which the source of data or the destination of the result is specified in the instruction are referred to as addressing modes. The addressing mode describes the location of the operands rather than their type.
Addressing Modes in 8085 Microprocessor
The 8085 microprocessor has five addressing modes:
1.Direct Addressing Modes
In the direct addressing mode, the address of the data or operand is given in the instruction itself. The size of instruction is either 2-bytes or 3-bytes
LDA 9500H (loads the content of memory location directly into accumulator)
SHLD C050H (stores the content of 16-bit memory location into HL pair directly)
2.Immediate Addressing Modes
The operand is given within the instruction in this addressing method. For 8-bit data, size of instruction is 2-bytes and for 16-bit data, size of instruction is 3-bytes.
MVI A,32H (loads the immediate data into the specified register)
LXI B,4545H (loads 16-bit immediate data into the specified register pair)
3.Register Direct Addressing Mode
This mode specifies the register or register pair that contains the data rather than the address. That means the operand is in the general-purpose register.
MOV A,B (copies data from source register to destination register)
XCHG (swaps the contents of the DE and HL register pairs)
4.Register Indirect Addressing Mode
In this mode, the address of the operand is specified by a register pair as a pointer for the operand.
MOV A,M (the contents of the memory address indicated by the H-L pair are transferred to the accumulator)
STAX B (Stores the contents of the accumulator to the memory location specified by the contents of register pair)
5.Implied Addressing Mode
There is certain instruction that operates on the content of the accumulator such instructions do not require the address of the operand.
CMA (complements the content of accumulator)
CMC (complements the carry flag)
Addressing Modes in 8086 Microprocessor
Some of the different addressing modes in 8086 microprocessor’s programmings are:
1.Immediate Addressing Mode
The addressing mode in which the data/operand is a part of instruction and appears in the form of a successive byte is known as the immediate addressing mode.
2.Direct Memory Addressing Mode
A 16-bit memory address (offset) is explicitly stated in the instruction in this sort of addressing mechanism. One of the operands is the direct memory and the other operand is the register.
3.Direct Offset Addressing Mode
A version of direct addressing, this addressing employs arithmetic operators to alter an address.
ARR DB 15,17,18,21
MOV AL, ARR ; MOV AL,18
ADD BH, ARR+3 ; ADD BH 21
4.Register Addressing Mode
In this mode, the register may contain source operand, destination operand, or both.
5.Indirect Memory Addressing Mode
Indirect addressing takes advantage of the computer’s capability for the segment: offset addressing. The registers used for this purpose are the base register (BX and BP) and index register (DI and SI)
MOV [BX], AL
6.Base Index Addressing Mode
This mode combines base registers (BX and BP) and index registers (SI and DI) to form an effective address.
MOV AX,[BX + SI]
7. Base Index with Displacement Addressing Mode
In this mode, a base register, an index register, and a displacement (a number or offset value) are combined to generate an effective address.
MOV AL, [BX + SI + 2]
8.String Addressing Mode
This addressing mode utilizes index registers (SI and DI). The first byte or word of the source string is pointed to with SI, while the first byte or word of the destination string is pointed to with DI when the string instruction is executed. The SI or DI is automatically incremented and decremented to point to the next byte or word depending on the direction flag (D).