???????:??IP(?CS)???? - PowerPoint PPT Presentation

1 / 41
About This Presentation
Title:

???????:??IP(?CS)????

Description:

Title: 3 8086/8088 Author: shen Last modified by: Legend User Created Date: 1/22/2000 11:24:16 AM Document presentation format: – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 42
Provided by: Shen97
Category:
Tags:

less

Transcript and Presenter's Notes

Title: ???????:??IP(?CS)????


1
3.3.5 ??????
  • ????????
  • ????
  • ??????
  • ???????
  • ????

2
1.????
  • ?????????IP(?CS)????
  • ??????????????
  • ???????????????

3
(1) ??????? - JMP ????????????????,???????????????
???CS?IP???,JMP????4???? ? ?????? JMP disp
??????8/16???????IP?CS????? ? ??????
JMP reg/mem reg/mem??16??????IP?CS?????
? ?????? JMP segmentoffset
??????16????16????????CS?IP? ? ?????? JMP
mem32 mem32??16????16????????CS?IP?
4
? ??????
  • ??????????????????????????????????IP????
  • ??? ???? ???????
  • 8? -128127 JMP SHORT OPRD
  • 16? -3276832767 JMP NEAR PTR OPRD
  • ?JMP 0120H ????0120H
  • JMP SHORT LP ??LP
  • JMP NEAR PTR BBB ??BBB
  • ???????,????CS??????

5
  • ???????
  • ??????????????????????
  • ?1JMP SI
  • ?(SI)1200H,??????,(IP)1200H,????????????1200H???
    ???
  • ????????????????,??????IP????,??????16??????

6
  • ?2JMP BXDI
  • ??????
  • (DS)3000H,(BX)1300H,
  • (DI)1200H,(32500H)2350H
  • ??????(IP)2350H
  • ??????,??????????
  • JMP WORD PTRBXDI
  • ???????????????

7
  • ???????
  • ????????????????????????
  • ?JMP 2000H1000H
  • ???,(IP)?1000H,(CS)?2000H
  • ???????????,????????????????????FAR PTR?
  • ?JMP FAR PTR far_label
  • ???far_label????????

8
???????
  • ???????(????)???????????????
  • JMP DWORD PTRSI
  • ??????(DS)4000H,(SI)1212H,
  • (41212H)1000H,(41214H)4A00H
  • ??????(IP)1000H,(CS)4A00H
  • ????4B000H????????
  • ???DWORD PTR????????????

9
JMP DWORD PTR SI????
11111111
11101100
DSSI
4000
DS
1212
)
SI
41212
41212 41213 41214 41215
00
1000
IP
10
00
4A00
CS
4A
???????????
10
(2)?????? - JXX
  • ?????????????????
  • ??????????????????????????
  • ??
  • JXX label xx???????
  • ????????-128127???
  • ???????????p142?3-7?

11
  • ? ????????????????
  • JB/JC ??,?CF1,???
  • JNB/JNC/JAE ?????,?CF0,???
  • JP/JPE ????PF1(?),???
  • JNP/JPO ????PF0(?),???
  • JZ/JE ????(ZF1),???
  • JNZ/JNE ?????(ZF0),???
  • JS SF1,???
  • JNS SF0,???
  • JO OF1,???
  • JNO OF0,???

12
? ???????????????
  • ????????????????????????
  • CMP dist,src ??
  • Jxx label ????????
  • ?????????
  • JA ?????(distgtsrc)
  • ????? CF0?ZF0
  • JNA/JBE ????????(distsrc)
  • ????? CF1?ZF1

13
?????????
  • JG ?????(distgtsrc)
  • ????? (SF?OF0)?ZF0
  • JGE ????????(distsrc)
  • ????? (SF?OF0)?ZF1
  • JL ?????(distltsrc)
  • ????? (SF?OF1)?ZF0
  • JLE ????????(distsrc)
  • ????? (SF?OF1)?ZF1

14
  • ???CX??????????????
  • JCXZ label
  • ?(CX)0,????label??????

15
  • ??????????????????BX?????
  • MOV BX, 1234H
  • MOV CH, 4 CH??????
  • ROT MOV CL, 4 CL??????
  • ROL BX, CL ???4????4?
  • MOV AL, BL
  • AND AL, 0FH ???4?
  • ADD AL, 30H ???ASCII?
  • CMP AL, 39H ? 9 ??
  • JBE DISP ?(AL)9, ????
  • ADD AL, 7 ?(AL)gt9, ??7??A-F
  • DISP MOV DL, AL (DL)???
  • MOV AH, 2
  • INT 21H ????
  • DEC CH 4???????????
  • JNZ ROT ??, ??
  • MOV DL, 48H H
  • MOV AH, 2
  • INT 21H ????H

16
2.??????
  • ??????????????????
  • ????????CX??
  • ????????????-128127??????
  • ?????????????

17
  • (1)LOOP
  • ??LOOP label
  • ??(CX)-1?CX
  • ?(CX)?0,???label???
  • ??????,??LOOP??????
  • ?LOOP???????????
  • DEC CX
  • JNZ label

18
  • (2)LOOPZ (LOOPE)
  • ??LOOPZ label
  • ??(CX)-1?CX
  • ?(CX)?0?ZF1,???label???
  • ??????,??LOOP??????
  • (3)LOOPNZ (LOOPNE)
  • ??LOOPNZ label
  • ??(CX)-1?CX
  • ?(CX)?0?ZF0,???label???
  • ??????,??LOOP??????

19
  • ?1?1A000H???256????????1,? ????????0???????,?????
    ???1??????(?????1A000H)
  • MOV AX, 1A00H
  • MOV DS, AX
    1A00H?
  • MOV DI, -1
  • MOV CX, 256
  • GOON INC DI
  • DEC BYTE PTRDI
  • LOOPNZ GOON
  • HLT

