0% found this document useful (0 votes)
7 views

Chapter (1) :: The 80x86 Microprocessor

Uploaded by

oaa777953705
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Chapter (1) :: The 80x86 Microprocessor

Uploaded by

oaa777953705
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Chapter (1):

The 80x86 Microprocessor

12/22/2015 1
Chapter (1):
The 80x86 Microprocessor
 Brief history of the 80x86 family
 Inside the 8088/8086
 Introduction to the assembly programming
 Introduction to program segments
 80x86 addressing modes

12/22/2015 2
Brief history of microprocessor

Company 4 bit 8 bit 16 bit 32 bit 64 bit

8008 8088/6
4004 80386 80860
intel 8080 80186
4040 80486 pentium
8085 80286

Z8000
zilog Z80 Z8001
Z8002

6800 68006 68020


Motorola 6802 68008 68030
6809 68010 68040

12/22/2015 3
Brief history of 80x86 family

12/22/2015 4
Inside the 8088/8086
U?
8086 vs 8088 U?
33 16 33 16
MN AD0
15 MN AD015
22 AD1
14 22 AD114
19 READY AD2
13 19 READY AD213
21 CLK
RESET
AD3
12
AD4
21 CLK
RESET
AD3
AD4
12 8_bit Data Bus
11 11
18 AD5
10 18 AD510
INTR AD6
9 INTR AD69
AD7
8
AD8
16_bit Data Bus AD7
A87
8
7
AD9
6 20_bit Address A96 20_bit Address
AD10
5 A105
AD11
4 A114
AD12
3 A123
AD13
2 A132
AD14
39 A1439
AD15
38 A1538
A16/S3
37 A16/S3
37
A17/S4
36 A17/S4
36
A18/S5
35 A18/S5
35
A19/S6 A19/S6
34 34
BHE/S7 SSO
26 26
DEN27 DEN27
DT/R
28 DT/R
28
30 M/IO 30 IO/M
31 HLDA 32 31 HLDA 32
17 HOLD RD29 17 HOLD RD29
23 NMI WR25 23 NMI WR25
TEST ALE
24 TEST ALE
24
INTA INTA

8088
8086MIN 8088MIN
8086

12/22/2015 5
Inside the 8088/8086
 8086 Pin Assignment

12/22/2015 6
Inside the 8088/8086
 8086 Pin D escription
Vcc (pin 40) : Pow er
G nd (pin 1 and 20) : G round
AD 0..AD 7 ,A8..A15 ,A19/S6,A18/S5,A17/S4,A16/S3 : 20 -bit Address Bus
MN /MX’(input) : Indicates O perating mode
READY (input ,Active H igh) : take uP to w ait state
CLK (input) : Provides basic timing for the processor
RESET (input,Active H igh) : At least 4 clock cycles Causes the uP immediately
terminate its present activity.
TEST’(input ,Active Low ) : Connect this to H IG H
H O LD (input ,Active H igh) : Connect this to LO W
H LDA (output ,Active H igh) : H old Ack
IN TR (input ,Active H igh) : Interrupt request
IN TA’(output ,Active Low ) : Interrupt Acknow ledge
N MI (input ,Active H igh) : N on-maskable interrupt

12/22/2015 7
Inside the 8088/8086
 8086 Pin D escription
D EN ’(output) : D ata Enable.It is LO W w hen processor w ants to
receive data or processor is giving out data (to74245)

D T/R’(output) : D ata Transmit/Receive.


W hen H igh,data from uP to memory
W hen Low ,data is from memory to uP (to74245 dir)

IO /M’(output) : If H igh uP access I/O D evice.


If Low uP access memory

RD ’(output) : W hen Low ,uP is performing a read operation

W R’(output) : W hen Low ,uP is performing a w rite operation

ALE (output) : Address Latch Enable ,Active H igh


Provided by uP to latch address
W hen H IG H ,uP is using AD 0..AD 7,A19/S6,
12/22/2015 A18/S5,A17/S4, A16/S3 as address lines 8
Inside the 8088/8086
 W e concern on the tw o important internal operation of 8086
 Pipelining
 Registers

12/22/2015 9
Inside the 8088/8086

