You are on page 1of 7

Computer Organization and Architecture

CSEN 2202
Lecture 7 – 8
27/01/2020

Dr. Debranjan Sarkar


Addressing Modes
• The different ways in which the location of an operand is specified in an
instruction are referred to as addressing modes
• Sometimes two or more addressing modes are combined in one mode
• Advantages:
• It gives flexibility to the programmers with respect to the number of
instructions and execution time by providing various addressing modes
• It reduces the length of the instructions and the size of the programs.
Because these two parameters are associated with the capacity of the
memory
Different addressing modes
(Class I : No address field)
• Implied addressing mode
• Operands are indicated implicitly by the instruction
• Accumulator is generally used to hold the operand
• Result is also stored in accumulator
• Examples:
• CMA (Complement accumulator)
• RAL (Rotate accumulator left through carry)
• Immediate addressing mode
• Operand is mentioned explicitly in the instruction
• Instruction contains the value of the operand rather than its address
• To initialize register to a constant value, this mode is useful
• Examples:
• MVI B, 06 (Load B register with the decimal value 6)
• ADI 5 (Add 5 with the content of accumulator and put the result in the accumulator)
Different addressing modes
(Class I : No address field)
• Stack addressing mode
• The instruction does not have any address field
• All operands for an instruction are taken from the top of the stack
• Result is pushed on to the top of the stack
• Stack-organized computers use this addressing mode
• Examples:
• ADD (add using the operands from the top of the stack)
Different addressing modes
(Class II : Address field is register address)
• Register direct addressing mode
• Processor registers hold the operands
• If there are 2k registers in the CPU, k bits are required for each address field
• As registers are faster than memory, faster execution is possible
• Example:
• ADD R1, R2 (Add contents of R1 and R2 and store the result in R1)
• Register indirect addressing mode
• The instruction specifies an address of a register that holds the address of the operand in memory
(show figure)
• Useful for rapid access of the main memory location e.g. array
• Advantage: using small number of bits in the address field of the instruction, a memory location is
accessed, rather than directly using large bits
• Example: MOV R1, *R2 (The content of the memory location whose address is in register R2 is
moved to register R1)
Different addressing modes
(Class II : Address field is register address)
• Auto increment (or decrement) mode
• Similar to Register indirect addressing mode
• Register’s content is incremented after execution of the instruction (auto-
increment)
• Register’s content is decremented before execution of the instruction (auto-
decrement)
• This is necessary for accessing an array of data in memory
• Example: MOV R1, *R2+ (The content of the memory location whose address
is in register R2 is moved to register R1 and then the register R2 is
automatically incremented)
Thank you

You might also like