Upload
a-samuel-clement
View
228
Download
0
Embed Size (px)
Citation preview
8/10/2019 4615-4716_Chapter 5.ppt
1/22
CopyrightD
orlingKindersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 1
PROGRAMMING
CONCEPT ! I"C#APTER $
8/10/2019 4615-4716_Chapter 5.ppt
2/22
CopyrightD
orlingKindersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das %
Input/Output ProgrammingA& I'O (e)ice is *re+,e&ly re*erre( o as a
.por/ 0ih a& associae( a((ress
A&y I'O (e)ice has a ,&i+,e a((ress 2&o0&as .por a((ress/ or si3ply 3e&io&e( as .por/
8/10/2019 4615-4716_Chapter 5.ppt
3/22
CopyrightD
orlingKindersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 4
Figure 5.1 5 I'O pors 0ih a((ress ,s a&( (aa ,s
a&( he rea( a&( 0rie co&rol si7&als
8/10/2019 4615-4716_Chapter 5.ppt
4/22
CopyrightD
orlingKindersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das
Memory Mapped I/OI& his sche3e he I'O (e)ice has he sa3e
a((ress space a&( a((ressi&7 sche3e as3e3ory
9or exa3ple 7i)e& he i&sr,cio& MO" AL:4$6#; he a((ress 4$6# 3ay e a3e3ory locaio& or he a((ress o* a& I'O
(e)iceo I'O a((ressi&7 (oes &o &ee( a&y special
i&sr,cio&s
#o0e)er he 3e3ory space 7es re(,ce(
8/10/2019 4615-4716_Chapter 5.ppt
5/22
CopyrightD
orlingKindersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das $
Peripheral or Isolated I/OAlso re*erre( o as .I'O 3appe( I'O/ sa7e? IN acc,3,laor por
O>T
>sa7e? O>T por acc,3,laor
8/10/2019 4615-4716_Chapter 5.ppt
7/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das @
Fixed Port AddressingThis is ,se( o&ly when the address of an
I/O deice is
! "its wide#ere he a((ress o* he por is (irecly
3e&io&e( i& he i&sr,cio&
Noe ha (aa ca& e 8 is or 16 is
(epe&(i&7 o& he (aa ,s 0i(h o* he I'O (e)ice
8/10/2019 4615-4716_Chapter 5.ppt
8/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 8
9ixe( Por A((ressi&7Exa3ples
IN AL $#
IN A 1%#O>T 4# AL
O>T 9C# A
8/10/2019 4615-4716_Chapter 5.ppt
9/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das
#aria"le Port AddressingThis is ,se( 0he& he a((resse( por has a
1$%"it address
#ere he por a((ress is o e loa(e( i&o Da&( he& o&ly he I'O i&sr,cio& ca& e ,se(
O&ly he D re7iser ca& e ,se( *or his
8/10/2019 4615-4716_Chapter 5.ppt
10/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 1
"ariale Por A((ressi&7&xamples
MO" D 8@6#
IN AL DMO" D 9C6#
O>T D A
8/10/2019 4615-4716_Chapter 5.ppt
11/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 11
Exa3ple $
8/10/2019 4615-4716_Chapter 5.ppt
12/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 1%
Exa3ple $
8/10/2019 4615-4716_Chapter 5.ppt
13/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 14
Modular ProgrammingIss,es o e resol)e( *or s,ccess*,l exec,io& a&( li&2i&7
o* (iere& 3o(,les< The (iere& 3o(,les ha co&si,ehe sol,io& 3ay e i& (iere& co(e se73e&sBLIC &,31
P>BLIC &,3%
P>BLIC &,34A proce(,re &a3e( M>LT ca& e allo0e( access
*ro3 oher 3o(,les i* i is (eclare( as
P>BLIC 3,l
8/10/2019 4615-4716_Chapter 5.ppt
15/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 1$
The (ireci)e &,-
he& a 3o(,le &ee(s o ,se (aa a&( co(eha ha)e ee& (eF&e( else0here i sho,l(,se he (ireci)e ETRN 3ea&i&7 ha helaels ei&7 ,se( i& his 3o(,le are exer&alo he 3o(,le
9or3aETRN &a3e1?ype
ETRN &a3e1?ype &a3e%?ype
8/10/2019 4615-4716_Chapter 5.ppt
16/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 16
The (ireci)e ETRNExa3ples
ETRN &,31?ye
ETRN &,3%?0or(&,34?0or(ETRN 3,li?*ar a *ar proce(,re is (eclare(
8/10/2019 4615-4716_Chapter 5.ppt
17/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 1@
R,&&i&7 0o 3o(,les
3o(a
8/10/2019 4615-4716_Chapter 5.ppt
18/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 18
R,&&i&7 0o 3o(,les
3o(a
8/10/2019 4615-4716_Chapter 5.ppt
19/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das 1
Assem"ling the two modules
The 3o(,les ca& e asse3le( a&( li&2e(
o7eherThe co33a&( is
ml 0lename1.asm 0lename.asm0lename2.asm 3
&xample+ml moda.asm mod".asm
8/10/2019 4615-4716_Chapter 5.ppt
20/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das %
Exa3ple $
8/10/2019 4615-4716_Chapter 5.ppt
21/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das %1
Lisi&7 a&( De,77i&7The lis Fles o* oh 3o(,les ca& e oai&e(
y he co33a&(
ml/Fl moda.asm mod".asm.ote I& he lis Fle he a((ress o* li&es o*
co(e 0hich ,se exer&al (aa'pro7ra3 ha)ehe leer .E/ i& i
9or (e,77i&7 ,se he co33a&( de"ugmoda.exe.The& he se+,e&ce o* seps o*7oi&7 *ro3 o&e co(e se73e& o he ohera&( re,r&i&7 ca& e clearly oser)e(
8/10/2019 4615-4716_Chapter 5.ppt
22/22
CopyrightD
orlingKind
ersleyIndiaPvtLtd
The x86 Microprocessor - Lyla B Das %%
9re+,e&ly >se( Mo(,lese ca& place *re+,e&ly ,se( pro7ra3s i&
(iere& 3o(,les a&( li&2 i o o,r 3o(,les0he& &ee(e(
Exa3ples are co&)ersio& pro7ra3s (isplaypro7ra3s a&( he li2e