Restore the adjusted symbol id start
[nasm.git] / standard.mac
blobbbbf90d8d327619c17fcb701e10214e55e9c4a8b
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 two need to be defined, though the actual definitions will
21 ; be constantly updated during preprocessing.
22 %define __FILE__
23 %define __LINE__
25 %define __SECT__                ; it ought to be defined, even if as nothing
27 %imacro section 1+.nolist
28 %define __SECT__ [section %1]
29           __SECT__
30 %endmacro
31 %imacro segment 1+.nolist
32 %define __SECT__ [segment %1]
33           __SECT__
34 %endmacro
36 %imacro absolute 1+.nolist
37 %define __SECT__ [absolute %1]
38           __SECT__
39 %endmacro
41 %imacro struc 1.nolist
42 %push struc
43 %define %$strucname %1
44 [absolute 0]
45 %$strucname:                    ; allow definition of `.member' to work sanely
46 %endmacro 
47 %imacro endstruc 0.nolist
48 %{$strucname}_size:
49 %pop
50 __SECT__
51 %endmacro
53 %imacro istruc 1.nolist
54 %push istruc
55 %define %$strucname %1
56 %$strucstart:
57 %endmacro
58 %imacro at 1-2+.nolist
59           times %1-($-%$strucstart) db 0
60           %2
61 %endmacro
62 %imacro iend 0.nolist
63           times %{$strucname}_size-($-%$strucstart) db 0
64 %pop
65 %endmacro
67 %imacro align 1-2+.nolist nop
68           times ($$-$) & ((%1)-1) %2
69 %endmacro
70 %imacro alignb 1-2+.nolist resb 1
71           times ($$-$) & ((%1)-1) %2
72 %endmacro
74 %imacro extern 1-*.nolist
75 %rep %0
76 [extern %1]
77 %rotate 1
78 %endrep
79 %endmacro
81 %imacro bits 1+.nolist
82 [bits %1]
83 %endmacro
85 %imacro use16 0.nolist
86 [bits 16]
87 %endmacro
88 %imacro use32 0.nolist
89 [bits 32]
90 %endmacro
92 %imacro global 1-*.nolist
93 %rep %0
94 [global %1]
95 %rotate 1
96 %endrep
97 %endmacro
99 %imacro common 1-*.nolist
100 %rep %0
101 [common %1]
102 %rotate 1
103 %endrep
104 %endmacro
106 %imacro cpu 1+.nolist
107 [cpu %1]
108 %endmacro