-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
th04_op.asm
2956 lines (2631 loc) · 68.2 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
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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;
; +-------------------------------------------------------------------------+
; | This file has been generated by The Interactive Disassembler (IDA) |
; | Copyright (c) 2009 by Hex-Rays, <support@hex-rays.com> |
; +-------------------------------------------------------------------------+
;
; 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 SHARED
BINARY = 'O'
include ReC98.inc
include th04/th04.inc
include th04/hardware/grppsafx.inc
include th04/music/music.inc
extern SCOPY@:proc
extern _execl:proc
extern _getch:proc
extern _memcpy:proc
extern _strlen:proc
g_SHARED group SHARED, SHARED_
; ===========================================================================
; 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/atrtcmod.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/dos_axdx.asm
include libs/master.lib/dos_keyclear.asm
include libs/master.lib/dos_puts2.asm
include libs/master.lib/dos_read.asm
include libs/master.lib/dos_seek.asm
include libs/master.lib/dos_setvect.asm
include libs/master.lib/egc.asm
include libs/master.lib/file_append.asm
include libs/master.lib/file_close.asm
include libs/master.lib/file_create.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_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_byteboxfill_x.asm
include libs/master.lib/grcg_hline.asm
include libs/master.lib/grcg_polygon_c.asm
include libs/master.lib/grcg_round_boxfill.asm
include libs/master.lib/grcg_setcolor.asm
include libs/master.lib/get_machine_98.asm
include libs/master.lib/get_machine_at.asm
include libs/master.lib/get_machine_dosbox.asm
include libs/master.lib/check_machine_fmr.asm
include libs/master.lib/get_machine.asm
include libs/master.lib/gaiji_backup.asm
include libs/master.lib/gaiji_entry_bfnt.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_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/graph_show.asm
include libs/master.lib/graph_start.asm
include libs/master.lib/js_end.asm
include libs/master.lib/keybeep.asm
include libs/master.lib/make_linework.asm
include libs/master.lib/palette_init.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/random.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/soundio.asm
include libs/master.lib/text_clear.asm
include libs/master.lib/txesc.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/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_free.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/super_cancel_pat.asm
include libs/master.lib/super_put_rect.asm
include libs/master.lib/super_put.asm
include libs/master.lib/respal_exist.asm
include libs/master.lib/respal_free.asm
include libs/master.lib/pfint21.asm
db 0
include libs/master.lib/js_start.asm
include libs/master.lib/draw_trapezoid.asm
include th03/formats/pfopen.asm
include libs/master.lib/pf_str_ieq.asm
include libs/master.lib/js_sense.asm
include libs/master.lib/bgm_bell_org.asm
include libs/master.lib/bgm_mget.asm
include libs/master.lib/bgm_read_sdata.asm
include libs/master.lib/bgm_timer.asm
include libs/master.lib/bgm_pinit.asm
include libs/master.lib/bgm_timerhook.asm
include libs/master.lib/bgm_play.asm
include libs/master.lib/bgm_sound.asm
include libs/master.lib/bgm_effect_sound.asm
include libs/master.lib/bgm_stop_play.asm
include libs/master.lib/bgm_set_tempo.asm
include libs/master.lib/bgm_init_finish.asm
include libs/master.lib/bgm_stop_sound.asm
include libs/master.lib/graph_gaiji_puts.asm
include libs/master.lib/graph_gaiji_putc.asm
_TEXT ends
; ===========================================================================
; Segment type: Pure code
op_01_TEXT segment byte public 'CODE' use16
assume cs:op_01_TEXT
;org 0Ch
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing
include th04/formats/cfg.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public _start_game
_start_game proc near
push bp
mov bp, sp
les bx, _resident
mov es:[bx+resident_t.stage], 0
mov al, es:[bx+resident_t.cfg_lives]
mov es:[bx+resident_t.credit_lives], al
mov al, es:[bx+resident_t.cfg_bombs]
mov es:[bx+resident_t.credit_bombs], al
mov es:[bx+resident_t.playchar_ascii], '0' + PLAYCHAR_REIMU
mov es:[bx+resident_t.stage_ascii], '0'
call _playchar_menu
or ax, ax
jnz short loc_A96A
les bx, _resident
mov es:[bx+resident_t.demo_num], 0
call _main_cdg_free
call cfg_save
call gaiji_restore
kajacall KAJA_SONG_FADE, 10
call _game_exit
les bx, _resident
cmp es:[bx+resident_t.debug_mode], 0
jnz short loc_A957
pushd 0
push ds
push offset aMain ; "main"
push ds
push offset aMain ; "main"
jmp short loc_A962
; ---------------------------------------------------------------------------
loc_A957:
pushd 0
push ds
push offset path ; "deb"
push ds
push offset path ; "deb"
loc_A962:
call _execl
add sp, 0Ch
loc_A96A:
pop bp
retn
_start_game endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public _start_extra
_start_extra proc near
push bp
mov bp, sp
les bx, _resident
mov es:[bx+resident_t.stage], STAGE_EXTRA
mov es:[bx+resident_t.credit_lives], 3
mov es:[bx+resident_t.credit_bombs], 2
mov es:[bx+resident_t.playchar_ascii], '0' + PLAYCHAR_REIMU
mov es:[bx+resident_t.stage_ascii], '6'
call _playchar_menu
or ax, ax
jnz short loc_A9C7
les bx, _resident
mov es:[bx+resident_t.demo_num], 0
call _main_cdg_free
call cfg_save
call gaiji_restore
kajacall KAJA_SONG_FADE, 10
call _game_exit
pushd 0
push ds
push offset aMain ; "main"
push ds
push offset aMain ; "main"
call _execl
add sp, 0Ch
loc_A9C7:
pop bp
retn
_start_extra endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public _start_demo
_start_demo proc near
push bp
mov bp, sp
les bx, _resident
mov es:[bx+resident_t.stage], 0
mov es:[bx+resident_t.credit_lives], 3
mov es:[bx+resident_t.credit_bombs], 3
inc es:[bx+resident_t.demo_num]
cmp es:[bx+resident_t.demo_num], 4
jbe short loc_A9EF
mov es:[bx+resident_t.demo_num], 1
loc_A9EF:
les bx, _resident
mov al, es:[bx+resident_t.demo_num]
mov ah, 0
dec ax
mov bx, ax
cmp bx, 3
ja short loc_AA6E
add bx, bx
jmp cs:off_AAAD[bx]
loc_AA08:
les bx, _resident
mov es:[bx+resident_t.playchar_ascii], '0' + PLAYCHAR_REIMU
mov es:[bx+resident_t.stage_ascii], '3'
mov es:[bx+resident_t.shottype], SHOTTYPE_A
mov es:[bx+resident_t.demo_stage], 3
jmp short loc_AA6E
; ---------------------------------------------------------------------------
loc_AA22:
les bx, _resident
mov es:[bx+resident_t.playchar_ascii], '0' + PLAYCHAR_MARISA
mov es:[bx+resident_t.stage_ascii], '0'
mov es:[bx+resident_t.shottype], SHOTTYPE_A
mov es:[bx+resident_t.demo_stage], 0
jmp short loc_AA6E
; ---------------------------------------------------------------------------
loc_AA3C:
les bx, _resident
mov es:[bx+resident_t.playchar_ascii], '0' + PLAYCHAR_REIMU
mov es:[bx+resident_t.stage_ascii], '2'
mov es:[bx+resident_t.shottype], SHOTTYPE_B
mov es:[bx+resident_t.demo_stage], 2
jmp short loc_AA6E
; ---------------------------------------------------------------------------
loc_AA56:
les bx, _resident
mov es:[bx+resident_t.playchar_ascii], '0' + PLAYCHAR_MARISA
mov es:[bx+resident_t.stage_ascii], '1'
mov es:[bx+resident_t.shottype], SHOTTYPE_B
mov es:[bx+resident_t.demo_stage], 1
loc_AA6E:
push 1
call palette_black_out
call super_free
freePISlotLarge 0
call _main_cdg_free
call cfg_save
call gaiji_restore
call _game_exit
pushd 0
push ds
push offset aMain ; "main"
push ds
push offset aMain ; "main"
call _execl
add sp, 0Ch
pop bp
retn
_start_demo endp
; ---------------------------------------------------------------------------
off_AAAD dw offset loc_AA08
dw offset loc_AA22
dw offset loc_AA3C
dw offset loc_AA56
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public MAIN_PUT
main_put proc near
var_2 = word ptr -2
arg_0 = word ptr 4
arg_2 = word ptr 6
enter 2, 0
push si
push di
mov si, [bp+arg_2]
mov ax, si
imul ax, 20
add ax, 224
mov di, ax
call egc_copy_rect_1_to_0_16 pascal, 256, ax, (128 shl 16) or 16
call grcg_setcolor pascal, GC_RMW, [bp+arg_0]
mov [bp+var_2], si
mov bx, si
cmp bx, 5
ja short loc_AB59
add bx, bx
jmp cs:off_ABCB[bx]
loc_AAF3:
call cdg_put_nocolors_8 pascal, large (272 shl 16) or 224, 10
les bx, _resident
mov al, es:[bx+resident_t.rank]
mov ah, 0
add ax, 16h
mov [bp+var_2], ax
jmp short loc_AB59
; ---------------------------------------------------------------------------
loc_AB12:
cmp _extra_unlocked, 0
jnz short loc_AB24
call grcg_setcolor pascal, (GC_RMW shl 16) + 12
loc_AB24:
push (272 shl 16) or 244
push 11
jmp short loc_AB54
; ---------------------------------------------------------------------------
loc_AB2E:
push (272 shl 16) or 264
push 12
jmp short loc_AB54
; ---------------------------------------------------------------------------
loc_AB38:
push (272 shl 16) or 284
push 13
jmp short loc_AB54
; ---------------------------------------------------------------------------
loc_AB42:
push (272 shl 16) or 304
push 14
jmp short loc_AB54
; ---------------------------------------------------------------------------
loc_AB4C:
push (272 shl 16) or 324
push 15
loc_AB54:
call cdg_put_nocolors_8
loc_AB59:
GRCG_OFF_CLOBBERING dx
cmp [bp+arg_0], 8
jnz short loc_ABC4
call cdg_put_8 pascal, 256, di, 35
call cdg_put_8 pascal, 352, di, 36
call egc_copy_rect_1_to_0_16 pascal, large (0 shl 16) or 384, (RES_X shl 16) or 16
mov _graph_putsa_fx_func, FX_WEIGHT_BOLD
mov bx, [bp+var_2]
shl bx, 2
pushd _MENU_DESC[bx]
call _strlen
add sp, 4
shl ax, 3
mov dx, 624
sub dx, ax
push dx
push (384 shl 16) or 15
mov bx, [bp+var_2]
shl bx, 2
pushd _MENU_DESC[bx]
call graph_putsa_fx
loc_ABC4:
pop di
pop si
leave
retn 4
main_put endp
; ---------------------------------------------------------------------------
db 0
off_ABCB dw offset loc_AAF3
dw offset loc_AB12
dw offset loc_AB2E
dw offset loc_AB38
dw offset loc_AB42
dw offset loc_AB4C
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public OPTION_PUT
option_put proc near
@@y = word ptr -4
var_2 = word ptr -2
arg_0 = word ptr 4
arg_2 = word ptr 6
enter 4, 0
push si
push di
mov di, 224
mov ax, [bp+arg_2]
shl ax, 4
add ax, 224
mov [bp+@@y], ax
cmp [bp+arg_2], 7
jnz short loc_ABF7
mov [bp+@@y], 340
loc_ABF7:
call egc_copy_rect_1_to_0_16 pascal, 224, [bp+@@y], (192 shl 16) or 16
loc_AC08:
call grcg_setcolor pascal, GC_RMW, [bp+arg_0]
mov bx, [bp+arg_2]
cmp bx, 7
ja loc_AD9A
add bx, bx
jmp cs:off_AE18[bx]
loc_AC24:
call cdg_put_nocolors_8 pascal, large (224 shl 16) or 224, 16
push (320 shl 16) or 224
les bx, _resident
mov al, es:[bx+resident_t.rank]
mov ah, 0
add ax, 21
push ax
call cdg_put_nocolors_8
les bx, _resident
mov al, es:[bx+resident_t.rank]
mov ah, 0
add ax, 6
loc_AC57:
mov si, ax
jmp loc_AD9A
; ---------------------------------------------------------------------------
loc_AC5C:
call cdg_put_nocolors_8 pascal, large (224 shl 16) or 240, 17
push (320 shl 16) or 240
les bx, _resident
mov al, es:[bx+resident_t.cfg_lives]
mov ah, 0
push ax
call cdg_put_nocolors_8
mov si, 0Ah
jmp loc_AD9A
; ---------------------------------------------------------------------------
loc_AC85:
call cdg_put_nocolors_8 pascal, large (224 shl 16) or 256, 18
push (320 shl 16) or 256
les bx, _resident
mov al, es:[bx+resident_t.cfg_bombs]
mov ah, 0
push ax
call cdg_put_nocolors_8
mov si, 0Bh
jmp loc_AD9A
; ---------------------------------------------------------------------------
loc_ACAE:
call cdg_put_nocolors_8 pascal, large (224 shl 16) or 272, 19
les bx, _resident
cmp es:[bx+resident_t.bgm_mode], SND_BGM_OFF
jnz short loc_ACCB
mov ax, 1Ch
jmp short loc_ACD8
; ---------------------------------------------------------------------------
loc_ACCB:
les bx, _resident
mov al, es:[bx+resident_t.bgm_mode]
mov ah, 0
add ax, 18h
loc_ACD8:
mov [bp+var_2], ax
call cdg_put_nocolors_8 pascal, large (320 shl 16) or 272, ax
les bx, _resident
mov al, es:[bx+resident_t.bgm_mode]
mov ah, 0
add ax, 0Ch
jmp loc_AC57
; ---------------------------------------------------------------------------
loc_ACF7:
call cdg_put_nocolors_8 pascal, large (224 shl 16) or 288, 20
les bx, _resident
cmp es:[bx+resident_t.se_mode], SND_SE_OFF
jnz short loc_AD14
mov ax, 1Ch
jmp short loc_AD25
; ---------------------------------------------------------------------------
loc_AD14:
les bx, _resident
mov al, es:[bx+resident_t.se_mode]
mov ah, 0
push ax
mov ax, 1Fh
pop dx
sub ax, dx
loc_AD25:
mov [bp+var_2], ax
call cdg_put_nocolors_8 pascal, large (320 shl 16) or 288, ax
les bx, _resident
mov al, es:[bx+resident_t.se_mode]
mov ah, 0
add ax, 0Fh
jmp loc_AC57
; ---------------------------------------------------------------------------
loc_AD44:
push (272 shl 16) or 304
les bx, _resident
mov al, es:[bx+resident_t.turbo_mode]
mov ah, 0
mov dx, 33
sub dx, ax
push dx
call cdg_put_nocolors_8
mov di, 256
les bx, _resident
mov al, es:[bx+resident_t.turbo_mode]
mov ah, 0
add ax, 12h
jmp loc_AC57
; ---------------------------------------------------------------------------
loc_AD72:
call cdg_put_nocolors_8 pascal, large (272 shl 16) or 320, 31
mov di, 256
mov si, 14h
jmp short loc_AD9A
; ---------------------------------------------------------------------------
loc_AD87:
call cdg_put_nocolors_8 pascal, large (272 shl 16) or 340, 15
mov di, 256
mov si, 15h
loc_AD9A:
GRCG_OFF_CLOBBERING dx
cmp [bp+arg_0], 8
jnz short loc_AE11
call cdg_put_8 pascal, di, [bp+@@y], 35
cmp di, 256
jnz short loc_ADBD
lea ax, [di+96]
push ax
jmp short loc_ADC0
; ---------------------------------------------------------------------------
loc_ADBD:
push 384
loc_ADC0:
push [bp+@@y]
push 36
call cdg_put_8
call egc_copy_rect_1_to_0_16 pascal, large (0 shl 16) or 384, (RES_X shl 16) or 16
mov _graph_putsa_fx_func, FX_WEIGHT_BOLD
mov bx, si
shl bx, 2
pushd _MENU_DESC[bx]
call _strlen
add sp, 4
shl ax, 3
mov dx, 624
sub dx, ax
push dx
push (384 shl 16) or 15
mov bx, si
shl bx, 2
pushd _MENU_DESC[bx]
call graph_putsa_fx
loc_AE11:
pop di
pop si
leave
retn 4
option_put endp
; ---------------------------------------------------------------------------
db 0
off_AE18 dw offset loc_AC24
dw offset loc_AC5C
dw offset loc_AC85
dw offset loc_ACAE
dw offset loc_ACF7
dw offset loc_AD44
dw offset loc_AD72
dw offset loc_AD87
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public MENU_SEL_MOVE
menu_sel_move proc near
arg_0 = byte ptr 4
arg_2 = byte ptr 6
push bp
mov bp, sp
mov al, _menu_sel
cbw
push ax
push 1
call _putfunc
mov al, [bp+arg_0]
add _menu_sel, al
mov al, _menu_sel
cbw
or ax, ax
jge short loc_AE4B
mov al, [bp+arg_2]
mov _menu_sel, al
loc_AE4B:
mov al, _menu_sel
cmp al, [bp+arg_2]
jle short loc_AE58
mov _menu_sel, 0
loc_AE58:
cmp _extra_unlocked, 0
jnz short loc_AE76
mov al, _menu_sel
cbw
cmp ax, 1
jnz short loc_AE76
cmp _in_option, 0
jnz short loc_AE76
mov al, [bp+arg_0]
add _menu_sel, al
loc_AE76:
mov al, _menu_sel
cbw
push ax
push 8
call _putfunc
call _snd_se_reset
call snd_se_play pascal, 1
call _snd_se_update
pop bp
retn 4
menu_sel_move endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public MAIN_UPDATE_AND_RENDER
main_update_and_render proc near
push bp
mov bp, sp
push si
cmp _main_menu_initialized, 0
jnz short loc_AEEB
mov _main_menu_unused_1, 0
mov _main_input_allowed, 0
call egc_copy_rect_1_to_0_16 pascal, (192 shl 16) or 224, (288 shl 16) or 160
xor si, si
jmp short loc_AED6
; ---------------------------------------------------------------------------
loc_AEC0:
push si
mov al, _menu_sel
cbw
cmp ax, si
jnz short loc_AECE
mov ax, 8
jmp short loc_AED1
; ---------------------------------------------------------------------------
loc_AECE:
mov ax, 1
loc_AED1:
push ax
call main_put
inc si
loc_AED6:
cmp si, 6
jl short loc_AEC0
mov _putfunc, offset main_put
mov _main_menu_initialized, 1
mov _main_input_allowed, 0
loc_AEEB:
cmp _key_det, INPUT_NONE
jnz short loc_AEF7
mov _main_input_allowed, 1
loc_AEF7:
cmp _main_input_allowed, 0
jz loc_B043
test _key_det.lo, low INPUT_UP
jz short loc_AF0E
call menu_sel_move pascal, 5, -1
loc_AF0E:
test _key_det.lo, low INPUT_DOWN
jz short loc_AF1C
call menu_sel_move pascal, 5, 1
loc_AF1C:
test _key_det.hi, high INPUT_OK
jnz short loc_AF2C
test _key_det.lo, low INPUT_SHOT
jz loc_B02B
loc_AF2C:
call _snd_se_reset
call snd_se_play pascal, 11
call _snd_se_update
mov al, _menu_sel
cbw
mov bx, ax
cmp bx, 5
ja loc_B02B
add bx, bx
jmp cs:off_B046[bx]
loc_AF51:
call _start_game
jmp short loc_AFBD
; ---------------------------------------------------------------------------
loc_AF56:
call _start_extra
graph_accesspage 1
call pi_load pascal, 0, ds, offset aOp1_pi
call pi_palette_apply pascal, 0
call pi_put_8 pascal, large 0, 0
freePISlotLarge 0
call graph_copy_page pascal, 0
mov PaletteTone, 100
call far ptr palette_show
mov _main_menu_initialized, 0
mov _in_option, 0
mov _menu_sel, 1
jmp loc_B043
; ---------------------------------------------------------------------------
loc_AFAD:
call _regist_view_menu
mov _main_menu_initialized, 0
jmp short loc_B02B
; ---------------------------------------------------------------------------
loc_AFB7:
call _musicroom
call _main_cdg_load
loc_AFBD:
graph_accesspage 1
call pi_load pascal, 0, ds, offset aOp1_pi
call pi_palette_apply pascal, 0
call pi_put_8 pascal, large 0, 0
freePISlotLarge 0
call graph_copy_page pascal, 0
mov PaletteTone, 100
call far ptr palette_show
mov _main_menu_initialized, 0
mov _in_option, 0
mov _menu_sel, 0
jmp short loc_B043
; ---------------------------------------------------------------------------
loc_B010:
mov _main_menu_initialized, 0
mov _in_option, 1
mov _menu_sel, 0
jmp short loc_B02B
; ---------------------------------------------------------------------------
loc_B021:
mov _main_menu_initialized, 0
mov _quit, 1
loc_B02B:
test _key_det.hi, high INPUT_CANCEL
jz short loc_B037
mov _quit, 1
loc_B037:
cmp _key_det, INPUT_NONE
jz short loc_B043
mov _main_input_allowed, 0
loc_B043:
pop si
pop bp
retn
main_update_and_render endp
; ---------------------------------------------------------------------------
off_B046 dw offset loc_AF51
dw offset loc_AF56
dw offset loc_AFAD
dw offset loc_AFB7
dw offset loc_B010
dw offset loc_B021
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public OPTION_UPDATE_AND_RENDER
option_update_and_render proc near
push bp
mov bp, sp
push si
cmp _option_initialized, 0
jnz short loc_B0A2
mov _option_input_allowed, 0
call egc_copy_rect_1_to_0_16 pascal, (272 shl 16) or 224, (160 shl 16) or 144
xor si, si
jmp short loc_B08D
; ---------------------------------------------------------------------------
loc_B077:
push si
mov al, _menu_sel
cbw
cmp ax, si
jnz short loc_B085
mov ax, 8
jmp short loc_B088
; ---------------------------------------------------------------------------
loc_B085:
mov ax, 1
loc_B088:
push ax
call option_put
inc si
loc_B08D:
cmp si, 8
jl short loc_B077
mov _putfunc, offset option_put
mov _option_initialized, 1
mov _option_input_allowed, 0
loc_B0A2:
cmp _key_det, INPUT_NONE
jnz short loc_B0AE
mov _option_input_allowed, 1
loc_B0AE:
cmp _option_input_allowed, 0
jz loc_B35B
test _key_det.lo, low INPUT_UP
jz short loc_B0C5
call menu_sel_move pascal, 7, -1
loc_B0C5:
test _key_det.lo, low INPUT_DOWN
jz short loc_B0D3
call menu_sel_move pascal, 7, 1
loc_B0D3:
test _key_det.hi, high INPUT_OK
jnz short loc_B0E3
test _key_det.lo, low INPUT_SHOT
jz loc_B16F
loc_B0E3:
mov al, _menu_sel
cbw
cmp ax, 6
jz short loc_B0F4
cmp ax, 7
jz short loc_B14F
jmp loc_B178
; ---------------------------------------------------------------------------
loc_B0F4:
les bx, _resident
mov es:[bx+resident_t.rank], RANK_NORMAL
mov es:[bx+resident_t.cfg_lives], CFG_LIVES_DEFAULT
mov es:[bx+resident_t.cfg_bombs], CFG_BOMBS_DEFAULT
mov es:[bx+resident_t.bgm_mode], SND_BGM_FM86
mov es:[bx+resident_t.se_mode], SND_SE_FM
mov es:[bx+resident_t.turbo_mode], 1
kajacall KAJA_SONG_STOP
les bx, _resident
mov al, es:[bx+resident_t.bgm_mode]
mov ah, 0
push ax
mov al, es:[bx+resident_t.se_mode]
mov ah, 0
push ax
call snd_determine_modes
call snd_load pascal, ds, offset aOp, SND_LOAD_SONG
kajacall KAJA_SONG_PLAY
mov _option_initialized, 0
jmp short loc_B16F
; ---------------------------------------------------------------------------
loc_B14F:
call _snd_se_reset
call snd_se_play pascal, 11
call _snd_se_update
mov _option_initialized, 0
mov _menu_sel, 4
mov _in_option, 0
loc_B16F:
test _key_det.lo, low INPUT_RIGHT
jz loc_B250
loc_B178:
mov al, _menu_sel
cbw
mov bx, ax
cmp bx, 5
ja loc_B246
add bx, bx
jmp cs:off_B36B[bx]
loc_B18C: