Chapter 2: Intel 8088/8086 Microprocessors
Chapter 2: Intel 8088/8086 Microprocessors
Diagram of 8088/8086
EU
Address bus: BIU
Multipurpose AX 20 bit
BX
Registers Stack
CX
DX
segments Internal Bus
SP and CS
of CPU:
Pointer and BP Instruction DS
16 bit data
SS
Index SI
Pointer 20 bit address
ES
Registers DI
IP
in 8088/8086
8 high bit 8 low bit
CX CH CL
DX DH DL
Segment Registers
• Generate memory addresses when combined with other
registers in the microprocessor.
• Four or six segment registers in various versions of the
microprocessor.
• A segment register functions differently in real mode than in
protected mode.
• Following is a list of each segment register, along with its
function in the system.
6/Chapter2
Segment Registers
• CS (code) segment holds code (programs and procedures)
used by the microprocessor.
• DS (data) contains most data used by a program.
Data are accessed by an offset address or contents of other registers
that hold the offset address
• ES (extra) an additional data segment used by some
instructions to hold destination data.
• SS (stack) defines the area of memory used for the stack.
stack entry point is determined by the stack segment and stack pointer
registers
the BP register also addresses data within
the stack segment
7/Chapter2
Segment Registers
• E.g: Physical Address 12345H
code segment offset
1000 H 2345H
1200 H 0345H
1004 H ?
0300 H ?
Segment Registers
• Segment Registers: store the segment addresses
FFFFF
.............
58FFF
extra segment
49000 4900 ES
43FFF
Stack segment
34000 3400 SS
30000
2FFFF Code segment
20000 2000 CS
1FFFF Data segment
10000 1000 DS
00000
11/Chapter2
Segment Registers
• Overlapped segments
FFFFF
s
t
a d
c a
k 0A480
t 0A47F
a c Stack
o 0A280
d 0A28 SS
0A27F
e Data
0A0F0 0A0F DS
0A0EF
Code
090F0 090F CS
00000
12/Chapter2
CS IP Instruction’s
address
SS SP or BP Stack address
ES DI Destination’s
address
14/Chapter2
Flag Register
15 14 2 1 0
O D I T S Z A P C
• 9 bits are used, 6 flag bits which show some following status:
C or CF (carry flag)): holds the carry after addition or borrow after
subtraction. (CF=1 khi có nhớ hoặc mượn từ MSB)
P or PF (parity flag): is the count of ones in a number expressed as even
or odd. Logic 0 for odd parity; logic 1 for even parity.
if a number contains three binary one bits, it has odd parity
if a number contains no one bits, it has even parity
A or AF (auxilary carry flag): holds the carry (half-carry) after addition or
the borrow after subtraction between bit positions 3 and 4 of the result.
Z or ZF (zero flag): shows that the result of an arithmetic or logic
operation is zero.
15/Chapter2
Flag Register
15 14 2 1 0
O D I T S Z A P C
• 9 bits are used, 6 flag bits which show some following status:
S or SF (Sign flag): flag holds the arithmetic sign of the result after an
arithmetic or logic instruction executes.
O or OF (Overflow flag): occurs when signed numbers are added or
subtracted.
an overflow indicates the result has exceeded
the capacity of the machine
16/Chapter2
Flag Register
15 14 2 1 0
O D I T S Z A P C
• 3 controlled flags
T or TF (trap flag)): The trap flag enables trapping through an on-chip
debugging feature.
I or IF (Interrupt enable flag): controls operation of the INTR (interrupt
request) input pin.
D or DF (direction flag): selects increment or decrement mode for the DI
and/or SI registers.
17/Chapter2
Flag Register
• E.g.: 80h
+
80h
100h
Instruction cycle
• 4 bytes for 8088 and 6 bytes for 8086
• Pipeline processing
without
pipelining F1 D1 E1 F2 D2 E2 F3 D3 E3
Fetch
F1 D1 E1
with pipelining F2 D2 E2
F3 D3 E3 Decode
Execute
1 instruction cycle
19/Chapter2
Intel 8088
• 16-bit processor
• introduced in 1979
• 3 mm, 5 to 8 MHz, 29 KTOR,
0.33 to 0.66 MIPS
21/Chapter2
Intel 8088
Intel 8086
23/Chapter2
Extended
memory
FFFFF Systematic
Memory
A0000 484 Kbytes 1 Mbytes
9FFFF of real memory
Program
Memory
640 Kbytes
00000
25/Chapter2
9FFFF
MSDOS
9FFF0
Memory for
application’s
programs
08E30
COMMAND.COM
08490
Device drivers (mouse.sys)
02530
MSDOS
01160
IO.SYS
00700
Vùng DOS
00500
Vùng BIOS
00400
00000 Interrupt vector
26/Chapter2
FFFFF
ROM BIOS
F0000
ROM BASIC
E0000
Reserve area
C8000
Video BIOS ROM
C0000
Video RAM (text)
B0000
Video RAM (visual)
A0000
27/Chapter2
I/O ports
• Address: 0000H –FFFFH, M/IO =0
FFFF
Extended area
COM1
03F8
Điều khiển đĩa mềm
03F0
CGA adapter
03D0
LPT1
0378
Hard disk controller
0320
COM2
02F8
8255
0060
Timer (8253)
0040
Interrupt controller
0020
0000 DMA
28/Chapter2
FFFFF
Reset Bootstrap
FFFF0 program jump
003FF
Interrupt vectors
00000
29/Chapter2
• E.g:
MOV AL, [1234H] ; Copy content of a memory cell whose address is DS:1234
to AL
MOV [ 4320H ], CX ; Copy content of CX to continuous memory cells DS:
4320 and DS: 4321
MOV [ 4321H ], CL ; ?
33/Chapter2
• E.g:
MOV AL, [BX] ; Copy content of the memory cell whose address is DS:BX to
AL
MOV [ SI ], CL ; Copy content of CL to of the memory cell whose address is
DS:SI
MOV [ DI ], AX ; Copy content of AX to continuous memory cells DS: DI và
DS: (DI +1)
34/Chapter2
• E.g:
MOV CX, [BX]+10 ; Copy content of 2 continuous memory cells DS:BX+10
and DS:BX+11 to CX
MOV CX, [BX+10] ; equal to the previous command
MOV AL, [BP]+5 ; copy content of memory cell SS:BP+5 to AL
35/Chapter2
• E.g:
MOV AX, [SI]+10 ; Copy content of 2 continuous memory cells DS:SI+10
and DS:SI+11 to AX
MOV AX, [SI+10] ; equal to the previous command
MOV AL, [DI]+5 ; copy content of memory cell DS:DI+5 to AL
36/Chapter2
• E.g:
MOV AX, [BX] [SI]+8 ; Copy content of 2 continuous memory
cells DS:BX+SI+8 and DS:BX+SI+9 to AX
Summary
Addressing mode Operand Default segment reggister