Document case-insensitivity bug.
[nasm.git] / standard.mac
blob7cfd4db524af375a23c659325c328e1e79a1a44a
1 ; Standard macro set for NASM -*- nasm -*-
3 ; Macros to make NASM ignore some TASM directives before the first include
4 ; directive.
6     %idefine IDEAL
7     %idefine JUMPS
8     %idefine P386
9     %idefine P486
10     %idefine P586
11     %idefine END
13 ; This is a magic token which indicates the end of the TASM macros
14 *END*TASM*MACROS*
16 ; Note that although some user-level forms of directives are defined
17 ; here, not all of them are: the user-level form of a format-specific
18 ; directive should be defined in the module for that directive.
20 ; These three need to be defined, though the actual definitions will
21 ; be constantly updated during preprocessing.
22 %define __FILE__
23 %define __LINE__
24 %define __BITS__
26 %define __SECT__                ; it ought to be defined, even if as nothing
28 %imacro section 1+.nolist
29 %define __SECT__ [section %1]
30           __SECT__
31 %endmacro
32 %imacro segment 1+.nolist
33 %define __SECT__ [segment %1]
34           __SECT__
35 %endmacro
37 %imacro absolute 1+.nolist
38 %define __SECT__ [absolute %1]
39           __SECT__
40 %endmacro
42 %imacro struc 1.nolist
43 %push struc
44 %define %$strucname %1
45 [absolute 0]
46 %$strucname:                    ; allow definition of `.member' to work sanely
47 %endmacro 
48 %imacro endstruc 0.nolist
49 %{$strucname}_size:
50 %pop
51 __SECT__
52 %endmacro
54 %imacro istruc 1.nolist
55 %push istruc
56 %define %$strucname %1
57 %$strucstart:
58 %endmacro
59 %imacro at 1-2+.nolist
60           times %1-($-%$strucstart) db 0
61           %2
62 %endmacro
63 %imacro iend 0.nolist
64           times %{$strucname}_size-($-%$strucstart) db 0
65 %pop
66 %endmacro
68 %imacro align 1-2+.nolist nop
69           times ($$-$) & ((%1)-1) %2
70 %endmacro
71 %imacro alignb 1-2+.nolist resb 1
72           times ($$-$) & ((%1)-1) %2
73 %endmacro
75 %imacro extern 1-*.nolist
76 %rep %0
77 [extern %1]
78 %rotate 1
79 %endrep
80 %endmacro
82 %imacro bits 1+.nolist
83 [bits %1]
84 %endmacro
86 %imacro use16 0.nolist
87 [bits 16]
88 %endmacro
89 %imacro use32 0.nolist
90 [bits 32]
91 %endmacro
92 %imacro use64 0.nolist
93 [bits 64]
94 %endmacro
96 %imacro global 1-*.nolist
97 %rep %0
98 [global %1]
99 %rotate 1
100 %endrep
101 %endmacro
103 %imacro common 1-*.nolist
104 %rep %0
105 [common %1]
106 %rotate 1
107 %endrep
108 %endmacro
110 %imacro cpu 1+.nolist
111 [cpu %1]
112 %endmacro
114 %define __FLOAT_DAZ__ nodaz
115 %define __FLOAT_ROUND__ near
116 ; __FLOAT__ contains the whole floating-point configuration so it can
117 ; be saved and restored
118 %define __FLOAT__ __FLOAT_DAZ__,__FLOAT_ROUND__
119 %imacro float 1-*.nolist
120 %rep %0
121 [float %1]
122 %ifidni %1,daz
123 %define __FLOAT_DAZ__ daz
124 %elifidni %1,nodaz
125 %define __FLOAT_DAZ__ nodaz
126 %elifidni %1,near
127 %define __FLOAT_ROUND__ near
128 %elifidni %1,up
129 %define __FLOAT_ROUND__ up
130 %elifidni %1,down
131 %define __FLOAT_ROUND__ down
132 %elifidni %1,zero
133 %define __FLOAT_ROUND__ zero
134 %elifidni %1,default
135 %define __FLOAT_DAZ__ nodaz
136 %define __FLOAT_ROUND__ near
137 %endif
138 %rotate 1
139 %endrep
140 %endmacro
142 %imacro default 1+.nolist
143 [default %1]
144 %endmacro
146 %imacro incbin 1-2+.nolist 0
147 %push incbin
148 %pathsearch %$dep %1
149 %depend %$dep
150         %? %$dep,%2
151 %pop
152 %endmacro