4.1.1 ????(machinelanguage) - PowerPoint PPT Presentation

1 / 75
About This Presentation
Title:

4.1.1 ????(machinelanguage)

Description:

– PowerPoint PPT presentation

Number of Views:92
Avg rating:3.0/5.0
Slides: 76
Provided by: jerr2180
Category:

less

Transcript and Presenter's Notes

Title: 4.1.1 ????(machinelanguage)


1
???????
?????
  • ????
  • ???

2
?4? ????????
  • ????
  • ???????
  • ????
  • ??????
  • ????
  • ????????????????????
  • ??????

3
4.1 ??
  • ??????
  • ????
  • ????????????,????????
  • ????

????
4
4.1.1 ????(machinelanguage)
?????????????
5
4.1.1 ????(machinelanguage)
?????????,????????????????????????????
?????,???????????????????????????,???????????
??????????????????????????,???????????????????????
???? ????????0?1?????,????,????????,??????
?????????,????????????????????
6
4.1.1 ????(machinelanguage)
????????
??
  • ???????????????,??????????????
  • 8086?PENTIUM????????????1???13???
  • ???????????,?????????
  • ?????100000?????????????????????????

7
4.1.2 ????(Assembly Language)
????(Assembly Language)?????????????
??????,????(Memoni)?????,?????(Symbol)???(Label)??
????????????????????,????????????????????????????

8
4.1.2 ????(Assembly Language)
  • ???? ???????????,????????,??????????????????,??
    ?????????????,???????????????????
  • ??????????????????????????
  • ???????(source program)

Microsoft ???MASM?????
9
4.1.2 ????(Assembly Language)
?????? ?????????????????????,????????????
??,?????????,?????????????????,????????????,????,?
???????????? ???????????????,????????????,???
????????????? ????,?????????????????,?????????
????????
10
4.1.3 ????(high level language)
???????????,?????????????,????????????????,???
???????????????,????????????????????????
???????
(1)?????????,?????,????????????????????????????
????? (2)???????????????????????,?????????
??????,???????,??????????,?????
11
4.1.3 ????(high level language)
???????
(1)???????????,???????,?????????,????????????,??
??????,??????????????????????????
(2)??,????????????????????????
12
4.1.3 ????(high level language)
???????
??????????????????????,???????,????????
???????????????????????????,??????,???????????????
??????????????,?BASIC???
??
???????
????
?????????????
13
4.1.4 ????????????
????????????????,???????????????????
??????? (1)???????????? (2)??????????????? (3)??
????????? (4)????????????????? (5)?????,?????
14
4.1.4 ????????????
MASM
???????????.ASM
? ?? ????
????????
???? ??
????
?????????? .OBJ .LST
??????? . EXE
LINK
???? ??
?4.3 ??????????
15
4.2 ???????????????
???????????????????,?????????????????
???????????????????,????????,??????? ?????????????
??????
16
4.2.1 ????????????
17
4.2.1 ????????????
18
4.2.1 ????????????
19
4.2.1 ????????????
NAME ????????
STACK SEGMENT STACK ENDS
DATA SEGMENT DATA ENDS
CODE SEGMENT ASSUM CSCODE, DS DATA,
SSSTACK START .. CODE ENDS
END START
?????????
20
4.2.2 ???????????
???????
MASN?????????????? ????????????,?????????
?????????,????????
?????????????????,???????????????,????????????
???????,????????????????,??? ????????
???????????????????,?????????
?????????????????,????????????????,??????????????
????,?????????????,????????????,??????????
DATA SEGMENT NUM DW 1234H DATA
ENDS????,??NUM?????????????,?????1234H
21
4.2.3 ???????????
???????
???????4???(??)??,???????????
1?????????
??? ???? ????
??? ?? ???
????? ?? LOOP ADD
AX,BX AX
AXBX
22
4.2.3 ???????????
???????
???????4???(??)??,???????????
2?????????
??? ??? ??1,??2,.,??n
?? DAT DB
12H,34H,56H ??
DATA SEGMENT NUM DW 1234H DATA
ENDS
????????????
?? ????????, ??????????????
23
4.2.3 ???????????
???????
???????4???(??)??,???????????
3?????????
?? ???? ??1,??2,.,??n ??
?????????
??????????,????????????,????????
MOV AL, 90H CRLF MOV DL, 30H
24
4.2.3 ???????????
???????
4???????
??? ???????????????????????????????????
???????????? (1)??(az AZ) (2)??(09) (3)????
25
4.2.3 ???????????
???????
4???????
???? (1)????????????? (2)???
?????????? (3)????????,???????? (4)??????????? (5)
???31???,???31???? (6)??????????????,?????????????
????????
26
(No Transcript)
27
????
  • ????

