Title: ?????(field)
1?8? ?????????
28.1 8086/8088??????????
- 8.1.1 8086/8088 ?????
- 1. ??????
- ??????????
- (1) ?????
- (2) ???????
- (3) ????????
- (4) ?????????,????????????????
3?????
- ?????(field)
- --????????????
- ?????
- --?????????????????(???? ????????),??????????
4???????
- ??????????,????????,???????,?????????
??? ??? ??? ???
5 ??
- ?1?? INC AX
- ??????1????,????????
- ?????? ADD AX, BX
- ????????????????,?????,????(???)???????
??????????????,??????????????
6- ????????????????,???????????????????,?????,???
??????????????? - ?????????????????,???????????????????????????????
???????
7 ????
- ?? ??????????????????????????
- ???????????????????
-
- ????????????,???????????????????,?????????????
-
8??????
- ????????????????,???????????,????????????
- ??????,??????????,??????????????,?????????????????
??????
9??????????
- ????(?????)
- ?????
- ????
- ????
- ????
-
- ??,Z80??
- ???? ????
- ??????????
- ????????
- ?????????
- ??????????
10- ??????
- ???????
- ?????????
- (?????????????)
- 2. ???????
11?8-1 ???????
?????????? ?????????
?????(???) ?????(???) ?????(???) ?????(???) MOV AX, 20 ????????
????? ?????? ?????? ?????? MOV AX, BX ??????????
????? ? ? ? ? ? ? ???? ???? MOV AX, DS20 MOV AX, B(?) ??????? ?????
????? ? ? ? ? ? ? ? ? ? ? ??????? MOV AX, BX BX, BP, SI, DI ??
????? ? ? ? ? ? ? ? ? ? ? ??????? MOV AX, BX20 MOV AX, BXB(?) BX, BP, SI, DI ?????
????? ? ? ? ? ? ? ? ? ? ? ?????? MOV AX, BXSI BX, BP??SI, DI ??
????? ? ? ? ? ? ? ? ? ? ? ???????? MOV AX, BXSI20 MOV AX, BXSIB(?) BX, BP??SI, DI ?????
????? ????? ???? ???? IN AL, 20 ???????(0 0FFH)
????? ????? ???? ???? IN AL, DX DX ?????(0 0FFFFH)
12(1) ????(Immediate addressing)
- ??????????,???????????,???????????????,???????????
?????,????????,??????????
13 ?? ? example
- MOV AL, 80H ??? ???
- AX
- MOV AX, 3064H
? -
? - ADD AL, 20H
? - ADD AX, 1090H ???
OP
6 4
3 0
14 - ??????8?,????16?????16??,????????????,???????????
? -
- ???????????????,??????????,???????????
-
15- ??,?B???,??4????????,???????????????
- A EQU 86H ????????????,??A????
?86H - MOV AL, 5 ??????,AL05H
- MOV BL, A A???,???86H,??????,B
L86H - MOV AX, 364H ??????,AH03H,AL64H,AX0
364H - MOV BX, OFFSET B ??????,BX???????B?????
16- ??????????????????????,??????????
- MOV AL, 256 256100H,???AL????????
- MOV AX, -32769 -32769???AX????????(??)??
- MOV 100H, AL ????????????
- DEC 20 ?????????????
- MOV DS, 1234H ????????,??????????????
17(2) ?????(Register addressing)
- ????????,?????????,?????????????
- ??8????,?????? AH, AL,BH,BL, CH, CL, DH, DL .
- ??16????,??????AX, BX,CX, DX, SI, DI, SP
,BP,CS,DS,ES,SS (?CS ????????) -
18 EXAMPLE
- INC AX MOV AX, BX
-
- DEC AX ROL AH , 1
- ?AH??????????
CF
D7 D0
19- ??
- MOV AX , BX ????????,AX?BX,?BX??
- MOV AX, BL ?????????????
- MOV CS, AX ???CS?????????
- MOV ES, DS ????????????????
20 ????????
- (1) ?????????,??????????????(?????,????CPU?????),
???????? - (2)??????????
- ????,????,??????????????
- ???????????????,?????????,?????????????
??(? MOV BX , AX )
21 - ??????????,??????????????????,??????????????????,?
???????
22(3)????(Direct Addressing)
- ??????????,?????????????????EA (Effective
Address) ,EA?????????????? - ????????,???????????????,???,????EA???????(???????
?,????????)???????????????,??????????????
23 - ? 1. MOV AX , DS2000H
- ?(DS) 3000H, ?????????????
24 - ? ??? ????????,???
- ? ???????????
- ? ?????,??????
- ?DS.
- 30000H AX
- ?
- ?
- ? 32000H
-
????(AX)3050H
OP
00
20
50
30
25 - ??, ?????????????????(????)?????????? ??????
- ? 2 ???????(???)?,???????? ?
- MOV AX , ES 3000H
- ? ES MOV AX , 3000H
- ??????????,????????????????????????
- ?( MOV 2000H , 3000H )
26(4) ???????(Register indirect Addressing)
- ????????????,???? ?????(????BX,BP,SI?DI??),
???????????????????,????????(????????????????)? - BX..??????? DS
- EA BP.. SS
- SI ..DS
- DI .DS
27Example
- MOV AX , BX
- ? ( DS) 2000H ,(BX) 1000H
- ????20000H 1000H 21000H
-
???????? - AX . ???????
- ?
???????, -
? ?? -
? MOV AX,ES BX -
???????? -
(AX) 50A0H
A0H
50 H
28(5) ???????(Register relative addressing)
- ?????????????????????????????8??16???????
- ?????
29-
- BX 8????
- EA BP
- SI 16????
- DI
- ????????,??????BX,SI, DI???,?????DS?????
??BP???,??????SS.
30 Example
- MOV AX, SI3000H
? - ?(DS)4000H,(SI)2000H
? - ????
?40000H2000H3000H
? - 45000H
? - ????????
? - ?? AX 40000H
-
43000H -
SI ? -
45000H ? -
?
-
-
OP
OP
00
30
34
12
31- ??????????????,??????????????
- ??????????????????????????
32(6)??????(Based indexed addressing)
- ????????????????????????????,????????????
- BX SI
???????BX,??????DS - EA
- BP DI
???????BP,??????SS -
33 Example
- ?MOV AX,BXDI
- ?(DS)2100H,(BX)0158H,DI10A5H.
- ? EA 0158H10A5H11FDH
- ????21000H11FDH221FDH
-
- BX 21000H
- 21158H
- AX
-
- 221FDH
-
34
12
34- ?????????????(???)???,?????????????,??????????????
??? - ????????????,? ???????
35(7 )?????????(Relative based indexed address)
- ????????????????.
- ???????????????????????????8??16???????
- BX SI
?BX,?????? DS - EA ???
- BP DI
?BP,?????? SS
36?MOV AX,BXSI0250H
OP
OP
50
02
- ?(DS)3000H,(BX)2000H,(SI)1000H,?
? - EA 2000H1000H0250H3250H
? - ????30000H3250H33250H
? -
-
BX 30000H -
- AX ???
32000H ?
-
32250H ? -
SI 33250H ?
34
12
37????????????(??)
??
??
???
??
???
??
(2)?????
(1)????
?8.1 ????????????(1)
38???
??
EA
??
(3)????
??
???
???
???
EA
??
(4)???????
?8.1 ????????????(2)
39??
???
???
EA
???
??
???
??
(5)???????
?8.1 ????????????(3)
40???
??
?? ???
?? ???
???
???
EA
??
???
???
(6)??????
?8.1 ????????????(4)
41??
?? ???
?? ???
???
EA
???
???
??
???
???
???
(7)????????
?8.1 ????????????(5)
42? ? ? ? ?
??
??
???
??
(8)????
??
DX
??
DX
???
??
(9)????
?8.1 ????????????(6)
433. ?????????()
- ???????
- ????????????????????????,???????????,???
?? - ??????????????????,???????,???????IP????
??(CS???????) -
44- ?????????????????????????,???????????,??????
?????????????????????????,???????,?????????????CS,
??????????????IP???????
45- ?????????????????,????????????,????????????????(?
?????)???????????????
46- ??????????????????,????????????,?????????????????
?????????????(?????)???????(?????)? - ?JMP????,???????????????,??8-2???
47?8-2 ?????????
????? ?????
????(L???) ????(L???) ????(L???) ????(L???) ????????(???) ????????(???)
????(L???) ????(L???) ????(L???) ????(L???) JMP L(?) JMP FAR PTR L (?)
?????? ?????? ?????? ???????????? ?
?????? ?????? ?????? JMP AX ?
???? ??? ??? ???? (B???) ???? (B???) ????????? ??????????
???? ??? ??? ???? (B???) ???? (B???) JMP B(?) JMP WORD PRT DS20 JMP B(??) JMP DWORD PTR DS 20
???? ??? ??? ???? ??????? ?????BX, BP, SI, DI ??? ?????BX, BP, SI, DI ???
???? ??? ??? ???? ??????? JMP BX JMP DWORD PTR BX
???? ??? ??? ???? ??????? ?????BX, BP, SI, DI ?? ???? ?????BX, BP, SI, DI ?? ????
???? ??? ??? ???? ??????? JMP BX20 JMP BXB(?) JMP DWORD PTR BX20 JMP BXB(??)
???? ??? ??? ???? ?????? ?????BX, BP??SI, DI ??? ?????BX, BP??SI, DI ???
???? ??? ??? ???? ?????? JMP BXSI JMP DWORD PTR BXSI
???? ??? ??? ???? ???????? ?????BX, BP??SI, DI ?????? ?????BX, BP??SI, DI ??????
???? ??? ??? ???? ???????? JMP BXSI20 JMP BXSIB(?) JMP DWORD PTR BXSI20 JMP BXSIB(??)
48(1) ??????(?????)
- ??????(???????)???????????????,??????????????????
??IP???(??-IP),???????,????????????????
????????????????,????????????,??????????????????
,??????????????????CPU??
49- ???????,????????IP?????????(????),?
- IP(??-IP)??????
- ???????????????????????
- ??,??L???????,?????????????????
- JMP L ??????????L-IP,?????L
-
50(2) ??????(?????)
- ? ??????(???????)
- ? JMP BX BX????????
- ? ??????(???????)
- (i) ????
- ???? ????(??????)????????,????????????????????,?
?B????????????,????????????????????????????
51- JMP B ??????(DSB)???????
?? - JMP WORD PTR DS20??????(DS20)?????????
52- (ii) ???????
- ???? ????(??????)????????,????????????BX?BP?S
I?DI??????,????????????????????????? - JMPBX ??????(DSBX)?????????
- JMPBP ??????(SSBP)????????
- JMP DSBP ??????(DSBP)?????????
-
53- (iii) ???????
- ???? ????(??????)????????,??????????????(BX?BP
?SI?DI??)?????????? - ??,?????????????????????????
- JMPBX20 ??????(DSBX20)?????????
- JMPBP20 ??????(SSBP20)?????????
- JMP DSBP20 ??????(DSBP20)?????????
54- (iv) ??????
- ???? ????(??????)????????,?????????????????(B
X?BP??)?????????(SI?DI??)?????? - ??,????????????????????????
- JMPBXSI ??????(DSBXSI)?????????
- JMPBPSI ??????(SSBPSI)?????????
- JMP DSBPSI ??????(DSBPSI)?????????
55- (v) ????????
- ???? ????(??????)????????,?????????????????(BX?B
P??)?????????(SI?DI??)?????????? - ??,?????????????????????????
- JMPBXSI20 ??????(DSBXSI20)?????????
- JMPBPSI20 ??????(SSBPSI20)?????????
- JMP DSBPSI20 ??????(DSBPSI20)????????
?
56(3) ??????(?????)
- ????(???????)????????????????,?????????????????,??
?????????????,????????????? - ??????????????,????????????????????????,??????????
?????????????CPU?,????????,???????????????????? -
57- ??,??L??????????,??????????????????
- JMP FAR PTR L ?L???????????FAR PTR
-
58(4) ??????(?????)
- ?????????????????????,????????,?????????
?? ??????????,?????????? - ??????????????????????DWORD PTR???,
- JMP DWORD PTR B lt1gt ????
- JMP DWORD PTR DS20 lt2gt ????
- JMP DWORD PTR BX lt3gt ???????
- JMP DWORD PTR BXB lt4gt ???????
- JMP DWORD PTR BX20 lt5gt ???????
- JMP DWORD PTR BXSI lt6gt ??????
- JMP DWORD PTR BXSIB lt7gt ????????
- JMP DWORD PTR BXSI20 lt8gt ????????
-
59- ?lt1gt?????B???,????,???????????????????????,???????
???? - ????????????,B????B?????????????
60- ? ?W?????????,?????????
- W DW L
- MOV SI, OFFSET W
- MOV AX, W
- JMP L ?JMP AX ? JMP W ?JMPSI
-
- L
61- ???W??????L,???????????????8-2??
- JMP L???????(L???)
- JMP AX?????????????(???AX????????)
- JMP W???????????????(??W????????)
- JMPSI???????????????(SI???????????????,?????????
??????)? - 4??????????,??????????L??
62???
??
??
????
???
????
(2)???????
(1)????
?8.2 ??????????????(1)
63???
??
EA
????
(3)????
??
???
???
???
EA
????
(4)???????
?8.2 ??????????????(2)
64??
???
???
???
EA
????
???
??
(5)???????
?8.2 ??????????????(3)
65??
???
?? ???
?? ???
???
???
EA
????
???
???
(6)??????
?8.2 ??????????????(4)
66??
?? ???
?? ???
???
???
EA
???
????
???
???
???
(7)????????
?8.2 ??????????????(5)
678.1.2 8086/8088 ????
- ????????(??)
- ????
- ??????
- ????????? ???
- ?????
- ????
- ???????
68(?)????
?? ?? ?? ??
?? ?? ?? ?? MOV ??,? XCHG ???1,???2 PUSH ?? POP ??? B/W B/W W W (??)?(?) (???1) ?? (???2) SP ?SP-2, (SSSP) ?(?)? (??)? ?(SSSP), SP ?SP2
69(1) MOV ??
???
???
?????
???? ??????? ??????? ?????? ????????
AX BX CX DX SI DI SP BP AL BL CL DL AH BH CH
DH
????
DS ES SS
CS
70- ? MOV AL, BL
- MOV DI, AX
- MOV CX, DS1000H
- MOV BL, 40
- MOV WORD PTRSI,01H
- WORD PTR ?????BYTE PTR ??????
- DWORD PTR ?????? (???)
- ??????????????????
71- ?(?)???????????,??,W1????????
- MOV ES, 1234H ?????????????
- MOV 1AH, CL ????????????????1AH???AH
- MOV CS,BX CS?????????
- MOV W1,BX ?????????????
- MOV ES, DS ????????????
- MOV AX, BL ????????(??)???
72 ??1
- ?MOV????????????????
- 2035H
- 2045H
01H
.
02H
73?????????
- MOV BL, DS2035
- MOV CL, DS2045H
- MOV DS2045H, BL
- MOV DS2035H,CL
- HLT
74????????????
- MOV SI , 2035H
- MOV DI, 2045H
- MOV AH, SI
- MOV AL, DI
- MOV DS2035H,AL
- MOV DS2045H,AH
75 ??2
- ????BLOCK1??BLOCK2
-
- 2040H 2060H
-
- ?2040H?????10???????2060?????10???????
BLOCK1
BLOCK2
76 ANSWER
- START MOV SI, 2040H
- MOV DI, 2060H
- MOV CX, 0AH
- LOOP1 MOV BL, SI09H
- MOV DI09H,BL
- DEC SI
- DEC DI
- DEC CX
- JNZ LOOP1
- HLT
77 ??3
- ?2040H?????10?????????2060H?????10??????????
78(2)PUSH???POP??
- ????? ???? PUSH SRC
- (SS) ????? SP
SP-2 -
???(SP1,SP) SRC - (SP) ????
POP DST - ?? ???DST
(SP1,SP) - ? ? ?????SP
SP2 - ? ?
- ??? ??
-
-
????
79- ?? ?SS1000H,SP2000H,BX1234H,?????? PUSH
AX?PUSH BX ? POP CX ?????,SS??,SP
,?????????? ,BXCX
?
80(3)XCHG??(????)
- ??XCHG OPR1, OPR2
- ??OPTR1 OPTR2
- ??O D I T S Z A P C
- - - - - - - - -
- - ?XCHG AL,BL
- XCHG BX,CX
- XCHG DS2530H, CX
81XCHG???????????????
?????
???
AX BX CX DX SI DI SP BP AL BL CL DL AH BH CH
DH
???? ??????? ??????? ?????? ????????
82 ??1
- ?XCHG??????????????
- MOV BL , SI 09H
-
- XCHG BL , DI09H
-
- MOV SI09H , BL
83 ??2
- ?BX1234H,DS2000H,???(21234H)5678H,??
XCHG BX, BX ???,BX5678H,???
(21234H)1234H??????BX??????,?? (DSBX)
??????25678H???(??????? 21234H ???),?????
842. ??????
- ???????15?,???????????????????????/????????
??,???????????????????????????
85 ?????? (1)
?? ?? ?? ??
???? ???? PUSHF W SP ?SP-2, (SSSP) ?Flag
???? ????? POPF W Flag?(SSSP), SP ?SP2
???? ???AH LAHF B AH?Flag?8?
???? AH??? SAHF B Flag?8?? AH
?? ?? XLAT?XLATB XLAT ??????? B B AL ?(DSBXAL) AL ?(????BXAL)
???? ?????? LEA 16?Reg, Mem W 16? Reg?Mem?????
???? ?????????DS LDS 16?Reg, ?? Mem W 16? Reg?(Mem)?? DS ?(Mem)??
???? ?????????ES LES 16?Reg, ?? Mem W 16?Reg ?(Mem)?? ES ?(Mem)??
86?????? (2) ??
?? ?? ?? ??
???? ?????? ?????? CBW CWD B W AH????AL???? DX????AX????
???? ?? IN Ac, ??? B/W Ac ?(??), ???00FFH
???? ?? IN Ac, DX B/W Ac ?(DX), DX00FFFFH
???? ?? OUT ???, Ac B/W (??) ? Ac , ???00FFH
???? ?? OUT DX, Ac B/W (DX)?Ac, DX00FFFFH
87 ?????? (3) ??
?? ?? ?? ??
???? ??? MOVSB B (ESDI)?? ?(DSSI)?? DF0? SI?SI1, DI?DI1 DF1? SI?SI- 1, DI?DI -1
???? ??? MOVSW W (ESDI)? ?(DSSI)? DF0? SI?SI2, DI?DI2 DF1? SI?SI- 2, DI?DI -2
???? ??? MOVS ??,? B/W ?
???? ??? (???) STOSB B (ESDI)?AL ?DF0, ?DI?DI1 ?DF1, ?DI?DI- 1
???? ??? (???) STOSW W (ESDI)?AX ?DF0, ?DI?DI2 ?DF1, ?DI?DI- 2
???? ??? (???) STOS ?? B/W ?
88?????? (4) ??
?? ?? ?? ??
???? ??? (???) LODSB B AL ?(DSDI) ?DF0, ?SI?SI1 ?DF1, ?SI?SI- 1
???? ??? (???) LODSW W AL ?(DSDI) ?DF0, ?SI?SI2 ?DF1, ?SI?SI- 2
???? ??? (???) LODS ? B/W ?
89(1)??????
- ???????4?
- PUSHF
- POPF
- LAHF AH Flag??8?
- SAHF Flag??8? AH
- ??8086 ??????TF?? 1
90(2)????
- ????XLAT??BXAL??????????????????AL??
- ???XLAT???,???????????????,????????????
???BX,????????????????????????AL? - ?????,??BX????AL?????,???????????,?DS???
?,?????????????(??)??AL?? -
91- ??,??B????????????????,?????????,AL66H?
- B DB 3FH, 06H, 5BH, 4FH, 66H ????????
- DB 6DH, 7DH, 07H, 7FH, 6FH
- MOV BX,OFFSET B ?BX??????????????
- MOVAL,4
?AL?????????????4 - XLAT
???????(??)?AL? - ????,???????????????????????(???4-1),??,
?????AL??????????(09),??????????????????????
92(3) ??????
- ???????LEA?LDS?LES?3?
- LEA (Load Effective Address)
-
- LDS (Load pointer into register and DS)
- LES (Load pointer into register and ES)
93(i)???????
- ??LEA REG , SRC
- ??REG SRC
- ??????????????EA????????,????????16????????
94?LEA BX,BXDI6H
- ???????(BX)1000H,(DI)0200H,
- ???????,(BX)1206H
- ?????MOV BX,BXDI6H??????
- ??????,LEA AX,VAR???????????,?MOV
AX,VAR???????????
95(ii) LDS REG , SRC
- ??REG (SRC)
- DS (SRC2)
- ??---------
- ?????????(?4???)??DS????????????
- ?????(???) ?????
- ?????(???) DS
96 Example
- ?1. LDS DI,DS2130H
- ?(DS)3000H
- 32130H
-
DI -
DS -
???
???
97(iii) LES REG , SRC
- ?? REG (SRC)
- ES (SRC2)
- LDS?LES??????????????
98(4) ??????
- ???????CBW?CWD????
- ??,CBW???AL??8????????16????AX?,??????AL????
??AH????? - CWD???AX??16????????32????DX?AX?(??DX???1
6?,AX???16?),??????AX??????DX??????
99- ??,?AX379AH, ????CBW???,AX0FF9AH,?????
CWD??,?DX0000H,AX379A H - ?AX977AH, ??????CBW?,AX007AH,?????CWD??
,?DX0FFFFH,AX977AH? - CBW?CWD???????????????CBW?????AL???????,???AL?
???????AHCWD?????AX???????,???AX????????DX?
100(5)??????
- lt1gt ????????
- ??IN AL, PORT ??AL (PORT)
- IN AX, PORT AX
(PORT1,PORT) - OUT PORT,AL (PORT) AL
- OUT PORT,AX (PORT1,PORT)
AX - ?PORT????????,???0255(00FFH)
101lt2gt????????
- ??IN AL, DX ??AL (DX)
- IN AX, DX AX
(DX1,DX) - OUT DX,AL (DX) AL
- OUT DX,AX (DX1,DX) AX
- ???????????,????? DX.
- MOV DX,XXXXH
102????????(???)
- ????
- 08??? ????????
- 116??? ????
- 0-??????(??)
- 1-?????? (??)
1 1 1 0 1 0 W
PORT
103 1110 11 W
PORT
104?????????
- IN????????????????????????.
- ? IN AL , 28H IN AL, 27H
- MOV DS2000H ,AL TEST
AL,000001000B -
JNZ ERROR -
105- OUT???????????????I/O??
- ???26H??(?????)?7?????????,??????????
- COM- REG EQU 26H ?????
- BEGIN- BIT EQU 10000000B ???
-
- MOV AL, OTRCNBITS
- OR AL, BEGIN-BIT
- OUT COM-REG, AL
106(6) ?????
- ???????MOVS?STOS?LODS?3?,?????3????
- ????? ?????(MOVS)
- ?????MOVS?????????????,?????????????????
107- MOVS???3???
- MOVSB?MOVSW?MOVS??, ??
- MOVSB????????(DSSI)??????????????(ESDI)???
?????DF0,????SI?SI1,DI?DI1?DF1,????SI?SI-1,DI
?DI-1? - MOVSW????????(DSSI)?????????????(ESDI)????
???DF0,????SI?SI2,DI?DI2?DF1,????SI?SI-2,DI?D
I-2? -
108- MOVS??, ?????????(????SI)?????(????)?????????
(ESDI)?????(????)?? - ??????,?DF0,????SI?SI1,DI?DI1?DF1,????SI
?SI-1,DI?DI-1? ?????,?DF0,????SI?SI2,DI?
DI2?DF1,????SI?SI-2,DI?DI-2?
109- ??,
- MOVSB???
- MOVS BYTE PTR ESDI, DSSI
- MOVSW???
- MOVS WORD PTR ESDI, WORD PTR DSSI
-
110?????????
- ???1000H?????100?????????????????????
-
111????
- MOV AX , DS
- MOV ES , AX
- MOV SI , 1063H
- MOV DI , 1064H
- MOV CX , 64H
- STD
- REP MOVSB
- HLT
- ?????????????????
-
112- ??????????STOS(??)
- ?????STOS????AL?AX????????????(ESDI)????
?????DI?????? - ???????????REP?,?????????????????
-
113- ??????????LODS(??)
- ?????LODS??????( DSSI)?????????AL?AX????
???????????SI???? - ???????????????,?????????????,??????????
????,??????????,???????????????????? - ?
- ??,????????100?????????????,????????????
????????
114- CLD?
- MOV SI,1000H??????1000H?
- MOV BX,0?
- MOV DX,0?
- MOV CX,101?
- LODDEC CX?
- JZ STO?
- LODSW
??????????AX? - MOV BX,AX?
- AND AX,8000H???????????
- JZ LOD?
- ADD DX,BX?
- JMP LOD?
- STOMOVSI,DX?
115(?)?????
1161. ??????
- (1) ??????????
- ?? ??
?? - ?? ADD DST,SRC DST
SRCDST - ????? ADC DST,SRC DST SRCDSTCF
- ?? SUB DST, SRC DST
DST-SRC - ????? SBB DST,SRC DST DST-SRC-CF
-
- ?? O D I T S Z A P C ??????????
- ---
117 Example
- ???????????????
- W XY24-Z(X,Y,Z?????)
- MOV AX, X
- ADD AX, Y
- ADD AX, 24
- SUB AX, Z
- MOV W, AX
-
118 Example
- ??????(?????????--
- ??16?)
- 2000H 3000H
- ?16?
?16? -
- ?16?
?16? -
-
- ?2000H????????(????)?3000H??????????,????2000H
????
119???
- MOV SI , 2000H ?????????
- MOV AX, SI ???????16??AX
- MOV DI ,3000H ?????????
- ADD AX, DI ??????16???2?? ??16???.(??
-
CF,??????????CF) - MOV SI,AX ??16?????
- MOV AX, SI2
- ADC AX,DI2???16???CF(?16??????)??.
- MOV SI2,AX ??16?????.
- ???????(????)??,?????(????)??,??????????
120?3
- ??????(???)?? ?2500H????,???????????
?2000H?3000H????(????),?????????2000H???,??????
121????
- MOV CL , DS2500H
- MOV SI , 2000H
- MOV DI , 3000H
- CLC
?CF - LOOP1 MOV AX , SI
- ADC AX , DI
- MOV SI , AX
- INC SI
- INC SI
- INC DI
- INC DI
- DEC CL
- JNZ LOOP1
- MOV AX , 0H
- ADC AX , 0H
?????????? - MOV SI , AX
- HLT
-
122(2) ?1 ?1?????
- ?? ?? ??
- ? 1 INC OPR OPR OPR1
- ? 1 DEC OPR OPR OPR-1
- ??(Negate) NEG OPR OPR -OPR
- ?? CMP OPR1,OPR2 OPR1-OPR2
- ??INC?DEC O D I T S Z A P C
- - - - -
- NEG?CMP - - -
123 NEG??
- NEG??????????????,?????????,NEG?????????(?????)??
???????(?????),NEG?????????? - ????(?????)??,???1.
124 Example
- ?AL00010001B17,??NEG AL?,
- AL11101111B-17?
- ?AL11010001B-47?,??NEG AL?,
- AL00101111B47
125????
- ???????????,?????????,????????????,?CMP???????????
(?JZ , JG , JO ?)??? - ?. ??Xgt50,???TOO-HIGH ???????X-Y????,????OVERFLOW
??,?? X-Y ,???????RESULT??(??,X,Y,RESULT?????)
?
126 ???
- ?????????????????,?????????????????.
- MOV AX , X ?(X)??AX
- CMP AX , 50 ??
- JG TOO-HIGH ??(X)??50,??? TOO-HIGH
- SUB AX, Y ????(Y)
- JO OVERFLOW ?????
- JNS NONNEG
- NEG AX
- NONNEG MOV RESULT , AX
-
???,????,??????RESULT -
- TOO-HIGH
-
- OVERFLOW
-
127(3) ????
- (i) ?????
- ??IMUL SRC
- ??????
- ????? AX (Al)(SRC)
- ????DXAX (AX)(SRC)
- (?????,???????????)
- (ii) ?????
- ??MUL SRC
- ??????
- ?IMUL,?????????????
128(4) ????
- ?????
- ??IDIV SRC
- ??????
- ????AL (AX)/(SRC) ??
- AH (AX)/(SRC) ???
- ??? AX (DXAX)/(SRC)??
- DX (DXAX)/(SRC) ???
- ????????????????????
- ???,???????????.
- ?????
- ??DIV SRC
- ??????
- ?IDIV??,????,???????????
129 ???
- ??O D I T S Z A P C
- IMUL --- U U U U X
- MUL --- U U U U X
- IDIV U --- U U U U U
- DIV U --- U U U U U
- X ??????
- U ???
- - ???
-
130???????????????
- ???
- AX (V-(XYZ-540))/X ??
- DX ??
- (??,X ,Y ,Z ,V ?????)
131 PROGRAM
- MOV AX, X
- IMUL Y XY,???DXAX?
- MOV CX, AX
- MOV BX, DX ?????BXCX?
- MOV AX, Z
- CWD ???????Z??BXCX??????
- ADD CX, AX
- ADC BX, DX
- SUB CX, 540
- SBB BX, 0 ?BXCX???540
- MOV AX, V
- CWD
- SUB AX, CX ???????V???(BXCX)?
- SBB DX, BX ??X,??AX?,???DX??
- IDIV X
132(2) BCD?????
- ??BCD?,????????????(Binary Coded
Decimal),???4?????????????(00001001???BCD?10101
111???BCD?). - ??BCD????????2?BCD?
- ?37
- ??BCD????????4?????BCD?,?4??0.
- ?37
0011 0111
0000 0011
0000 0111
133(i)??BCD????????
- ? 1 18 7 25
- 0 0 0 1 1 0 0 0 - - - - - - - - 18
- 0 0 0 0 0 1 1 1 - - - - - - - - 7
- 0 0 0 1 1 1 1 1 - - - - - - - - ?
-
(1111???BCD?) - ?????????(??),???6??
- 0 0 0 1 1 1 1 1
- 0 0 0 0 0 1 1 0
- 0 0 1 0 0 1 0 1 - - - - - - - -
25(????) - ?3???4?(?????????)???,
- AF1
134??BCD????????
- ???BCD???6,???????????
- ?????????????
-
?16?? - ????BCD????
-
?1?10 (?6) - ??,?BCD????,????BCD????????????9(10101111),????6
,????,????? - ?????(????)????
135??BCD????????
- ?2 19 8 27
- 0 0 0 1 1 0 0 1 --------- 19
- 0 0 0 0 1 0 0 0 --------- 8
- 0 0 1 0 0 0 0 1----------21(????)
- ???,?????????????(AF1?CF1),?????16??,?????,???
10,?6,??6??. - 0 0 1 0 0 0 0 1
- 0 0 0 0 0 1 1 0
- 0 0 1 0 0 1 1 1-----------27(????)
- ??,?BCD????,?AF1(?CF1)????4?(??4?)????6???
-
136BCD????????
- BCD??????????
- ????BCD???????????10101111???????,???????????
?(AF1?CF1),?????????6(0110B)??? - BCD??????????
- (1) AF1,??????????,?????-6???
- (2) CF1,???????????,?????-6???
137(ii)??BCD????????
- ??????????
- ?? DAA
- ??AL AL?????????BCD??
- ??????????
- ?? DAS
- ??AL AL?????????BCD??
- DAA--Decimal Adjust for Addition
- DAS-- Decimal Adjust for Subtraction
- ??O D I T S Z A P C
- U ---
138???BCD3 BCD1BCD2
- ??,BCD1,BCD2,BCD3??????,?????4??????BCD?,
- ??(BCD1) 1834 , (BCD2) 2789.
- ?????????????????AL, AF, CF ????
3 4
1 8
8 9
2 7
2 3
4 6
139 ???
- ?? ?? AL CF
AF - MOV AL, BCD1 AL 34 34 -
- ???? - ADD AL, BCD2 AL 3489 BDH 0 0
- DAA ?? 23 BCD
1 ???? - MOV BCD3,AL (BCD3) 23 23 1
- MOV AL, BCD11 AL 18 18 1
- ADC AL, BCD21 AL 1827CF 40H 0
1 - DAA ?? 46
BCD 0 - MOV BCD31,AL (BCD31) 46 46 0
- ? 183427894623
140 ??BCD?
- 8086????BCD???????????,????????????????,??,8086???
??BCD???????? - ???????BCD???????,??????(??BCD?)??????????,???????
?????,????????????BCD??
141(iii)??BCD?????
- ??????(AAA)
- ??????(AAS)
- ??????(AAM)
- ??????(AAD)
1422. ?????????
- (i)??????
- ?? ?? ??
- ? NOT OPR OPR OPR
- ? OR DST,DST DST DST V SRC
- ? AND DST,SRC DST DST SRC
- ?? XOR DST,SRC DST DST SRC
- ?? TEST OPR1,OPR2 OPR1 OPR2
143(ii) ????
- ?? ?? ??
- ???? SHL OPR,CNT 0
- (??,OPR????????????????,CNT???1?CL)
- ???? SAL OPR,CNT 0
- ??1??,????(????)????(0 1?1 0),?OF1,??????,OF
0 - ???? SHR OPR,CNT 0
- ???? SAR OPR,CNT
CF
CF
CF
CF
144 - ????
- ??????????????.???,????0???,????0.
- ????
- ??????????????.???,??????????,????0.
-
145(iii) ??????
- ?????????
- ROL OPR ,CNT
-
- ?????????
- ROR OPR , CNT
CF
CF
146??????
- ????????
- RCL OPR , CNT
-
- ????????
- RCR OPR , CNT
CF
CF
147???????
- ????????,???????? ????(????????CF???JC?JNC??,?????
?????? - ????n????2 (n)??,??
- 62 (2) 0000011010000011000
- ??,??n????2(n)??,???????,??????????????,???????
?(???????,???????)
148?1?????AL?????10(?10x)
- SAL AL, 1 ?AL????1?,?2x
- MOV BL, AL 2x???BL?.
- MOV CL, 2 ??????CL
- SAL AL,CL 2x??2?,?8x
- ADD AL, BL 2x ??8x,AL??10x
149 - ?2??UNPACKED???16???BCD??????BCD?,???????PACKED??
????? - UNPACKED
PACKED
0000 4
0000 5
0000 6
0000 7
5 4
7 6
150 ???
- MOV DX, 8 ???????????8
- MOV CL, 4 ??????4
- MOV SI, 0
- MOV DI, SI
- CONVERTMOV AX, WORD PTRSIUNPACKED
- SHL AL, CL
- SHR AX, CL
- MOV PACKEDDI, AL ????
- ADD SI, 2
- INC DI
- DEC DX ??????1
- JNZ CONVERT
151(?) ????
- ???????
- ??????
- ??????
- ?????????
152?????????
- ?????? JMP L
- ?????? JMP AX
- (??????????????????)
- ?????? JMP 2500H3600H
- ?????? JMP DWORD PTRDI
- (?????DI,DI1,DI2,DI3???????)
153- 1. ??????
- ????????? JMP SHORT OPR (????)
- ?? IP IP8
????(-127128) - ??????? ?? JMP NEAR PTR OPR(????)
- ?? IP
IP16???? - 2. ??????
- ?? JMP WORD PTR OPR(?????????
-
?????????) - ?? IP (EA)
154.
- 3.????(?)??
- ?? JMP FAR PTR OPR ( ??)
- ?? IP OPR??????
- CS OPR???????
- 4. ??????
- ?? JMP DWORD PTR OPR
- ?? IP (EA)
- CS (EA2)
- ? JMP DWORD PTR BXDI6
155??????
- ???????
- MOV CX , N
- BEGIN .
- . ???
- .
- DEC CX
- JNZ BEGIN LOOP BEGIN
- ??LOOP??,??????
156??????
- ?????,?????????????,???????????????????
- ?? ??/????
???? - ?? LOOP OPR
CX 0 - ??????? LOOPZ OPR/LOOPE OPR
ZF1?CX0 - ???????? LOOPNZ OPR/LOOPNE OPR ZF0
?CX0
157 ??????(?)
- 1.???????,CX CX-1
- 2.OPR?????
- 3.??---------(???ZF???CX-1???,?ZF1?,CX???0ZF????
????,?CX???0??.) - ?
158- ?1????????,AX
- MOV CX , 5
- MOV AX , 50
- LP1 SUB AX , CX
- LOOP LP1
- HLT
159- ?2?100??????????????????
- (??????????ZF???CX????????????????????)
160-
- MOV CX , 100?
- MOV SI,0FFFH??????????1000H?????
- NEXTINC SI?
- CMP BYTE PTRSI, ??
- LOOPNZ NEXT
- ?
- ??,??????ZF????CMP?????,??CX?1?????
161??????????
- (1)????
- ?? ?? ??
- ?????? Call DST SP SP-2
-
(SP1,SP) IP(??????) -
IP IP???(??????) - ?????? Call DST SP SP-2
-
(SP1,SP) IP -
IP (EA) (EA?DST ????? -
????????) - ?Call Display ( ??????)
- Call WORD PTR BX (??????)
162??????????
- ?? ?? ??
- ?????? Call DST SP SP-2
-
(SP1,SP) CS -
SP SP-2 ?????? -
(SP1,SP) IP -
IP ??? -
CS ??? ?????? - ?Call FAR PTR Display
-
163??????????
- ?? ?? ??
- ?????? Call DST SP SP-2
-
(SP1,SP) CS -
SP SP-2 ?????? -
(SP1,SP) IP -
IP (EA) -
CS (EA2) ?????? -
-
EA?DST????????????? - ?Call DWORD PTR BXSI
-
-
164??????????
- (2) ????
- ?? ??
?? - ???? RET (C3H) IP
(SP1,SP) -
SP SP2 - ??????? RET n IP (SP1,SP)
-
SP SP2 -
SP SPn(n ???)
165??????????
- (2) ????
- ?? ??
?? - ???? RET (CBH) IP
(SP1,SP) -
SP SP2 -
CS (SP1,SP) -
SP SP2 - ??????? RET n IP (SP1,SP)
-
SP SP2 -
CS (SP1,SP) -
SP SP2 -
SP SPn(n???)
166??(???)?????
- Proc-A PROC NEAR(?FAR)
- ____________
- ??? ____________
. - .
- .
- .
- ____________
- RET
- ENDP
-
167?????RET n ??????
- ?.??????FFIT ??,?????????????????,?????FFIT
?,????????ES?DI ?,?????????,????DISPLAY ???????? - ??? FFIT
DISPLAY - call FFIT
call DISPLAY -
- ret ?
ret 2
168FFIT ????
- FFIT PUSH BP
- MOV BP, SP
- PUSH ES
- PUSH DI
- LES DI , BP04 ???????ES?DI
- AAA ESMOV AL, DI ?ES?DI???????
- CMP AL,00 ????????????
- JZ EEE
- PUSH AX
?????DISPLAY???????(??????) - CALL DISPLAY
- INC DI
- JMP AAA
- EEE POP DI
- POP ES
- POP BP
- RET ?
169?????RET n ??????
- DISPLAY ???????
AX -
DI -
ES -
BP - SP
FFIT ???????? - ????????
- ????????
-
1708.1.3 ????????????????
- 1. ?????????????
- ????????????,??????????????????????
- 8086/8088????????
- ????????(REPREPE/REPZ?REPNE/REPNZ)
- ??????(LOCK)
- ?????(ES?CS?SS?DS)
- ??????7??????,????????,??8-20???
171 ?????????????
???? ??????? ????? ????????
LOCK 11110000(F0H) REPNE/REPNZ 11110010(F2H) REPE/REPZ 11110011(F3H) REP 11110011(F3H) ES 00100110(26H) CS 00101110(2EH) SS 00110110(36H) DS 00111110(3EH)
1722. ????????
- 8086/8088???????(?????)?????????,????1???,????6???
?????????????????1???????,?????1???????,?????12?
????????(???)??????12???????? - ?????????(???)???????16???,????????????????,??????
????????????????????? -
1738086/8088?????????
???
???
???
???
??? ??
???? ??
???(???)
???
174(1) ?????
- ?????????????????,????????????????????8?????,?
??????????8????8?? - ?????????????10???,??8.8???
175XXXXXXXX
XXXXXX DW
XXXXXX SW
XXXXXX VW
XXXXXXX W
XXXXXXX Z
XXXXX reg
XXXX W reg
XXX sr XXX
XXXXX UUU
?8.8 ????????????
176- D????????????/??????????????????????????????????,D
??????????????reg????????????????????? - ?D0,??????????
- ?D1,????????????
-
- W???????????????
- ?W0,??????
- ?W1,??????
177(2) ??????
- ?????????????????,?mod??reg??r/m??mod????,???
?reg??3?,???????3???r/m??3?,???????????????????
- ??????????????5???,??8.9???
178mod reg r/m
mod 0 sr r/m
mod XXX r/m
XXXXXXXX
mod UUU r/m
?8.9 ?????????????
179?8-21 reg??sr????????
reg? reg? reg? reg? reg? reg? reg? reg? sr? sr? sr? sr?
000 001 010 011 100 101 110 111 00 01 10 11
W1 AX CX DX BX SP BP SI DI ES CS SS DS
W0 AL CL DL BL AH CH DH BH ES CS SS DS
180?8-22 mod??r/m???????
00 01 10 11 11
?????????? ??????8???? ??????16???? ????? ?????
?????????? ??????8???? ??????16???? W1 W0
000 BXSI BXSIdisp8 BXSIdisp16 AX AL
001 BXDI BXDIdisp8 BXDIdisp16 CX CL
010 BPSI BPSIdisp8 BPSIdisp16 DX DL
011 BPDI BPDIdisp8 BPDIdisp16 BX BL
100 SI SIdisp8 SIdisp16 SP AH
101 DI DIdisp8 DIdisp16 BP CH
110 16????? BPdisp8 BPdisp16 SI DH
111 BX BXdisp8 BXdisp16 DI BH
mod
r/m
181- ?1???MOV BXDI-6,CL????????
- ? ?????????????????????????????,???3????
- 10 00 10 DW mod reg r/m
disp8 - ??(reg????)????????,??D0?CL???????reg001???
?????,??W0???????????????8????,??mod01????BXD
Idisp8?r/m001?????(-6),????11111010???,????????
10001000 01 001 001 11111010?
182- ?2???ADD AX,BX????????
- ????????????????,??????????????????????????????,
???????? - 00 00 00 DW mod reg
r/m - ??(reg????)?????????,??D1?AX???????reg000??????
?,??W1????????????,??mod11,??????BX????011? - ??,????????00000011 11 000 011?
1834. ???????
- ??????????????????????????????????????????
????,????????????????????????? - ???????????????????,??????????????,?????
?????,?????????. - ?????????????,???????,????????????,????
?????,?????????????,??? -
184(1) ???????
- ??/?????????,????????????EA?EA?????????
??????,??????8-24???
185?8-24 ?????????(?????)
???? ??????? ??????? ?????? ?????? ???????? ????????
???? ??????? ??????? BXSI BPDI BXDI BPSI BXSIdisp BPDIdisp BXDIdisp BPSIdisp
6 5 9 7 8 11 12
186(2) ?????????
- ??????????????????????,??,???????????
- ???CPU??????????????,?????????????????????????
?? - ???????
- ??????????????????????
- 8086????????????,??????????????????(???)??????
?????????????????????????????????????????? - ???????????????4??????
-
187?8-25 8086????????? (1)
? ? ? ? ???????
ADD?SUB ??????? 3
ADD?SUB ?????? 9EA
ADD?SUB ?????? 16EA
ADD?SUB ??????? 4
ADD?SUB ?????? 17EA
188?8-25 8086????????? (2) ??
? ? ? ? ???????
MO