OPR1,OPR2,RESULT
PUSH DX
PUSH AX
DIF OPR1,OPR2
IMUL AX
MOV RESULT,AX
POP AX
POP DX
ENDM
宏调用:
DIFSQR VAR1,VAR2,VAR3
9.宏定义体内不仅可以使用宏调用,也可以包含宏定义.
宏定义:
DEFMAC MACRO MACNAM,OPERATOR
MACNAM MACRO X,Y,Z
PUSH AX
MOV AX,X
OPERATOR AX,Y
MOV Z,AX
POP AX
ENDM
ENDM
其中MACNAM是内层的宏定义名,但又是外层宏定义的哑元,所以调用DEFMAC时,就形成一个宏定义.
宏调用:
DEFMAC ADDITION,ADD
宏展开:
+ ADDITION MACRO X,Y,Z
PUSH AX
MOV AX,X