Has anybody run into problems using the preprocessor with macros?
I'm trying to find a way to keep track of my registers with AVRASM2 using #defines and macros with .def'd registers. This works well.. until I try to use it in my code. The macros are in one file, with the code and #defines in a few .asm files. I don't know if that has anything to do with it or not.
A simple example such as this works fine, but now it says "Operand 1: Invalid register." Operand 1 beng something I #defined ('bits' or 'avail' in my example listing) after calling my def_GetBits macro.
When I try to use #defines I also see the assembler complaining about a "macro body spanning an EOF" as if I missed an .endm directive, or "unexpected , (comma)" as if the #defined symbol equates to nothing.
Anyhow.. this works, but I'm trying to find a simple example that doesnt work.
/* GetBits */ .macro def_GetBits .def GB_bits = r24 .def GB_avail = r22 .def GB_buffer = r25 .def GB_dest = r23 .endm .macro undef_GetBits .undef GB_bits .undef GB_avail .undef GB_buffer .undef GB_dest .endm ; GetBits - do something def_GetBits #define bits GB_bits #define avail GB_avail GetBits: ldi avail, 0xAA ldi bits, 0xBB sub bits, avail ; do something ret #undef bits #undef avail undef_GetBits