WHY VARIOUS ADDRESSING MODES
It is the part of ISA (instruction Set architecture) and have direct impact on architectural complexity & speed of the machine. To reduce complexity & increase speed of machine different addressing modes are used.
VARIOUS ADDRESSING MODES
The most common addressing techniques are:
- Implied
- Immediate
- Direct
- Indirect
- Register
- Register Indirect
- Relative addressing
- Base-register addressing
- Indexing
To explain the addressing modes, we use the following notation:
Adrs - contents of an address field in the instruction that refers to a memory.
R - contents of an address field in the instruction that refers to a register.
EA - actual (effective) address of the location containing the referenced operand.
(X) - contents of location X.
Implied Mode:
In this mode operand are indicated implicitly in the instruction.
Example:
- CMA: It complements the contents of the Accumulator.
Immediate mode:
In this mode the operand is present in the instruction.
Example:
- MVI A, 06: moves 06 to the accumulator.
- ADI 05: adds 05 to the contents of Accumulator
Direct Addressing:
A very simple form of addressing is direct addressing, in which the address field contains the effective address of the operand.
EA = Adrs
It requires only one memory reference and no special calculation.
Example:
LDA 2500H: Loads the accumulator with the contents of memory
location 2500H
STA 2500H: Store the contents of the accumulator to the memory location 2500H
Indirect Mode:
In this mode address field of the operand specifies the address of operand.
EA = (Adrs)
Example:
MOV R1, (X): contents of location whose address is given in X is loaded into register R1.
Register Direct Addressing Mode:
Address field of the instruction contains register where operands are stored.
EA = R
Example:
ADD R1, R2: adds the contents of the register R1 & R2 and store the result in R1.
Register Indirect Addressing Mode:
In this mode address field of the instruction contains register where the address of operand is stored.
EA = (R)
Relative addressing Mode:
In this mode the effective address is obtained by adding the contents of Program Counter (PC) with the address part of Instruction. That is, the current instruction address is added to the address field to produce the EA. Thus, the effective address is a displacement
relative to the address of the instruction.
Example:
JMP 20: branch to location relative to the value 20(offset).
Base-register addressing
In this mode the contents of the base register is added to the address part of instruction to give the effective address of the operand. This mode is used for relocation of program in memory.
Index addressing mode:
In this mode the contents of the index register is added to the address part of instruction to give the effective address of the operand. Address part of instruction contents the base address of the operand array and index register contains the offset. This mode is used for
array processing.
0 Comments