Addressing Modes
Addressing Modes
• Immediate mode
• Register mode
• Absolute mode
• Indirect mode
• Index mode
• Relative mode
• Auto-increment mode
• Auto-decrement mode
Implementation of variables and
constants
• Variables and constants are the most simplest
and commonly used data types on every
computer.
• A variable is initialized by allocating a register
or memory location to hold its value in
assembly language.
• The addressing modes used for representing
variables are:
• Register mode
• Absolute mode
• Register mode: operand is the contents of a processor
register.
» The name of the register is specified in the instruction.
• Eg: Move R1, R2.
• This instruction copies the contents of register R2 to R1.
• Absolute mode: also known as Direct mode
» The operand is in a memory location.
» The address of the location of the operand is given explicitly as a
part of the instruction.
• Eg: Move A, 2000
• The addressing mode used for representing
constants :
• Immediate mode: operand is given explicitly in the
instruction means operand is part of the instruction itself.
• No memory reference is required to access the operand.
• Eg: Move #200,R0.
• Eg: Move 200 immediate ,R0: It places the value 200 in the
register R0.The immediate mode is used to specify the value
of source operand.
• In assembly language, the immediate subscript is
not appropriate so # symbol is used.
• It can be re-written as : Move #200,R0
• The sharp sign(#) is used in front of the value to
indicate that this value is to be used as an immediate
operand.
• Constant values are used frequently in high level
language programs.
• For eg : A= B+6, this statement contains the constant 6.
• Let us assume that A and B are declared earlier as variables
and may be accessed using absolute mode.
• (Ri)+
• To access successive words in a byte –addressable
memory with a 32-bit word length, the increment must
be 4.
Auto decrement mode
• The contents of the register are to be
decremented before being used as the
effective address.
• -(Ri)