28
LEA SI,SUM1 LEA DI,SUM2 LEA
BX,SUM CLC MOV CX,04H LOP1MOV
AL,SI ADC AL,DI MOV SI,AL
INC SI INC SI INC DI
INC DI DEC CX JNZ LOP1 RET
4.2.3 ???????????
????????????
1???(LABEL) (1)?????????????????????????????,???
??????????(????),?????????????,???????????? ??????
? ??? CS ?????IP ????(TYPE)????????????? ??N
EAR OR ?? FAR

JMP????
29
4.2.3 ???????????
????????????
(2)??????? ????????(??)??????????????????,??
??????? (3)??????????????PROC???????,????????,?
????CALL????????? Mov AL,06H CALL print
Print PROG . .
RET Print ENDP
30
4.2.3 ???????????
????????????
2??????(operand)??????????????????????????
??????
(1)??????????????????????????
????????? ?????? ??????? ??????
?????? ???????????,6.24E-4
Num DB 123H NUM1 DW 12 NUM2 DW 12O NUM3
DW 12B
31
4.2.3 ???????????
????????????
?????ASCII?
(1)?????
???? ????A41H,CD4344H
? ????????????count EQU 2343H ???????????
?,????,????
DAT DB 23H45H
32
4.2.3 ???????????
????????????
(2)??????????????????????,???????????,???????,???
??????IP??????????????????? 8????? 16?????AX?BX?CX
?DX?SI?DI?BP?SP?DS?CS?ES?SS
33
4.2.3 ???????????
????????????
(3)?????????????????????????,????????????????????
???????? ???????(????)(?????????????)
34
4.2.3 ???????????
????????????
??(????)???BUFFTER ????????,?????? ???? LEA
AX,BUFFTER MOV AX,
OFFSET BUFFTER ???? DB,DW ,DD
35
4.2.3 ???????????
????????????
????????,??????,????????????????????,??????
???????? ?????????,?????????,?????,??????
????????????????? ?????
36
4.2.3 ???????????
????????????
DAT DB 18,20,30 MOV AL DAT MOV AX,
DAT MOV AX, WORD PTR DAT MOV BX,100 MOV
WORD PTR BX, 100
????????
37
4.2.3 ???????????
???????????????????
????????? ????? ? ?????
,?????????????,???????????????
???????????????????????? ???????????????????
????????????
38
4.2.3 ???????????
???????????????????
1???? ??????????????????
(1) ????????/?MOD?SHR?SHL? ??NUM0101
1010B ??? NUM SHL 11011 0100B MOV
AX,20101H MOV AX,STA2STA???,??????????
39
4.2.3 ???????????
???????????????????
1???? ??????????????????
(2)?????AND OR XOR NOT ??MOV AL,77H AND
84H MOV AX,00FFH OR 1783H
MOV AH,,NOT 0FFH
AL04H AX17FFH AH00H
40
4.2.3 ???????????
???????????????????
1???? ??????????????????
(2)????????????????,???????????,?????????? ?????
?????????? ? ?????????,????????? AND BX,77H
AND 0FEH
??
41
4.2.3 ???????????
???????????????????
1???? ??????????????????
(3)?????EQ?LT?GT?LE?GE?????? ??????????????,?????
???????????,?????????,???????????????????,????????
???? ???????1 ?????0
??
42
4.2.3 ???????????
???????????????????
(3)?????EQ?LT?GT?LE?GE??????
?? MOV AX,PORT LT 5 ??
MOV AX,0FFFFH
MOV AX, 0
??
PORTlt5----
PORTgt5---
43
4.2.3 ???????????
???????????????????
(3)????????????,???????????????????
?? MOV BX,((PORT LT 5)AND 20H)OR ((PORT
GE 5) AND 30H)
??
PORTlt5----
MOV BX,20H MOV BX, 30H
PORTgt5---
44
4.2.3 ???????????
???????????????????
2???????????
?? ????? ?????
45
4.2.3 ???????????
???????????????????
2???????????
????? ??????(?????)????,???????????(??????????)
????,??????????????????????
46
4.2.3 ???????????
???????????????????
2??????????? ?????
(1)SEG ?????? ???????????????????????? ??SEG
??? ? ??? ?? MOV DX, SEG ABC
MOV DS,DX ??????????????????
47
4.2.3 ???????????
???????????????????
2??????????? ?????
(2) OFFSET ????? ?????????????????? ?? OFFSET
??? ? ??? Mov SI , OFFSET DAT1
48
4.2.3 ???????????
???????????????????
?? ????DATA??????? DATA SEGMENT DAT1 DB
20,30 DAT2 DW 2000H,3532H DAT3 DD 1234
5678H, 9ABCDEFH DATA ENDS
MOV AX OFFSET DAT1 ???MOV AX, 0 MOV AX
OFFSET DAT2 ???MOV AX, 2 MOV AX OFFSET
DAT3 ???MOV AX, 6
49
4.2.3 ???????????
???????????????????
2??????????? ?????
(3) TYPE ????? ?????????????????? ?? TYPE ???
???? ? ??? MOV AX, TYPE DAT1(??)
50
4.2.3 ???????????
???????????????????
2??????????? ?????
???????????
?????? ???? ???
DB BYTE 1
DW WORD 2
DD DWORD 4
DQ QWORD 8
DT TBYTE 10??? 10
51
4.2.3 ???????????
???????????????????
2??????????? ?????
??????????
NEAR ?? -1
FAR ?? -2
52
4.2.3 ???????????
???????????????????
TYPE ?????
ARRAR DW 1,2,3 TABL DB 3ABCDHFJAK MOV
SI , TYPE ARRAY MOV AH ,TYPE TABL
??SI?AH?
53
4.2.3 ???????????
???????????????????
??BX?
TYPE ????
student STRUC NAME1 DB ABCD NO
DB ? NUM1 DB ? NUM2 DB ? NUM3
DB ? Student ENDS
MOV BX, TYPE student
54
4.2.3 ???????????
???????????????????
TYPE ????
??????NEAR(-1) ???FAR(-2)?????
55
4.2.3 ???????????
???????????????????
2??????????? ?????
(4)LENGTH ?
?? ??????????????????8086?????,LENGTH?????DUP????
?????,??????????????????(????????) ??????DUP??????
???1? ?? LENGTH ???
56
4.2.3 ???????????
n DUP( ) ??????,?( )????????????,??n??????????
?? ARR DW 20 DUP(2OH) DAT DB 12,25,AB ' MOV
AL,LENGTH ARR AL?20 MOV AH, LENGTH DAT AH?1
???????ARR?????DUP?????20?,?????0020H(40???)
57
4.2.3 ???????????
???????????????????
2??????????? ?????
(5)SIZE
????????????????????????DUP???????,???SIZE???????
??????????????????????????DUP???????,?????TYPE????
?? ?? SIZE ???
58
4.2.3 ???????????
???????????????????
(5)SIZE
?? TBL DW 100 DUP (?) TBL1 DB 12H,34H MOV
AL , SIZE TBL1 AL?1 MOV AH , SIZE TBL
AH?-200 MOV BL ,LENGTH TBL BL?100 MOV BH
,TYPE TBL BH?2
59
4.2.3 ???????????
TYPE LENGTH SIZE
????????,??????????????? SIZE TBL(LENGTH
TBL)(TYPE TBL) ? SIZE LENGTH x TYPE
60
4.2.3 ???????????
???????????????????
2???????????
????? ??????????????????,??????? ??????
??
61
4.2.3 ???????????
???????????????????
(1)PTR
???????????????????(???????)o
???? PTR ???
???????BYTE?WORD?DWORD?NEAR?FAR? ?????????????
?
62
4.2.3 ???????????
???????????????????
(1)PTR
??PTR??????????????????????????,?????????????
PTR??????????????,???????????????????????,??????
???? PTR?????????????????,?????????????????,??
????????????????? PTR?????????
63
4.2.3 ???????????
???????????????????
(1)PTR
VARW DW 2030H, 4080H .. MOV AL ,BYTE PTR
VARW ??VARW?????BYTE???? M
OV AX,VARW
??VARW?????WORD???
64
4.2.3 ???????????
???????????????????
(1)PTR
10H
20H
30H
40H


