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.
7 %imacro proc 1 ; begin a procedure definition
17 %imacro arg 0-1 4 ; used with the argument name as a label
19 ;%assign %$argnum %$argnum+1
21 %assign %$arg %1+%$arg
26 %error Mismatched `endproc'/`proc'
33 ;__end_%$procname: ; useful for calculating function size
34 ; global %{$procname}_arglen
35 ;%{$procname}_arglen equ %$arg-8
38 ; global %{$procname}_arg%$i
39 ;%{$procname}_arg%$i equ %{$procname}.arg%$i
46 ; redefine ret instructions for in-proc cases
77 ; invoke calls a C function
78 ; defaults to word (16 bit) size parameters
81 ;%define invoketype word
84 ; %define invoketype dword
86 ; %define invoketype word
88 ; %define invoketype byte
100 %elifidni %1, word cs
102 %elifidni %1, word ds
104 %elifidni %1, word es
106 %elifidni %1, word fs
108 %elifidni %1, word gs
118 add esp, byte %{1}_arglen