Monday, March 19, 2012

Various addressing modes of 8086/8088

1)      Register Addressing mode
2)      Immediate Addressing mode
3)      Register Indirect Addressing mode
4)      Direct Addressing mode
5)      Indexed Addressing mode
6)      Base Relative Addressing mode
7)      Base Indexed Addressing mode

Register Addressing Mode
Data transfer using registers is called register addressing mode. Here operand value is present in register. For example

MOV AL,BL;
MOV AX,BX;
Immediate Addressing mode
When data is stored in code segment instead of data segment immediate addressing mode is used. Here operand value is present in the instruction. For example

MOV AX, 12345;
Direct Addressing mode
When direct memory address is supplied as part of the instruction is called direct addressing mode. Operand offset value with respect to data segment is given in instruction. For example

MOV AX, [1234];
ADD AX, [1234];
Register Indirect Addressing mode
Here operand offset is given in a cpu register. Register used are BX, SI(source index), DI(destination index),  or BP(base pointer). BP holds offset w.r.t Stack segment, but SI,DI and BX refer to data segment. For example

MOV [BX],AX;
ADD AX, [SI];
Indexed Addressing mode
Here operand offset is given by a sum of a value held in either SI, or DI register and a constant displacement specified as an operand. For example
Lets take arrays as an example. This is very efficient way of accessing arrays.
My_array  DB ‘1’, ‘2’, ‘3’,’4,’5’;

MOV SI, 3;
MOV AL, My_array[3];

So AL holds value 4.
Base Relative Addressing mode
Operand offset given by a sum of a value held either in BP, or BX and a constant offset sepecified as an operand. For example

MOV AX,[BP+1];
JMP [BX+1];
Base Indexed
Here operand offset is given by sum of either BX or BP with either SI or DI. For example

MOV AX, [BX+SI]
 JMP [BP+DI]

22 comments:

  1. Hi, this is good. Helped me very much

    ReplyDelete
  2. What about I/O port addressing modes?

    ReplyDelete
    Replies
    1. Well I/O port addressed using direct addressing modes and indirect addressing modes.
      Direct mode example:
      IN AX, PORTA
      IN AX, PORTB
      OUT PORTA, AX
      OUT PORTB, AX
      etc.

      Indirect example
      IN AX, DX
      inputs 16 bit data "addressed" by DX
      IN AL, DX
      inputs 8 bit data "addressed" by DX
      OUT DX, AX
      outputs 16 bit data to the port addressed by DX
      OUT DX, AL
      outputs 8 bit data to the port addressed by DX

      Delete
  3. thanks Mr Blogger
    its really helpful....

    ReplyDelete
  4. Why to add different offset values in addressing mode of 8086 ?

    ReplyDelete
  5. In alp8086 we do not end line by ';'. Please make sure you correct it. For imp programs on alp must see alpmp9.blogspot.com

    ReplyDelete
  6. In alp8086 we do not end line by ';'. Please make sure you correct it. For imp programs on alp must see alpmp9.blogspot.com

    ReplyDelete
  7. Isn't there some more classification like I/O addressing ,string,Implied ?

    ReplyDelete
  8. Isn't there some more classification like I/O addressing ,string,Implied ?

    ReplyDelete
  9. Thanks Helped mE in Cheating In online papersđź–¤

    ReplyDelete