Addressing Modes in Microprocessor 8086/8088, Lecture notes of Microprocessors

Lecture notes from the University of Namibia

Typology: Lecture notes

2018/2019

Uploaded on 03/24/2019

201607006
201607006 🇳🇦

8 documents

1 / 40

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
8086
ADDRESSING
MODES
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28

Partial preview of the text

Download Addressing Modes in Microprocessor 8086/8088 and more Lecture notes Microprocessors in PDF only on Docsity!

ADDRESSING

MODES

Addressing Modes in

Microprocessor

Types of Addressing Modes:

(1) Data Addressing Modes

(2) I/O Ports addressing modes

(3) Program-Memory Addressing

Modes

(4) Stack-Memory Addressing

Modes

Opcode and Operand in Microprocessor

Opcode is short of “operation code”

An opcode is a single instruction that can be executed by the CPU. In machine

language it is a binary or hexadecimal value such as B7 loaded into the instruction

register.

In assembly language mnemonic form an opcode is a command such as MOV or ADD

or JMP.

Example:

MOV AX, 1000H ; MOV is the opcode.

; AX (register) is an operand.

Operands are manipulated by the opcode. In this example, the operands are the register

AX and the value 1000H.

8-bit 8-bit 8-bit
OP CODE OPERAND
1 byte 1 to 2 byte

Register Addressing Mode

Transfers a copy of a byte or word from the source register
or memory location to the destination register or memory
location.
Use of registers to hold the data to be manipulated
Memory is not accessed when this addressing mode is
executed
Example:
MOV BX, DX ; copy the contents of DX into BX
MOV ES, AX ; copy the contents of AX into ES
ADD AL, BH ; add the contents of BH to contents of AL
Source and destination registers must have the same size

Immediate Addressing Mode

Transfers the source, an immediate byte or word of data,

into the destination register or memory location

■ The source operand is a constant

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.

Immediate Addressing Mode

Example:

MOV AX, 2550H ; move 2550H into AX

MOV CX, 625 ; load the decimal value 625 into CX

MOV BL, 40H ; load 40H into BL

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, 0123H ; illegal instruction!

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 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

Example:

Find the physical address of the memory location and its contents after the

execution of the following, assuming that DS = 1512H.

MOV AL, 3BH
MOV [3518], AL

Direct Addressing Mode

Solution:

First 3BH is copied into AL,

Then in line two, the contents of AL are moved to logical address DS:3518 which is

Shifting DS left and adding it to the offset gives the physical address of 18638H

(15120H + 3518H = 18638H).

After the execution of the second instruction, the memory location with address

18638H will contain the value 3BH.

Displacement Mode

The Displacement Only Addressing Mode

The displacement-only addressing mode consists of a 16 bit constant that

specifies the address of the target location.

The instruction mov al,ds:[8088h] loads the al register with a copy of the byte

at memory location 8088h.

Likewise, the instruction mov ds:[1234h],dl stores the value in the dl register

to memory location 1234h:

The Displacement Only Addressing Mode

■ The displacement-only addressing mode is perfect for

accessing simple variables.

■ Intel named this the displacement-only addressing mode

because a 16 bit constant (displacement) follows the

mov opcode in memory.

■ In that respect it is quite similar to the direct addressing

mode on the x86 processors. There are some minor

differences, however.

  • First of all, a displacement is exactly that- some

distance from some other point. On the x86, a direct

address can be thought of as a displacement from

address zero.

Register Indirect Addressing

Mode

■ Transfers a byte or word between a register and a memory location

addressed by an index or base register

■ The address of the memory location where the operand resides is held

by a register

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

■ SI, DI and BX are combined with DS in order to generate the 20-bit

physical address. BP is combined with SS.

Example:

MOV AX, [BX] ; moves into AX the contents of the memory

location pointed to by DS:BX, 1000:

Register Indirect Addressing

Mode

The physical address is calculated as

1000x10+1234=11234H

■ The same rules apply when using register SI or DI.

■ Example:

MOV CL, [SI] ; move contents of DS:SI into CL

MOV [DI], AH ; move contents of AH into DS:DI

■ Example:

■ Assume that DS = 1120, SI = 2498, and AX = 17FE Show the contents

of memory locations after the execution of MOV [SI], AX ; move

contents of AX into DS:SI

Register Indirect Addressing

Mode

Register Indirect Addressing Mode