> I am a simple question:
I am a simple answer. :)
> is this code wrong?
Yes.
> yyy resd 1
>
> mov yyy, eax
Nasm evaluates "yyy" as some number... possibly zero, possibly 0x400???, possibly 0x8049???, or so. So, in Nasm syntax, you're trying to move the contents of eax into some number. Masm/Tasm syntax would mean "into memory location ...", but Nasm syntax requires "republican parentheses" ("[...]") to indicate a memory location. (Masm/Tasm requires "offset" to mean the "plain number" or "immediate addressing mode" - "mov eax, yyy" means the [contents] of memory at yyy in Masm/Tasm syntax, but the number "yyy" in Nasm syntax - either is legal, in that direction)
mov [yyy], eax
will do what you want.
Martin makes a good point that you may need to specify "bits 32" ("use 32" in section/segment declarations, actually), although it's perfectly legal in 16-bit code as well. Depends on what OS you're targetting, and which of Nasm's output formats you're using. Usually, when they don't specify an OS, it means Windows. In that case, you'd want either "-f obj" or "-f win32". "-f obj" defaults to 16 bit code, and *will* need to be told you want 32 bits! "-f win32" defaults to 32 bits, and doesn't need it.
Martin also mentions that "resd" (and its friends "resb", "resw", "resq", "resy", "reso", and "rest") want to be in "section .bss", while the code wants to be in "section .text" ("segment" is an alias for "section"). Section/segment names are meaningless in "-f obj" output mode, and "res?" in an initialized section/segment will be silently zeroed, other output formats warn and zero... but "do it right", you'll be glad for the habit.
There's a nice manual available online or for download at:
http://www.nasm.usif all else fails. :)
But feel free to ask, if you've got other questions (tell us what OS!).
Best,
Frank