1 ;; --------------------------------------------------------------------------
3 ;; Copyright 1996-2016 The NASM Authors - All Rights Reserved
4 ;; See the file AUTHORS included with the NASM distribution for
5 ;; the specific copyright holders.
7 ;; Redistribution and use in source and binary forms, with or without
8 ;; modification, are permitted provided that the following
11 ;; * Redistributions of source code must retain the above copyright
12 ;; notice, this list of conditions and the following disclaimer.
13 ;; * Redistributions in binary form must reproduce the above
14 ;; copyright notice, this list of conditions and the following
15 ;; disclaimer in the documentation and/or other materials provided
16 ;; with the distribution.
18 ;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 ;; CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 ;; INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 ;; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 ;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 ;; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 ;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 ;; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 ;; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 ;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 ;; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 ;; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 ;; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 ;; --------------------------------------------------------------------------
34 ; Standard macro set for NASM -*- nasm -*-
36 ; Macros to make NASM ignore some TASM directives
45 ; The normal standard macros
48 ; Note that although some user-level forms of directives are defined
49 ; here, not all of them are: the user-level form of a format-specific
50 ; directive should be defined in the module for that directive.
52 ; These three need to be defined, though the actual definitions will
53 ; be constantly updated during preprocessing.
58 %define __SECT__ ; it ought to be defined, even if as nothing
60 %imacro section 1+.nolist
61 %define __SECT__ [section %1]
65 %imacro segment 1+.nolist
66 %define __SECT__ [segment %1]
70 %define __SECTALIGN_ALIGN_UPDATES_SECTION__ 1
71 %imacro sectalign 1.nolist
73 %if __SECTALIGN_ALIGN_UPDATES_SECTION__ = 1
78 %define __SECTALIGN_ALIGN_UPDATES_SECTION__ 0
80 %define __SECTALIGN_ALIGN_UPDATES_SECTION__ 1
85 %imacro absolute 1+.nolist
86 %define __SECT__ [absolute %1]
90 %imacro struc 1-2.nolist 0
92 %define %$strucname %1
94 %$strucname: ; allow definition of `.member' to work sanely
97 %imacro endstruc 0.nolist
98 %{$strucname}_size equ ($-%$strucname)
103 %imacro istruc 1.nolist
105 %define %$strucname %1
109 %imacro at 1-2+.nolist
110 times (%1-%$strucname)-($-%$strucstart) db 0
114 %imacro iend 0.nolist
115 times %{$strucname}_size-($-%$strucstart) db 0
119 %imacro align 1-2+.nolist nop
121 times (((%1) - (($-$$) % (%1))) % (%1)) %2
124 %imacro alignb 1-2+.nolist
127 resb (((%1) - (($-$$) % (%1))) % (%1))
129 times (((%1) - (($-$$) % (%1))) % (%1)) %2
133 %imacro bits 1+.nolist
137 %imacro use16 0.nolist
141 %imacro use32 0.nolist
145 %imacro use64 0.nolist
149 %imacro extern 1-*.nolist
156 %imacro static 1-*.nolist
163 %imacro global 1-*.nolist
170 %imacro common 1-*.nolist
177 %imacro cpu 1+.nolist
181 %define __FLOAT_DAZ__ nodaz
182 %define __FLOAT_ROUND__ near
183 ; __FLOAT__ contains the whole floating-point configuration so it can
184 ; be saved and restored
185 %define __FLOAT__ __FLOAT_DAZ__,__FLOAT_ROUND__
187 %imacro float 1-*.nolist
191 %define __FLOAT_DAZ__ daz
193 %define __FLOAT_DAZ__ nodaz
195 %define __FLOAT_ROUND__ near
197 %define __FLOAT_ROUND__ up
199 %define __FLOAT_ROUND__ down
201 %define __FLOAT_ROUND__ zero
203 %define __FLOAT_DAZ__ nodaz
204 %define __FLOAT_ROUND__ near
210 %imacro default 1+.nolist
214 %imacro userel 0.nolist
217 %imacro useabs 0.nolist
220 %imacro usebnd 0.nolist
223 %imacro usenobnd 0.nolist
227 %imacro incbin 1-2+.nolist 0