Searching \ for '[PIC]: Macro question' 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/devices.htm?key=pic
Search entire site for: 'Macro question'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Macro question'
2002\07\19@184447 by Richard Mellina

picon face
       There's something that has been bugging me lately about macros.
MPASM puts in the macro code where the macro is in the program, right? So if
you have...

dosomething     macro   [arguments]
               :
               :       some instructions
               :
               endm

main
       btfss    register, bit
       dosomething [arguments]
       :
       :       instructions
       :
       end


... is MPASM smart enough to change it to...



dosomething     macro   [arguments]
               :
               :       some instructions
               :
               endm

main
       btfsc    register, bit
       goto       aftermacro
       dosomething [arguments]
aftermacro
       :
       :       instructions
       :
       end

...or would it not change it causing the "btfss   register, bit" to only
skip the first instruction in the macro? Any help would be appreciated.
Thanks!

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


2002\07\19@191719 by Andrew Warren

flavicon
face
Richard Mellina <.....PICLISTKILLspamspam@spam@mitvma.mit.edu> wrote:

> if you have...
>
>         btfss    register, bit
>         dosomething [arguments]
>
> ... is MPASM smart enough to change it to...
>
>         btfsc    register, bit
>         goto       aftermacro
>         dosomething [arguments]
> aftermacro
>
> ...or would it not change it causing the "btfss   register, bit" to only
> skip the first instruction in the macro?

Richard:

MPASM will not change a BTFSS to a BTFSC/GOTO; if you put a BTFSS
immediately before a multi-instruction macro, that BTFSS will skip
only the first instruction.

-Andy

=== Andrew Warren -- aiwspamKILLspamcypress.com
=== Principal Design Engineer
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation

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


2002\07\19@225222 by Bob Ammerman

picon face
There is nothing magic about a macro. Macros are just a preprocessing step
performed on the source code. The actual underlying assembler would only
"see" the instructions genereated by the macro.

Thus, in your example

   btfss    register,bit
   dosomething args

the assembler will _not_ make any changed either to the code outside the
macro (btfss register,bits) nor to the code inside the macro (some
instructions). Except, of course it will substitute the arguments as needed
into "some instructions".


Bob Ammerman
RAm Systems

{Original Message removed}

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