piclist 2003\02\20\153322a >
Thread: How to do token pasting in MPASM?
face BY : Ned Konz email (remove spam text)

[Sorry for those of you who get this twice; I wasn't sure whether the
subject flag rules have been changed to fix the broken mail clients
yet or not.]

Say I want to make a MPASM macro that will be invoked as:

       MyMacro abc,xyz

and will generate the following code:

abcxyz    equ 123

That is, it pastes its two arguments together to make a label. Is this
possible in MPASM? How about:

abcxyz    equ "abcxyz"

Which also pastes the arguments together and makes a string out of

I know how to do it in C using the ## token pasting operator and the #
stringizing operators (and the fact that two adjacent strings are

But I only see the #v(<expr>) form that would allow tokens to be
pasted together (with an intervening number).

After reading the MPASM manual I can't figure out how to do these. I
hope this isn't an oversight.

Ned Konz

http://www.piclist.com hint: To leave the PICList
<200302201151.39256@ned.bike-nomad.com> 7bit

See also: www.piclist.com/techref/microchip/languages.htm?key=asm
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) How to do token pasting in MPASM?

month overview.

new search...