Tải bản đầy đủ (.pdf) (13 trang)

Thiết kế và lập trình hệ thống - Chương 23

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (318.71 KB, 13 trang )

 ✂✁

☎ ✆


✞✠✟✡

✟☞


✌✎✍

✏✑

✏✓





✕✖


✘ ✙
✞✚
✛✜

1

✔✎✣



✖✤
✑✦✥




✧✎★
✩✪



UMBC
U M B C
U
N
I
V
E
R
S
I
T
Y


O
F



M
A
R
Y
L
A
N
D


B
A
L
T
I
M
O
R
E


C
O
U
N
T
Y
1

9


6

6
✬✎✭
✮✠✯
✰✱





✰✎✵
StringOperations.
MOVS,LODS,STOS,INS,OUTS
Allowdatatransfersofabyte,awordoradoubleword,orifrepeated,a
blockofeachofthese.
TheDflag-bit(direction),SIandDIareimplicitlyused.
•D=0:AutoincrementDIandSI.
UseCLDinstructiontoclearthisflag.
•D=1:AutodecrementDIandSI.
UseSTDinstructiontosetit.
DI:
Accessesdataintheextrasegment.CanNOToverride.
SI:
Accessesdatainthedatasegment.Canbeoverriddenwithsegment
overrideprefix.
 ✂✁

☎ ✆



✞✠✟✡

✟☞


✌✎✍

✏✑

✏✓





✕✖


✘ ✙
✞✚
✛✜

2

✔✎✣


✖✤

✑✦✥




✧✎★
✩✪



UMBC
U M B C
U
N
I
V
E
R
S
I
T
Y


O
F


M
A

R
Y
L
A
N
D


B
A
L
T
I
M
O
R
E


C
O
U
N
T
Y
1

9

6


6
✬✎✭
✮✠✯
✰✱





✰✎✵
StringOperations.
LODS:
LoadsAL,AXorEAXwithdatastoredatthedatasegment(orextra
segment)+offsetgivenbySI.
SIisincrementedordecrementedafterwards:
STOSB:
StoresAL,AXorEAXtotheextrasegment(ES)+offsetgivenbyDI.
EScannotbeoverridden.
DIisincrementedordecrementedafterwards:
LODS
 
✁✂




✁✝

 ✟




☛☞





☛ ✌
✍✏✎

✒ ✓
 
✁✂



LODSB

✁✕

 ✟



☛☞






☛ ✌
✍✏✎

LODSD


✁✝

 ✟



☛☞





☛ ✌
✍✏✎

doubleword.
LODS
✆✟

 
✁✂




✖✘✗
✙✚

✒ ✛

 ✟

STOS
 
✁✂



✆✟


 
☛☞

✁✝





☛ ✌
✍✏✎


✒ ✓
 
✁✂



STOSB

✆✟


 
☛☞

✁✕

 


 
☛ ✌
✍✏✎

STOSD

✆✟


 
☛☞



✁✝

 


 
☛ ✌
✍✏✎

word.
 ✂✁

☎ ✆


✞✠✟✡

✟☞


✌✎✍

✏✑

✏✓






✕✖


✘ ✙
✞✚
✛✜

3

✔✎✣


✖✤
✑✦✥




✧✎★
✩✪



UMBC
U M B C
U
N
I

V
E
R
S
I
T
Y


O
F


M
A
R
Y
L
A
N
D


B
A
L
T
I
M
O

R
E


C
O
U
N
T
Y
1

9

6

6
✬✎✭
✮✠✯
✰✱





✰✎✵
StringOperations:
LODSW
EAX
EBX

ECX
EDX
ESP
EBP
EDI
ESI
CS
DS
ES
SS
  ✁


✄ ☎

*10H




+




11000









+/-
2
 ✂✁

☎ ✆


✞✠✟✡

✟☞


✌✎✍

✏✑

✏✓





✕✖


✘ ✙

✞✚
✛✜

4

✔✎✣


✖✤
✑✦✥




✧✎★
✩✪



UMBC
U M B C
U
N
I
V
E
R
S
I
T

Y


O
F


M
A
R
Y
L
A
N
D


B
A
L
T
I
M
O
R
E


C
O

U
N
T
Y
1

9

6

6
✬✎✭
✮✠✯
✰✱





✰✎✵
StringOperations.
REPprefix:
ExecutestheinstructionCXtimes.
NOTE:REPdoesnotmakesensewiththeLODSinstruction.
CLD

 

 




☛✁

.STARTUP
MOV AX

☎ ✆


☎ ✞
.EXIT
END




✙✠

✒☞☛


✙✌









.CODE





✙✎


✒ ✛



✙✏





MOV ES

AX
MOV DI












MOV CX

✢ ✑









✍✓



MOV AX

☎ ✔

☎ ✞










✒ ✕











✗✘

✄✚

✄✜

















 ✂✁

☎ ✆


✞✠✟✡

✟☞


✌✎✍

✏✑

✏✓





✕✖



✘ ✙
✞✚
✛✜

5

✔✎✣


✖✤
✑✦✥




✧✎★
✩✪



UMBC
U M B C
U
N
I
V
E
R
S

I
T
Y


O
F


M
A
R
Y
L
A
N
D


B
A
L
T
I
M
O
R
E



C
O
U
N
T
Y
1

9

6

6
✬✎✭
✮✠✯
✰✱





✰✎✵
StringOperations.
MOVS:
Movesabyte,wordordoublewordfromdatasegmentandoffsetSI
toextrasegmentandoffsetDI.
Increments/decrementsbothDIandSI:
INS/OUTS(notavailableonthe8086):
Transfersabyte,wordordoublewordofdatafrom/toanI/Odevice
into/outoftheextra/datasegment+offsetDI/SI,respectively.

TheI/OaddressisstoredintheDXregister.
MOVS










 
☛☞

 ✟



☛☞

 


 


✍✏✎







☛ ✌
✍✏✎

MOVSB

✆✟


 
☛☞

 ✟



☛☞

 


 
☛ ✌
✍✏✎







☛ ✌
✍✏✎

MOVSD





 
☛☞

 ✟



☛☞

 


 


✍✏✎







☛ ✌
✍✏✎

 

✄✜










 
☛☞


 



 



 
☛ ✌
✍✏✎






☛ ✌
✍✏✎

INSB

✆✟


 
☛☞


 



 


 



✍✏✎

INSD





 
☛☞


 



 


 
☛ ✌
✍✏✎

OUTSB


 




 ✟



☛☞





☛ ✌
✍✏✎

×