You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following documentation here as well as discussion here I think I've established that using \?1 etc. is the only way to write a macro for 6502 which would work equally well for immediate mode as well as zero page mode arguments.
This appears to work fine for a single simple macro (LOAD_DATA in the example below) but when calling a macro from within another macro it seems like the argument type gets lost (COPY_DATA with immediate arg in the example below).
(Side note: I still haven't managed to get my head around why the immediacy of the argument does get removed at all - I understand macros aren't simple token replacements in wla but it would feel like the intuitive behaviour of macros in situations like this would be to pass the # symbol through all the way and let the assembler make the decisions about addressing mode.)
However this quickly becomes impractical when dealing with multiple arguments.
My real-world example involved a macro with 5 arguments, at least 4 of which I wanted to support either immediate or zero-page values; and that macro called another with 3 arguments all of which I wanted to support either type of value; so in the first macro I would have had to have 8 branches on an .if statement just to cover all the potential combinations of incoming arguments that needed to be passed on.
The text was updated successfully, but these errors were encountered:
Following documentation here as well as discussion here I think I've established that using
\?1
etc. is the only way to write a macro for 6502 which would work equally well for immediate mode as well as zero page mode arguments.This appears to work fine for a single simple macro (
LOAD_DATA
in the example below) but when calling a macro from within another macro it seems like the argument type gets lost (COPY_DATA
with immediate arg in the example below).(Side note: I still haven't managed to get my head around why the immediacy of the argument does get removed at all - I understand macros aren't simple token replacements in wla but it would feel like the intuitive behaviour of macros in situations like this would be to pass the
#
symbol through all the way and let the assembler make the decisions about addressing mode.)EDIT: I should say that the following does resolve this issue for the above example:
However this quickly becomes impractical when dealing with multiple arguments.
My real-world example involved a macro with 5 arguments, at least 4 of which I wanted to support either immediate or zero-page values; and that macro called another with 3 arguments all of which I wanted to support either type of value; so in the first macro I would have had to have 8 branches on an
.if
statement just to cover all the potential combinations of incoming arguments that needed to be passed on.The text was updated successfully, but these errors were encountered: