Addressing Modes - Microprocessor And Interfacing
- Basic
- The way in which the operand of an instruction is specified
- Categories
- Addressing modes for data
- Addressing modes for branch
- Instruction consists of
- Opcode
- Operand
- Starting Address
- Effective address or Offset -=> Determined by adding any combination of three address elements
- Displacement -=> It is an 8 bit or 16 bit immediate value given in the instruction
- Base -=> Contents of base register, BX or BP
- Index -=> Content of index register SI or DI
- Different Modes used by 8086
- Implied mode
- In implied addressing the operand is specified in the instruction itself
- In this mode the data is 8 bits or 16 bits long and data is the part of instruction
- Zero address instruction are designed with implied addressing mode
- Example -=>
CLC (Used to reset Carry flag to 0)
- Immediate addressing mode (symbol #)
- In this mode data is present in address field of instruction
- Example -=>
MOV AL,35H (Move the data 35H into AL register)
- Register mode
- In register addressing the operand is placed in one of 8 bit or 16 bit general purpose registers
- The data is in the register that is specified by the instruction
- Here one register reference is required to access the data
- Example -=>
MOV AX,CX (Move the contents of CX register to AX register)
- Register Indirect mode
- In this addressing the operand’s offset is placed in any one of the registers BX,BP,SI,DI as specified in the instruction
- The effective address of the data is in the base register or an index register that is specified by the instruction
- Here two register reference is required to access the data
- Exam ple -=>
MOV AX,[BX] (Move the contents of memory location addressed by the register BX to the register AX)
- Auto Indexed (Increment mode)
- Effective address of the operand is the contents of a register specified in the instruction
- After accessing the operand, the contents of this register are automatically incremented to point to the next consecutive memory location
- Here one register reference,one memory reference and one ALU operation is required to access the data
- Useful for stepping through arrays in a loop
- Example -=>
Add R1, (R2)+
- Auto indexed (Decrement mode)
- Can be used to implement a stack as push and pop and LIFO
- Example -=>
Add R1,-(R2)
- Direct addressing/Absolute addressing Mode (symbol [])
- The operand’s offset is given in the instruction as an 8 bit or 16 bit displacement element
- Only one memory reference operation is required to access the data
- Example -=>
ADD AL,[0301]
- Indirect addressing Mode (symbol @ or ())
- In this mode address field of instruction contains the address of effective address
- Here two references are required
- 1st reference to get effective address
- 2nd reference to access the data
- Types based on the availability of Effective address
- Register Indirect
- In this mode effective address is in the register, and corresponding register name will be maintained in the address field of an instruction
- Here one register reference,one memory reference is required to access the data
- Memory Indirect
- In this mode effective address is in the memory, and corresponding memory address will be maintained in the address field of an instruction
- Here two memory reference is required to access the data
- Indexed addressing mode
- The operand’s offset is the sum of the content of an index register SI or DI and an 8 bit or 16 bit displacement
- Example -=>
MOV AX,[SI +05]
- Based Indexed Addressing
- The operand’s offset is sum of the content of a base register BX or BP and an index register SI or DI
- Example -=>
ADD AX,[BX+SI]
- Based on Transfer of control
- PC relative addressing mode
- Base register addressing mode