MOV AH,BYTE PTR VARWDI JMP DWORD PTR BX
?????? CALL WORD PTR BXSI
?????? ????CALL???BXSI??????????
??????,?????????,???PTR?????????,????????????
65
4.2.3 ???????????
???????????????????
(1)PTR
10H
20H
30H
40H


??PTR???????????????? ????????????? ?? DATA1
DB 100 DUP (?) DATA1?????? DATA2 EQU WORD FTR
DATA1 DATA2????? DATA3 EQU DWORD PTR DATA1
DATA3?????? ??DATA1?DATA2?DATA3?????????????,????
??????????,??,??????????????????????,??DATA1,?????
??,????DATA2 EQU ????????????????
66
4.2.3 ???????????
???????????????????
(1)PTR
10H
20H
30H
40H


MOV DATA1,AL ???? MOV DATA1, AX ????
MOV DATA2 ,AX ???? ??,???PTR?????????????????,?
?PTR??????????? MOV BX ,5 ( ?????????????) ???P
TR??????? INC BYTE PTRBX ???? MOV WORD PTR
BX ,5
67
4.2.3 ???????????
???????????????????
(1)PTR
??? PTR ???????????? ?? NEXT MOV BX ,100
NEXT?NEAR???? FNEXT EQU FAR FTR NEXT
FNEXT?FAR????
NEXT JNEXT ????????????????,????????????????????,
????????
68
4.2.3 ???????????
???????????????????
(1)PTR
??????,????????????(??? ???),??PTR?????????? JMP
NEAR PTR NEXT ???? . NETX MOV BX ,100
69
4.2.3 ???????????
???????????????????
(2)THIS???????
?? THIS ?? ??????BYTE?WORD?DWORD?FAR?NEAR? ?
?????????????????????????????????BYTE?WORD?DWORD?
???,???????????NEAR?FAR?????
70
4.2.3 ???????????
???????????????????
?EQU??????THIS ?????
(2)THIS???????
FIRSTBYTE EQU THIS BYTE WORDTABLE DW 3275H
,08ABH
???????????DB,DW??????????(?????????),???????(
????)???,???????????????DB?DW??(?????)???(???)????
??????
???????????
71
4.2.3 ???????????
???????????????????
JMP TAB ?????????
(2)THIS???????
??????????????? TAB EQU THIS FAR MOV
AX,1234H
TABMOV AX,1234H
???THIS????TAB?FAR????,????????????????,???????
???????????,????MOV AX,1234H????
72
4.2.3 ???????????
???????????????????
3??????????

