-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
th04_op.asm
349 lines (297 loc) · 7.82 KB
/
th04_op.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
;
; +-------------------------------------------------------------------------+
; | This file has been generated by The Interactive Disassembler (IDA) |
; | Copyright (c) 2009 by Hex-Rays, <[email protected]> |
; +-------------------------------------------------------------------------+
;
; Input MD5 : 492DA6ACEE8714C252630BCE0D3C12FD
; File Name : th04/OP.EXE
; Format : MS-DOS executable (EXE)
; Base Address: 0h Range: 0h-133E0h Loaded length: 11A40h
; Entry Point : 0:0
; OS type : MS DOS
; Application type: Executable 16bit
.386
.model use16 large _TEXT
BINARY = 'O'
include ReC98.inc
include th04/th04.inc
include th04/sprites/op_cdg.inc
op_01 group OP_SETUP_TEXT, op_01_TEXT
; ===========================================================================
_TEXT segment word public 'CODE' use16
extern PALETTE_BLACK_IN:proc
extern PALETTE_BLACK_OUT:proc
extern GRCG_BYTEBOXFILL_X:proc
extern GRCG_SETCOLOR:proc
extern GRAPH_CLEAR:proc
extern GRAPH_COPY_PAGE:proc
extern GRAPH_PI_FREE:proc
extern PALETTE_SHOW:proc
extern IRAND:proc
extern SUPER_FREE:proc
extern SUPER_ENTRY_BFNT:proc
extern SUPER_PUT_RECT:proc
_TEXT ends
; ===========================================================================
; Segment type: Pure code
OP_SETUP_TEXT segment byte public 'CODE' use16
assume cs:op_01
;org 0Ch
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing
include th04/zunsoft.asm
OP_SETUP_TEXT ends
op_01_TEXT segment byte public 'CODE' use16
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public @main_cdg_load$qv
@main_cdg_load$qv proc near
push bp
mov bp, sp
call cdg_load_all pascal, CDG_NUMERAL, ds, offset aSft1_cd2
call cdg_load_all pascal, CDG_MAIN, ds, offset aSft2_cd2
call cdg_load_all pascal, CDG_CURSOR, ds, offset aCar_cd2
call cdg_load_all_noalpha pascal, 40, ds, offset aSl_cd2
pop bp
retn
@main_cdg_load$qv endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public @main_cdg_free$qv
@main_cdg_free$qv proc near
push bp
mov bp, sp
call cdg_free_all
pop bp
retn
@main_cdg_free$qv endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public @op_animate$qv
@op_animate$qv proc near
@@page = byte ptr -4
var_3 = byte ptr -3
@@component = word ptr -2
enter 4, 0
push si
push di
mov PaletteTone, 0
call far ptr palette_show
graph_accesspage 1
call grcg_setcolor pascal, (GC_RMW shl 16) + V_WHITE
call grcg_byteboxfill_x pascal, large 0, (((RES_X - 1) / 8) shl 16) or (RES_Y - 1)
GRCG_OFF_CLOBBERING dx
call graph_copy_page pascal, 0
call @pi_load$qinxc pascal, 0, ds, offset aOp5b_pi
call @pi_load$qinxc pascal, 1, ds, offset aOp4b_pi
call @pi_load$qinxc pascal, 2, ds, offset aOp3b_pi
call @pi_load$qinxc pascal, 3, ds, offset aOp2b_pi
call @pi_load$qinxc pascal, 4, ds, offset aOp1b_pi
call @pi_load$qinxc pascal, 5, ds, offset aOp0b_pi
call @pi_palette_apply$qi pascal, 0
push 4
call palette_black_in
graph_showpage 0
graph_accesspage 1
xor si, si
mov [bp+var_3], 0
mov di, 100
mov [bp+@@page], 0
jmp short loc_CDC4
; ---------------------------------------------------------------------------
loc_CD7A:
mov ax, si
mov bx, 4
cwd
idiv bx
or dx, dx
jnz short loc_CDB0
cmp [bp+var_3], 6
jnb short loc_CDB0
pushd 38
mov al, [bp+var_3]
mov ah, 0
push ax
call @pi_put_8$qiii
inc [bp+var_3]
graph_accesspage [bp+@@page]
mov al, 1
sub al, [bp+@@page]
mov [bp+@@page], al
graph_showpage al
loc_CDB0:
mov PaletteTone, di
call far ptr palette_show
add di, 2
call @frame_delay$qi pascal, 1
inc si
loc_CDC4:
cmp si, 1Ch
jl short loc_CD7A
mov PaletteTone, 200
call far ptr palette_show
graph_showpage 0
graph_accesspage al
freePISlotLarge 0
freePISlotLarge 1
freePISlotLarge 2
freePISlotLarge 3
freePISlotLarge 4
freePISlotLarge 5
les bx, _resident
cmp es:[bx+resident_t.demo_num], 0
jnz short loc_CE50
call snd_load pascal, ds, offset aOp_1, SND_LOAD_SONG
kajacall KAJA_SONG_PLAY
loc_CE50:
graph_accesspage 1
call @pi_load$qinxc pascal, 0, ds, offset aOp1_pi_1
call @pi_palette_apply$qi pascal, 0
call @pi_put_8$qiii pascal, large 0, 0
freePISlotLarge 0
call graph_copy_page pascal, 0
xor si, si
jmp short loc_CEAA
; ---------------------------------------------------------------------------
loc_CE8B:
mov bx, si
imul bx, size rgb_t
mov Palettes[bx].r, 255
mov bx, si
imul bx, size rgb_t
mov Palettes[bx].g, 255
mov bx, si
imul bx, size rgb_t
mov Palettes[bx].b, 255
inc si
loc_CEAA:
cmp si, COLOR_COUNT
jl short loc_CE8B
call far ptr palette_show
mov PaletteTone, 100
call far ptr palette_show
xor si, si
mov [bp+var_3], 240
jmp short loc_CEE8
; ---------------------------------------------------------------------------
loc_CEC7:
mov al, [bp+var_3]
mov Palettes[0 * size rgb_t].r, al
mov Palettes[0 * size rgb_t].g, al
mov Palettes[0 * size rgb_t].b, al
call far ptr palette_show
call @frame_delay$qi pascal, 1
inc si
mov al, [bp+var_3]
add al, -16
mov [bp+var_3], al
loc_CEE8:
cmp si, 15
jl short loc_CEC7
xor si, si
mov [bp+var_3], 252
jmp short loc_CF4E
; ---------------------------------------------------------------------------
loc_CEF5:
mov di, 1
jmp short loc_CF34
; ---------------------------------------------------------------------------
loc_CEFA:
mov [bp+@@component], 0
jmp short loc_CF2D
; ---------------------------------------------------------------------------
loc_CF01:
mov bx, di
imul bx, size rgb_t
add bx, [bp+@@component]
mov al, _pi_headers._palette[bx]
mov bx, di
imul bx, size rgb_t
add bx, [bp+@@component]
cmp al, Palettes[bx].r
jnb short loc_CF2A
mov bx, di
imul bx, size rgb_t
add bx, [bp+@@component]
mov al, [bp+var_3]
mov Palettes[bx].r, al
loc_CF2A:
inc [bp+@@component]
loc_CF2D:
cmp [bp+@@component], size rgb_t
jl short loc_CF01
inc di
loc_CF34:
cmp di, COLOR_COUNT
jl short loc_CEFA
call far ptr palette_show
call @frame_delay$qi pascal, 1
inc si
mov al, [bp+var_3]
add al, -4
mov [bp+var_3], al
loc_CF4E:
cmp si, 63
jl short loc_CEF5
call @pi_palette_apply$qi pascal, 0
pop di
pop si
leave
retn
@op_animate$qv endp
_playchar_menu procdesc near
op_01_TEXT ends
; ===========================================================================
SHARED segment byte public 'CODE' use16
include th02/snd/snd.inc
extern @FRAME_DELAY$QI:proc
extern @PI_PALETTE_APPLY$QI:proc
extern @PI_PUT_8$QIII:proc
extern @PI_LOAD$QINXC:proc
extern @POLAR$QIII:proc
extern SND_KAJA_INTERRUPT:proc
extern SND_DELAY_UNTIL_MEASURE:proc
extern SND_LOAD:proc
extern @input_reset_sense$qv:proc
extern @input_sense$qv:proc
extern SND_SE_PLAY:proc
extern _snd_se_update:proc
extern _bgimage_snap:proc
extern _bgimage_put:proc
extern _bgimage_free:proc
extern CDG_LOAD_ALL_NOALPHA:proc
extern CDG_LOAD_ALL:proc
extern CDG_FREE_ALL:proc
SHARED ends
.data
; libs/master.lib/pal[data].asm
extern PaletteTone:word
; libs/master.lib/sin8[data].asm
extern _SinTable8:word:256
extern _CosTable8:word:256
include th04/zunsoft[data].asm
aSft1_cd2 db 'sft1.cd2',0
aSft2_cd2 db 'sft2.cd2',0
aCar_cd2 db 'car.cd2',0
aSl_cd2 db 'sl.cd2',0
aOp5b_pi db 'op5b.pi',0
aOp4b_pi db 'op4b.pi',0
aOp3b_pi db 'op3b.pi',0
aOp2b_pi db 'op2b.pi',0
aOp1b_pi db 'op1b.pi',0
aOp0b_pi db 'op0b.pi',0
aOp_1 db 'op',0
aOp1_pi_1 db 'op1.pi',0
.data?
extern _resident:dword
; libs/master.lib/pal[bss].asm
extern Palettes:byte:48
; libs/master.lib/vs[bss].asm
extern vsync_Count1:word
; th02/formats/pi_slots[bss].asm
extern _pi_buffers:dword
extern _pi_headers:PiHeader
; th02/hardware/input_sense[bss].asm
extern _key_det:word
include th04/zunsoft[bss].asm
end