Addressing Mode - 8086

You might also like

You are on page 1of 24

ADDRESSING

MODES OF 8086

N.Savithaa
Asst. Professor/ECE
SRIT
DEFINITION

• The different ways that a microprocessor can


access data are referred to as addressing
modes.
CLASSIFICATION

I. Register addressing mode


II. Immediate addressing mode
III. Direct addressing mode
IV. Register Indirect addressing mode
V. Base plus index addressing mode
VI. Register relative addressing mode
VII.Base relative plus index addressing mode
(i) Register addressing mode
• Register addressing transfers a copy of a byte or word
from the source register to destination register. Register
addressing is the most common form of data addressing
and once the register names are learned, is the easiest
to apply.
• 8-bit register names with register addressing: AH, AL,
BH, BL, CH, CL, DH, DL.
• 16-bit register names: AX, BX, CX, DX, SP, BP, SI ,DI, IP,
CS, SS, DS and ES.
CONTINUE…
• Never mix an 8-bit register with 16-bit, it is not
allowed in microprocessor.
• Code segment register (CS) is never used as
destination.
• Segment to segment MOV instruction is not
allowed.
• Memory is not accessed when this addressing
mode is executed.
EXAMPLE…
• MOV AL, BL ; Copies 8-bit content of BL into
AL
• MOV AX, CX ; Copies 16-bit content of CX
into AX

• MOV AL, BL 16BX AB

32 AB
AX
(ii) Immediate addressing mode

• Immediate addressing transfers the source, an


immediate byte or word data, into the
destination register.
• Immediate data means constant data.
• In this mode, 8 bit or 16 bit data can be
specified as a part of instruction.
CONTINUE…
• The operand comes immediately after the
opcode.

• For this reason, this addressing mode executes


quickly.

• Immediate addressing mode can be used to


load information into any of the registers except
the segment registers and flag registers.
EXAMPLE…
• MOV BL, 44 ; Copies 44 decimal (2CH) into BL
• MOV AX, 0044H ; Copies 0044H into AX
• The data must first be moved to a general-purpose
register and then to the segment register.
• Example:
MOV AX, 2550H
MOV DS, AX
MOV DS, 2550H – Illegal instruction
(iii) Direct addressing mode
• Moves a byte or word between a memory
location and a register.
• The data is in some memory location(s) and
the address of the data in memory comes
immediately after the instruction
• This address is the offset address (OR)
Effective address(EA).
CONTINUE…
• In case of 8 bit displacement, the EA is
obtained by sign extending the 8 bit
displacement to 16 bit.
• The 20 bit physical address of memory is
calculated by multiplying the content of DS
register by 16(decimal) or 10H and adding
effective address.
EXAMPLE…
• MOV AX, [2400] ; move contents of
DS:2400H into AX
• The physical address is calculated by
combining the contents of offset location
2400 with DS
(iv) Register Indirect addressing mode

• Transfers a byte or word between a register and a


memory location addressed by an index or base register

• In this mode, the name of the register which holds the


effective address will be specified in the instruction.

• The registers used for this purpose are SI, DI, and BX

• They must be combined with DS in order to generate the


20-bit physical address.
CONTINUE…
• The data segment is used by default with
register indirect addressing or any other
addressing modes that uses BX, DI or, SI to
address memory.
• If BP register addresses memory, the stack
segment is used by default.
• The [ ] symbol denote indirect addressing in
assembly language.
EXAMPLE…
• MOV AX, [BX] ; moves into AX the contents of the
memory location pointed to by DS:BX, 1000:1234
• The physical address is calculated as

1000x10+1234=11234H
• The same rules apply when using register SI or DI.
• MOV CL, [SI] ; move contents of DS:SI into CL
• MOV [DI], AH ; move contents of AH into DS:DI
(v) Base plus index addressing mode

• Base-plus-index addressing transfer a byte or word


between a register and a memory location
addressed by a base register (BP or BX) plus an
index register (DI or SI).
• The base register often holds the beginning
location of a memory array, whereas the index
register holds the relative position of an element in
the array.
CONTINUE…

• When BP addresses memory, stack segment


is selected by default and when BX addresses
memory data segment is selected by default.
• One base register and one index register are
used.
EXAMPLE…
• MOV CX, [BX+DI] ; Copies the word content
of the data segment memory location
addressed by BX plus DI into CX.
• MOV [BP+DI], AH ; Copies AH into stack
segment memory location addressed by BP
plus DI
(vi) Register relative addressing mode

• Moves a byte or word between a register and


the memory location addressed by an index
or base register plus a displacement.

• The data in a segment of memory are addressed


by adding the displacement to the contents of a
base or an index register (BP, BX, DI, or SI).
CONTINUE…
• Remember that BX, DI or SI addresses data
segment and BP addresses the stack
segment.

• MOV AX, [DI+0100H] ; Copies the word


content of the data segment memory location
addressed by DI plus 100H into AX.
EXAMPLE…
• MOV AX, [BX+4] ; move contents of
DS:BX+4 into AX

• Physical Address = (DSx10) + (BX+4)

• MOV CH, [SI+5] ; move contents of the


DS:SI+5 into CH

• Physical Address = (DSx10) +(SI+5)


(vii)Base relative plus index
addressing mode
• Base relative plus index addressing transfers a
byte or word between a register and a memory

• location addressed by a base and an index


register plus displacement.

• It is similar to base plus index addressing, but it


adds a displacement beside using a base
register and an index register.
CONTINUE…
• This type of addressing mode often
addresses a two-dimensional array of
memory data.
• The data in a segment of memory are
addressed by adding the displacement to the
contents of a base and an index register (BP,
BX, DI, or SI).
EXAMPLE…
• MOV DH, [BX+DI+0020H] ; Copies the byte
content of data segment memory location
addressed by the sum of BX, DI and 20H into DH.
• MOV [BP+SI+0006], AL; move contents of AL into

SS:BP+SI+6
• Physical Address = (SSx10) + (BP+SI+6)

You might also like