1 ; NASM macro set to make interfacing to 32-bit programs easier
2 ; Also cool little macros to make NASM emulate some MASM things.
4 ; Originally included in NASM. Modifications by Peter Johnson, 1999.
8 %imacro proc 1 ; begin a procedure definition
18 %imacro arg 0-1 4 ; used with the argument name as a label
20 ;%assign %$argnum %$argnum+1
22 %assign %$arg %1+%$arg
27 %error Mismatched `endproc'/`proc'
34 ;__end_%$procname: ; useful for calculating function size
35 ; global %{$procname}_arglen
36 ;%{$procname}_arglen equ %$arg-8
39 ; global %{$procname}_arg%$i
40 ;%{$procname}_arg%$i equ %{$procname}.arg%$i
47 ; redefine ret instructions for in-proc cases
78 ; invoke calls a C function
79 ; defaults to word (16 bit) size parameters
82 ;%define invoketype word
85 ; %define invoketype dword
87 ; %define invoketype word
89 ; %define invoketype byte
101 %elifidni %1, word cs
103 %elifidni %1, word ds
105 %elifidni %1, word es
107 %elifidni %1, word fs
109 %elifidni %1, word gs
119 add esp, byte %{1}_arglen