This repository has been archived by the owner on Mar 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
macros.inc
288 lines (247 loc) · 4.85 KB
/
macros.inc
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
IFDEF ??version
IF ??version ge 030Ah
VERSION T300
ENDIF
ELSE
DISPLAY "This module requires Turbo Assembler"
ERR
ENDIF
IDEAL
IFDEF __TINY__
$$Tiny EQU
ENDIF
IFDEF __SMALL__
$$Small EQU
ENDIF
IFDEF __MEDIUM__
$$Medium EQU
ENDIF
IFDEF __COMPACT__
$$Compact EQU
ENDIF
IFDEF __LARGE__
$$Large EQU
ENDIF
IFDEF __HUGE__
$$Huge EQU
ENDIF
IFDEF __T__
$$Tiny EQU
ENDIF
IFDEF __S__
$$Small EQU
ENDIF
IFDEF __M__
$$Medium EQU
ENDIF
IFDEF __C__
$$Compact EQU
ENDIF
IFDEF __L__
$$Large EQU
ENDIF
IFDEF __H__
$$Huge EQU
ENDIF
IFDEF __P__
$$Pascal EQU
ENDIF
IFDEF __t__
$$Tiny EQU
ENDIF
IFDEF __s__
$$Small EQU
ENDIF
IFDEF __m__
$$Medium EQU
ENDIF
IFDEF __c__
$$Compact EQU
ENDIF
IFDEF __l__
$$Large EQU
ENDIF
IFDEF __h__
$$Huge EQU
ENDIF
IFDEF __p__
$$Pascal EQU
ENDIF
IFDEF $$Tiny
$$Model EQU TINY
$$Language EQU C
$$StackPtr EQU NEARSTACK
ENDIF
IFDEF $$Small
$$Model EQU SMALL
$$Language EQU C
$$StackPtr EQU NEARSTACK
ENDIF
IFDEF $$Compact
$$Model EQU COMPACT
$$Language EQU C
$$StackPtr EQU FARSTACK
ENDIF
IFDEF $$Medium
$$Model EQU MEDIUM
$$Language EQU C
$$StackPtr EQU NEARSTACK
ENDIF
IFDEF $$Large
$$Model EQU LARGE
$$Language EQU C
$$StackPtr EQU FARSTACK
ENDIF
IFDEF $$Huge
IFDEF $$TurboC
$$Model EQU HUGE
ELSE
$$Model EQU TCHUGE
ENDIF
$$Language EQU C
$$StackPtr EQU FARSTACK
ENDIF
IFDEF $$Pascal
$$Model EQU LARGE
$$Language EQU PASCAL
$$StackPtr EQU FARSTACK
ENDIF
IFNDEF $$Model
DISPLAY "Memory model not specified."
ERR
ENDIF
IFNDEF $$Language
IFNDEF $$StackPtr
MODEL $$Model
ELSE
MODEL $$StackPtr $$Model
ENDIF
ELSE
IFNDEF $$StackPtr
MODEL $$Model, $$Language
ELSE
MODEL $$StackPtr $$Model, $$Language
ENDIF
ENDIF
MACRO SaveSI
USES si
ENDM
MACRO SaveDI
USES di
ENDM
IF @DataSize eq 0
MACRO LES_ reg,memref
mov reg,memref
ENDM
MACRO LDS_ reg,memref
mov reg,memref
ENDM
MACRO SaveDS
ENDM
MACRO LoadES
push ds
pop es
ENDM
ES_ EQU
SS_ EQU
ELSE
MACRO LES_ reg,memref
les reg,memref
ENDM
MACRO LDS_ reg,memref
lds reg,memref
ENDM
MACRO SaveDS
USES ds
ENDM
MACRO LoadES
ENDM
ES_ EQU es:
SS_ EQU ss:
ENDIF
IF @Model eq 7
MACRO SetUpDS
ASSUME ds : @data
USES ds
mov ax,@data
mov ds,ax
ENDM
ELSE
MACRO SetUpDS
ENDM
ENDIF
_Cdecl EQU C
IFDEF $$Pascal
_CType EQU PASCAL
ELSEIFDEF __PAS__
_CType EQU PASCAL
ELSEIFDEF __PASCAL__
_CType EQU PASCAL
ELSE
_CType EQU _Cdecl
ENDIF
IFDEF $$PM
GLOBAL PASCAL __0000H : ABS
GLOBAL PASCAL __0040H : ABS
GLOBAL PASCAL __A000H : ABS
GLOBAL PASCAL __B000H : ABS
GLOBAL PASCAL __B800H : ABS
GLOBAL PASCAL __C000H : ABS
GLOBAL PASCAL __D000H : ABS
GLOBAL PASCAL __E000H : ABS
GLOBAL PASCAL __F000H : ABS
Sel0000h EQU __0000H
Sel0040h EQU __0040H
SelA000h EQU __A000H
SelB000h EQU __B000H
SelB800h EQU __B800H
SelC000h EQU __C000H
SelD000h EQU __D000H
SelE000h EQU __E000H
SelF000h EQU __F000H
ELSE
Sel0000h = 00000h
Sel0040h = 00040h
SelA000h = 0A000h
SelB000h = 0B000h
SelB800h = 0B800h
SelC000h = 0C000h
SelD000h = 0D000h
SelE000h = 0E000h
SelF000h = 0F000h
ENDIF
IF @DataSize eq 0
$$ES EQU
$$DS EQU
$$SS EQU
ELSE
$$ES EQU es
$$DS EQU ds
$$SS EQU ss
ENDIF
IF @CodeSize eq 0
$$CS EQU
ELSE
$$CS EQU cs
ENDIF
MACRO CODESTART
IF @CodeSize EQ 0
CODESEG
ELSEIFNDEF $$CodeSeg
CODESEG
ELSEIFDEF $$Pascal
CODESEG
ELSE
CODESEG $$CodeSeg
ENDIF
ENDM
IF @CodeSize EQ 0
$$CodeSize = 2
ELSE
$$CodeSize = 4
ENDIF
IF @DataSize EQ 0
$$DataSize = 2
ELSE
$$DataSize = 4
ENDIF