0% found this document useful (0 votes)
13 views

Addresing Modes

Uploaded by

hyperyug14111994
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Addresing Modes

Uploaded by

hyperyug14111994
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Execution Unit &

Addressing Modes of 8086

Prepared By: Prof. Sunil K. Vithlani


Assistant Professor,
Department of Information Technology,
DDU, Nadiad

1
VARIOUS REGISTERS IN EU

2
POINTER AND INDEX REGISTERS
◼ These registers are used to store the offset addresses of
memory locations relative to the segment registers.
Two pointer registers are :
◼ Stack pointer – The value in the SP always represents
the offset of the next stack location that can be accessed.
◼ Base pointer – It also represents an offset relative to SS
register but is employed in the based addressing mode.
Two index registers are:
◼ Source index (SI)- It is used to store an offset address
for source operand.
◼ Destination index (DI)- It is used for storage of an offset
address for the destination operand.
3
ADDRESSING MODES OF 8086

◼ The addressing modes available in Intel 8086 are:


1. Implicit Addressing
2. Register Addressing
3. Immediate Addressing
4. Memory Addressing
1. Direct Addressing
2. Register Indirect Addressing
3. Based Relative Addressing
4. Indexed Relative Addressing
5. Based Indexed Relative Addressing

4
The MOV instruction

MOV AX , BX

Destination Source

5
Implicit Addressing Mode

◼ Instruction specify their function and operand both


implicitly within the mnemonic itself.

◼ E.g. STC (set Carry Flag) , CLC (Clear CF), CMC


(Compliment CF) , STD (set Direction Flag) etc…

6
Register Addressing Mode

◼ The operand to be accessed is specified as residing in an


internal register of the 8086.
◼ Examples

Assembly Language Size Operation


MOV AL, BL 8-bits Copies BL into AL
MOV CH, CL 8-bits Copies CL into CH
MOV AX, CX 16-bits Copies CX into AX
MOV SP, BP 16-bits Copies BP into SP
MOV BX, ES 16-bits Copies ES into BX
MOV ECX, EBX 32-bits Copies EBX into ECX
MOV ESP, EDX 32-bits Copies EDX into ESP
◼ Both theDSsource and —the destination
MOV ES, Not allowed operands have been
(segment-to-segment)
specified as the contents
MOV BL, DX — of internal registers
Not allowed (mixedof the 8086
sizes)

7
Immediate Addressing Mode

◼ If a source operand is part of the instruction instead of


the contents of a register or memory location, it
represents what is called the immediate operand and is
accessed using immediate addressing mode.

◼ Typically immediate operand represents constant data


Immediate operands can be either a byte or word of
data
 Example:
MOV AL , 15H (2 bytes)
 MOV CX, 4AC2H (3bytes).

8
Memory Addressing Mode

◼ One of the operands must be in memory.


◼ We have to specify the address.
◼ Address is generally specified as segment:offset.
◼ Segment part shows the base address of the segment.
◼ Offset part shows the displacement or distance from the
segment base and is also known as effective address.
◼ Different memory addressing modes specifies how an
effective address is computed for an operand stored in a
memory which then combines with segment address to
generate physical address.

9
Direct Addressing Mode

◼ Physical address = {Segment}:{direct address}


◼ Default Segment register is DS.
◼ Direct address is 16-bit offset address provided in the
instruction.
◼ Example: MOV CX , [1000h]
◼ This stands for move the contents of the memory location,
which is offset by 1000H from the current value in DS into
internal register CX
◼ CX <- [DS*10+1000]H
◼ E.g. MOV AX,ES:[0050h]
◼ MOV [4527h],BX

10
Register indirect Addressing Mode

◼ Physical address = {Segment} : {BX or BP or SI or DI}


◼ Effective address of an operand is indirectly given in one of the
register.
◼ Default Segment register is DS if register used are BX,SI or DI.
◼ If BP is used to store effective address then SS is default
Segment.
 MOV AX,[BX]
 MOV ES:[DI],AL
 ADD CX,[SI]
 OR CH, [BP]

11
Base Addressing Mode

◼ Physical address={Segment}:{BX or BP}+{8-bit or 16-bit displacement}

◼ Effective address of an operand is specified using BX/BP plus 16-


bit/8-bit displacement value.

◼ Default Segment register is DS if BX register is used.


◼ If BP is used to store address then SS is default Segment.
 MOV AX,80h[BX]
 MOV [BP+2],AL
 AND ARRAY[BX],AX

12
Index Addressing Mode

◼ Physical address={Segment}:{SI or DI}+{8-bit or 16-bit displacement}

◼ Effective address of an operand is specified using indexed registers


plus 16-bit/8-bit displacement value.

◼ Default Segment register is DS.


 MOV AL,[SI + 34h]
 MOV [DI + 1234h], AX

13
Base-Index Addressing Mode

◼ PA ={Segment}:{BX or BP} + {SI or DI} + {8-bit or 16-bit displacement}

◼ Default Segment register is DS, if BX is used in effective address.


◼ Default Segment register is SS, if BP is used.

 MOV AL,[BX + SI] or MOV AL,[BX][SI]


 ADD CL,[BP+SI+1234h]

14
15
16

You might also like