NASM 0.96
[nasm.git] / standard.mac
blob92aab58360640e85fa8626e7c031f44bc8866cf1
1 ; Standard macro set for NASM 0.96 -*- nasm -*-
2 ; Note that although some user-level forms of directives are defined
3 ; here, not all of them are: the user-level form of a format-specific
4 ; directive should be defined in the module for that directive.
6 %define __NASM_MAJOR__ 0
7 %define __NASM_MINOR__ 96
9 ; These two need to be defined, though the actual definitions will
10 ; be constantly updated during preprocessing.
11 %define __FILE__
12 %define __LINE__
14 %define __SECT__                ; it ought to be defined, even if as nothing
16 %imacro section 1+.nolist
17 %define __SECT__ [section %1]
18           __SECT__
19 %endmacro
20 %imacro segment 1+.nolist
21 %define __SECT__ [segment %1]
22           __SECT__
23 %endmacro
25 %imacro absolute 1+.nolist
26 %define __SECT__ [absolute %1]
27           __SECT__
28 %endmacro
30 %imacro struc 1.nolist
31 %push struc
32 %define %$strucname %1
33 [absolute 0]
34 %$strucname:                    ; allow definition of `.member' to work sanely
35 %endmacro
36 %imacro endstruc 0.nolist
37 %{$strucname}_size:
38 %pop
39 __SECT__
40 %endmacro
42 %imacro istruc 1.nolist
43 %push istruc
44 %define %$strucname %1
45 %$strucstart:
46 %endmacro
47 %imacro at 1-2+.nolist
48           times %1-($-%$strucstart) db 0
49           %2
50 %endmacro
51 %imacro iend 0.nolist
52           times %{$strucname}_size-($-%$strucstart) db 0
53 %pop
54 %endmacro
56 %imacro align 1-2+.nolist nop
57           times ($$-$) & ((%1)-1) %2
58 %endmacro
59 %imacro alignb 1-2+.nolist resb 1
60           times ($$-$) & ((%1)-1) %2
61 %endmacro
63 %imacro extern 1-*.nolist
64 %rep %0
65 [extern %1]
66 %rotate 1
67 %endrep
68 %endmacro
70 %imacro bits 1+.nolist
71 [bits %1]
72 %endmacro
74 %imacro global 1-*.nolist
75 %rep %0
76 [global %1]
77 %rotate 1
78 %endrep
79 %endmacro
81 %imacro common 1-*.nolist
82 %rep %0
83 [common %1]
84 %rotate 1
85 %endrep
86 %endmacro