forked from nmlgc/ReC98
-
Notifications
You must be signed in to change notification settings - Fork 0
/
th04_maine.asm
8037 lines (7366 loc) · 133 KB
/
th04_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
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 : 50C37C4BDDEC04B753524F5D3B030A96
; File Name : th04/MAINE.EXE
; Format : MS-DOS executable (EXE)
; Base Address: 0h Range: 0h-126D0h Loaded length: 10062h
; Entry Point : 0:0
; OS type : MS DOS
; Application type: Executable 16bit
.286 ; Force the .model directive to create 16-bit default segments...
.model large
__LARGE__ equ 1
.386 ; ... then switch to what we actually need.
; And yes, we can't move this to an include file for some reason.
include ReC98.inc
include th04/th04.asm
extern _execl:proc
extern _memcpy:proc
extern _tolower:proc
; ===========================================================================
; 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_filesize.asm
include libs/master.lib/dos_keyclear.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_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_byteboxfill_x.asm
include libs/master.lib/grcg_setcolor.asm
include libs/master.lib/gdc_outpw.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_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_hide.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_scrollup.asm
include libs/master.lib/graph_show.asm
include libs/master.lib/js_end.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/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_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.asm
include libs/master.lib/pfint21.asm
db 0
include libs/master.lib/js_start.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_pack_put_8_noclip.asm
include libs/master.lib/graph_gaiji_puts.asm
include libs/master.lib/graph_gaiji_putc.asm
_TEXT ends
; ===========================================================================
; Segment type: Pure code
maine_01_TEXT segment byte public 'CODE' use16
assume cs:maine_01_TEXT
;org 9
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
sub_A059 proc near
var_A = byte ptr -0Ah
var_4 = word ptr -4
enter 0Ah, 0
push si
push ds
push offset aMiko_cfg ; "MIKO.CFG"
call file_ropen
push ss
lea ax, [bp+var_A]
push ax
push 0Ah
call file_read
call file_close
mov si, [bp+var_4]
mov word ptr _humaconfig+2, si
mov word ptr _humaconfig, 0
mov ax, si
pop si
leave
retn
sub_A059 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
; int __stdcall sub_A08A(char *arg0)
sub_A08A proc near
_arg0 = dword ptr 4
push bp
mov bp, sp
call _cdg_freeall
call graph_hide
call text_clear
call gaiji_restore
call sub_D3F4
pushd 0
pushd [bp+_arg0] ; arg0
pushd [bp+_arg0] ; path
call _execl
add sp, 0Ch
pop bp
retn 4
sub_A08A endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A0BD proc near
push bp
mov bp, sp
les bx, _humaconfig
mov al, es:[bx+12h]
les bx, off_E5C0
mov es:[bx+3], al
les bx, _humaconfig
mov al, es:[bx+19h]
add al, 30h ; '0'
les bx, off_E5C0
mov es:[bx+4], al
les bx, _humaconfig
mov al, es:[bx+25h]
les bx, off_E5C0
mov es:[bx+5], al
push word ptr off_E5C0+2
push bx
call sub_A292
call sub_ADFC
call sub_A2D1
pop bp
retn
sub_A0BD 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
var_4 = dword ptr -4
_argc = word ptr 6
_argv = dword ptr 8
_envp = dword ptr 0Ch
enter 4, 0
mov word ptr [bp+var_4+2], ds
mov word ptr [bp+var_4], 0A8h ; 'ィ'
call sub_A059
or ax, ax
jz locret_A290
les bx, _humaconfig
mov al, es:[bx+12h]
les bx, [bp+var_4]
mov es:[bx+4], al
mov word_10070, 5208h
push ds
push offset aMSzlEd_dat ; "幻想郷ed.dat"
call sub_D43C
call gaiji_backup
push ds
push offset aGameft_bft ; "GAMEFT.bft"
call gaiji_entry_bfnt
les bx, _humaconfig
mov al, es:[bx+10h]
mov ah, 0
push ax
mov al, es:[bx+18h]
mov ah, 0
push ax
call snd_determine_modes
call graph_show
les bx, _humaconfig
cmp byte ptr es:[bx+30h], 0FEh
jb loc_A1FE
call sub_A0BD
call sub_B44D
call sub_C0F8
les bx, _humaconfig
cmp byte ptr es:[bx+30h], 0FFh
jz short loc_A187
cmp byte ptr es:[bx+0Fh], 0
jnz short loc_A1E9
loc_A187:
les bx, [bp+var_4]
mov al, es:[bx+5]
les bx, _humaconfig
add al, es:[bx+0Fh]
les bx, [bp+var_4]
mov es:[bx+5], al
graph_accesspage 1
call pi_slot_load pascal, 0, word ptr [bp+var_4+2], bx
call pi_slot_palette_apply pascal, 0
call pi_slot_put pascal, large 0, 0
freePISlotLarge 0
push 0
call graph_copy_page
push 1
call palette_black_in
push 0
call _input_wait_for_change
push 4
call palette_black_out
loc_A1E9:
kajacall KAJA_SONG_FADE, 4
push 64h ; 'd'
call frame_delay
call sub_C814
jmp loc_A281
; ---------------------------------------------------------------------------
loc_A1FE:
les bx, _humaconfig
cmp byte ptr es:[bx+30h], 0FDh
jnz short loc_A274
push 64h ; 'd'
call frame_delay
call sub_C814
les bx, [bp+var_4]
mov byte ptr es:[bx+5], 34h ; '4'
mov PaletteTone, 0
call far ptr palette_show
graph_accesspage 1
call pi_slot_load pascal, 0, large [bp+var_4]
call pi_slot_palette_apply pascal, 0
call pi_slot_put pascal, large 0, 0
freePISlotLarge 0
push 0
call graph_copy_page
push 1
call palette_black_in
push 0
call _input_wait_for_change
push 4
call palette_black_out
jmp short loc_A27E
; ---------------------------------------------------------------------------
loc_A274:
push 64h ; 'd'
call frame_delay
call sub_C814
loc_A27E:
call sub_C0F8
loc_A281:
kajacall KAJA_SONG_FADE, 4
push ds
push offset arg0 ; "op"
call sub_A08A
locret_A290:
leave
retf
_main endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A292 proc near
var_2 = word ptr -2
arg_0 = dword ptr 4
enter 2, 0
call sub_A2D1
pushd [bp+arg_0]
call file_ropen
or ax, ax
jnz short loc_A2AD
mov ax, 1
leave
retn 4
; ---------------------------------------------------------------------------
loc_A2AD:
call file_size
mov [bp+var_2], ax
mov word_12478, 1F48h
push ds
push word_12478
push ax
call file_read
call file_close
xor ax, ax
leave
retn 4
sub_A292 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A2D1 proc near
push bp
mov bp, sp
pop bp
retn
sub_A2D1 endp
EGC_START_COPY_DEF 1, near
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A30A proc near
var_4 = 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 ax, [bp+arg_2]
sar ax, 3
mov dx, [bp+arg_0]
shl dx, 6
add ax, dx
mov dx, [bp+arg_0]
shl dx, 4
add ax, dx
mov si, ax
call egc_start_copy_1
xor di, di
jmp short loc_A368
; ---------------------------------------------------------------------------
loc_A32F:
mov [bp+var_2], 0
jmp short loc_A35E
; ---------------------------------------------------------------------------
loc_A336:
graph_accesspage 0
les bx, _VRAM_PLANE_B
add bx, si
mov ax, es:[bx]
mov [bp+var_4], ax
mov al, 1
out dx, al
mov bx, word ptr _VRAM_PLANE_B
add bx, si
mov ax, [bp+var_4]
mov es:[bx], ax
add [bp+var_2], 2
add si, 2
loc_A35E:
cmp [bp+var_2], 28h ; '('
jl short loc_A336
inc di
add si, 28h ; '('
loc_A368:
cmp di, 0C8h
jl short loc_A32F
call egc_off
graph_accesspage 0
pop di
pop si
leave
retn 4
sub_A30A endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A37F proc near
var_8 = dword ptr -8
var_4 = word ptr -4
var_2 = word ptr -2
arg_0 = word ptr 4
arg_2 = word ptr 6
arg_4 = word ptr 8
arg_6 = word ptr 0Ah
enter 8, 0
push si
push di
mov eax, _pi_slot_buffers
mov [bp+var_8], eax
cmp [bp+arg_2], 1
jnz short loc_A39A
add word ptr [bp+var_8], 0A0h
jmp short loc_A3B2
; ---------------------------------------------------------------------------
loc_A39A:
cmp [bp+arg_2], 2
jnz short loc_A3A7
add word ptr [bp+var_8], 0FA00h
jmp short loc_A3B2
; ---------------------------------------------------------------------------
loc_A3A7:
cmp [bp+arg_2], 3
jnz short loc_A3B2
add word ptr [bp+var_8], 0FAA0h
loc_A3B2:
mov eax, [bp+var_8]
shr eax, 10h
mov dx, word ptr [bp+var_8]
shr dx, 4
add ax, dx
mov dx, word ptr [bp+var_8]
and dx, 0Fh
mov word ptr [bp+var_8+2], ax
mov word ptr [bp+var_8], dx
graph_showpage 1
mov ax, [bp+arg_6]
sar ax, 3
mov dx, [bp+arg_4]
shl dx, 6
add ax, dx
mov dx, [bp+arg_4]
shl dx, 4
add ax, dx
mov si, ax
graph_accesspage 0
xor di, di
jmp loc_A491
; ---------------------------------------------------------------------------
loc_A3F7:
call graph_pack_put_8_noclip pascal, large 400, [bp+var_8], 320
call egc_start_copy_1
egc_selectpat
egc_setrop EGC_COMPAREREAD or EGC_WS_PATREG or EGC_RL_MEMREAD
outw2 EGC_BITLENGTHREG, 0Fh
mov bx, [bp+arg_0]
shl bx, 3
mov ax, di
and ax, 3
add ax, ax
add bx, ax
outw2 EGC_MASKREG, [bx+60Ch]
mov [bp+var_4], 7D00h
mov [bp+var_2], 0
jmp short loc_A461
; ---------------------------------------------------------------------------
loc_A444:
les bx, _VRAM_PLANE_B
add bx, [bp+var_4]
mov ax, es:[bx]
mov bx, word ptr _VRAM_PLANE_B
add bx, si
mov es:[bx], ax
inc [bp+var_2]
add si, 2
add [bp+var_4], 2
loc_A461:
cmp [bp+var_2], 14h
jl short loc_A444
call egc_off
add si, 28h ; '('
add word ptr [bp+var_8], 140h
mov eax, [bp+var_8]
shr eax, 10h
mov dx, word ptr [bp+var_8]
shr dx, 4
add ax, dx
mov dx, word ptr [bp+var_8]
and dx, 0Fh
mov word ptr [bp+var_8+2], ax
mov word ptr [bp+var_8], dx
inc di
loc_A491:
cmp di, 0C8h
jl loc_A3F7
graph_showpage 0
push [bp+arg_6]
push [bp+arg_4]
call sub_A30A
pop di
pop si
leave
retn 8
sub_A37F endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A4AE proc near
var_8 = word ptr -8
var_6 = word ptr -6
var_4 = word ptr -4
var_2 = word ptr -2
enter 8, 0
push si
push di
call sub_A57F
graph_accesspage 0
push 3C00h
call hmem_allocbyte
mov word ptr dword_1247A+2, ax
mov word ptr dword_1247A, 0
xor si, si
mov di, 140h
mov [bp+var_4], 0
jmp loc_A573
; ---------------------------------------------------------------------------
loc_A4DB:
mov [bp+var_2], 50h ; 'P'
mov [bp+var_6], 0
jmp loc_A567
; ---------------------------------------------------------------------------
loc_A4E8:
mov ax, [bp+var_2]
sar ax, 3
mov dx, di
shl dx, 6
add ax, dx
mov dx, di
shl dx, 4
add ax, dx
mov [bp+var_8], ax
les bx, _VRAM_PLANE_B
add bx, [bp+var_8]
mov ax, es:[bx]
mov dx, si
add dx, dx
les bx, dword_1247A
add bx, dx
mov es:[bx], ax
inc si
les bx, _VRAM_PLANE_R
add bx, [bp+var_8]
mov ax, es:[bx]
mov dx, si
add dx, dx
les bx, dword_1247A
add bx, dx
mov es:[bx], ax
inc si
les bx, _VRAM_PLANE_G
add bx, [bp+var_8]
mov ax, es:[bx]
mov dx, si
add dx, dx
les bx, dword_1247A
add bx, dx
mov es:[bx], ax
inc si
les bx, _VRAM_PLANE_E
add bx, [bp+var_8]
mov ax, es:[bx]
mov dx, si
add dx, dx
les bx, dword_1247A
add bx, dx
mov es:[bx], ax
inc si
add [bp+var_6], 2
add [bp+var_2], 10h
loc_A567:
cmp [bp+var_6], 3Ch ; '<'
jl loc_A4E8
inc [bp+var_4]
inc di
loc_A573:
cmp [bp+var_4], 40h
jl loc_A4DB
pop di
pop si
leave
retn
sub_A4AE endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A57F proc near
push bp
mov bp, sp
cmp dword_1247A, 0
jz short loc_A59C
push word ptr dword_1247A+2
call hmem_free
mov dword_1247A, 0
loc_A59C:
pop bp
retn
sub_A57F endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A59E proc near
var_6 = word ptr -6
var_4 = word ptr -4
var_2 = word ptr -2
enter 6, 0
push si
push di
xor cx, cx
mov si, 140h
mov [bp+var_4], 0
jmp loc_A641
; ---------------------------------------------------------------------------
loc_A5B1:
mov [bp+var_2], 50h ; 'P'
mov [bp+var_6], 0
jmp short loc_A637
; ---------------------------------------------------------------------------
loc_A5BD:
mov ax, [bp+var_2]
sar ax, 3
mov dx, si
shl dx, 6
add ax, dx
mov dx, si
shl dx, 4
add ax, dx
mov di, ax
mov ax, cx
add ax, ax
les bx, dword_1247A
add bx, ax
mov ax, es:[bx]
les bx, _VRAM_PLANE_B
add bx, di
mov es:[bx], ax
inc cx
mov ax, cx
add ax, ax
les bx, dword_1247A
add bx, ax
mov ax, es:[bx]
les bx, _VRAM_PLANE_R
add bx, di
mov es:[bx], ax
inc cx
mov ax, cx
add ax, ax
les bx, dword_1247A
add bx, ax
mov ax, es:[bx]
les bx, _VRAM_PLANE_G
add bx, di
mov es:[bx], ax
inc cx
mov ax, cx
add ax, ax
les bx, dword_1247A
add bx, ax
mov ax, es:[bx]
les bx, _VRAM_PLANE_E
add bx, di
mov es:[bx], ax
inc cx
add [bp+var_6], 2
add [bp+var_2], 10h
loc_A637:
cmp [bp+var_6], 3Ch ; '<'
jl short loc_A5BD
inc [bp+var_4]
inc si
loc_A641:
cmp [bp+var_4], 40h
jl loc_A5B1
pop di
pop si
leave
retn
sub_A59E endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A64D proc near
var_2 = byte ptr -2
var_1 = byte ptr -1
arg_0 = dword ptr 4
enter 2, 0
mov bx, word_12478
mov cl, [bx]
inc word_12478
mov bx, word_12478
mov al, [bx]
mov [bp+var_1], al
inc word_12478
mov bx, word_12478
mov al, [bx]
mov [bp+var_2], al
inc word_12478
mov al, cl
mov ah, 0
mov bx, ax
test byte ptr [bx+0B69h], 2
jnz short loc_A694
les bx, [bp+arg_0]
mov ax, word_124C4
mov es:[bx], ax
sub word_12478, 3
leave
retn 4
; ---------------------------------------------------------------------------
loc_A694:
mov al, [bp+var_1]
mov ah, 0
mov bx, ax
test byte ptr [bx+0B69h], 2
jnz short loc_A6B8
mov al, cl
mov ah, 0
add ax, 0FFD0h
les bx, [bp+arg_0]
mov es:[bx], ax
sub word_12478, 2
leave
retn 4
; ---------------------------------------------------------------------------
loc_A6B8:
mov al, [bp+var_2]
mov ah, 0
mov bx, ax
test byte ptr [bx+0B69h], 2
jnz short loc_A6E8
mov al, cl
mov ah, 0
add ax, 0FFD0h
imul ax, 0Ah
mov dl, [bp+var_1]
mov dh, 0
add ax, dx
add ax, 0FFD0h
les bx, [bp+arg_0]
mov es:[bx], ax
dec word_12478
leave
retn 4
; ---------------------------------------------------------------------------
loc_A6E8:
mov al, cl
mov ah, 0
add ax, 0FFD0h
imul ax, 64h
mov dl, [bp+var_1]
mov dh, 0
add dx, 0FFD0h
imul dx, 0Ah
add ax, dx
mov dl, [bp+var_2]
mov dh, 0
add ax, dx
add ax, 0FFD0h
les bx, [bp+arg_0]
mov es:[bx], ax
leave
retn 4
sub_A64D endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A713 proc near
arg_0 = dword ptr 4
push bp
mov bp, sp
mov bx, word_12478
cmp byte ptr [bx], 2Ch ; ','
jnz short loc_A72E
inc word_12478
pushd [bp+arg_0]
call sub_A64D
pop bp
retn 4
; ---------------------------------------------------------------------------
loc_A72E:
les bx, [bp+arg_0]
mov ax, word_124C4
mov es:[bx], ax
pop bp
retn 4
sub_A713 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A73B proc near
push bp
mov bp, sp
add word_124BC, 10h
cmp word_124BC, 230h
jl short loc_A78D
add word_124BE, 10h
mov word_124BC, 90h
cmp word_124BE, 180h
jl short loc_A78D
call sub_A815
cmp byte_1247E, 0
jnz short loc_A76F
push 0
call _input_wait_for_change
loc_A76F:
mov word_124BC, 50h ; 'P'
mov word_124BE, 140h
graph_accesspage 1
call sub_A59E
graph_accesspage 0
call sub_A59E
loc_A78D:
pop bp
retn
sub_A73B endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A78F proc near
var_2 = word ptr -2
arg_0 = word ptr 4
enter 2, 0
push si
push di
mov cx, 140h
jmp short loc_A809
; ---------------------------------------------------------------------------
loc_A79A:
egc_selectpat
egc_setrop EGC_COMPAREREAD or EGC_WS_PATREG or EGC_RL_MEMREAD
outw2 EGC_BITLENGTHREG, 0Fh
mov bx, [bp+arg_0]
shl bx, 3
mov ax, cx
and ax, 3
add ax, ax
add bx, ax
outw2 EGC_MASKREG, [bx+62Ch]
mov ax, cx
shl ax, 6
mov dx, cx
shl dx, 4
add ax, dx
add ax, 0Ah
mov si, ax
xor di, di
jmp short loc_A802