I've spent over an hour trying to figure out what's happen here. I'm sure is a really stupid simple mistake, but I just can't see it.
.nolist
include \masm32\include\masm32rt.inc
.listall
.data
.code
program:
xor eax,eax
jnz @f
inkey
@@:
exit
end program
gives error--
K:\tst3 \masm32\BIN\ML /c /coff /Cp /nologo /Fm /Zi /Zd /I"\masm32\INCLUDE" tst.
asm
Assembling: tst.asm
tst.asm(10) : error A2006: undefined symbol : @@
Works fine without the /Zi /Zd debug switches.
So what the heck am I doing wrong here? I swear it's worked in the past.
You're not doing anything wrong, it's a stupid masm bug :wink
It's because the label appears immediately after a macro call.
I can't actually test right now, but try adding a space before the "@@:", or insert a blank line before it, failing that insert a comment.
I just tried this with the same result-
xor eax,eax
jnz @f
;x
inkey
;y
; this is a test
mov eax,1
@@:
exit
everything works fine if I use actual labels rather then the @@ type labels.
The problem appears to be /Zi or /Zd in combination with a macro that changes to the data section (reparg in this case). YAMB
I copied and pasted it in qeditor. It assembles and links just fine.
Sometimes when I copy and paste some portions, the same problem happens. Then I need to comment those parts and retype them again. I hope this helps.
Absolute correct Michael, and it doesn't even need a macro-
I just tried this with the exact same results:
program:
xor eax,eax
jnz @f
.data
abcd dd 1
.code
@@:
ret
end program