NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: Zdenek Sojka on August 28, 2007, 10:11:02 AM
-
Hello,
I would like to use conditional assembly under some more complex circumstances, eg.
if parameter %1 is eax or ebx
if macro1 or macro2 is defined
etc...
%ifidn %1,eax || %1,ebx
%ifdef macro1 || macro2
doesn't work, but it doesn't give any warning, too
How can I do that?
thank you
-
I'm not a very sophisticated macro user. I don't *think* Nasm will accept boolean expressions within an "%if???". I think you'll have to do it one at a time...
%ifidni %1, eax
; do your thing
%endif
%ifidni %1, ebx
; do your thing
%endif
Et painful cetera...
Best,
Frank
-
Thank you for reply - I didn't receive any notification email, so I am reading your post now...
Too bad NASM works this way...
at least, I was able to use following construction:
%macro is32bitreg 1
%ifdef res
%undef res
%endif
%ifidni %1, eax
%define res
%elifidni %1, ebx
%define res
%elifidni %1, ecx
%define res
%elifidni %1, ecx
%define res
%elifidni %1, edx
%define res
%elifidni %1, esi
%define res
%elifidni %1, edi
%define res
%elifidni %1, ebp
%define res
%elifidni %1, esp
%define res
%endif
%endmacro
%macro imovzx 2
is32bitreg %1
%ifdef res
movzx %1,%2
%else
mov %1,%2
%endif
%endmacro