Phil Cross wrote: > I must come clean. Having read all the replies, for which thanks, thought > about it, and tried a few things - macros DO work. I was in a muddle. > . I'm glad to hear they work -- I would have some programs that would be in a fix if they did not!! :-) . > > My program was monolithic, and didn't use the linker. Then, when I > single-stepped through a program using MPLAB SIM and a macro was executed, > SIM showed a jump to the macro definition, and stepped through it. Hence I > could watch the execution of the macro by single-stepping. > > However, after modularising my program, and using the linker, SIM doesn't > step through the macro definitions - it just (apparently) jumps over the > macro instruction, although the macro is invisibly executed This is why I > thought it wasn't working - I didn't see the execution of the macro when > single-stepping, as I did before I used the linker. > > So I guess my question now is why can't I single-step through a macro when I > use the linker . However, you STILL seem to be a little bit confused about macros! The only thing that happens when you define a macro is that the assembler, when doing the first pass of assembling your program (there are one-pass assemblers, but most all of them are at least two-passes) , says: "Ah ha! I have a macro definition! I am going to stick it in a special table somewhere, and whenever I come across the place where this guy *uses* that macro on my next pass, then I will physically replace the place where he invokes the macro with the contents of this entry in the macro table, replacing the parameter names with the arguments that he gives me." The point being, the macro is not "called" -- the body of the macro physically replaces the line where it is invoked. So, assuming you define the macro as three lines of code, then your one invocation of the macro name will result in three lines of code being physically inserted there, and assembled, just as if you wrote it there in the first place. What may possibly be happening, trying to figure out your difficulty, is that with most assemblers that I am familiar with (not sure about MPASM) you have the choice of either listing or not listing a macro expansion. That is, you have the choice of the output listing either showing the three lines of code (as per my previous example) or only showing the macro name. Most people tend to not want to list macro expansions, but looking at the object code you will be able to see that the address is increment the proper number of instructions. Hope this helps. As someone else said, if you give a short example perhaps we can hone in on the exact difficulty better. John -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist