Title: 80x86????????
1?7? ????????
27.1 ???
1. ??? ???? MACRO ?????
... ?? ENDM 2.
??? ???? ???? 3. ???
????????,MASM?????????????,????????????????????
3- 4. ??
- ???????????????????????
- ????,?????????????,???????????????????????,?????
?????? - ???????MASM??????????????,????????
- ??????????,?????????????????,MASM???????????????
- ??????????????,???????????????????
4 ??????????????,????????????? back
4CH dosint EQU 21H
dispch MACRO MOV
AH,2 MOV DL, ' '
INT 21H
ENDM
5code SEGMENT ASSUME
CScode main dispch dispch
MOV AH,back
INT dosint code ENDS
END main
6??????????? MOV AH,2
MOV DL,'' INT 21H
MOV AH,2 MOV DL,''
INT 21H MOV AH,4CH
INT 21H
77.1.2 ????????
- 1. LOCAL?????????????
- LOCAL ???,...,???
- ???????,MASM????????????????????????????(??00
00 ??FFFF),??????????? - 2. EXITM ???
- ?????????,????????????MASM??EXITM?ENDM???????
? - Â
8??7.16???????? sum MACRO a,b
LOCAL next MOV CX,a LEA
BX,b XOR AX,AX nextADD
AX,BX ADD BX,2 LOOP
next ENDM ???buf1?buf2?????????,????????
sum 5,buf1 sum 7,buf2
9????????? MOV CX,5 LEA
BX,buf1 XOR AX,AX ??0000ADD
AX,BX ADD BX,2 LOOP
??0000 MOV CX,7 LEA
BX,buf2 XOR AX,AX ??0001ADD
AX,BX ADD BX,2 LOOP
??0001
107.1.3 ????
- 1. lt gt
- ?????,????????????????,????"lt" ?"gt"?????????
- 2.
- ?????,???????????????????,??????????
- 3.
- ?????,????????,?MASM?????????????,????????
11- 4. !
- ?????lt?gt??????,MASM????!???????(lt?gt??"?'???)
???????????!??????,???!!?!??????????????? - 5.
- ?????,???????,?????????
- Â
12?????????? data MACRO p,q vp
DB q ENDM ????????
x 1 data x,x
x x1 data x,x ??????? 1 v1
DB 1 1 v2 DB 2
137.1.3 ??????
- ????????????3?????v1?v2?v3,??????????,????????????
- mm1 MACRO x
- MOV AX,x
- MUL AX
- ENDM
14 mm2 MACRO a,b,c mm1 a
MOV BX,AX mm1 b ADD
AX,BX MOV c,AX ENDM ??
mm2 v1,v2,v3
15?????mm2??? 1 mm1 v1 1 MOV BX,AX 1
mm1 v2 1 ADD AX,BX 1 MOV
v3,AX ????????,????mm1?????????? 2 MOV
AX,v1 2 MUL AX 1 MOV BX,AX 2
MOV AX,v2 2 MUL AX 1 ADD AX,BX
1 MOV v3,AX
167.2.4 ?????????
- ????????????,????????,??????????
- ???????????CALL?????,??????????????,?????????
- ????????????????,???????,???????(???????????),???
???? - ??????????????????,??????????????????????????Â
177.2 ???
1. ?? REPT ????? ...
??? ENDM 2. ??
???????????????????,????????????
18 ?????????1?10???????????????????????
- x 1
- REPT 10
- DB x
- x x1
- ENDM
- ??????????
- 1 DB 1
- 1 DB 2
-
- 1 DB 9
- 1 DB 10
197.2.2 IRP ???
1. ?? IRP ???, lt???, ..., ???gt
... ??? ENDM 2. ??
?lt gt?????????,??????????????? 3. ??
20 ??7.19???SP?????????????7?PUSH??,???????????
IRP regs,ltAX,BX,CX,DX,SI,DI,BPgt PUSH
regs ENDM ????????? 1 PUSH AX 1
PUSH BX 1 PUSH CX 1 PUSH DX 1
PUSH SI 1 PUSH DI 1 PUSH BP
217.2.3 IRPC ???
1. ?? IRPC ???,
lt???gt ??????ltgt???? ... ???
ENDM 2. ?? ?IRP????,??????????????,?????????
????
227.2.4 ???????
- ????????????,??????????????,??????
- ????????,?????????????????,MASM??????????????????
?????,????????? - ????????????
237.3 ????
- ????????????????????????,???????????????????????
?????????????? - ?????????????
- IFxx ???
- lt????1gt
- ELSE
- lt????2gt
- ENDIF
24- ??????????IF?IFDEF
- ????????????
- ???CPU????????
- ???????????
25????
- ?????????????,????????????,???????????????MASM????
??????????? - MASM???????????REPT?IRP?IRPC?????????,??????????
???????????????,??????????? - ??????,??????????????????????,?????????????,?????
?????