20
  • ?2?8000H??????1000??????? ??S,???,?????????A
    DDR?,??ADDR????0FFFFH?
  • MOV DI, 8000H
  • MOV CX, 1000
  • MOV AL, S
  • MOV ADDR, 0FFFFH
  • GOON SCASB
  • LOOPNZ GOON
  • JNZ DONE
  • DEC DI
  • MOV ADDR,DI
  • DONE HLT

21
3. ?????????
  • ??(???)
  • ?????????,?????????????
  • ??
  • ??????,IP(CS)??????????????????,??????????IP(CS)?
  • ???????????????????
  • ????,????
  • ??????,?????????
  • ??
  • ?????,????,??????????????
  • ??????
  • ??????? CALL
  • ??????? RET

22
(1)????CALL
  • ????CALL sub sub???????
  • ????????????,?????????
  • ???????
  • ???????????CALL?????
  • ??CALL near_proc
  • CALL???,????IP????,??????????????IP??
  • ??????????????CALL???????????
  • ?CALL 0120H ????????????

23
  • ????????????????,???
  • CS0102 CALL 0120H 3??
  • CS0105
  • ????? 0120-0105H001BH
  • ??CALL 0120H?????E8 1B 00
  • CS0102 E8
  • CS0103 1B CALL 0120H
  • CS0104 00
  • CS0105

24
???????
  • ??????????????????
  • ??CALL mem16/reg16
  • CALL???,????IP????,?????????/????????IP?
  • ?
  • CALL BX ??????BX??
  • CALL WORD PTRSI ??????????

25
CALL WORD PTR SI??????? ??(DS) 8000H,(SI)
1200H
???
IPH IPL
81200H
81201H
???
26
???????
  • ???????????????CALL?????
  • ??CALL far_proc far_proc???????
  • ??????
  • ? CS????
  • ? IP????
  • ? CS????
  • ? IP?????
  • ?CALL 2000H1000H
  • CALL TIMER TIMER????

27
???????
  • ?????????????????4????????
  • ??CALL mem32
  • ??????
  • SP?(SP)-2
  • ((SP)1,(SP))?(CS) CS??
  • CS?(mem322)
  • SP?(SP)-2
  • ((SP)1,(SP))?(IP) IP??
  • IP?(mem32)
  • ?CALL DWORD PTRDI
  • ?????DI,DI1,DI2,DI3?????????????????,??
    ???????

28
CALL DWORD PTRDI
CALL
???
IPH IPL
DI
DI1
DI2
???
DI3
CSH CSL
?????????
29
  • ?????????,(AX)? (DX)?
  • CS2000H MOV AX, 2012H
  • 2003H MOV CX, 200CH
  • 2006H PUSH CX
  • 2007H CALL 4000H
  • 200AH ADD AX, BX
  • 200CH ADD AX, DX
  • 200EH HLT
  • CS4000H MOV BX, 200AH
  • POP DX
  • RET

30
(2)????RET
  • ??????RET????
  • ????????IP????
  • ??????RET????
  • ????????IP?CS????
  • ????????????? RET n ,??n???,???????????????????
  • ?RET 4 ?????????4???

31
4.????
  • 8086/8088 CPU???????????????????????,?????????,???
    ??????????????????????????????????
  • ????????
  • (1)INT n ????n???????,N0255
  • (2)INTO ?????????????
  • (3)IRET ?????????????

32
(1) INT n
????? n 0?255
  • ??
  • INT n
  • ??
  • n4 ??????????????????????????(???),???????
    ?????

??
0000 n4
XXH
XXH
?????????????(IP)
YYH
YYH
????
????????????(CS)
33
  • INT?????
  • ?FLAGS????
  • ?INT????????????(??CS?IP?????)
  • ?????????????CS?IP?
  • INT?????IF?TF, ?????????
  • INT?????????????,?INT 21H

34
INT??????
????
  • INT 21H

??
IPL
SP11FA
IPH
??INT 21H???
CSL
CSH
FLAGSL
FLAGSH
SP1200
??INT 21H???
35
INT??????(?)
  • ??INT 21H???, CS? IP?
  • ??n21H,??n484H?
  • ???,(00084H)2000H1123H
  • ?? CS2000H IP1123H

00000084H
23H
0000 21H4
11H
IP
00H
20H
CS
36
(2)????INTO
  • INTO??????OF,??OF1,???????4???????OF0,?????
    ??
  • ??INTO???????????????????
  • IMUL DX
  • INTO ???,???INT 4, ??????
  • MOV RESULT,AX
  • MOV RESULT2,DX

37
(3)??????IRET
  • ??????????????????IRET??????(CS?IP)???????????
  • ??????????????????,?????????,?????IRET???IRET????
    ????
  • ????????IP
  • ????????CS
  • ????????FLAG

38
3.3.6 ???????
  • 1.??????
  • ???????????
  • (1)CF????
  • CLC 0?CF
  • STC 1?CF
  • CMC CF??
  • (2)DF????
  • CLD 0?DF (??????????????)
  • STD 1?DF (??????????????)
  • (3)IF????
  • CLI 0?IF (??INTR??)
  • STI 1?IF (??INTR??)

39
2. ??????
(1)????HLT
  • ??HLT???,CPU??????,???????????????
  • ????(??IF1?????????INTR????????NMI)???????CPU??
    ?????
  • HLT???????

40
(2)?????NOP
  • NOP????????????,???3?????,??????????
  • ????????????(???)?

41
??
  • P152
  • 3.3, 3.6, 3.12, 3.15
Write a Comment
User Comments (0)
About PowerShow.com