Addressing Modes
Addressing Modes
Important terms:
Effective address or Offset: An offset is determined by adding any
combination of three address elements: displacement, base and index.
o Displacement: It is an 8 bit or 16-bit immediate value given in the
instruction.
o Base: Contents of base register, BX or BP.
o Index: Content of index register SI or DI.
Types of Addressing modes:
1. Implied mode: the operand is specified in the instruction itself.
Ex: CLC
2. Immediate addressing mode (#): the data is present in address field of
instruction.
Ex: ADD 7
3. Register Mode: the operand is stored in the register -MOV AX, CX
4. Register Indirect mode: the operand’s offset is placed in any one of the
registers BX, BP, SI, DI as specified in the instruction.
Ex: MOV AX, [BX] (move the contents of memory location s addressed by
the register BX to the register AX)
5. Auto Indexed (increment/decrement mode) - This is similar to the register
indirect mode except that the register is incremented or decremented after (or
before) its value is used to access memory.
Ex: Add R1, (R2)+ // OR
R1 = R1 +M[R2]
R2 = R2 + d
6. Direct addressing/ Absolute addressing Mode [ ]): the effective address is
equal to the address part of the instruction i.e, the operand resides in memory
and its address is given directly by the address field of the instruction.
Ex: ADD R1, 4000 - In this the 4000 is effective address of operand.
7. Indirect Address Mode: the address field of the instruction gives the address
where the effective address is stored in memory.
8. Indexed addressing mode: the operand's address is calculated by adding an
index value to a base address. The index value can be a constant or stored in a
register.
Ex: MOV AX, [SI +05]
9. Base-indexed addressing mode: the effective address of the operand is
calculated by adding together a base address and an index value.
Ex: ADD AX, [BX+SI]
10. Displacement Addressing Mode: the contents of the indexed register are
added to the Address part of the instruction, to obtain the effective address of
operand.
EA = A + (R),
In this the address field holds two values, A (which is the base value) and R (that
holds the displacement), or vice versa.
11. Relative Addressing Mode: the contents of PC (Program Counter) are added
to address part of instruction to obtain the effective address.
12. Base register addressing mode - This can be defined as EA = A + (R), where A
is displacement and R holds pointer to base address.