12/22/2015 10
Inside the 8088/8086
Address bus (20 bits)
AH AL G eneral purpose
BH BL register 

CH CL
Execution U nit
DH DL
(EU ) D ata bus
SP CS (16 bits)
Segment
BP register DS
SI SS
DI ALU D ata bus ES
(16 bits)
IP

Bus
control
ALU Instruction Q ueue External bus
EU
control
Flag register
Bus Interface U nit (BIU )
12/22/2015 11
Inside the 8088/8086
 Registers
 In CPU ,the register are used to store the information temporarily
 In register, the information could be one or tw o bytes of data to be
processed or the address of data.
 The registers of the 8088/8086 fall into six categories

12/22/2015 12
Inside the 8088/8086
 Registers
15 8 7 0
AX AH AL Accumulator

D ata G roup BX BH BL Base


G eneral purpose
register CX CH CL Counter

DX DH DL D ata

15 0

SP Stack Pointer

BP Base Pointer
Pointer and
Index registers
SI Source Index

12/22/2015 DI D estination Index 13


Inside the 8088/8086
 Registers
15 0
CS Code Segment
Segment
DS D ata Segment
registers
SS Stack Segment
ES Extra Segment
15 0
Flag    
O F D F IF TF SF ZF AF PF CF
register

12/22/2015 14
Inside the 8088/8086
 Registers
 D ata registers
 U sed for arithmetic and data movement
 Each register can be addressed as either a 16-bits or 8-bits value.
1. AX (accumulator): arithmetic operations and other operations.
2. BX (base): hold the address of a procedure or variable same to SI,
D I,and BP,and perform arithmetic and data movement
3. CX (counter): acts as a counter for repeating or loop instructions.
These instructions automatically repeat and decrement CX.
4. DX (data): a special role in multiply and division operations

12/22/2015 15
Inside the 8088/8086
 Registers
 Segment registers
 U sed as base locations for program instructions,data,and stack.
 Each register has a 16-bits.
1. CS (code segment ): hold the base location of all executable
instructions (code) in a program.
2. D S (data segment): is a default base location for variables.
3. SS (stack segment): contains the base location of stack.
4. ES (extra segment): is an additional base location for memmory
variables.

12/22/2015 16
Inside the 8088/8086
 Registers
 Index registers
 Contain the offsets of data and instructions.
 O ffset refer to the distance of variable,label,or instruction from the its
base segment.
1. BP (base pointer): contains an assumed offset from the SS register,
often used by a subroutine to locate variables that w ere passed on
the stack by a call program.
2. SP (stack pointer): contain the offset of the top of the stack. SP &
SS combine to form the complete address of the top of the stack.
3. SI (source index): point the source string.
4. D I (destination index): acts as a destination for string movement
instructions.
12/22/2015 17
Inside the 8088/8086
 Registers
 Status and Control registers
1. IP (instruction pointer): alw ays contains the offset of the next
instruction to be executed w ithin the current code segment. IP &
CS combine to form the complete address of the next instruction.
2. Flag: a special register used to show the status of the CPU or the
results of arithmetic operations. Tw o types (control flag & status
flag)

12/22/2015 18
Introduction to Program Segments
 In 8086 microprocessor, address bus has 20-bits then its access
memory 220 = 1048676 = 1Mbytes.(00000h) to (FFFFFh)

 All registers have 16-bits then its access 216 = 65536 = 64K-bytes.
 its impossible to access the memory, for this reason, the memory
is divided to segments (each segment = 64K-bytes) (0000h -FFFFh).
 Inside each segment,any address can be identify by offset.
 Then, to determine the address in the memory, used segment
value & offset (Segment : O ffset). Ex. (AABB:5566). Its called
logical address.

12/22/2015 19
Introduction to Program Segments
 Logical address & Physical address
 8086 has three types of addresses (physical – offset - logical)
 Physical address: is the 20-bits address that is actually put on the address
bus,this is the actual physical location in RAM or RO M.
 O ffset address: is a location w ithin a 64k-bytes segment range.
 Logical address: consists of a segment value and offset address.
 The logical address of an instruction alw ays consist of CS & IP (CS:IP)
 Physical address = (segment value * 16) + offset
 O r by shifting the segment value left one hex digit and then adding
