Debian Codegraph @

misc/c32.mac

raw
1 ; NASM macro set to make interfacing to 32-bit programs easier -*- nasm -*-
2
3
4
5 %imacro proc 1 ; begin a procedure definition
6
7 %push proc
8
9 global %1
10
11 %1: push ebp
12
13 mov ebp,esp
14
15 %assign %$arg 8
16
17 %define %$procname %1
18
19 %endmacro
20
21
22
23 %imacro arg 0-1 4 ; used with the argument name as a label
24
25 %00 equ %$arg
26
27 %assign %$arg %1+%$arg
28
29 %endmacro
30
31
32
33 %imacro endproc 0
34
35 %ifnctx proc
36
37 %error Mismatched `endproc'/`proc'
38
39 %else
40
41 leave
42
43 ret
44
45 __end_%$procname: ; useful for calculating function size
46
47 %pop
48
49 %endif
50
51 %endmacro
52