(1) ???? MOV AL,BX???BX????????????,???? ???
?????? BX?????? MOV DX,SI 5??????,????????????
??,?SI???????5,?????,??????????,?????????????
73
4.2.3 ???????????
???????????????????
3??????????

(2)???? ???""??????CS?DS?ES?SS??,?????????????
????????????????,????????,????????????? ??MOV AX
, ESSI MOV AL , ESBX
???DS
74
4.2.3 ???????????
???????????????????
4.???????????

(1)????????,????????? (2)??????,?????????????? (3)
??????????????????????
75
????????
??? ???
? ? 1. LENGTH,SIZE,WIDTH,MASK,(),ltgt,????,????
? ? 2. ??????
? ? 3 . PTR,OFFSET,SEG,TYPE,THIS
? ? 4. HIGH,LOW
? ? 5. ,/,MOD,SHL,SHR
? ? 6. ,
? ? 7. EQ,NE,LE,LT,GT,GE
? ? 8. NOT,
? ? 9. AND
? ? 10. OR,XOR
? ? 11. SHORT

76
4.3?????
?????????????????,??????????? CRLF MACRO MOV
AL,ODH MOV AH,02H INT 21H ?? MOV
AL ,OAH MOV AH,02H INT 21H ??
ENDM
?????????????????,?????6??????????????,????????
??????,?????????????
Write a Comment
User Comments (0)
About PowerShow.com