Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

CHAPTER 3

Intel 8086 Registers and Addressing Modes


Atanu Shome
Computer Science and Engineering Discipline
Khulna University
Confession

■ Most of the materials have been collected from Internet.


■ Images are taken from Internet.
■ Various books are used to make these slides.
■ Primary reference book:
I. Microprocessor and Microcomputer based system
design by Dr. M. Rafiquzzaman
■ The Intel Microprocessors by Barry B. Brey

Atanu Shome, CSE, KU 2


This slide is not enough to learn these topics. It’s just for
your guideline. (NAH! Just a reminder for me - which
topics to cover) Reading from the slides only, will be a BIG
mistake.

YOU NEED TO READ THE DAMN BOOK

Atanu Shome, CSE, KU 3


Segmented Memory Problem

■ Can be overlapping for different segments


■ Different logical address can point to same physical address
■ Write 4 different CS:IP values for the same memory address 12BE7h
12BEh:0007h
12BDh:0017h
12BCh:0027h
12BBh:0037h

Atanu Shome, CSE, KU 4


20 bit Stack Physical Address
Calculation
■ SS and SP

■ In based addressing mode, BP instead of SP

Atanu Shome, CSE, KU 5


8086 Registers

■ 8 general registers What are they for?


■ 16 bit each
■ AX, BX, CX, DX, SP, BP, SI,DI

Read the book


Atanu Shome, CSE, KU 6
8086 Flags
■ Six one-bit flags
■ AF
■ CF
■ OF
■ SF
■ PF
■ ZF
■ Three control bit in flag
registers: DF, IF, TF

Atanu Shome, CSE, KU 7


Example

■ Find out the status of CF, OF, PF, SF flags of 8086 after the following assembly
instructions:
MOV AX, 7FFFh
MOV BX, 8001h
ADD AX,BX

Atanu Shome, CSE, KU 8


Addressing Modes of 8086

■ Five groups
– Register and Immediate mode
– Memory mode
– I/O mode
– Relative addressing mode
– Implied addressing mode

Atanu Shome, CSE, KU 9


Register and Immediate Addressing
Mode
1. Register Addressing Mode
MOV DX, CX
MOV AL,DL
2. Immediate Addressing Mode
MOV CL, 03H
OR
VALUE EQU 03H
MOV CL,VALUE

Atanu Shome, CSE, KU 10


Memory Modes

3. Direct Addressing Mode


MOV CX, DS:START
START=0040h, [DS]=3050h, What are addresses from which data will be
transferred in CX?
30540h to CL, 30541h to CH
4. Register Indirect Addressing Mode
MOV [DI],BX
[DS]=5004h, [DI]=0020h, [BX]=3456h – Then, after the execution of above
instruction, what will happen?

Atanu Shome, CSE, KU 11


Memory Modes

5. Based Addressing Modes


(Uses DS, SS, BX, BP)
MOV AL, START [BX]
MOV AL, [BX+START]

6. Indexed Addressing Mode


MOV BH, ARRAY[SI]

7. Based Indexed Addressing Mode


MOV ALPHA[SI][BX]

Atanu Shome, CSE, KU 12


Memory Modes

8. String Addressing Mode


MOVS BYTE
IF [DF]=0, [DS]=2000h, [SI]=0500h, [ES]=4000h, [DI]=0300h, [20500] 16=38h &
[40300]16=45h
Then, after the instruction execution
[40300]16 = 38h, [SI]=0501h, and [DI]=0301h

Atanu Shome, CSE, KU 13


I/O Modes

9. I/O Addressing xModes


OUT 05h, AL
IN AL,DX

Atanu Shome, CSE, KU 14


Relative Addressing Mode & Implied
Addressing Mode
10. Relative Addressing Mode
JNC START

11. Implied Addressing Mode


CLC
■ https://www.youtube.com/watch?v=R6pFW209lfk
■ https://www.youtube.com/watch?v=QP-4FlwNTvw
■ https://www.youtube.com/watch?v=BZGsuwrM8Tc
■ https://www.youtube.com/watch?v=VD_RGiKWPBg

Atanu Shome, CSE, KU 15


Atanu Shome, CSE, KU 16
Practice

■ What will happen after the following operation if DF is set to 0?


a[DI] = b [SI]

■ Determine the addressing modes of the following instructions:


i. MOV BX, 0235H
ii. MOV CS, DS:START
iii. MOV BH, ARRAY[SI]

Atanu Shome, CSE, KU 17

You might also like