I was trying to do something that my feeble memory thought worked 30 years ago in Mac/65 and not getting any joy in atasm.
I'm making macros to act as wrappers to function calls in a library of routines. Then I'm conditionally assembling routines in the library, so if they are not referenced, they don't get included and waste space. I was figuring this would work.... (only important parts included)
.macro mFunc ; other stuff happens jsr libFunc .endm ; Later in the main code.... mFunc ; Later.... .if .ref libFunc libFunc ; fun stuff ensues rts .endif
This does not work. The .ref does not see the libFunc referenced, so it does not build libFunc. Should this work? Or am I insane?
If the forward referenced label doesn't work, how about a declared value in the macro like this?...
.macro mFunc DO_FUNC .= 1 ; other stuff happens jsr libFunc .endm ; Later in the main code.... mFunc ; Later.... .if .ref DO_FUNC ; and .def does not work either. libFunc ; fun stuff ensues rts .endif
DO_FUNC set in the macro is also not seen. neither .ref or .def sees it.
Next fallback plan...
DO_FUNC .= 0 ; Later on.... .macro mFunc DO_FUNC .= 1 ; other stuff happens jsr libFunc .endm ; Later in the main code.... mFunc ; Later.... .if DO_FUNC>0 libFunc ; fun stuff ensues rts .endif
This (annoyingly) does work. DO_FUNC defined outside the scope of a macro can have its value changed in a macro, and THAT value change is seen by the conditional assembly.
Rather not have to throw in a bunch of flags in a header file separate from the library file which is included in the end of the assembly.
Edited by kenjennings, Wed Mar 21, 2018 11:18 AM.