ADDRESSING MODES
Refers to different ways of specifying
the location of an operand in an
instruction.
Each assembly language instruction
consists of and Op code and Operand
Op Code
It is the mnemonic part of the
instruction/that indicates what it is to
do/code for the operation. E.g. ADD.
LDA
In ADD 12 , ADD is the Opcode
Operand
- is the address field that holds the
data to be manipulated or it can be
just the data to be manipulated e.g. in
ADD 12, “12” is the operand
Types of addressing Modes
• Immediate
• Direct
• Indirect
• Indexed
• Relative
Immediate Addressing
Operand is part of instruction
- In other words the value to be used is stored in the instruction
- The computer does not need to search in the memory the data to be upon
since it is already in the instruction
- The operand in the instruction is not an address at all but the actual data to
be used
- Eg MOVE # 300 moves the value 300 into accumulator register
Direct Addressing
The address given in the instruction is the one that contains the
operand
e.g. ADD A
— Add contents of cell A to accumulator
A is the address where the operand is located so the computer will
look in memory at address A for operand
Indirect Addressing Mode
The address given in instruction holds another
address where the actual data is stored
Address A contains another address where the
actual data will be located
RELATIVE ADDRESSING
Relative addressing mode Cont
In relative addressing the address part of the
instruction is added to the value in the Program
Counter(PC) to obtain the address of the data to be
manipulated
This is direct addressing that begins from a
fixed point and all addresses are relative to that
point
Eg Load R1, B(PC)
The above loads register R1 with the contents of
memory location whose address is the sum of the
contents of PC and the value of B
Indexed addressing
Index addressing mode Cont
In index addressing the address part of the
instruction is added to the value held in the Index
Register to obtain the address of the data to be
manipulated.
The actual address is found by adding a
displacement to the base address
There are two addresses that are used, the address
register which holds the base register then the data
register or index register
When these two are added you get the Effective
Address where the actual data to be used is located