Author Topic: syntax - Inlcude, conditional and macros  (Read 13150 times)

Offline Borneq

  • Jr. Member
  • *
  • Posts: 26
syntax - Inlcude, conditional and macros
« 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 ?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: syntax - Inlcude, conditional and macros
« Reply #1 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




Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: syntax - Inlcude, conditional and macros
« Reply #2 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