Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

1.5.

3 Memory Addressing Modes


When a data byte/word is located in memory, its address needs to be detetmined to access the data
and perform the specified operation. The address of the operand may be
"'specified directly in the instruction
given indirectly in the instruction
mentioned in the instruction with respect to the contents of the other register
" given indirectly in the instruction but with respect to the contents of the other register
Based on the above specification, the memory addressing modes is represented in three ways.
1. Direct addressing mode
2. Indirect addressing mode
3. Indexed addressing mode

1. Direct addres_ing mode


In this memory addressing mode, the memory operand address, is specitied as part of the instruction.
For example ;DA 2400H (in 8085processor instruction) which means that the operand is stored in the
memory location 2400H. This operand address isgiven in the addressing mode as shown in Fig. L:8
Introduction to Digital Computers and Microprocessors
Operation code Address of operand
Memory

Operand

Fig. 1.8 Direct addressing mode

Note: In the 8086, all the addresses are calculated with respect to the segment register contents.
DS is the data segment register.

2. Indirect addressing mode


In this memory addressing mode, the instruction specifies the place (a register or a memory location)
where the operand address is stored thus if the operand address is stored în X(may be register or may
be memory), the instruction would specify as follows: perform the operation on the operand whose
address can be determined using X. For example
MOV M, A [(H) (L)] + (A) in 8085 process
In the 8085, indirect address is stored in HL register pair. The above instruction transfers the contents
of register A(accumulator) to memory location whose address is given in the HL register pair as shown
in Fig. 1.9.
Register
H L

23 00

Memory
22FF

+2300 43 4

2301

2302

2303 43

Accumulator
Fig, 1.9
8
Microprocessors
3. Indexed addressing mode
The indexed addressing mode is useful when different elements of a list or an
array are to be stored
in loop for performing the same set of operation. In this mode
The base of the array is specified in a register called base register
The index or distance of the element from the base of the array to be accessed in specified in
a register called indexed register
The sum of the contents of Base register and Index register is the address of the operand in
memory.
Let us assume that the ten numbers, X1, X, X3 ... X10 are stored in memory in consecutive locations
starting from 0300H. The address 0300H is the base of the array and will be stored in base register.
For the first element, the index register willcontain 0. To accessX5, the index register will contain 04
Fig. 1.10 shows this index addressing mode
Base Register Index Register
0300 04

Memory
0300 X1 Base location
0301 X2
0302 X3
0303 X4
X5
Address of operand
(0304 H) X6
X7
X8
X9
0310 X10

Fig. 1.10
Thus, the operation in loop may be performed as follows
Start: Load the base register with the base location of the array
Load the index register with 0
Loop: 'Perform operation
Increment the index register
Iftheindex register contents less than N(length of array)then branch to loop else continue

You might also like