Open In App

Addressing Modes

Addressing Modes– The term addressing modes refers to the way in which the operand of an instruction is specified. The addressing mode specifies a rule for interpreting or modifying the address field of the instruction before the operand is actually executed.

Addressing modes for 8086 instructions are divided into two categories:



1) Addressing modes for data

2) Addressing modes for branch



The 8086 memory addressing modes provide flexible access to memory, allowing you to easily access variables, arrays, records, pointers, and other complex data types.  The key to good assembly language programming is the proper use of memory addressing modes.

An assembly language program instruction consists of two parts


The memory address of an operand consists of two components: 

IMPORTANT TERMS

According to different ways of specifying an operand by 8086 microprocessor, different addressing modes are used by 8086.

Addressing modes used by 8086 microprocessor are discussed below:

Add R1,-(R2)   //OR
R2 = R2-d
R1 = R1 + M[R2] 

Auto decrement mode is same as  auto increment mode. Both can also be used to implement a stack as push and pop . Auto increment and Auto decrement modes are useful for implementing “Last-In-First-Out” data structures.

  • Direct addressing/ Absolute addressing Mode (symbol [ ]): The operand’s offset is given in the instruction as an 8 bit or 16 bit displacement element. In this addressing mode the 16 bit effective address of the data is the part of the instruction.
    Here only one memory reference operation is required to access the data.

    Example:ADD AL,[0301]   //add the contents of offset address 0301 to AL
  • 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.

    Based on the availability of Effective address, Indirect mode is of two kind:

    1. 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.
    2. 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, addressing modes are:

    Advantages of Addressing Modes

    1. To give programmers to facilities such as Pointers, counters for loop controls, indexing of data and program relocation.
    2. To reduce the number bits in the addressing field of the Instruction.

    Sample GATE Question

    Match each of the high level language statements given on the left hand side with the most natural addressing mode from those listed on the right hand side.

    1. A[1] = B[J];         a. Indirect addressing
    2. while [*A++];        b. Indexed  addressing
    3. int temp = *x;       c. Autoincrement

    (A) (1, c), (2, b), (3, a)
    (B) (1, a), (2, c), (3, b)
    (C) (1, b), (2, c), (3, a)
    (D) (1, a), (2, b), (3, c)

    Answer: (C)

    Explanation:

    List 1                           List 2
    1) A[1] = B[J];      b) Index addressing 
    Here indexing is used
    
    2) while [*A++];     c) auto increment
    The memory locations are automatically incremented
    
    3) int temp = *x;    a) Indirect addressing
    Here temp is assigned the value of int type stored
    at the address contained in X

    Hence (C) is correct solution.

    lease write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

    Article Tags :