Hello
Thank you for your answer; macros and conditional assembly are separate issues. but they work together in a fine way, especially when using recursion. I give you an example, extracted from my code:
************** apply fct to arg_1,...arg_n (0 <= n <= 10)
apply macro ; fct,arg_1,...,arg_n
ifnc "\2",""
\1 \2
apply <\1>, <\3>,<\4>,<\5>,<\6>,<\7>,<\8>,<\9>,<\a>,<\b>
endif
endm
function macro ; arg
ldaA \1
endm
************** Now the code
progr apply function,1,2,3,4
************** produces the following listing (with option print macro expansion and macro calls)
progr apply function,1,2,3,4
ifnc "1",""
function 1
ldaA 1
apply <function>, <2>,<3>,<4>,<>,<>,<>,<>,<>,<>
ifnc "2",""
function 2
ldaA 2
apply <function>, <3>,<4>,<>,<>,<>,<>,<>,<>,<>
ifnc "3",""
function 3
ldaA 3
apply <function>, <4>,<>,<>,<>,<>,<>,<>,<>,<>
ifnc "4",""
function 4
ldaA 4
apply <function>, <>,<>,<>,<>,<>,<>,<>,<>,<>
ifnc "",""
endif
endif
endif
endif
endif
************** The expected listing would be:
progr ldaA 1
ldaA 2
ldaA 3
ldaA 4
Naturally, I use apply with functions doing more interesting things that the "function" given in the example ! (things can even be more involved, as function is generally a macro containing itself conditional assembly).
What is needed here is a directive "don't print lines with if, else, endif", independant of the directive "don't print macro expansions".
I have looked at the listing file, and seen that dbg files follow more or less what is done for lst files. You say that when you choose the option "don't print macro expansion" the code for the option taken is shown in the listing file. My problem is that with the HC12 assembler the listing shows ...nothing in this case, and that's my problem for debugging.
Well, I would not be so demanding for lst files, as I prefer to look at my source file than at the listing, but when I am debugging I have not the choice : the debugger imposes me the dbg file ...
Your solution to have a hard copy listing of the macro definitions is right for one level of macro, but when you have macros which call macros which call ... things become much more difficult.
I use also subroutines, but not exactly for the same purposes. When you want to pass complex arguments (especially functions), macros are irreplaceable. They permit a quasi-functional style of programming, while keeping the efficacity and flexibility of assembler. C is far from this...
Regards.