Addressing modes in 8085
Addressing modes in 8085. The way in which an operand is given to an instruction is known as addressing mode. Addressing modes do exist in every processor and microcontroller, however they vary little. There are various types of addressing modes in 8051, and important ones are immediate addressing mode, register addressing mode, direct addressing mode, indirect addressing mode and index addressing mode.
Immediate Addressing Mode in 8085
This is most common addressing modes in all processors and controllers. In Immediate addressing mode of 8085 , the instruction itself specifies the operand. Although the instructions are lengthier, it is simple to identify the operands.
Eg:
MOV CL, 12H; Moves 12 immediately into CL register
MOV BX, 1234H; Moves 1234 immediately into BX register
Register addressing mode in 8085
In register addressing modes of 8085 , Using registers, operands are provided in this mode. Although instructions are shorter, looking at the instruction does not reveal the operands.
Eg: MOV CL, DL
MOV AX, BX
Direct addressing mode in 8085
In direct addressing modes of 8085 , the instruction directly specifies the operand’s address. Here, the segment is indicated by the instruction, and just the offset address is supplied. Following is example of Direct addressing mode in 8085.
Eg: MOV CL, [4321H]; Moves data from location 4321H in the data
; segment into CL
; The physical address is calculated as
; DS * 10H + 4321
; Assume DS = 5000H
; :. PA= 50000 + 4321 = 54321H
; : CL← [54321H]
MOV CX, [4320H]; Moves data from location 4320H and 4321H
; in the data segment into CL and CH
Indirect addressing modes in 8085
This is important in addressing modes in 8085, that has further classifications as well. Following are further classifications of indirect addressing mode in 8085.
Register Indirect addressing mode:
The offset address for the data byte is provided by theµP in this mode using either of the two base registers (BP, BX) or either of the two index registers (SI, DI). The Base Registers specify the segment:
BX — Data Segment, BP — Stack Segment
Eg: MOV CL,[BX] ;Moves a byte fro red as DS* 10H + BX
;Stack Segment
;Physical Address calculated as SS * 10H + BP
Eg: MOV [BP], CL ; Moves a byte from
; Segment into CL.
; Physical Address
Register Relative Addressing Mode
In this manner, an 8-bit or 16-bit displacement and one of the base registers are used to calculate the operand address.
Eg:MOV CL,[BX+4] ;Moves a byte from the address pointed by BX+4 in
; Data Seg to CL.
; Physical Address: DS * 10H + BX + 4H
Eg: MOV 12H [BP], CL ; Moves a byte from CL to location pointed by BP+12H in
; the Stack Seg.
; Physical Address: SS* 10H + BP + 12H
Based Indexed Addressing mode
This is another addressing modes in 8085. Here, operand address is calculated as Base register plus an Index register.
Eg: MOV CL, [BX+SI] ; Moves a byte from the address pointed by BX+SI
; in Data Segment to CL.
; Physical Address: DS * 10H + BX + SI
MOV [BP+DI], CL ; Moves a byte from CL into the address pointed by
; BP+DI in Stack Segment.
; Physical Address: SS * 10H + BP + DI
Base relative plus index addressing mode
In this mode, the operand’s address is determined by adding the base register, index register, and either an 8-bit or 16-bit displacement.
Eg: MOV CL,[BX+DI+20] ; Moves a byte from the address pointed by
; BX+SI+20H in Data Segment to CL.
; Physical Address: DS * 10H + BX +SI+ 20H
Eg: MOV [BP+SI+2000], CL ; Moves a byte from CL into the location pointed by
; BP+SI+2000H in Stack Segment.
; Physical Address: SS * 10H + BP+SI+2000H
Implied addressing mode
This is last addressing modes in 8085 , The operands are implied in this addressing method, thus they are not mentioned in the instruction.
Eg: STC ; Sets the Carry Flag.
Eg: CLD ; Clears the Direction
Important points for understanding addressing modes:
1) Anything given in square brackets will be an Offset Address also called Effective Address.
2) MOV instruction by default operates on the Data Segment; unless specified otherwise.
3) BX and BP are called Base Registers.
BX holds Offset Address for Data Segment.
BP holds Offset Address for Stack Segment.
4) Sland Dl are called Index Registers
5) The Segment to be operated is decided by the Base Register and NOT by the Index Register.
This was all about addressing modes in 8051. Read the following as well for more information. Checkout this pdf.