Professional Documents
Culture Documents
The 8086
Microprocessor Family
• Characteristics
– 16 bit microprocessor
– 16 bit data bus
• it can read from or write to memory
and I/O ports either 8 or 16 bits at a
time
– 20 bit address bus
• it can address 220 memory locations
– each location is 1 byte (8 bits) wide,
thus 16 bit words will require
consecutive memory locations
8086 Architecture 2
Members of this family
• 8088
– same as 8086 but has an 8 bit data bus
• 80186/80188
– enhanced instruction set…but still
backwards compatible
• 80286
– designed for a multi-user, multi-tasking
microcomputer
– users a virtual address mode to prevent
collision of users’ programs
• 80386/80486
– first Intel 32 bit processor
– can directly address up to 4 GB of
memory
8086 Architecture 3
8086 Block Diagram
Hindu College,
Amritsar.
8086 Architecture 5
Internal Architecture
8086 Architecture 6
Execution Unit (EU)
8086 Architecture 7
The Flag Register
8086 Architecture 9
The BIU Queue
8086 Architecture 10
8086 Programmer’s
Model
16-bit Registers
ES Extra Segment
BIU registers
AX AH AL Accumulator
BX BH BL Base Register
CX CH CL Count Register
DX DH DL Data Register
SP Stack Pointer
BP Base Pointer
SI Source Index Reg
EU registers
16 bit arithmetic
DI Destination Index
FLAGS
Hindu College,
Amritsar.
Segment Registers
• the 220 bytes of addresses are divided in to
4 64KB segments
– code segment - CS register stores upper 16 bits of
its starting address
• where instructions are coming from
– stack segment - SS register stores upper 16 bits of
its starting address
• stores addresses and data while a subprogram is
executed
– data segment - DS register stores upper 16 bits of
its starting address
• holds data
– extra segment - ES register stores upper 16 bits of
its starting address
• holds more data
• the lower 4 bits are always zero! why?
– example: if, the starting address of the code
segment is 348A0, then CS contains the value
348AH...this is called the segment base
• the segments can overlap in the case of
small program
8086 Architecture 12
Segments
Segment Starting
address is segment MEMORY
Address
000000H
register value shifted
4 place to the left.
CODE
64K Data
Segment
STACK
DATA
EXTRA CS:0
64K Code
Segment
Segmen
t
Registe
rs
Segments are < or = 64K,
can overlap, start at an address0FFFFFH
that ends in 0H.
Hindu College,
Amritsar.
8086 Memory
Terminology
Memory Segments
Segment 000000H
Registers
001000H
DS: 010 DATA
0H 10FFFH
0B2000H
S 0B200H STACK
S 0C1FFFH
:
ES: 0CF00H 0CF000H
EXTRA
0DEFFFH
CS: 0FF00H
0FF000H
CODE
0FFFFFH
Segments are < or = 64K
and can overlap.
Note that the Code segment is < 64K since 0
Hindu College,
Amritsar.
The Code Segment
000000H
4000H
CS: 0400H
4056H
IP 0056H CS:IP = 400:
Logical Add
Left-
shift 4 Memory
bits 0400
Segment Register0
Offset + 0056
0FFFFFH
Physical or 04056H
Absolute Address
The offset is the distance in bytes
from the start of the segment.
The offset is given by the IP for the
Code Segment.
Instructions are always fetched with
using the CS register. Hindu College,
Amritsar.
The physical address is also called the absolute address
The Data Segment
00000
0H
05C00H
DS: 05C0
05C50H
EA 0050 DS:EA
Memory
05C00
Segment Register
Offset + 0050
Physical Address
05C50H
0FFFFFH
8086 Architecture 17
Stack Pointer Register
(SP)
8086 Architecture 18
Accessing Immediate and
Register Data
• addressing modes
– specify the different ways the processor can
access data
• immediate addressing mode
MOV CX, 437BH
• puts the specified value, 437BH directly
into CX
• can you do this in 2 instructions?
• register addressing mode
MOV CX, AX
• a register is the source of the operand
MOV CX, BL ...legal?
• direct addressing mode
MOV CX, [437AH]
MOV [437AH], CX
• an effective address (offset) is the source of
the operand
8086 Architecture 19
Why Use Segmented
Model?
• Easier to manipulate 16 bit
numbers than 20 bit numbers…
one less byte to deal with
• Easier to timeshare and
multitask
– each users process can get its own
logical segments for its code and
data
• these values are stored in the
Process Control Block (PCB) for a
process when it is swapped out.
8086 Architecture 20
Review of Registers
• In EU
– General purpose registers
• AX, BX, CX, DX
– Others
• SP - Stack Pointer (top of the stack)
• ST - Status flag
• BP - Base Pointer, SI - Source
Index, DI - Destination Index
– these usually hold the 16 bit offset of a
data word in one of the segments
8086 Architecture 21
• In BIU
– Segments registers
• CS, DS, SS, ES
– Others
• IP - Instruction Pointer (next
instruction in the CS)
• Queue - a set of registers
8086 Architecture 22
Review of Addressing
Modes
• Immediate - operand is a
constant value contained in the
instruction
MOV AX, 0100H
• Register - operand is an 8-bit or
a 16-bit register
MOV SP, BX
• Direct - operand is a fixed
location in memory
MOV CL, [48H]
MOV [48H], CL
8086 Architecture 23
Another Addressing
Mode
• Indirect - operand is a memory
location determined at run-time
by using the address stored in
one or two registers
MOV AX, [BX][SI]
8086 Architecture 24