4615-4712_chapter 1
TRANSCRIPT
-
8/10/2019 4615-4712_Chapter 1
1/46
Co
pyr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 1
THE ARCHITECTURE OF
8086
CHATER !
-
8/10/2019 4615-4712_Chapter 1
2/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 2
Fi"#re !$!a 8086% I&TER&ALBLOC' DIA(RAM
-
8/10/2019 4615-4712_Chapter 1
3/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 3
-
8/10/2019 4615-4712_Chapter 1
4/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 4
The 8086 )icroprocessor
hasThe exec#*io+ #+i*
The ,#s i+*er-ace #+i*
-
8/10/2019 4615-4712_Chapter 1
5/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 5
THE E.ECUTIO& U&IT
Has *he i+*er+al re"is*ers/ ALU a+ *he co+*rol
#+i*
-
8/10/2019 4615-4712_Chapter 1
6/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 6
Fi" !$1 Re"is*ers
-
8/10/2019 4615-4712_Chapter 1
7/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 7
The scra*ch pa re"is*ersA. 2!6 ,i*s3 44 AH a+ AL 2each 8 ,i*3
B. 2!6 ,i*s3 44 BH a+ BL 2each 8 ,i*3
C. 2!6 ,i*s3 44 CH a+ CL 2each 8 ,i*3D. 2!6 ,i*s3 44 DH a+ DL 2each 8 ,i*3
-
8/10/2019 4615-4712_Chapter 1
8/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 8
oi+*er a+ I+exRe"is*ersDI es*i+a*io+ i+ex -or s*ri+" opera*io+s
5I so#rce i+ex -or s*ri+" opera*io+s
5 s*ac poi+*er -or accessi+" s*ac *opB ,ase poi+*er -or accessi+" a+y loca*io+
i+ s*ac
I i+s*r#c*io+ poi+*er4poi+*s *o *he +ex*i+s*r#c*io+ *o ,e exec#*e
-
8/10/2019 4615-4712_Chapter 1
9/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 9
Fi" !$7 Fla" Re"is*er
-
8/10/2019 4615-4712_Chapter 1
10/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 10
FLA(5CONDITIONAL FLAGS CONTROL FLAGS
OF O9er:o; :a" DF Direc*io+ Fla"
5F 5i"+ Fla" IF I+*err#p* Fla"
-
8/10/2019 4615-4712_Chapter 1
11/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 11
Exa)ple !$!Fi+ *he s*a*#s o- *he :a"s CF /5F/ AF a-*er
*he -ollo;i+" i+s*r#c*io+s are exec#*e
MO= AL/7>HADD AL/0CEH
-
8/10/2019 4615-4712_Chapter 1
12/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 12
Exa)ple !$15ho; *he e?ec* o- *he -ollo;i+" i+s*r#c*io+s
o+ *he CF/ECH
ADD B./17H
-
8/10/2019 4615-4712_Chapter 1
13/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 13
Exa)ple !$7Ass#)i+" ;e are ai+" signed8 ,i*
+#),ers/ ho; is *he res#l* o- *he -ollo;i+"
ai*io+ *o ,e i+*erpre*e MO= AL/!1>
ADD AL/>
-
8/10/2019 4615-4712_Chapter 1
14/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 14
THE BU5 I&TERFACE U&ITis respo+si,le -or aress calc#la*io+s
pre4-e*chi+" i+s*r#c*io+s -or *he #e#e
a+ se#e+ci+" i+s*r#c*io+s o+e ,y o+e
-
8/10/2019 4615-4712_Chapter 1
15/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 15
THE I&5TRUCTIO& UEUEThere is a #e#e ;hich -e*ches i+s*r#c*io+s
ahea o- *he exec#*io+ *i)e
a+ places *he) i+ a six ,y*e rs* i+ rs* o#*2FIFO3 #e#e
re4-e*chi+" ,elo+"s *o a class o- ieas callepipeli+i+"/ ;hich )ea+s *ha* ,o*h exec#*io+
a+ -e*chi+" *ae place a* *he sa)e *i)e$
-
8/10/2019 4615-4712_Chapter 1
16/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 16
MEMOR 5E(ME&TATIO&Each aress is 10 ,i*
B#* aress re"is*ers are o+ly !6 ,i*s lo+"
There are -o#r *ypes o- )e)ory se")e+*sThey ca*er *o a*a/ coe/ s*ac a+ a+o*her
a*a se")e+* calle *he ex*ra se")e+*
-
8/10/2019 4615-4712_Chapter 1
17/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 17
5e")e+* Re"is*ers 2!6 ,i*s lo+"3C5 coe se")e+* re"is*er
D5 a*a se")e+* re"is*er
55 s*ac se")e+* re"is*erE5 ex*ra se")e+* re"is*er
-
8/10/2019 4615-4712_Chapter 1
18/46
Cop
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 18
Fi"#re !$@ Calc#la*io+ o- a physical
aress -ro) *he lo"ical aress -or aa*a se")e+*
-
8/10/2019 4615-4712_Chapter 1
19/46
C
op
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 19
Fi"#re !$> 5e")e+* re"is*ers a+
correspo+i+" se")e+*s
-
8/10/2019 4615-4712_Chapter 1
20/46
C
op
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 20
5e")e+*s a+ correspo+i+"
re"is*ersCoe se")e+* 4444 I+s*r#c*io+ poi+*er 2I3
5*ac se")e+* G$ 5*ac poi+*er 253
-
8/10/2019 4615-4712_Chapter 1
21/46
C
op
yr i
ght
Dorlin
gKinde r
sle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 21
Ari*h)e*ic Lo"ic U+i*per-or)s all ari*h)e*ic a+ lo"ic
co)p#*a*io+s$
is *he )os* i)por*a+* #+i* o- *he processori+s*r#c*io+s *ha* are -e*che a+ ecoe/ are
exec#*e i+ *he ALU$
*he ALU has irec* access *o *he "e+eral
p#rpose re"is*ers a+ :a"s$
-
8/10/2019 4615-4712_Chapter 1
22/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 22
Fi"#re !$6 5*ac a+ physical
aress o- *he *op o- s*ac
-
8/10/2019 4615-4712_Chapter 1
23/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 23
E?ec*i9e aressHo; is i* calc#la*e
ha* is i*s rela*io+ship ;i*h *he physical
aress
-
8/10/2019 4615-4712_Chapter 1
24/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 24
Ta,le !$! 5e")e+*s a+
Correspo+i+" Re"is*ers Use -or5peci-yi+" O? 5e*s
-
8/10/2019 4615-4712_Chapter 1
25/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 25
Exa)ple !$@The co+*e+* o- D5 is 7@>BH$ The a)o#+* o-
a*a *ha* is *o ,e s*ore i+ *he a*a se")e+*
is !1' ,y*es$ here i+ )e)ory/ ;ill *hisse")e+* ,e loca*e
-
8/10/2019 4615-4712_Chapter 1
26/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 26
Exa)ple !$@ 5ol#*io+The ,ase aress o- *he se")e+* is 345B0H
The las* aress ;ill ha9e a+ o?se* o- !1'
-ro) *he ,ase aress $!' !01@ ,y*es
!1 ' !1 !01@ !1118 7000H
The las* aress o- *he se")e+* 7@>B0H J
7000H 375B0H
-
8/10/2019 4615-4712_Chapter 1
27/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 27
Exa)ple !$>The co+*e+*s o- *he -ollo;i+" se")e+* re"is*ers
are as "i9e+
C5 !!!!H/ D5 7777H/ 55 1>16H
I !171H/ 5 !!00H /
o?se* i+ a*a se")e+* 0010H
Calc#la*e *he correspo+i+" physical aresses-or *he aresse ,y*e i+ a3 C5 ,3 55 a+ c3 D5
-
8/10/2019 4615-4712_Chapter 1
28/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 28
Exa)ple !$> 5ol#*io+The aress o- *he +ex* i+s*r#c*io+ is "i9e+ ,y
!!!!0H J !171H !17@1H
The physical aress o- *he s*ac *op is1>160H J !!00H 167>0H
The physical aress o- *he a*a i+ *he a*ase")e+* is calc#la*e as 77770H J 0010H
777>0H
-
8/10/2019 4615-4712_Chapter 1
29/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 29
A9a+*a"es o- 5e")e+*a*io+All aress re"is*ers are o+ly !6 ,i* lo+"/
*ho#"h *he physical aress is 10 ,i*s
All aresses are re4loca*a,le
-
8/10/2019 4615-4712_Chapter 1
30/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 30
Me)ory Or"a+iKa*io+ Li**le
E+ia+I+ *he case o- a ;or o- a*a s*ore i+ )e)ory
i- *he lo;er ,y*e is i+ *he lo;er aress
a+ *he hi"her ,y*e is i+ *he hi"her aressi* is calle *he little endian fo!at
-
8/10/2019 4615-4712_Chapter 1
31/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 31
Fi"#re !$ Li**le E+ia+ For)a*
-
8/10/2019 4615-4712_Chapter 1
32/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 32
ADDRE55I&( MODE5The ;ay i+ ;hich opera+s are specie i+ a+
asse),ly la+"#a"e i+s*r#c*io+ is calle i*s
addessing !odeFor a )o9e i+s*r#c*io+/ *he -or)a* is
MO= es*i+a*io+/ so#rce
-
8/10/2019 4615-4712_Chapter 1
33/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 33
Aressi+" )oes ,asic
ass#)p*io+s The opera+s ca+ ,e i+ re"is*ers/ i+ )e)ory/
or )ay ,e i+ *he i+s*r#c*io+ i*sel-$ B#* *he8086 oes +o* ha9e a+ aressi+" )oe i+
;hich ,o*h opera+s are i+ )e)ory loca*io+s I+ *he case o- *;o opera+s/ o+e o- *he) ca+
,e i+ )e)ory/ ,#* *he o*her ;ill ha9e *o ,eplace i+ a re"is*er $
Da*a *ypes sho#l )a*ch i$e$/ *he so#rce a+es*i+a*io+ sho#l ,o*h ,e ei*her ,y*es or;ors
-
8/10/2019 4615-4712_Chapter 1
34/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 34
Re"is*er Aressi+"Here ,o*h *he so#rce a+ es*i+a*io+ are
re"is*ers
MO= AL/ AHMO= CH/ BL
MO= 5I/ B.
MO= E5/A.
-
8/10/2019 4615-4712_Chapter 1
35/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 35
I))eia*e Aressi+"Here/ *he so#rce ;ill ,e a co+s*a+* a*a
MO= AL/ @>H
MO= B./ 7@E7HMO= CL$
MO= RICE/@0
MO= &UM5/ 0FC6HRICE a+ &UM5 are la,els -or )e)ory
aresses
-
8/10/2019 4615-4712_Chapter 1
36/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 36
Direc* Aressi+"Here ei*her *he so#rce or *he es*i+a*io+ ;ill
,e a )e)ory aress
MO= A./N17@>HMO= N!08PH/AL
MO= A. / RICE
MO= CO5T/AL
RICE a+ CO5T are la,els -or )e)oryaresses
-
8/10/2019 4615-4712_Chapter 1
37/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 37
Re"is*er I+irec* Aressi+"I+ *his )oe/ *he aress o- *he a*a is hel
i+ a re"is*er
E?ec*i9e aressEA EA Q NB. NDI N5IS
-
8/10/2019 4615-4712_Chapter 1
38/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 38
Re"is*er I+irec* Aressi+"
Co+*$MO= AL/NB.
MO= N5I/ CL
MO= NDI/A.
-
8/10/2019 4615-4712_Chapter 1
39/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 39
Exa)ple !$6 5ho; *he loca*io+ o- a*a i+ )e)ory/ a-*er
*he exec#*io+ o- each o- *hese i+s*r#c*io+s/
i- *he co+*e+* o- re"is*ers are as "i9e+D5 !!!1H/ A. EE8H a+ B. 7@00H
MO= N0@11H/ AL
MO= N0@1@H/ A.
MO= NB./ A.
-
8/10/2019 4615-4712_Chapter 1
40/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 40
Re"is*er Rela*i9e Aressi+"I+ elati"earessi+" )oe/ a +#),er or
isplace)e+* is par* o- *he e?ec*i9e aress
EA QNB. NDI N5I NBS J 8 ,i* or !6 ,i*isplace)e+*
The isplace)e+* ca+ ,e a !6 ,i*si"+e#+si"+e +#),er or a+ 8 ,i* sign
e#tended+#),er
-
8/10/2019 4615-4712_Chapter 1
41/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 41
Re"is*er Rela*i9e Aressi+"
Co+*$MO= CL/ !0NB.
Th#s *he e?ec*i9e aress is NB. J !0 $
-
8/10/2019 4615-4712_Chapter 1
42/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 42
Base I+exe MoeI+ *his )oe/ a+ i+ex re"is*er a+ a ,ase
re"is*er *o"e*her carry *he e?ec*i9e aress $
The co+*e+* o- *hese *;o re"is*ers are aea+ calle *he e?ec*i9e aress$
MO= AL/NB.N5I
MO= NB.NDI/C.
-
8/10/2019 4615-4712_Chapter 1
43/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 43
Rela*i9e Base I+exe MoeThe e?ec*i9e aress is *he s#) o- *he *;o
re"is*ers a+ a isplace)e+* $
MO= DL />NB.NDIMO= >NBN5I/ A.
MO= CL/CO5TNB.NN5I
-
8/10/2019 4615-4712_Chapter 1
44/46
C
op
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 44
Exa)ple !$ Fi+ *he aress o- physical )e)ory -or
*he -ollo;i+" i+s*r#c*io+s i- *he co+*e+*o- *he re#ire re"is*ers are as "i9e+ ,elo;
55 17@@ H/ D5 @011H /B. 0100H/ B !@01H/ 5I @@@1H
i3 MO= CL/!17@HN5I
i3 MO= AL/>N5INNB
-
8/10/2019 4615-4712_Chapter 1
45/46
Cop
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
The x86 Microprocessor Lyla B Das 45
Ta,le !$1 % E?ec*i9e Aress a+ Re-erre5e")e+*s -or =ario#s Me)ory BaseAressi+" Moes
-
8/10/2019 4615-4712_Chapter 1
46/46
Cop
yr i
ght
Dorlin
gKinde
rsle
yInd
iaPvt
Lt d
5e")e+* O9errieMO= AL/ E5% NB.
MO= D5% NBJ/ BL
MO= A./ C5%NB.