Saturday 27 August 2016

Data Addressing Modes of 8086

     1. Immediate Addressing Mode
In this mode, 8 or 16 bit data(operand) can be specified as part of the instruction.
____________________________________
|      OP Code        |      Immediate Operand   |
|______________|_____________________|

Example: MOV CL, 03H
              = Moves the 8 bit data  03H into CL

                MOV DX, 0525H
              = Moves the 16 bit data 0525H into DX

A constant value such as "VALUE" can be defined by the assembler EQUATE directive such as
  
              VALUE EQU 35H
Example: MOV BH, VALUE
             = Used to load 35H into BH


     2. Register Addressing Mode
The operand to be accessed is specified as residing in an internal register of 8086.

Example: MOV DX, CX
             = Move 16 bit content of CX into DX

                MOV CL, DL
             = moves 8 bit content of DL into CL


     3. Direct Addressing Mode
The instruction Opcode is followed by an Effective Address(EA), this effective address is directly used as the 16 bit offset of the storage location of the operand from the location specified by the current value in the selected segment register.

The default segment is always DS.

PA= DS:EA
Segment override prefix (SOP)
PA =  _    _
          | CS
          | DS |      :         [ Direct Address ]
          |  SS |
          |  ES |
          --    -- 


     4. Register Indirect Addressing Mode
The EA is specified in either pointer(BX) register or an index (SI or DI) register. The 20 bit physical address is computed using DS and EA.

Example: MOV [DI], BX
             If [DS] = 5004, [DI]=0020, [BX]=2456, PA=[50060]
             The content of BX is moved to memory locations 50060H and 50061H.

               MOV AL, [START+BX]
              The 8 bit content of this memory location is moved to AL.
               The kind of addressing used in this particular example is known as Based Addressing Mode,                since BX pointer is used. 
               
               Indexed Addressing Mode: MOV BH, START [SI]
                                                         Here Physical Address(PA) will be [START]+[SI]+[DS]

               Based Indexed Addressing Mode: MOV ALPHA[SI][BX], CL
                                                         Here PA will be ALPHA+[SI]+[BX]+[DS]


     5. Input-Output Mode (Direct):
Here port number is an 8-bit immediate operand.

Example: OUT 05H, AL
                Outputs [AL] to 8-bit port 05H.

          Input-Output (Indirect):
The port number is taken from DX.

Example: IN AL, DX
              If [DX] = 5040,
              8 bit content by port 5040 is moved to AL.


     6. Relative Addressing Mode
Example: JNC START
             If CY=0, then PC is loaded with current PC contents plus 8 bt signed value of START,                        otherwise the next instruction is executed.


     7. Implied Addressing Mode
Instruction using this operating mode have no operands.

Example: CLC which clears the carry flag.

No comments:

Post a Comment