-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.asm
380 lines (372 loc) · 6.14 KB
/
main.asm
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
_main proc far
var_6= word ptr -6
var_4= word ptr -4
var_2= word ptr -2
arg_0= word ptr 6
arg_2= word ptr 8
arg_4= word ptr 0Ah
arg_27= word ptr 2Dh
FUNC_ENTER(6)
mov ax, 55h
push ax
CALL(bigpic_initBuffers)
sub ax, ax
push ax
PUSH_OFFSET(s_thiefCfg)
CALL(open)
mov [bp+var_4], ax
inc ax
jnz short loc_10039
mov ax, 4
push ax
CALL(sub_28424, far)
loc_10039:
mov ax, 6
push ax
mov ax, offset g_configuredFlag
mov dx, seg seg027
push dx
push ax
push [bp+var_4]
CALL(read)
push [bp+var_4]
CALL(close)
mov gs, seg027_x
push gs:g_unusedConfiguration
CALL(disk1Swap)
cmp [bp+arg_0], 1
jg short loc_1007E
cmp gs:g_configuredFlag, 0
jnz short loc_100E7
loc_1007E:
mov gs:g_configuredFlag, 1
push [bp+arg_4]
push [bp+arg_2]
push [bp+arg_0]
CALL(configureBT3)
mov gs:g_avConfiguration, ax
mov ax, 2
push ax
PUSH_OFFSET(s_thiefCfg)
CALL(open)
mov [bp+var_4], ax
inc ax
jnz short loc_100C5
mov ax, 4
push ax
call far ptr sub_28424
add sp, 2
loc_100C5:
mov ax, 4
push ax
mov ax, offset g_configuredFlag
mov dx, seg seg027
push dx
push ax
push [bp+var_4]
CALL(write)
push [bp+var_4]
CALL(close)
loc_100E7:
sub ax, ax
push ax
mov bx, gs:g_avConfiguration
and bx, 0Fh
shl bx, 1
shl bx, 1
push word ptr (graphicsDrivers+2)[bx]
push word ptr graphicsDrivers[bx]
CALL(open)
mov [bp+var_4], ax
inc ax
jnz short loc_1011C
mov ax, 4
push ax
call far ptr sub_28424
add sp, 2
loc_1011C:
mov ax, 18h
push ax
mov ax, offset monsterBuf
mov dx, seg seg023
push dx
push ax
push [bp+var_4]
CALL(read)
mov ax, 1068h
push ax
mov ax, offset vid_setMode
mov dx, seg seg024
push dx
push ax
push [bp+var_4]
CALL(read)
push [bp+var_4]
CALL(close)
mov ax, 1
push ax
call far ptr vid_setMode
add sp, 2
sub ax, ax
push ax
call far ptr j_nullsub_2
add sp, 2
sub ax, ax
push ax
PUSH_OFFSET(s_firstTitle)
CALL(open)
mov [bp+var_4], ax
inc ax
jnz short loc_1018E
mov ax, 4
push ax
call far ptr sub_28424
add sp, 2
loc_1018E:
mov ax, 33000
push ax
mov ax, offset g_rosterCharacterBuffer
mov dx, seg seg022
push dx
push ax
push [bp+var_4]
CALL(read)
push [bp+var_4]
CALL(close)
mov [bp+var_6], 0
jmp short loc_101BD
loc_101BA:
inc [bp+var_6]
loc_101BD:
cmp [bp+var_6], 8
jge short loc_101E6
mov ax, 3200
push ax
CALL(_mallocMaybe)
mov bx, [bp+var_6]
shl bx, 1
shl bx, 1
mov word ptr gs:musicBufs._offset[bx], ax
mov gs:musicBufs._segment[bx], dx
jmp short loc_101BA
loc_101E6:
mov ax, 33000
push ax
CALL(_mallocMaybe)
mov word ptr gs:word_42562, ax
mov word ptr gs:word_42562+2, dx
push dx
push ax
mov ax, offset g_rosterCharacterBuffer
mov dx, seg seg022
push dx
push ax
CALL(d3cmp_flate)
mov ax, offset g_rosterCharacterBuffer
mov dx, seg seg022
push dx
push ax
mov ax, word ptr gs:word_42562
mov dx, word ptr gs:word_42562+2
add ax, 0Dh
push dx
push ax
call far ptr gfx_drawFullscreenImage
add sp, 8
sub ax, ax
push ax
PUSH_OFFSET(s_titleScreen)
CALL(open)
mov [bp+var_4], ax
inc ax
jnz short loc_10266
push word ptr gs:word_42562+2
push word ptr gs:word_42562
CALL(_freeMaybe)
CALL(cleanupAndExit, near)
loc_10266:
mov ax, 33000
push ax
mov ax, offset g_rosterCharacterBuffer
mov dx, seg seg022
push dx
push ax
push [bp+var_4]
CALL(read)
push [bp+var_4]
CALL(close)
push word ptr gs:word_42562+2
push word ptr gs:word_42562
mov ax, offset g_rosterCharacterBuffer
mov dx, seg seg022
push dx
push ax
CALL(d3cmp_flate)
mov ax, offset g_rosterCharacterBuffer
mov dx, seg seg022
push dx
push ax
mov ax, word ptr gs:word_42562
mov dx, word ptr gs:word_42562+2
add ax, 0Dh
push dx
push ax
call far ptr gfx_drawFullscreenImage
add sp, 8
sub ax, ax
push ax
PUSH_OFFSET(s_musicAll)
CALL(open)
mov [bp+var_4], ax
inc ax
jnz short loc_102FB
push word ptr gs:word_42562+2
push word ptr gs:word_42562
CALL(_freeMaybe)
CALL(cleanupAndExit, near)
loc_102FB:
mov ax, 0FFFFh
push ax
mov ax, gs:g_avConfiguration
mov cl, 7
sar ax, cl
add ax, 10h
cwd
push dx
push ax
push [bp+var_4]
CALL(lseek)
mov ax, 2
push ax
lea ax, [bp+var_2]
push ss
push ax
push [bp+var_4]
CALL(read)
mov ax, 0FFFFh
push ax
mov ax, [bp+var_2]
cwd
push dx
push ax
push [bp+var_4]
CALL(lseek)
mov ax, 9C4h
push ax
mov ax, 0
mov dx, seg seg025
push dx
push ax
push [bp+var_4]
CALL(read)
mov [bp+var_6], 0
jmp short loc_10366
loc_10363:
inc [bp+var_6]
loc_10366:
cmp [bp+var_6], 8
jge short loc_103D4
mov ax, 0FFFFh
push ax
mov ax, [bp+var_6]
cwd
shl ax, 1
rcl dx, 1
push dx
push ax
push [bp+var_4]
CALL(lseek)
mov ax, 2
push ax
lea ax, [bp+var_2]
push ss
push ax
push [bp+var_4]
CALL(read)
mov ax, 0FFFFh
push ax
mov ax, [bp+var_2]
cwd
push dx
push ax
push [bp+var_4]
CALL(lseek)
mov ax, 3200
push ax
mov bx, [bp+var_6]
shl bx, 1
shl bx, 1
push gs:musicBufs._segment[bx]
push word ptr gs:musicBufs._offset[bx]
push [bp+var_4]
CALL(read)
jmp short loc_10363
loc_103D4:
push [bp+var_4]
CALL(close)
CALL(initializeHardware)
mov ax, 7
push ax
mov ax, 0FFh
push ax
CALL(song_playSong)
CALL(icons_read)
call far ptr j_nullsub_3
PUSH_OFFSET(s_titleText)
CALL(intro_scrollText)
sub ax, ax
push ax
PUSH_OFFSET(s_bardscr)
CALL(open)
mov [bp+var_4], ax
inc ax
jnz short loc_1043E
push word ptr gs:word_42562+2
push word ptr gs:word_42562
CALL(_freeMaybe)
CALL(cleanupAndExit, near)
loc_1043E:
mov ax, 80E8h
push ax
mov ax, offset g_rosterCharacterBuffer
mov dx, seg seg022
push dx
push ax
push [bp+var_4]
CALL(read)
push [bp+var_4]
CALL(close)
push word ptr gs:word_42562+2
push word ptr gs:word_42562
mov ax, offset g_rosterCharacterBuffer
mov dx, seg seg022
push dx
push ax
CALL(d3cmp_flate)
mov ax, offset g_rosterCharacterBuffer
mov dx, seg seg022
push dx
push ax
mov ax, word ptr gs:word_42562
mov dx, word ptr gs:word_42562+2
add ax, 0Dh
push dx
push ax
call far ptr gfx_drawFullscreenImage
add sp, 8
push word ptr gs:word_42562+2
push word ptr gs:word_42562
CALL(_freeMaybe)
mov ax, 4D0Ah
push ax
CALL(_mallocMaybe)
mov gs:bigpicCellData_off, ax
mov gs:bigpicCellData_seg, dx
CALL(map_resetLocation, near)
CALL(restoreGame)
push g_mapRval
CALL(gameLoop, near)
CALL(cleanupAndExit, near)
FUNC_EXIT
retf
_main endp