it to the offset address.
 Example: if logical address (9A32h:001Bh), determine the physical
address??
9A320 + 001B = 9A33B (physical address)

12/22/2015 20
Introduction to Program Segments
 Logical address & Physical address

12/22/2015 21
Introduction to Program Segments
 Memory Map:

12/22/2015 22
Introduction to Assembly Language

 Tw o w idely instructions w ere used in assembly language:


 MO V instruction
 AD D instruction
 MO V instruction: copies data from one location to another
 MO V destination,source ;copy source operand to destination
 Example: the follow ing program first loads CL w ith value 55H ,then
moves this value around to various registers inside the CPU .

12/22/2015 23
Introduction to Assembly Language

 Tw o w idely instruction w ere used in assembly language:


 MO V instruction
 AD D instruction
 MO V instruction: copies data from one location to another
 MO V destination,source ;copy source operand to destination
 Example: the follow ing program first loads CL w ith value 55H ,then
moves this value around to various registers inside the CPU .

 Another program:

12/22/2015 24
Introduction to Assembly Language
 Another program: w e have some notes

1. Values can be moved among all registers (except FR)


2. Values can not loaded directly into any segment register (CS,D S,ES,SS).But
first load it to a non segment register and then move it to the segment
register
3. Moving a large value into register w ill cause error.

12/22/2015 25
Introduction to Assembly Language
 AD D instruction: has the follow ing format
 AD D destination,source ;add source operand to destination
 Example:

 Then

 The AD D instruction can be rew ritten as

12/22/2015 26
Introduction to Assembly Language
 Example: add 5 bytes of data (25H ,12H ,15H ,1FH ,and 2BH )

 This program can be rew ritten as

 Assume the offset of data segment is 200H

12/22/2015 27
Introduction to Assembly Language
 Example (cont.): add 5 bytes of data (25H ,12H ,15H ,1FH ,and 2BH )
 Because D S uses only BX, D I, and SI to hold the offset address
of the data.Then BX or D I or SI is called pointer.
 This program can be rew ritten as

12/22/2015 28
More about segment in 8086
 Stack:
 Stack is a section of RAM used to storage the information
temporally.
 Tw o registers are used to access the stack (SS & SP). These
registers must be loaded before any instructions accessing the
stack are used.
 U sed tw o operation w ith stack (PO P & PU SH )
 PU SH : storing a CPU register in the stack.
 W hen the content of register (2-bytes) push into the
stack,then the SP decrement by 2.
 Ifa byte push into the stack,then the SP decrement by 1.
 PO P: loading the contents of the stack into the CPU register
 U sing the SS & SP registers to compute the physical address of
the stack.
12/22/2015 29
More about segment in 8086
 Stack: Push onto the stack

12/22/2015 30
More about segment in 8086
 Stack: Pop the stack

12/22/2015 31
More about segment in 8086
 Example on the access memory:

12/22/2015 32
More about segment in 8086
 Example on the overlapping in the memory:

12/22/2015 33
More about segment in 8086
 Flag Register:

12/22/2015 34
More about segment in 8086
 Flag Register w ith AD D instruction:

12/22/2015 35
More about segment in 8086
 Flag Register w ith AD D instruction:

12/22/2015 36
More about segment in 8086
 U sing the Zero Flag in the Looping:

 (ZF = 1) if the result is equal zero.


 JN Z instruction come after the D EC instruction, then the ZF check
the result of counter.

12/22/2015 37
80x86 addressing modes
 80x86 provide a seven distinct addressing modes:
1. Register
2. Immediate
3. D irect
4. Register indirect
5. Based relative
6. Indexed relative
7. Based indexed relative
 Register addressing mode: use the register to hold data.

12/22/2015 38
80x86 addressing modes
 Immediate addressing mode: source operand is constant.

MO V AX,0123H
MO V D S,AX
 D irect addressing mode:

 Register indirect addressing mode:

12/22/2015 39
80x86 addressing modes
 Based relative addressing mode:

 Indexed relative addressing mode:

 Based indexed addressing mode:

12/22/2015 40
Any Question?

12/22/2015 41

You might also like