Docsity

8086 Microprocessor and microcontroller, Summaries of Microprocessors

Partial preview of the text

Download 8086 Microprocessor and microcontroller and more Summaries Microprocessors in PDF only on Docsity!

EEE 3231: Microprocessor and Embedded

Systems



START:

MOV CX,

;initialize counter

NOTE: 

List of basic instructions Table 3.1 in Rafiquzzaman’s Book. 

Detailed

explanations

in

Marut’s

book

Name

operation

operand(s)

comment



Detailed

explanations

in

Marut’s

book



Also see the 8086 Assembly Language Publication handout uploaded to drive.

Farhana B Sufi (PhD), 2024

Instruction cycle & Addressing Modes: 

The sequence of operations to execute an instruction is the

INSTRUCTION

CYCLE

Fetch

Decode

Execute

One

of

the

tasks

in

an

instruction

cycle

is

to

determine

the

address

of

the



One

of

the

tasks

in

an

instruction

cycle

is

to

determine

the

address

of

the

operand, and how this ‘fetching’ is done is called the

ADDRESSING MODE.

Farhana B Sufi (PhD), 2024

Ref. Book: Rafiquzzaman



The 8086 has 12 Basic Addressing modes, classified into FIVE

groups: 1.

For accessing immediate and register data

For accessing data in memory (memory modes)

For accessing I/O ports (I/O modes)

Relative

addressing

mode

Relative

addressing

mode

Implied addressing mode

Farhana B Sufi (PhD), 2024

Rafiquzzaman

For

accessing data in memory

(memory modes)

The EU has access to all data registers and immediate operands. But cannot directly

access memory operands. -

The BIU generates 20-bit physical address after shifting segment register four bits

to the left & then adding 16-bit Effective Address (EA) to it.



The BIU computes the 20-bit Physical address internally – example



Code Segment Register (CS) = 456A

H

S

hift CS to the left by 4bits = 456A

H



Instruction

Pointer

(

IP)

=

1620

H

1620

H



Instruction

Pointer

(

IP)

=

1620

H

1620

H

20-bit Physical address is

= 46CC

H

However, a segment override prefix can be used.

e.g. INC BYTE PTR [START] will increment the 8bit content of memory location anDS with offset START by one. -

However, segment DS can be overridden by ES as follows:

INC ES: BYTE PTR [START]

Segments cannot be overridden for Stack reference instructions (e.g.

PUSH & POP)

Farhana B Sufi (PhD), 2024

Rafiquzzaman



EU has the general data registersAX - accumulatorBX – base registerCX – count

“

DX – data

“

And theSP Stack PointerBP Base “SI Source Index DI Destination “

Farhana B Sufi (PhD), 2024

Ref. Book: Rafiquzzaman

DI Destination “ FLAGS BIU has four 16-bit segment registers:Code Segment Register CSData

“

“

DS

Stack

“

“

SS

Extra

“

“

ES

AndInstruction Pointer

IP

1.

Direct Addressing Mode:

e.g

MOV CX, DS: START

This instruction moves the 16bit contents of a 20-bit physicalmemory location computed from START

and DS into CX.

2. Register Indirect Addressing Mode: EA is specified in either a pointer register or an index register. The pointer register can be either base register BX or base pointer register BP and indexregister can be either Source Index (SI) register or Destination Index (Dl)register. The 20 bit physical address is computed using DS and EA. e.g. MOV [

[[[DI], BX

If [DS] -

16

[DI] = 0020

16

and [BX] = 2456

16

then after MOV [DI], BX, content of BX (

16

) is moved to memory

locations 50060

16

and 50061

16

Farhana B Sufi (PhD), 2024

Rafiquzzaman

c. Based Addressing Mode:



EA is obtained by adding a displacement (signed 8 bit or unsigned 16bit) value tothe contents of BX or BP. The segment registers used arc DS and SS. Whenmemory is accessed using BX, the 20bit physical address is computed from BX andDS. On the other hand, when the stack is accessed, the 20 bit physical address iscomputed from BP and SS.

Farhana B Sufi (PhD), 2024

Rafiquzzaman

Based AddressingMode:

Fig 3.4: Rafiquzzaman

d. Indexed Addressing Mode:



EA

is calculated by adding the unsigned 16bit or signed-

extended or 8bit displacement and the contents SI or DI.

e.g. MOV BH, ARRAY [SI], moves the contents of the 20-bit address computed fro thedisplacement ARRAY, SI and DS into BH. Note

for

both

based

and

indexed

modes,

the

obtains

the

EA

by

using

the

Note

for

both

based

and

indexed

modes,

the

obtains

the

EA

by

using

the

equation EA = RA + M, where RA is the Reference Address and M is the Modifier, Incase of based addressing mode, RA is held in a register such as BX or BP.The based mode is useful in accessing segmented memory in which BX or BP holds thebase address of a segment. In indexed

addressing mode, on the other hand, RA is

included as part of the instruction and the 8086 register SI or DI contains the value ofM. RA can be unsigned 16 bit or signed-extended 8bit.

Farhana B Sufi (PhD), 2024

Rafiquzzaman

For accessing I/O ports (I/O modes):

IN

and

OUT

For memory-mapped I/O

In direct port mode the port number is an 8bit address (0 to 255) e.g. OUT 05H, AL -^

In indirect port mode port number is taken from DX. e.g. IN AL, DX

where [DX] = 5040

16

Relative addressing mode:

The EA is calculated with reference to the IP.e.g : JNZ 8 bit address IP = IP + 8 bit address. 3.

Implied addressing mode:

Instructions will have no operands.e.g. CLC

  • clear carry flag

Farhana B Sufi (PhD), 2024

  1. Rafiquzzaman2. Geeks for Geeks website



Text Books:

Mohamed Rafikuzzaman – MPs and MC-based SystemDesign

Charles Marut – Assembly Language Programming and Organization of the IBM

PC

Organization of the IBM

PC

Other: 1.

Handout uploaded in drive

Geeks for Geeks website - https://www.geeksforgeeks.org/addressing-modes-8086- microprocessor/