-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathth03_op.asm
1811 lines (1563 loc) · 37.9 KB
/
th03_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, <[email protected]> |
; +-------------------------------------------------------------------------+
;
; Input MD5 : 661F4F8FFAF1F3274F503D154133DEF0
; File Name : th03/OP.EXE
; Format : MS-DOS executable (EXE)
; Base Address: 0h Range: 0h-FD80h Loaded length: E97Ah
; Entry Point : 0:0
; OS type : MS DOS
; Application type: Executable 16bit
.386
.model use16 large _TEXT
include ReC98.inc
include th03/th03.inc
include th03/sprites/regi.inc
include th03/formats/scoredat.inc
extern _execl:proc
extern _getch:proc
group_01 group op_01_TEXT, OP_MUSIC_TEXT, OP_SEL_TEXT
; ===========================================================================
_TEXT segment word public 'CODE' use16
extern PALETTE_BLACK_OUT:proc
extern DOS_PUTS2:proc
extern EGC_SHIFT_LEFT_ALL:proc
extern GRCG_BYTEBOXFILL_X:proc
extern GRCG_SETCOLOR:proc
extern GRCG_OFF:proc
extern GAIJI_BACKUP:proc
extern GAIJI_RESTORE:proc
extern GAIJI_ENTRY_BFNT:proc
extern GAIJI_PUTSA:proc
extern GRAPH_400LINE:proc
extern GRAPH_CLEAR:proc
extern GRAPH_COPY_PAGE:proc
extern GRAPH_PI_FREE:proc
extern PALETTE_SHOW:proc
extern IRAND:proc
extern TEXT_CLEAR:proc
extern TEXT_PUTSA:proc
extern HMEM_FREE:proc
extern SUPER_FREE:proc
extern SUPER_ENTRY_BFNT:proc
extern SUPER_PUT:proc
extern RESPAL_CREATE:proc
extern RESPAL_FREE:proc
_TEXT ends
; ===========================================================================
; Segment type: Pure code
op_01_TEXT segment byte public 'CODE' use16
assume cs:group_01
;org 8
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing
@cfg_load$qv procdesc near
@cfg_save$qv procdesc near
@cfg_save_exit$qv procdesc near
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public START_GAME
start_game proc near
var_4 = word ptr -4
var_2 = word ptr -2
enter 4, 0
push si
les bx, _resident
mov es:[bx+resident_t.demo_num], 0
mov es:[bx+resident_t.pid_winner], 0
mov es:[bx+resident_t.story_stage], 0
mov es:[bx+resident_t.RESIDENT_is_cpu][0], 0
mov es:[bx+resident_t.RESIDENT_is_cpu][1], 1
mov es:[bx+resident_t.game_mode], GM_STORY
mov es:[bx+resident_t.story_lives], CREDIT_LIVES
mov es:[bx+resident_t.show_score_menu], 0
mov es:[bx+resident_t.RESIDENT_playchar_paletted][1], -1
call @select_story_menu$qv
or al, al
jz short loc_9A59
mov al, 1
jmp loc_9B9A
; ---------------------------------------------------------------------------
loc_9A59:
les bx, _resident
mov al, es:[bx+resident_t.RESIDENT_playchar_paletted][0]
mov ah, 0
dec ax
cwd
sub ax, dx
mov bx, ax
sar bx, 1
mov al, [bx+0A0h]
mov ah, 0
mov [bp+var_4], ax
mov bx, word ptr _resident
mov eax, es:[bx+resident_t.rand]
mov random_seed, eax
xor si, si
jmp short loc_9ADB
; ---------------------------------------------------------------------------
loc_9A85:
call IRand
mov bx, 7
cwd
idiv bx
mov [bp+var_2], dx
mov bx, [bp+var_2]
cmp byte ptr [bx+99h], 0
jnz short loc_9A85
mov ax, [bp+var_4]
cmp ax, [bp+var_2]
jz short loc_9A85
mov byte ptr [bx+99h], 1
mov ax, [bp+var_2]
add ax, ax
inc ax
mov [bp+var_2], ax
les bx, _resident
add bx, si
mov al, byte ptr [bp+var_2]
mov es:[bx+resident_t.story_opponents], al
mov bx, word ptr _resident
mov al, es:[bx+resident_t.RESIDENT_playchar_paletted][0]
mov ah, 0
cmp ax, [bp+var_2]
jnz short loc_9ADA
add bx, si
mov al, byte ptr [bp+var_2]
inc al
mov es:[bx+resident_t.story_opponents], al
loc_9ADA:
inc si
loc_9ADB:
cmp si, 6
jl short loc_9A85
les bx, _resident
mov al, es:[bx+resident_t.story_opponents]
mov es:[bx+resident_t.RESIDENT_playchar_paletted][1], al
mov al, byte ptr [bp+var_4]
add al, al
inc al
mov es:[bx+resident_t.story_opponents][6], al
mov es:[bx+resident_t.story_opponents][7], (1 + (PLAYCHAR_CHIYURI * 2))
cmp es:[bx+resident_t.RESIDENT_playchar_paletted][0], (1 + (PLAYCHAR_CHIYURI * 2))
jnz short loc_9B07
inc es:[bx+resident_t.story_opponents][7]
loc_9B07:
les bx, _resident
mov es:[bx+resident_t.story_opponents][8], (1 + (PLAYCHAR_YUMEMI * 2))
cmp es:[bx+resident_t.RESIDENT_playchar_paletted][0], (1 + (PLAYCHAR_YUMEMI * 2))
jnz short loc_9B1B
inc es:[bx+resident_t.story_opponents][8]
loc_9B1B:
xor si, si
jmp short loc_9B39
; ---------------------------------------------------------------------------
loc_9B1F:
les bx, _resident
add bx, si
mov al, es:[bx+resident_t.story_opponents]
mov ah, 0
dec ax
cwd
sub ax, dx
sar ax, 1
cmp ax, 9
jge loc_9A59
inc si
loc_9B39:
cmp si, STAGE_COUNT
jl short loc_9B1F
xor si, si
jmp short loc_9B4E
; ---------------------------------------------------------------------------
loc_9B42:
les bx, _resident
add bx, si
mov es:[bx+resident_t.score_last], 0
inc si
loc_9B4E:
cmp si, (PLAYER_COUNT * SCORE_DIGITS)
jl short loc_9B42
les bx, _resident
mov es:[bx+resident_t.rem_credits], 3
mov es:[bx+resident_t.op_skip_animation], 0
mov al, es:[bx+resident_t.rank]
mov ah, 0
imul ax, 25
add al, 70
mov es:[bx+resident_t.skill], al
call @cfg_save$qv
call gaiji_restore
kajacall KAJA_SONG_STOP
call @game_exit$qv
pushd 0
push ds
push offset path ; "mainl"
push ds
push offset path ; "mainl"
call _execl
add sp, 0Ch
mov al, 0
loc_9B9A:
pop si
leave
retn
start_game endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_9B9D proc near
arg_0 = word ptr 4
arg_2 = word ptr 6
push bp
mov bp, sp
push si
push di
mov di, [bp+arg_2]
mov si, [bp+arg_0]
or di, di
jnz short loc_9BB8
push 1B0012h
push ds
push offset gp1P_VS_CPU
jmp short loc_9BD3
; ---------------------------------------------------------------------------
loc_9BB8:
cmp di, 1
jnz short loc_9BC9
push 1B0013h
push ds
push offset gp1P_VS_2P
jmp short loc_9BD3
; ---------------------------------------------------------------------------
loc_9BC9:
push 1B0014h
push ds
push offset gpCPU_VS_CPU
loc_9BD3:
push si
call gaiji_putsa
pop di
pop si
pop bp
retn 4
sub_9B9D endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public START_VS
start_vs proc near
var_2 = word ptr -2
enter 2, 0
push si
xor si, si
les bx, _resident
cmp es:[bx+resident_t.game_mode], GM_VS
jnb loc_9C8B
call text_clear
call sub_B0AF
mov [bp+var_2], 0
pushd 0E1h
call sub_9B9D
push 10001h
call sub_9B9D
push 20001h
call sub_9B9D
loc_9C1B:
call @input_mode_interface$qv
or si, si
jnz short loc_9C7E
test _input_sp.lo, low INPUT_UP
jz short loc_9C4A
push [bp+var_2]
push 1
call sub_9B9D
dec [bp+var_2]
cmp [bp+var_2], 0
jge short loc_9C41
mov [bp+var_2], 2
loc_9C41:
push [bp+var_2]
push 0E1h
call sub_9B9D
loc_9C4A:
test _input_sp.lo, low INPUT_DOWN
jz short loc_9C70
push [bp+var_2]
push 1
call sub_9B9D
inc [bp+var_2]
cmp [bp+var_2], 2
jle short loc_9C67
mov [bp+var_2], 0
loc_9C67:
push [bp+var_2]
push 0E1h
call sub_9B9D
loc_9C70:
test _input_sp.lo, low INPUT_SHOT
jnz short loc_9C9B
test _input_sp.hi, high INPUT_OK
jnz short loc_9C9B
loc_9C7E:
mov si, _input_sp
call @frame_delay$qi pascal, 1
jmp short loc_9C1B
; ---------------------------------------------------------------------------
loc_9C8B:
les bx, _resident
mov al, es:[bx+resident_t.game_mode]
mov ah, 0
add ax, -GM_VS
mov [bp+var_2], ax
loc_9C9B:
cmp [bp+var_2], VS_CPU_CPU
jnz short loc_9CA5
mov al, 1
jmp short loc_9CA7
; ---------------------------------------------------------------------------
loc_9CA5:
mov al, 0
loc_9CA7:
les bx, _resident
mov es:[bx+resident_t.RESIDENT_is_cpu][0], al
cmp [bp+var_2], VS_1P_2P
jz short loc_9CB9
mov al, 1
jmp short loc_9CBB
; ---------------------------------------------------------------------------
loc_9CB9:
mov al, 0
loc_9CBB:
les bx, _resident
mov es:[bx+resident_t.RESIDENT_is_cpu][1], al
mov es:[bx+resident_t.demo_num], 0
mov es:[bx+resident_t.pid_winner], 0
mov es:[bx+resident_t.story_stage], 0
mov al, byte ptr [bp+var_2]
add al, GM_VS
mov es:[bx+resident_t.game_mode], al
mov es:[bx+resident_t.show_score_menu], 0
cmp [bp+var_2], 1
jnz short loc_9CEF
call @select_1p_vs_2p_menu$qv
or al, al
jz short loc_9D03
jmp short loc_9CF6
; ---------------------------------------------------------------------------
loc_9CEF:
call @select_vs_cpu_menu$qv
or al, al
jz short loc_9D03
loc_9CF6:
les bx, _resident
mov es:[bx+resident_t.game_mode], GM_NONE
mov al, 1
jmp short loc_9D49
; ---------------------------------------------------------------------------
loc_9D03:
mov [bp+var_2], 0
jmp short loc_9D19
; ---------------------------------------------------------------------------
loc_9D0A:
les bx, _resident
add bx, [bp+var_2]
mov es:[bx+resident_t.score_last], 0
inc [bp+var_2]
loc_9D19:
cmp [bp+var_2], (PLAYER_COUNT * SCORE_DIGITS)
jl short loc_9D0A
call @cfg_save$qv
call gaiji_restore
kajacall KAJA_SONG_STOP
call @game_exit$qv
pushd 0
push ds
push offset path ; "mainl"
push ds
push offset path ; "mainl"
call _execl
add sp, 0Ch
mov al, 0
loc_9D49:
pop si
leave
retn
start_vs endp
include th03/start.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_9E16 proc near
push bp
mov bp, sp
push si
mov _input_sp, INPUT_NONE
xor si, si
jmp short loc_9E43
; ---------------------------------------------------------------------------
loc_9E24:
call @input_mode_interface$qv
les bx, _resident
inc es:[bx+resident_t.rand]
inc si
cmp si, 208h
jle short loc_9E3C
call start_demo
loc_9E3C:
call @frame_delay$qi pascal, 1
loc_9E43:
cmp _input_sp, INPUT_NONE
jz short loc_9E24
call super_put pascal, large (160 shl 16) or 256, 0
mov si, 176
jmp short loc_9E76
; ---------------------------------------------------------------------------
loc_9E5C:
push si
call sub_B10A
call super_put pascal, si, large (256 shl 16) or 2
call @frame_delay$qi pascal, 1
add si, 8
loc_9E76:
cmp si, 288
jl short loc_9E5C
pop si
pop bp
retn
sub_9E16 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public SCORE_MENU
score_menu proc near
push bp
mov bp, sp
push si
les bx, _resident
mov es:[bx+resident_t.story_stage], STAGE_NONE
mov es:[bx+resident_t.show_score_menu], 1
mov es:[bx+resident_t.game_mode], GM_NONE
xor si, si
jmp short loc_9EA6
; ---------------------------------------------------------------------------
loc_9E9A:
les bx, _resident
add bx, si
mov es:[bx+resident_t.score_last], 0
inc si
loc_9EA6:
cmp si, (PLAYER_COUNT * SCORE_DIGITS)
jl short loc_9E9A
call @cfg_save$qv
call gaiji_restore
kajacall KAJA_SONG_STOP
call super_free
call @game_exit$qv
pushd 0
push ds
push offset path ; "mainl"
push ds
push offset path ; "mainl"
call _execl
add sp, 0Ch
mov al, 0
pop si
pop bp
retn
score_menu endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public MAIN_PUT
main_put proc near
arg_0 = word ptr 4
arg_2 = word ptr 6
push bp
mov bp, sp
push si
push di
mov si, [bp+arg_2]
mov di, [bp+arg_0]
or si, si
jnz short loc_9EF8
push (25 shl 16) + 17
push ds
push offset gpSTART
jmp short loc_9F4B
; ---------------------------------------------------------------------------
loc_9EF8:
cmp si, 1
jnz short loc_9F09
push (23 shl 16) + 18
push ds
push offset gpVS_START
jmp short loc_9F4B
; ---------------------------------------------------------------------------
loc_9F09:
cmp si, 2
jnz short loc_9F1A
push (22 shl 16) + 19
push ds
push offset gpMUSIC_ROOM
jmp short loc_9F4B
; ---------------------------------------------------------------------------
loc_9F1A:
cmp si, 3
jnz short loc_9F2B
push (24 shl 16) + 20
push ds
push offset gpHISCORE
jmp short loc_9F4B
; ---------------------------------------------------------------------------
loc_9F2B:
cmp si, 4
jnz short loc_9F3C
push (25 shl 16) + 21
push ds
push offset gpOPTION
jmp short loc_9F4B
; ---------------------------------------------------------------------------
loc_9F3C:
cmp si, 5
jnz short loc_9F51
push (26 shl 16) + 22
push ds
push offset gpQUIT
loc_9F4B:
push di
call gaiji_putsa
loc_9F51:
pop di
pop si
pop bp
retn 4
main_put endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public OPTION_PUT
option_put proc near
arg_0 = word ptr 4
arg_2 = word ptr 6
push bp
mov bp, sp
push si
push di
mov di, [bp+arg_2]
mov si, [bp+arg_0]
or di, di
jnz short loc_9FD6
call gaiji_putsa pascal, (25 shl 16) + 17, ds offset gpRANK, si
call text_putsa pascal, (37 shl 16) + 17, ds, offset asc_D965, TX_WHITE
les bx, _resident
mov al, es:[bx+resident_t.rank]
mov ah, 0
mov bx, ax
cmp bx, RANK_LUNATIC
ja loc_A092
add bx, bx
jmp cs:off_A099[bx]
@@easy:
push (38 shl 16) + 17
push ds
push offset gpEASY
jmp loc_A08C
; ---------------------------------------------------------------------------
@@normal:
push (37 shl 16) + 17
push ds
push offset gpNORMAL
jmp loc_A08C
; ---------------------------------------------------------------------------
@@hard:
push (38 shl 16) + 17
push ds
push offset gpHARD
jmp loc_A08C
; ---------------------------------------------------------------------------
@@lunatic:
push (37 shl 16) + 17
push ds
push offset gpLUNATIC
jmp loc_A08C
; ---------------------------------------------------------------------------
loc_9FD6:
cmp di, 1
jnz short loc_A02A
call gaiji_putsa pascal, (25 shl 16) + 19, ds, offset gpMUSIC, si
les bx, _resident
mov al, es:[bx+resident_t.bgm_mode]
mov ah, 0
or ax, ax
jz short loc_A006
cmp ax, SND_BGM_FM
jz short @@fm
cmp ax, SND_BGM_MIDI
jz short @@midi
jmp loc_A092
; ---------------------------------------------------------------------------
loc_A006:
push (35 shl 16) + 19
push ds
push offset gpOFF
jmp short loc_A08C
; ---------------------------------------------------------------------------
@@fm:
push (35 shl 16) + 19
push ds
push offset gpFM_86
jmp short loc_A08C
; ---------------------------------------------------------------------------
@@midi:
push (35 shl 16) + 19
push ds
push offset gpMIDI_SC88
jmp short loc_A08C
; ---------------------------------------------------------------------------
loc_A02A:
cmp di, 2
jnz short loc_A07D
call gaiji_putsa pascal, (23 shl 16) + 21, ds, offset gpKEYCONFIG, si
les bx, _resident
mov al, es:[bx+resident_t.key_mode]
mov ah, 0
or ax, ax
jz short @@key_vs_key
cmp ax, KM_JOY_KEY
jz short @@joy_vs_key
cmp ax, KM_KEY_JOY
jz short @@key_vs_joy
jmp short loc_A092
; ---------------------------------------------------------------------------
@@key_vs_key:
push (37 shl 16) + 21
push ds
push offset gpKEY_VS_KEY
jmp short loc_A08C
; ---------------------------------------------------------------------------
@@joy_vs_key:
push (37 shl 16) + 21
push ds
push offset gpJOY_VS_KEY
jmp short loc_A08C
; ---------------------------------------------------------------------------
@@key_vs_joy:
push (37 shl 16) + 21
push ds
push offset gpKEY_VS_JOY
jmp short loc_A08C
; ---------------------------------------------------------------------------
loc_A07D:
cmp di, 3
jnz short loc_A092
push (32 shl 16) + 22
push ds
push offset gpQUIT
loc_A08C:
push si
call gaiji_putsa
loc_A092:
pop di
pop si
pop bp
retn 4
; ---------------------------------------------------------------------------
db 0
off_A099 dw offset @@easy
dw offset @@normal
dw offset @@hard
dw offset @@lunatic
option_put endp
; =============== 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
cmp _menu_sel, 0
jge short loc_A0C3
mov al, [bp+arg_2]
mov _menu_sel, al
loc_A0C3:
mov al, _menu_sel
cmp al, [bp+arg_2]
jle short loc_A0D0
mov _menu_sel, 0
loc_A0D0:
mov al, _menu_sel
cbw
push ax
push 0E1h
call _putfunc
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 @@main_initialized
call text_clear
cmp byte_D953, 0
jnz short loc_A0FA
call sub_B0DB
loc_A0FA:
mov byte_D953, 0
mov _main_input_allowed, 0
xor si, si
jmp short loc_A11E
; ---------------------------------------------------------------------------
loc_A108:
push si
mov al, _menu_sel
cbw
cmp ax, si
jnz short loc_A116
mov ax, 0E1h
jmp short loc_A119
; ---------------------------------------------------------------------------
loc_A116:
mov ax, 1
loc_A119:
push ax
call main_put
inc si
loc_A11E:
cmp si, 6
jl short loc_A108
mov _putfunc, offset main_put
mov _main_menu_initialized, 1
mov _main_input_allowed, 0
@@main_initialized:
cmp _input_sp, INPUT_NONE
jnz short loc_A13F
mov _main_input_allowed, 1
loc_A13F:
cmp _main_input_allowed, 0
jz @@no_main_input_allowed
test _input_sp.lo, low INPUT_UP
jz short loc_A156
call menu_sel_move pascal, 5, -1
loc_A156:
test _input_sp.lo, low INPUT_DOWN
jz short loc_A164
call menu_sel_move pascal, 5, 1
loc_A164:
test _input_sp.hi, high INPUT_OK
jnz short loc_A172
test _input_sp.lo, low INPUT_SHOT
jz short loc_A1DB
loc_A172:
mov al, _menu_sel
cbw
mov bx, ax
cmp bx, 5
ja short loc_A1DB
add bx, bx
jmp cs:off_A1F7[bx]
menu_sel_start:
call start_game
jmp short loc_A19A
; ---------------------------------------------------------------------------
menu_sel_vs_start:
les bx, _resident
mov es:[bx+resident_t.RESIDENT_playchar_paletted][0], (1 + (PLAYCHAR_REIMU * 2))
mov es:[bx+resident_t.RESIDENT_playchar_paletted][1], (1 + (PLAYCHAR_REIMU * 2))
call start_vs
loc_A19A:
call sub_B008
call sub_9E16
call @select_cdg_load_part2_of_4$qv
mov _main_menu_initialized, 0
mov _main_input_allowed, 0
mov byte_D953, 1
jmp short @@no_main_input_allowed
; ---------------------------------------------------------------------------
menu_sel_musicroom:
nopcall @musicroom_menu$qv
jmp short loc_A19A
; ---------------------------------------------------------------------------
menu_sel_hiscore:
call score_menu
jmp short loc_A1DB
; ---------------------------------------------------------------------------
menu_sel_option:
mov _main_menu_initialized, 0
mov _in_option, 1
mov _menu_sel, 0
jmp short loc_A1DB
; ---------------------------------------------------------------------------
menu_sel_quit:
mov _main_menu_initialized, 0
mov _quit, 1
loc_A1DB:
test _input_sp.hi, high INPUT_CANCEL
jz short loc_A1E7
mov _quit, 1
loc_A1E7:
cmp _input_sp, INPUT_NONE
jz short @@no_main_input_allowed
mov _main_input_allowed, 0
@@no_main_input_allowed:
pop si
pop bp
retn
main_update_and_render endp
; ---------------------------------------------------------------------------
db 0
off_A1F7 dw offset menu_sel_start
dw offset menu_sel_vs_start
dw offset menu_sel_musicroom
dw offset menu_sel_hiscore
dw offset menu_sel_option
dw offset menu_sel_quit
; =============== 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_A24A
call text_clear
call sub_B0AF
mov _option_input_allowed, 0
xor si, si
jmp short loc_A235
; ---------------------------------------------------------------------------
loc_A21F:
push si
mov al, _menu_sel
cbw
cmp ax, si
jnz short loc_A22D
mov ax, TX_WHITE
jmp short loc_A230
; ---------------------------------------------------------------------------
loc_A22D:
mov ax, TX_BLACK
loc_A230:
push ax
call option_put
inc si
loc_A235:
cmp si, 4
jl short loc_A21F
mov _putfunc, offset option_put
mov _option_initialized, 1
mov _option_input_allowed, 0