NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: Borneq on June 09, 2011, 01:52:36 PM

Title: syntax - Inlcude, conditional and macros
Post by: Borneq on June 09, 2011, 01:52:36 PM
In ml.exe is include 7zAsm.asm, which syntax is in Nasm?
How conditional,
ifdef x64
else
endif

How write macro
CRC macro op:req, dest:req, src:req, t:req
    op      dest, DWORD PTR [r5 + src * 4 + 0400h * t]
endm

Is any compatibility options in Nasm to Macro Assembler ?
Title: Re: syntax - Inlcude, conditional and macros
Post by: Frank Kotler on June 11, 2011, 01:21:44 PM
Not much compatibility with Masm - t'wasn't a design consideration.

You can use "%ifdef", "%else", "%endif"... There's an extensive section in the Friendly Manual...

I'm not sure what your "CRC" macro is intended to emit. Can you show an example of its use? Perhaps we can figure out a Nasm equivalent...

Best,
Frank



Title: Re: syntax - Inlcude, conditional and macros
Post by: Keith Kanios on June 11, 2011, 06:49:33 PM
How write macro
CRC macro op:req, dest:req, src:req, t:req
    op      dest, DWORD PTR [r5 + src * 4 + 0400h * t]
endm

I believe this would be an adequate equivalent:

Code: [Select]
%macro CRC 4
    %1  %2, DWORD[r5 + %3 * 4 + 0400h * %4]
%endmacro