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