I wrote a small bit of assembly for nasm like this:
%macro register 1
%if %1 = 0
rax
%elif %1 = 1
rbx
%elif %1 = 2
rcx
%endif
%endmacro
add register(1), register(2)
I expect that to evaluate to 'add rbx, rcx'
However, nasm -E test.asm returns this, showing that the macro is not evaluated:
%line 10+1 test.asm
add register(1), register(2)
Compare that to this code:
%macro register 1
%if %1 = 0
rax
%elif %1 = 1
rbx
%elif %1 = 2
rcx
%endif
%endmacro
register(1)
which is transformed into
%line 10+1 test.asm
rbx
Why the difference? How can I achieve what I expect in the first snippet?