;;;;;;;;;;; test.asm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%assign i 5
%imacro if 3-*
%if %0 = 3
%push if
cmp %1, %3
j%-2 near %$i
%else
%fatal "if accepts 3 parameters."
%endif
%endmacro
%imacro else 0
%ifctx if
%repl else
jmp near %$e
%$i:
%else
%fatal "Expected 'if' before 'else'"
%endif
%endmacro
%imacro endif 0
%ifctx if
%$i:
%pop
%elifctx else
%$e:
%pop
%else
%fatal "Expected 'if' before 'endif'"
%endif
%endmacro
segment .code USE32
..start:
mov eax,0
if eax,e,0
inc eax
endif
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
**NASM version 0.98.39:**
c:\nasm> nasmw -e test.asm
%line 31+1 test.asm
[segment .code USE32]
..start:
mov eax,0
cmp eax, 0
%line 37+0 test.asm
jne near ..@2.i
%line 38+1 test.asm
inc eax
..@2.i:
ret
**NASM version 2.07**
c:\nasm> nasmw -e test.asm
%line 31+1 test.asm
[segment .code USE32]
..start:
mov eax,0
cmp eax, 0
%line 37+0 test.asm
jne near 5
%line 38+1 test.asm
inc eax
5:
ret
Inside "if" and "endif" macros ..
%$i is expanding to "5".
Just found this difference when using nagoa+.inc for win32 with nasm v2.07.
Thanks,
Mathi.