Macro Text Substitution

MPASM Assembler

Macro Text Substitution

String replacement and expression evaluation may appear within the body of a macro.

Command
Description
<arg>
Substitute the argument text supplied as part of the macro invocation.
#v(<expr>)
Return the integer value of <expr>. Typically, used to create unique variable names with common prefixes or suffixes. Cannot be used in conditional assembly directives (e.g. IFDEF, WHILE).

Arguments may be used anywhere within the body of the macro, except as part of normal expression. For example, the following macro:

define_table macro

local a = 0

while a < 3

entry#v(a) dw 0

a += 1

endw

endm

when invoked, would generate:

entry0 dw 0

entry1 dw 0

entry2 dw 0

entry3 dw 0


Microchip Technology Inc.
Microchip's Web Site
Voice: (480) 792-7200
Fax: (480) 899-9210
Microchip's E-mail Address
PreviousNext