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
Macros are instantiated by using the macro’s name (case-insensitive),
followed by an optional list of arguments. The body of the macro definition
can refer to arguments passed with the format “{#}”, where # is replaced by
the argument number. The first argument passed to a macro is therefore {1}.
{0} represents an exact substitution of the entire instantiation line.
If a macro is instantiated with more arguments than the used ones, there is no problem, but if you try to use an argument that it was not provided, DASM raises an exception.
It could be nice a way to check for the number of arguments, for instance {N}, allowing to write macros like this:
macro addwords
clc
lda {1}
adc {2}
if {n} = 3
sta {3}
lda {1}+1
adc {2}+1
sta {3}+1
else
sta {1}
lda {1}+1
adc {2}+1
sta {1}+1
endif
endm
addwords $80,$82,$84 ; Result in $84
addwords $80,$82 ; Result in $80
NOTE: currently, {N} returns the same as {0}, i.e. the placeholder is replaced by the full list of arguments. Bug?
NOTE2: if the condition expression is a comma separated list of argments, the IF is evaluated as "true". Bug?
The text was updated successfully, but these errors were encountered:
From the manual:
If a macro is instantiated with more arguments than the used ones, there is no problem, but if you try to use an argument that it was not provided, DASM raises an exception.
It could be nice a way to check for the number of arguments, for instance {N}, allowing to write macros like this:
NOTE: currently, {N} returns the same as {0}, i.e. the placeholder is replaced by the full list of arguments. Bug?
NOTE2: if the condition expression is a comma separated list of argments, the IF is evaluated as "true". Bug?
The text was updated successfully, but these errors were encountered: