This is a description of the macro. Macro syntax:
<Name of the macro> MACRO [formal parameters]
macro body
ENDM
Directive MACRO - is the title of the macro. It identifies the name and separated by commas formal parameters, if necessary.
Formal parameters allow you to copy the macro is not intact, and with the changes. Those values which need to be changed are described formal parameters.
Remark. The names of the formal parameters are local to the macro, ie they can match the names in the main program, makrogenerator understands them as parameters.
Ends the macro directive ENDM. ! No need to repeat the name of the macro.
Example 1, setting the data segment
initds macro
mov ax, @ data
mov ds, ax
endm
Macros can be placed:
1. At any point in the program.
! Certainly before the first reference to it.
2. In a separate file.
To make the macros available in the program, it is necessary at the beginning of the program to use the directive INCLUDE <filename>. In this stage of makrogeneratora text of the file is fully inserted in place of the directive.
Example. Masm
model small
include Mymacro.inc
. . .
You can write macros universal in one file, in the so-called makrobiblioteku. Connect it with the use of include.
That the text of the program does not include the extra macro, you can use the directive
PURGE <comma-delimited list of names of macros>
The directive specifies what macros should not be included in the text of the program.
Example. . . .
include mymacro.inc
purge outstr, initds
. . .
<Name of the macro> MACRO [formal parameters]
macro body
ENDM
Directive MACRO - is the title of the macro. It identifies the name and separated by commas formal parameters, if necessary.
Formal parameters allow you to copy the macro is not intact, and with the changes. Those values which need to be changed are described formal parameters.
Remark. The names of the formal parameters are local to the macro, ie they can match the names in the main program, makrogenerator understands them as parameters.
Ends the macro directive ENDM. ! No need to repeat the name of the macro.
Example 1, setting the data segment
initds macro
mov ax, @ data
mov ds, ax
endm
Macros can be placed:
1. At any point in the program.
! Certainly before the first reference to it.
2. In a separate file.
To make the macros available in the program, it is necessary at the beginning of the program to use the directive INCLUDE <filename>. In this stage of makrogeneratora text of the file is fully inserted in place of the directive.
Example. Masm
model small
include Mymacro.inc
. . .
You can write macros universal in one file, in the so-called makrobiblioteku. Connect it with the use of include.
That the text of the program does not include the extra macro, you can use the directive
PURGE <comma-delimited list of names of macros>
The directive specifies what macros should not be included in the text of the program.
Example. . . .
include mymacro.inc
purge outstr, initds
. . .
Комментариев нет:
Отправить комментарий