92
ImageCraft Assembly Language Guide, Document # 001-44475 Rev. *B
Assembler Directives
5.16
Macro Definition
MACRO, ENDM
Used to specify the start and end of a macro definition. The lines of code defined between a
MACRO
directive and an
ENDM
directive are not directly assembled into the program. Instead, it forms a
macro that can later be substituted into the code by a macro call. The following
MACRO
directive is
used to call the macro as well as a list of parameters. Each time a parameter is used in the macro
body of a macro call, it will be replaced by the corresponding value from the macro call.
Any assembly statement is allowed in a macro body except for another macro statement and labels
that are referenced from outside the macro.
Labels in macros have to be local to each invocation of the macro, for example:
macro xyz
mov a,2
loop: mov a,x
jnz loop
endmacro
Within a macro body, the expression @digit, where digit is between 0 and 9, is replaced by the cor-
responding macro argument when the macro is invoked. You cannot define a macro name that con-
flicts with an instruction mnemonic or an assembly directive.
Directive
Arguments
MACRO
ENDM
< name >< arguments >
Example:
A MACRO is defined and used in the source code.
MACRO MyMacro
ADD A, 42h
MOV X, 33h
ENDM
// The Macro instructions are expanded at address 2400
ORG 2400h
MyMacro
Summary of Contents for PSoC DESIGNER ImageCraft M8C
Page 6: ...6 ImageCraft Assembly Language Guide Document 001 44475 Rev B Contents Feedback ...
Page 10: ...10 ImageCraft Assembly Language Guide Document 001 44475 Rev B Introduction Feedback ...
Page 24: ...24 ImageCraft Assembly Language Guide Document 001 44475 Rev B M8C Microprocessor Feedback ...
Page 95: ...ImageCraft Assembly Language Guide Document 001 44475 Rev B 95 Assembler Directives Feedback ...
Page 96: ...96 ImageCraft Assembly Language Guide Document 001 44475 Rev B Assembler Directives Feedback ...
Page 104: ...104 ImageCraft Assembly Language Guide Document 001 44475 Rev B Feedback ...
Page 108: ...108 ImageCraft Assembly Language Guide Document 001 44475 Rev B Index Feedback ...