Searching \ for '[PIC]: MPASM Macro help Please' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=asm
Search entire site for: 'MPASM Macro help Please'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: MPASM Macro help Please'
2003\03\24@075948 by Hazelwood Lyle

flavicon
face
Greetings all,
I posted this question last night, but it never showed up on either of my accounts.
Please excuse me if you get it twice.

I'm just learning to write macros, and I have an ambitious one that is working, but not quite the
way I'd like.

If I invoke the macro only once, all is well. But
if I use it twice (or more), I get the following error:

: Address label duplicated or different in second pass
I understand the cause, but I'm wondering if there's a
way I can include branches to labels within a macro
without resorting to counting instructions and using
BRA $+xx. (which works for now, but makes editing a pain)

I'd be grateful for any suggestions.

Thanks,
Lyle Hazelwood

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\03\24@082343 by Quentin

flavicon
face
Hi
You can "include" labels in a Macro by making them LOCAL to that macro.
ex:
test    MACRO
       LOCAL   loop ;, labeln.....
loop    GOTO loop
       endm
--
Quentin
spam_OUTqscTakeThisOuTspamiptech.co.za
http://www.iptech.co.za

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\03\24@084458 by Olin Lathrop

face picon face
> Address label duplicated or different in second pass

Use the LOCAL directive to declare labels that will be unique to each
macro invocation.  See STD.INS.ASPIC at http://www.embedinc.com/pic for
lots of macro examples.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\03\24@084913 by Hazelwood Lyle

flavicon
face
Thanks Quentin, works like a charm.
I had seen the LOCAL option for variables
local to a macro, I didn't realize that it
could be applied to labels as well.

Lyle

{Original Message removed}

2003\03\26@023540 by Lyle Hazelwood

flavicon
face
Greetings all,
I'm trying to get a grip on macros, with an (overly) ambitious first
project.

macro is working well if only invoked from one place in the source.
If I invoke it from two places, the labels used inside the macro generate
an error,
: Address label duplicated or different in second pass

I understand the cause, but is there some way other than doing braches
by literal value instead of labels? I'd rather not count instructions for
each
conditional branch.

Any suggestions are appreciated.

Lyle Hazelwood

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body

2003\03\26@073840 by Olin Lathrop

face picon face
> I'm trying to get a grip on macros, with an (overly) ambitious first
> project.
>
> macro is working well if only invoked from one place in the source.
> If I invoke it from two places, the labels used inside the macro
> generate an error,
>> Address label duplicated or different in second pass

This exact question was answered just a day or two ago.

Use the LOCAL directive.  For lots of macro examples, see STD.INS.ASPIC at
http://www.embedinc.com/pic.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body

2003\03\26@074500 by Hazelwood Lyle
flavicon
face
Olin,
Thanks for the help (again).
The message you replied to was posted by me on Sunday evening.
By Monday morning, I had not yet seen the message from either
of my PICLIST accounts, so I reposted it from work, with a comment
at the beginning that the original post never made it through.

I noticed this morning, as you did, that the original "lost"
message finally made it through! If you check the header,
you'll see that it was sent Sunday night.

In any case, thanks for the help (twice!) and it's working great now.

Lyle

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2003 , 2004 only
- Today
- New search...