Title: 4.1.1 ????(machinelanguage)
1???????
?????
2 ?4? ????????
- ????
- ???????
- ????
- ??????
- ????
- ????????????????????
- ??????
34.1 ??
- ??????
- ????
- ????????????,????????
- ????
????
44.1.1 ????(machinelanguage)
?????????????
54.1.1 ????(machinelanguage)
?????????,????????????????????????????
?????,???????????????????????????,???????????
??????????????????????????,???????????????????????
???? ????????0?1?????,????,????????,??????
?????????,????????????????????
64.1.1 ????(machinelanguage)
????????
??
- ???????????????,??????????????
- 8086?PENTIUM????????????1???13???
- ???????????,?????????
- ?????100000?????????????????????????
74.1.2 ????(Assembly Language)
????(Assembly Language)?????????????
??????,????(Memoni)?????,?????(Symbol)???(Label)??
????????????????????,????????????????????????????
84.1.2 ????(Assembly Language)
- ???? ???????????,????????,??????????????????,??
?????????????,??????????????????? - ??????????????????????????
- ???????(source program)
Microsoft ???MASM?????
94.1.2 ????(Assembly Language)
?????? ?????????????????????,????????????
??,?????????,?????????????????,????????????,????,?
???????????? ???????????????,????????????,???
????????????? ????,?????????????????,?????????
????????
104.1.3 ????(high level language)
???????????,?????????????,????????????????,???
???????????????,????????????????????????
???????
(1)?????????,?????,????????????????????????????
????? (2)???????????????????????,?????????
??????,???????,??????????,?????
114.1.3 ????(high level language)
???????
(1)???????????,???????,?????????,????????????,??
??????,??????????????????????????
(2)??,????????????????????????
124.1.3 ????(high level language)
???????
??????????????????????,???????,????????
???????????????????????????,??????,???????????????
??????????????,?BASIC???
??
???????
????
?????????????
134.1.4 ????????????
????????????????,???????????????????
??????? (1)???????????? (2)??????????????? (3)??
????????? (4)????????????????? (5)?????,?????
144.1.4 ????????????
MASM
???????????.ASM
? ?? ????
????????
???? ??
????
?????????? .OBJ .LST
??????? . EXE
LINK
???? ??
?4.3 ??????????
154.2 ???????????????
???????????????????,?????????????????
???????????????????,????????,??????? ?????????????
??????
164.2.1 ????????????
174.2.1 ????????????
184.2.1 ????????????
194.2.1 ????????????
NAME ????????
STACK SEGMENT STACK ENDS
DATA SEGMENT DATA ENDS
CODE SEGMENT ASSUM CSCODE, DS DATA,
SSSTACK START .. CODE ENDS
END START
?????????
204.2.2 ???????????
???????
MASN?????????????? ????????????,?????????
?????????,????????
?????????????????,???????????????,????????????
???????,????????????????,??? ????????
???????????????????,?????????
?????????????????,????????????????,??????????????
????,?????????????,????????????,??????????
DATA SEGMENT NUM DW 1234H DATA
ENDS????,??NUM?????????????,?????1234H
214.2.3 ???????????
???????
???????4???(??)??,???????????
1?????????
??? ???? ????
??? ?? ???
????? ?? LOOP ADD
AX,BX AX
AXBX
224.2.3 ???????????
???????
???????4???(??)??,???????????
2?????????
??? ??? ??1,??2,.,??n
?? DAT DB
12H,34H,56H ??
DATA SEGMENT NUM DW 1234H DATA
ENDS
????????????
?? ????????, ??????????????
234.2.3 ???????????
???????
???????4???(??)??,???????????
3?????????
?? ???? ??1,??2,.,??n ??
?????????
??????????,????????????,????????
MOV AL, 90H CRLF MOV DL, 30H
244.2.3 ???????????
???????
4???????
??? ???????????????????????????????????
???????????? (1)??(az AZ) (2)??(09) (3)????
254.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????
294.2.3 ???????????
????????????
(2)??????? ????????(??)??????????????????,??
??????? (3)??????????????PROC???????,????????,?
????CALL????????? Mov AL,06H CALL print
Print PROG . .
RET Print ENDP
304.2.3 ???????????
????????????
2??????(operand)??????????????????????????
??????
(1)??????????????????????????
????????? ?????? ??????? ??????
?????? ???????????,6.24E-4
Num DB 123H NUM1 DW 12 NUM2 DW 12O NUM3
DW 12B
314.2.3 ???????????
????????????
?????ASCII?
(1)?????
???? ????A41H,CD4344H
? ????????????count EQU 2343H ???????????
?,????,????
DAT DB 23H45H
324.2.3 ???????????
????????????
(2)??????????????????????,???????????,???????,???
??????IP??????????????????? 8????? 16?????AX?BX?CX
?DX?SI?DI?BP?SP?DS?CS?ES?SS
334.2.3 ???????????
????????????
(3)?????????????????????????,????????????????????
???????? ???????(????)(?????????????)
344.2.3 ???????????
????????????
??(????)???BUFFTER ????????,?????? ???? LEA
AX,BUFFTER MOV AX,
OFFSET BUFFTER ???? DB,DW ,DD
354.2.3 ???????????
????????????
????????,??????,????????????????????,??????
???????? ?????????,?????????,?????,??????
????????????????? ?????
364.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
????????
374.2.3 ???????????
???????????????????
????????? ????? ? ?????
,?????????????,???????????????
???????????????????????? ???????????????????
????????????
384.2.3 ???????????
???????????????????
1???? ??????????????????
(1) ????????/?MOD?SHR?SHL? ??NUM0101
1010B ??? NUM SHL 11011 0100B MOV
AX,20101H MOV AX,STA2STA???,??????????
394.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
404.2.3 ???????????
???????????????????
1???? ??????????????????
(2)????????????????,???????????,?????????? ?????
?????????? ? ?????????,????????? AND BX,77H
AND 0FEH
??
414.2.3 ???????????
???????????????????
1???? ??????????????????
(3)?????EQ?LT?GT?LE?GE?????? ??????????????,?????
???????????,?????????,???????????????????,????????
???? ???????1 ?????0
??
424.2.3 ???????????
???????????????????
(3)?????EQ?LT?GT?LE?GE??????
?? MOV AX,PORT LT 5 ??
MOV AX,0FFFFH
MOV AX, 0
??
PORTlt5----
PORTgt5---
434.2.3 ???????????
???????????????????
(3)????????????,???????????????????
?? MOV BX,((PORT LT 5)AND 20H)OR ((PORT
GE 5) AND 30H)
??
PORTlt5----
MOV BX,20H MOV BX, 30H
PORTgt5---
444.2.3 ???????????
???????????????????
2???????????
?? ????? ?????
454.2.3 ???????????
???????????????????
2???????????
????? ??????(?????)????,???????????(??????????)
????,??????????????????????
464.2.3 ???????????
???????????????????
2??????????? ?????
(1)SEG ?????? ???????????????????????? ??SEG
??? ? ??? ?? MOV DX, SEG ABC
MOV DS,DX ??????????????????
474.2.3 ???????????
???????????????????
2??????????? ?????
(2) OFFSET ????? ?????????????????? ?? OFFSET
??? ? ??? Mov SI , OFFSET DAT1
484.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
494.2.3 ???????????
???????????????????
2??????????? ?????
(3) TYPE ????? ?????????????????? ?? TYPE ???
???? ? ??? MOV AX, TYPE DAT1(??)
504.2.3 ???????????
???????????????????
2??????????? ?????
???????????
?????? ???? ???
DB BYTE 1
DW WORD 2
DD DWORD 4
DQ QWORD 8
DT TBYTE 10??? 10
514.2.3 ???????????
???????????????????
2??????????? ?????
??????????
NEAR ?? -1
FAR ?? -2
524.2.3 ???????????
???????????????????
TYPE ?????
ARRAR DW 1,2,3 TABL DB 3ABCDHFJAK MOV
SI , TYPE ARRAY MOV AH ,TYPE TABL
??SI?AH?
534.2.3 ???????????
???????????????????
??BX?
TYPE ????
student STRUC NAME1 DB ABCD NO
DB ? NUM1 DB ? NUM2 DB ? NUM3
DB ? Student ENDS
MOV BX, TYPE student
544.2.3 ???????????
???????????????????
TYPE ????
??????NEAR(-1) ???FAR(-2)?????
554.2.3 ???????????
???????????????????
2??????????? ?????
(4)LENGTH ?
?? ??????????????????8086?????,LENGTH?????DUP????
?????,??????????????????(????????) ??????DUP??????
???1? ?? LENGTH ???
564.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???)
574.2.3 ???????????
???????????????????
2??????????? ?????
(5)SIZE
????????????????????????DUP???????,???SIZE???????
??????????????????????????DUP???????,?????TYPE????
?? ?? SIZE ???
584.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
594.2.3 ???????????
TYPE LENGTH SIZE
????????,??????????????? SIZE TBL(LENGTH
TBL)(TYPE TBL) ? SIZE LENGTH x TYPE
604.2.3 ???????????
???????????????????
2???????????
????? ??????????????????,??????? ??????
??
614.2.3 ???????????
???????????????????
(1)PTR
???????????????????(???????)o
???? PTR ???
???????BYTE?WORD?DWORD?NEAR?FAR? ?????????????
?
624.2.3 ???????????
???????????????????
(1)PTR
??PTR??????????????????????????,?????????????
PTR??????????????,???????????????????????,??????
???? PTR?????????????????,?????????????????,??
????????????????? PTR?????????
634.2.3 ???????????
???????????????????
(1)PTR
VARW DW 2030H, 4080H .. MOV AL ,BYTE PTR
VARW ??VARW?????BYTE???? M
OV AX,VARW
??VARW?????WORD???
644.2.3 ???????????
???????????????????
(1)PTR
10H
20H
30H
40H
MOV AH,BYTE PTR VARWDI JMP DWORD PTR BX
?????? CALL WORD PTR BXSI
?????? ????CALL???BXSI??????????
??????,?????????,???PTR?????????,????????????
654.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 ????????????????
664.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
674.2.3 ???????????
???????????????????
(1)PTR
??? PTR ???????????? ?? NEXT MOV BX ,100
NEXT?NEAR???? FNEXT EQU FAR FTR NEXT
FNEXT?FAR????
NEXT JNEXT ????????????????,????????????????????,
????????
684.2.3 ???????????
???????????????????
(1)PTR
??????,????????????(??? ???),??PTR?????????? JMP
NEAR PTR NEXT ???? . NETX MOV BX ,100
694.2.3 ???????????
???????????????????
(2)THIS???????
?? THIS ?? ??????BYTE?WORD?DWORD?FAR?NEAR? ?
?????????????????????????????????BYTE?WORD?DWORD?
???,???????????NEAR?FAR?????
704.2.3 ???????????
???????????????????
?EQU??????THIS ?????
(2)THIS???????
FIRSTBYTE EQU THIS BYTE WORDTABLE DW 3275H
,08ABH
???????????DB,DW??????????(?????????),???????(
????)???,???????????????DB?DW??(?????)???(???)????
??????
???????????
714.2.3 ???????????
???????????????????
JMP TAB ?????????
(2)THIS???????
??????????????? TAB EQU THIS FAR MOV
AX,1234H
TABMOV AX,1234H
???THIS????TAB?FAR????,????????????????,???????
???????????,????MOV AX,1234H????
724.2.3 ???????????
???????????????????
3??????????
(1) ???? MOV AL,BX???BX????????????,???? ???
?????? BX?????? MOV DX,SI 5??????,????????????
??,?SI???????5,?????,??????????,?????????????
734.2.3 ???????????
???????????????????
3??????????
(2)???? ???""??????CS?DS?ES?SS??,?????????????
????????????????,????????,????????????? ??MOV AX
, ESSI MOV AL , ESBX
???DS
744.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
764.3?????
?????????????????,??????????? CRLF MACRO MOV
AL,ODH MOV AH,02H INT 21H ?? MOV
AL ,OAH MOV AH,02H INT 21H ??
ENDM
?????????????????,?????6??????????????,????????
??????,?????????????