Short Note On Addressing Mode
Addressing Mode :Each operation field of an instruction specifies the operation to be performed. The operand field specifies the data (or operand) on which the operations must be executed. These data are stored in the registers or memory locations. So which executing an instructions, the processor needs the specific data from their storage locations.
The way, the data is specified or the way the operands are chosen by the processor during program execution gives the addressing mode of the instruction.
The different addressing modes are the following below –
Implied Mode : In this mode the operands are specified ‘implicitly’ in the definition of the instruction i.e the operands are implied in the definition . Operands need not be specified explicitly.
Example :
Complement Accumulator : This instruction is an implied instruction because the operand in the accumulator register is implied in the definition of the instruction. The operand need not be specified explicitly.
Uses : All register reference instructions using an accumulator and zero address instruction in a stack-organized computer are implied-mode instructions.
Immediate Addressing Mode : In this mode the operand is itself specified in the instruction operand field. Here the operand value is a constant.
Example :
LOADI 99 or LOADI immediate 99This means the 99 are to be loaded in the Accumulator as has been shown in the figure. In this mode the instruction has an operand field rather than an address field.
Uses : Immediate Addressing Mode instruction are useful for initializing registers to a constant value.
Register Mode or Register Direct Mode : In this mode the operands reside in registers that reside within the CPU i.e the operands reside directly in the CPU registers.
Example :
ADD B or ADD register direct B
Here B is a cpu register and the content of which is 10 i.e this content reside directly with in the cpu register B. Hence, this content must get added to the content of the accumulator.
Register Indirect Mode : In this mode the instruction specifies a register in the cpu whose contents give the address of the operand in memory i.e the content of the cpu register is the address of the operand’s location in the memory.
Example :
ADD B or ADD register indirect B
Here the content of the cpu register B is the memory location that contains the operand 99. So the register B contains the address of the operand (99) is to be added to the Accumulator content.
Uses : Register Indirect addressing modes are convenient to use as the execution time needed is much less.
Direct Addressing Mode : In this mode, the effective address of the operand is equal to the address part of the instruction i.e the address part of the instruction indicates the memory location containing the operand.
Example :
LOAD X
In this the memory location X contains the operand 60 to be loaded in the accumulator.
Indirect Addressing Mode : In this mode the address field of the instruction gives the address where the effective is stored in memory i.e the address part of the instruction indicates the memory location whose content is the address of the memory location containing.
Example :
LOAD W
The memory location W contains X, which is the memory location whose content is the actual operand 60. This operand is to be ultimately in the accumulator.
Relative Addressing Mode : In such modes the content of the cpu register is added to the address part of the instruction to obtain the actual address of the operand. The address part of the instruction which is usually a signed number an addition to the cpu register content, gives the effective address whose position in memory is relative to the address of the next instruction.
Uses : Relative addressing Mode is often used with branch type instruction.
Relative addressing mode may be of the following three types given below –
a) PC Relative Addressing Mode : In this mode the content of the program counter is added to the address part of the instruction to obtain the address of the operand.
b) Indexed Addressing Mode : In this mode the content of the index register is added to the address part of the instruction to obtain the actual address of the operand.
Uses : The index register can be used to access consecutive operands. This can be done by increment the register contents.
c) Base Register Addressing Mode : In this mode the content of the base register is added to the address part of the instruction to obtain the actual address of the operand.
Uses : Such modes are used in computers to facilitate the relocation of program in memory.
Stack Addressing Mode : Here the address of the operand is specified by the stack pointer (SP). The length of instruction is the shortly as it does not include any address of the memory location or mention any register. After each stack operation the contents of sp are automatically incremented or decremented . PUSH and POP are the two commonly used instructions of this type.
Example :
PUSH A à To PUSH the content of accumulator to the top of stack (TOS).
Uses : Useful hen PUSH and POP instructions are used in a program by the programmer.
When interrupt occurs the contents of important registers are saved into the stack. For this stack addressing is used.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment