-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
th02_maine.asm
375 lines (329 loc) · 10.3 KB
/
th02_maine.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
;
; +-------------------------------------------------------------------------+
; | This file has been generated by The Interactive Disassembler (IDA) |
; | Copyright (c) 2009 by Hex-Rays, <[email protected]> |
; +-------------------------------------------------------------------------+
;
; Input MD5 : E6F971B37336C0F9FCE53F895780031E
; File Name : th02/MAINE.EXE
; Format : MS-DOS executable (EXE)
; Base Address: 0h Range: 0h-FCF0h Loaded length: DE32h
; Entry Point : 0:0
; OS type : MS DOS
; Application type: Executable 16bit
.386
.model use16 large _TEXT
include ReC98.inc
include th02/th02.inc
extern _execl:proc
maine_01 group END_TEXT, maine_01_TEXT
; ===========================================================================
; Segment type: Pure code
_TEXT segment word public 'CODE' use16
assume cs:_TEXT
assume es:nothing, ds:_DATA, fs:nothing, gs:nothing
include libs/master.lib/bfnt_entry_pat.asm
include libs/master.lib/bfnt_extend_header_skip.asm
include libs/master.lib/bfnt_header_read.asm
include libs/master.lib/bfnt_header_analysis.asm
include libs/master.lib/bcloser.asm
include libs/master.lib/bfill.asm
include libs/master.lib/bfnt_palette_set.asm
include libs/master.lib/bgetc.asm
include libs/master.lib/palette_black_in.asm
include libs/master.lib/palette_black_out.asm
include libs/master.lib/bopenr.asm
include libs/master.lib/bread.asm
include libs/master.lib/bseek.asm
include libs/master.lib/bseek_.asm
include libs/master.lib/cutline.asm
include libs/master.lib/dos_axdx.asm
include libs/master.lib/dos_filesize.asm
include libs/master.lib/dos_setvect.asm
include libs/master.lib/egc.asm
include libs/master.lib/egc_shift_down.asm
include libs/master.lib/egc_shift_left.asm
include libs/master.lib/file_append.asm
include libs/master.lib/file_close.asm
include libs/master.lib/file_exist.asm
include libs/master.lib/file_read.asm
include libs/master.lib/file_ropen.asm
include libs/master.lib/file_seek.asm
include libs/master.lib/file_size.asm
include libs/master.lib/file_write.asm
include libs/master.lib/dos_close.asm
include libs/master.lib/dos_ropen.asm
include libs/master.lib/grcg_boxfill.asm
include libs/master.lib/grcg_line.asm
include libs/master.lib/grcg_setcolor.asm
include libs/master.lib/gaiji_backup.asm
include libs/master.lib/gaiji_entry_bfnt.asm
include libs/master.lib/gaiji_putca.asm
include libs/master.lib/gaiji_putsa.asm
include libs/master.lib/gaiji_read.asm
include libs/master.lib/gaiji_write.asm
include libs/master.lib/graph_400line.asm
include libs/master.lib/graph_clear.asm
include libs/master.lib/graph_copy_page.asm
include libs/master.lib/graph_extmode.asm
include libs/master.lib/graph_gaiji_putc.asm
include libs/master.lib/graph_gaiji_puts.asm
include libs/master.lib/graph_pi_free.asm
include libs/master.lib/graph_pi_load_pack.asm
include libs/master.lib/graph_pack_put_8.asm
include libs/master.lib/key_sense.asm
include libs/master.lib/over_put_8.asm
include libs/master.lib/palette_show.asm
include libs/master.lib/pfclose.asm
include libs/master.lib/pfgetc.asm
include libs/master.lib/pfread.asm
include libs/master.lib/pfrewind.asm
include libs/master.lib/pfseek.asm
include libs/master.lib/palette_entry_rgb.asm
include libs/master.lib/rottbl.asm
include libs/master.lib/smem_release.asm
include libs/master.lib/smem_wget.asm
include libs/master.lib/text_clear.asm
include libs/master.lib/vsync.asm
include libs/master.lib/vsync_wait.asm
include libs/master.lib/palette_white_in.asm
include libs/master.lib/palette_white_out.asm
include libs/master.lib/hmem_lallocate.asm
include libs/master.lib/mem_assign_dos.asm
include libs/master.lib/mem_assign.asm
include libs/master.lib/memheap.asm
include libs/master.lib/mem_unassign.asm
include libs/master.lib/super_entry_pat.asm
include libs/master.lib/super_entry_at.asm
include libs/master.lib/super_entry_bfnt.asm
include libs/master.lib/pfint21.asm
db 0
include th02/formats/pfopen.asm
include libs/master.lib/pf_str_ieq.asm
_TEXT ends
; ===========================================================================
END_TEXT segment byte public 'CODE' use16
@end_bad_animate$qv procdesc near
@end_good_animate$qv procdesc near
@staffroll_and_verdict_animate$qv procdesc near
END_TEXT ends
; Segment type: Pure code
maine_01_TEXT segment byte public 'CODE' use16
assume cs:maine_01
;org 3
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public @extra_unlock_animate$qv
@extra_unlock_animate$qv proc far
push bp
mov bp, sp
call @scoredat_is_extra_unlocked$qv
or ax, ax
jz loc_B07D
les bx, _resident
cmp es:[bx+mikoconfig_t.continues_used], 0
jnz short loc_B07D
call @pi_load$qinxc c, 0, offset aAll_pi, ds
call @pi_palette_apply$qi stdcall, 0
pop cx
call @pi_put_8$qiii c, 0, large 0
freePISlotLarge 0
push 2
call palette_black_in
call @frame_delay$qi pascal, 150
call @pi_load$qinxc c, 0, offset aBut_pi, ds
call @pi_palette_apply$qi stdcall, 0
pop cx
call @pi_put_8$qiii c, 0, large 0
freePISlotLarge 0
call @key_delay$qv
push 5
call palette_black_out
loc_B07D:
pop bp
retf
@extra_unlock_animate$qv endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B07F proc far
push bp
mov bp, sp
call @scoredat_is_extra_unlocked$qv
or ax, ax
jz loc_B115
mov PaletteTone, 0
call far ptr palette_show
call @pi_load$qinxc c, 0, offset aAll_pi, ds
call @pi_palette_apply$qi stdcall, 0
pop cx
call @pi_put_8$qiii c, 0, large 0
freePISlotLarge 0
push 2
call palette_black_in
call @frame_delay$qi pascal, 150
call @pi_load$qinxc c, 0, offset aExtra_pi, ds
call @pi_palette_apply$qi stdcall, 0
pop cx
call @pi_put_8$qiii c, 0, large 0
freePISlotLarge 0
call @key_delay$qv
push 5
call palette_black_out
loc_B115:
pop bp
retf
sub_B07F endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
; int __cdecl main(int _argc, const char **_argv, const char **_envp)
public _main
_main proc far
_argc = word ptr 6
_argv = dword ptr 8
_envp = dword ptr 0Ch
push bp
mov bp, sp
call @cfg_load$qv
or ax, ax
jz loc_B1FE
les bx, _resident
cmp es:[bx+mikoconfig_t.stage], 7Fh
jnz loc_B1FE
call @game_init_main$qv
call gaiji_backup
push ds
push offset aMikoft_bft ; "MIKOFT.bft"
call gaiji_entry_bfnt
call _snd_pmd_resident
call _snd_mmd_resident
les bx, _resident
cmp es:[bx+mikoconfig_t.bgm_mode], 0
jnz short loc_B161
mov _snd_midi_active, 0
jmp short loc_B189
; ---------------------------------------------------------------------------
loc_B161:
les bx, _resident
cmp es:[bx+mikoconfig_t.bgm_mode], 1
jnz short loc_B173
mov _snd_midi_active, 0
jmp short loc_B184
; ---------------------------------------------------------------------------
loc_B173:
les bx, _resident
cmp es:[bx+mikoconfig_t.bgm_mode], 2
jnz short loc_B189
mov al, _snd_midi_possible
mov _snd_midi_active, al
loc_B184:
call _snd_determine_mode
loc_B189:
graph_accesspage 0
mov dx, 164 ; Port 00A4h: Page display register
out dx, al
call super_entry_bfnt pascal, ds, offset aEndft_bft ; "endft.bft"
call @frame_delay$qi pascal, 100
les bx, _resident
cmp es:[bx+mikoconfig_t.rank], 4
jz short loc_B1C2
cmp es:[bx+mikoconfig_t.continues_used], 0
jz short loc_B1BA
call @end_bad_animate$qv
jmp short loc_B1BD
; ---------------------------------------------------------------------------
loc_B1BA:
call @end_good_animate$qv
loc_B1BD:
call @staffroll_and_verdict_animate$qv
jmp short loc_B1C6
; ---------------------------------------------------------------------------
loc_B1C2:
call sub_B07F
loc_B1C6:
mov PaletteTone, 50
call far ptr palette_show
call @regist_menu$qv
mov PaletteTone, 0
call far ptr palette_show
call gaiji_restore
call @game_exit$qv
pushd 0
push ds
push offset path ; "op"
push ds
push offset path ; "op"
call _execl
add sp, 0Ch
loc_B1FE:
pop bp
retf
_main endp
maine_01_TEXT ends
; ===========================================================================
SHARED segment word public 'CODE' use16
extern @key_delay$qv:proc
extern @pi_load$qinxc:proc
extern @FRAME_DELAY$QI:proc
extern @game_exit$qv:proc
extern _snd_mmd_resident:proc
extern _snd_determine_mode:proc
extern _snd_pmd_resident:proc
extern @game_init_main$qv:proc
extern @pi_palette_apply$qi:proc
extern @pi_put_8$qiii:proc
SHARED ends
; ===========================================================================
maine_03_TEXT segment word public 'CODE' use16
extern @cfg_load$qv:proc
maine_03_TEXT ends
; ===========================================================================
maine_04_TEXT segment byte public 'CODE' use16
extern @scoredat_is_extra_unlocked$qv:proc
extern @regist_menu$qv:proc
maine_04_TEXT ends
.data
aAll_pi = ($ - 7)
aBut_pi db 'but.pi',0
aExtra_pi db 'extra.pi',0
aMikoft_bft db 'MIKOFT.bft',0
aEndft_bft db 'endft.bft',0
; char path[]
path db 'op',0
include libs/master.lib/bfnt_id[data].asm
include libs/master.lib/clip[data].asm
include libs/master.lib/edges[data].asm
include libs/master.lib/fil[data].asm
include libs/master.lib/dos_ropen[data].asm
include libs/master.lib/gaiji_backup[data].asm
include libs/master.lib/gaiji_entry_bfnt[data].asm
include libs/master.lib/grp[data].asm
include libs/master.lib/pal[data].asm
include libs/master.lib/pf[data].asm
include libs/master.lib/sin8[data].asm
include libs/master.lib/tx[data].asm
include libs/master.lib/version[data].asm
include libs/master.lib/vs[data].asm
include libs/master.lib/mem[data].asm
include libs/master.lib/super_entry_bfnt[data].asm
include libs/master.lib/superpa[data].asm
public _key_delay_groups
_key_delay_groups db 5, 3, 0
db 0
include th02/formats/pfopen[data].asm
.data?
include libs/master.lib/clip[bss].asm
include libs/master.lib/fil[bss].asm
include libs/master.lib/pal[bss].asm
include libs/master.lib/vs[bss].asm
include libs/master.lib/vsync[bss].asm
include libs/master.lib/mem[bss].asm
include libs/master.lib/superpa[bss].asm
include th01/hardware/vram_planes[bss].asm
include th02/formats/pi_slots[bss].asm
include libs/master.lib/pfint21[bss].asm
include th02/hardware/input_sense[bss].asm
include th02/snd/snd[bss].asm
include th02/snd/load[bss].asm
extern _resident:dword
end