-
Notifications
You must be signed in to change notification settings - Fork 0
/
seg024.asm
2005 lines (1942 loc) · 32.9 KB
/
seg024.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
; Segment type: Pure code
seg024 segment para public 'DATA' use16
assume cs:seg024
assume es:nothing, ss:nothing, ds:dseg, fs:nothing, gs:nothing
mouseMovedP dw offset g_mouseMoved
mouseXP dw offset g_mouseX
mouseYP dw offset g_mouseY
g_joystickPresentFlag_P dw offset g_joystickPresentFlag
byte_4EF79_P dw offset byte_4EF79
byte_4EF7A_P dw offset byte_4EF7A
off_3E95C dd monsterBuf
off_3E960 dd monsterBuf
characterBitmasksP dd characterBitmasks
vid_setMode proc near
jmp near ptr _vid_setMode
vid_setMode endp
; Attributes: thunk
gfx_fillRectangle proc near
jmp near ptr sub_3EF35
gfx_fillRectangle endp
; Attributes: thunk
gfx_highlightLine proc near
jmp near ptr sub_3F426
gfx_highlightLine endp
; Attributes: thunk
gfx_enableMouseIcon proc near
jmp near ptr sub_3F603
gfx_enableMouseIcon endp
; Attributes: thunk
gfx_disableMouseIcon proc near
jmp near ptr sub_3F6A9
gfx_disableMouseIcon endp
; Attributes: thunk
gfx_drawMouseIcon proc near
jmp near ptr sub_3F714
gfx_drawMouseIcon endp
; Attributes: thunk
gfx_writeCharacter proc near
jmp near ptr sub_3F0D2
gfx_writeCharacter endp
; Attributes: thunk
gfx_drawFullscreenImage proc near
jmp near ptr sub_3F1CA
gfx_drawFullscreenImage endp
; Attributes: thunk
gfx_scrollTextWindow proc near
jmp near ptr sub_3F2C2
gfx_scrollTextWindow endp
vid_drawBigpic proc near
jmp near ptr _vid_drawBigpic
vid_drawBigpic endp
; Attributes: thunk
gfx_drawMagicIcon proc near
jmp sub_3F490
gfx_drawMagicIcon endp
; Attributes: thunk
sub_3E989 proc far
jmp near ptr sub_3F899
sub_3E989 endp
; Attributes: thunk
sub_3E98C proc far
jmp near ptr sub_3F7C1
sub_3E98C endp
; Attributes: thunk
sub_3E98F proc near
jmp near ptr sub_3F919
sub_3E98F endp
; Attributes: thunk
j_nullsub_3 proc near
jmp near ptr nullsub_3
j_nullsub_3 endp
; Attributes: thunk
j_nullsub_2 proc near
jmp near ptr nullsub_2
j_nullsub_2 endp
; Attributes: thunk
vid_setMouseIcon proc near
jmp near ptr _vid_setMouseIcon
vid_setMouseIcon endp
; Attributes: thunk
sub_3E99B proc far
jmp near ptr sub_3F95D
sub_3E99B endp
byte_3E99E db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9; 0
db 0Ah, 0Bh, 0Ch, 0Dh, 0Eh, 0Fh; 10
unk_3E9AE db 3
dword_3E9AF dd 0A0001F40h
word_3E9B3 dw 0
word_3E9B5 dw 0
word_3E9B7 dw 0
byte_3E9B9 db 0
byte_3E9BA db 0
byte_3E9BB db 0
byte_3E9BC db 0FFh, 7Fh, 3Fh, 1Fh, 0Fh, 7, 3, 1; 0
byte_3E9C4 db 80h, 0C0h, 0E0h, 0F0h, 0F8h, 0FCh, 0FEh, 0FFh; 0
byte_3E9CC db 1, 0, 2, 0, 3, 0, 4, 0, 5, 0; 0
db 6 ; 10
byte_3E9D7 db 0
db 7
db 0
db 8
db 0
db 0
db 0
db 0
db 0
db 0
db 0
word_3E9E2 dw 0A000h
vid_mouseY dw 0
vid_mouseX dw 0
vid_mouseIndex dw 0
vid_mouseBuf db 0C0h dup(0) ; 0
byte_3EAAA db 0, 0, 31, 192, 63, 240, 127, 248, 117, 248, 123, 248, 126, 88, 97, 152
db 127, 248, 62, 24, 63, 240, 31, 224, 6, 192, 0, 0, 0, 0, 0, 0
db 0, 0, 31, 192, 63, 240, 127, 248, 117, 248, 123, 248, 126, 88, 97, 152
db 127, 248, 62, 24, 63, 240, 31, 224, 6, 192, 0, 0, 0, 0, 0, 0
db 0, 0, 31, 192, 63, 240, 127, 248, 117, 248, 123, 248, 126, 88, 97, 152
db 127, 248, 62, 24, 63, 240, 31, 224, 6, 192, 0, 0, 0, 0, 0, 0
db 0, 0, 31, 192, 32, 48, 94, 8, 68, 8, 73, 232, 94, 72, 64, 136
db 65, 232, 38, 8, 40, 208, 25, 32, 6, 192, 0, 0, 0, 0, 0, 0
db 0, 0, 31, 192, 35, 240, 94, 120, 68, 24, 73, 232, 94, 72, 64, 136
db 65, 232, 38, 8, 43, 208, 25, 96, 6, 192, 0, 0, 0, 0, 0, 0
byte_3EB4A db 0, 0, 1, 0, 3, 128, 7, 192, 15, 224, 31, 240, 7, 192, 7, 192
db 7, 192, 7, 192, 7, 192, 7, 192, 7, 192, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 1, 0, 3, 128, 7, 192, 3, 128, 3, 128, 3, 128
db 3, 128, 3, 128, 3, 128, 3, 128, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 1, 0, 2, 128, 4, 64, 8, 32, 28, 112, 4, 64, 4, 64
db 4, 64, 4, 64, 4, 64, 4, 64, 7, 192, 0, 0, 0, 0, 0, 0
db 0, 0, 1, 0, 3, 128, 7, 192, 15, 224, 31, 240, 7, 192, 4, 64
db 3, 128, 4, 64, 3, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
byte_3EBEA db 0, 0, 7, 224, 15, 240, 31, 248, 31, 248, 31, 120, 31, 120, 31, 0
db 127, 192, 63, 128, 31, 0, 14, 0, 4, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 7, 224, 15, 240, 14, 48, 14, 48, 14, 0, 14, 0
db 14, 0, 31, 0, 14, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 7, 224, 8, 16, 16, 8, 17, 200, 17, 72, 17, 120, 17, 0
db 113, 192, 32, 128, 17, 0, 10, 0, 4, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 8, 0, 0, 0, 30, 128, 1, 0, 31, 0, 17, 0
db 127, 192, 63, 128, 31, 0, 14, 0, 4, 0, 0, 0, 0, 0, 0, 0
byte_3EC8A db 0, 0, 0, 0, 4, 0, 12, 0, 31, 224, 63, 240, 127, 248, 63, 248
db 31, 248, 12, 248, 4, 248, 0, 248, 0, 248, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 31, 224, 63, 240, 31, 240
db 8, 112, 0, 112, 0, 112, 0, 112, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 4, 0, 12, 0, 23, 224, 32, 16, 64, 8, 32, 8
db 23, 136, 12, 136, 4, 136, 0, 136, 0, 248, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 4, 0, 12, 0, 29, 64, 61, 16, 125, 32, 61, 64
db 30, 128, 12, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
byte_3ED2A db 0, 0, 0, 128, 0, 192, 31, 224, 63, 240, 127, 248, 127, 240, 127, 224
db 124, 192, 124, 128, 124, 0, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 64, 31, 224, 63, 240, 63, 224, 56, 64
db 56, 0, 56, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 128, 0, 192, 31, 160, 32, 16, 64, 8, 64, 16, 71, 160
db 68, 192, 68, 128, 68, 0, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 128, 0, 192, 10, 224, 34, 240, 18, 248, 10, 240, 5, 224
db 0, 192, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
byte_3EDCA db 0, 0, 48, 0, 56, 0, 28, 0, 15, 0, 15, 128, 31, 192, 27, 224
db 31, 240, 31, 240, 15, 248, 1, 248, 0, 112, 0, 0, 0, 0, 0, 0
db 0, 0, 48, 0, 24, 0, 12, 0, 7, 0, 11, 128, 27, 192, 19, 224
db 3, 240, 31, 240, 1, 248, 0, 120, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 32, 0, 16, 0, 8, 0, 4, 0, 4, 0, 8, 0
db 28, 0, 0, 0, 14, 0, 1, 128, 0, 112, 0, 0, 0, 0, 0, 0
db 0, 0, 48, 0, 56, 0, 28, 0, 15, 0, 15, 128, 31, 192, 27, 224
db 31, 240, 31, 240, 15, 248, 1, 248, 0, 112, 0, 0, 0, 0, 0, 0
db 0, 0, 48, 0, 24, 0, 12, 0, 7, 0, 11, 128, 27, 192, 19, 224
db 3, 240, 31, 240, 1, 248, 0, 120, 0, 0, 0, 0, 0, 0, 0, 0
byte_3EE6A db 0, 0, 3, 192, 7, 224, 15, 240, 15, 248, 15, 248, 63, 248, 63, 248
db 63, 248, 63, 248, 31, 248, 15, 240, 7, 224, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 1, 64, 5, 64, 5, 80, 5, 80, 7, 240, 23, 240
db 25, 240, 30, 240, 15, 240, 3, 224, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 3, 192, 6, 160, 10, 176, 10, 168, 10, 168, 56, 8, 40, 8
db 38, 8, 33, 8, 16, 8, 12, 16, 7, 224, 0, 0, 0, 0, 0, 0
db 0, 0, 3, 192, 7, 224, 15, 240, 15, 248, 15, 248, 63, 248, 63, 248
db 63, 248, 63, 248, 31, 248, 15, 240, 7, 224, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 1, 64, 5, 64, 5, 80, 5, 80, 7, 240, 23, 240
db 25, 240, 30, 240, 15, 240, 3, 224, 0, 0, 0, 0, 0, 0, 0, 0
currentMouseIcon dw offset byte_3EAAA
mouseIconList dw offset byte_3EAAA
dw offset byte_3EB4A
dw offset byte_3EBEA
dw offset byte_3EC8A
dw offset byte_3ED2A
dw offset byte_3EDCA
dw offset byte_3EE6A
dw offset byte_3EE6A
; Attributes: bp-based frame
_vid_setMode proc far
arg_0= word ptr 6
push bp
mov bp, sp
mov ax, [bp+arg_0]
or ax, ax
jz short loc_3EF2E
mov ax, 0Dh
int 10h ; - VIDEO - SET VIDEO MODE
; AL = mode
jmp short loc_3EF33
db 90h ;
loc_3EF2E:
mov ax, 3
int 10h ; - VIDEO - SET VIDEO MODE
; AL = mode
loc_3EF33:
pop bp
retf
_vid_setMode endp
; Attributes: bp-based frame
sub_3EF35 proc far
arg_0= word ptr 6
arg_2= word ptr 8
arg_4= word ptr 0Ah
arg_6= word ptr 0Ch
arg_8= byte ptr 0Eh
push bp
mov bp, sp
push es
push ds
push si
push di
mov ax, cs
mov ds, ax
assume ds:seg024
mov ax, [bp+arg_2]
mov cx, ax
shl ax, 1
shl ax, 1
shl ax, 1
mov bx, ax
shl ax, 1
shl ax, 1
add ax, bx
mov cs:word_3E9B3, ax ; word_3E9B3 = arg_2 * 40
mov ax, [bp+arg_6]
sub ax, cx
inc ax
mov cs:word_3E9B5, ax ; word_3E9B5 = (arg_6 - arg_2) + 1
mov al, [bp+arg_8]
not al
mov cs:byte_3E9B9, al
mov cs:byte_3E9BA, 0
mov cs:byte_3E9BB, 1
mov dx, 3C4h
mov al, 2
out dx, al ; EGA: sequencer address reg
; map mask: data bits 0-3 enable writes to bit planes 0-3
mov dx, 3CEh
mov al, 4
out dx, al ; EGA: graph 1 and 2 addr reg:
; read map select.
; Data bits 0-2 select map # for read mode 00.
mov ax, [bp+arg_0]
mov bx, ax
and bx, 7
mov dh, cs:byte_3E9BC[bx]
mov cx, [bp+arg_4]
mov bx, cx
and bx, 7
mov dl, cs:byte_3E9C4[bx]
mov bx, cx
mov cl, 3
shr ax, cl
shr bx, cl
add cs:word_3E9B3, ax
cmp ax, bx
jnz short loc_3F003
and dh, dl
mov bl, dh
loc_3EFB1:
mov dx, 3C5h
mov al, cs:byte_3E9BB
shl cs:byte_3E9BB, 1
out dx, al ; EGA port: sequencer data register
mov dx, 3CFh
mov al, cs:byte_3E9BA
out dx, al ; EGA port: graphics controller data register
sub bh, bh
rcr cs:byte_3E9B9, 1
rcl bh, 1
dec bh
and bh, bl
not bl
mov cx, cs:word_3E9B5
mov di, cs:word_3E9B3
mov ax, ds
mov ds, cs:word_3E9E2
assume ds:nothing
loc_3EFE6:
and [di], bl
or [di], bh
add di, 28h
loop loc_3EFE6
mov ds, ax
assume ds:seg024
not bl
inc cs:byte_3E9BA
cmp cs:byte_3E9BA, 4
jnz short loc_3EFB1
jmp loc_3F0CC
loc_3F003:
dec bx
cmp ax, bx
jnz short loc_3F05D
mov ax, dx
xchg al, ah
mov bx, ax
loc_3F00E:
mov dx, 3C5h
mov al, cs:byte_3E9BB
shl cs:byte_3E9BB, 1
out dx, al ; EGA port: sequencer data register
mov dx, 3CFh
mov al, cs:byte_3E9BA
out dx, al ; EGA port: graphics controller data register
sub ax, ax
rcr cs:byte_3E9B9, 1
rcl ax, 1
dec ax
and ax, bx
not bx
mov cx, cs:word_3E9B5
mov di, cs:word_3E9B3
push ds
mov ds, cs:word_3E9E2
assume ds:nothing
loc_3F041:
and [di], bx
or [di], ax
add di, 28h
loop loc_3F041
pop ds
assume ds:dseg
not bx
inc cs:byte_3E9BA
cmp cs:byte_3E9BA, 4
jnz short loc_3F00E
jmp short loc_3F0CC
db 90h ;
loc_3F05D:
inc bx
sub bx, ax
dec bx
mov bp, bx
inc bx
neg bx
add bx, 28h
mov si, bx
not dx
mov bx, dx
mov es, cs:word_3E9E2
assume es:nothing
loc_3F074:
mov dx, 3C5h
mov al, cs:byte_3E9BB
shl cs:byte_3E9BB, 1
out dx, al ; EGA port: sequencer data register
mov dx, 3CFh
mov al, cs:byte_3E9BA
out dx, al ; EGA port: graphics controller data register
sub dx, dx
rcr cs:byte_3E9B9, 1
rcl dx, 1
dec dx
mov al, dl
not bx
and dx, bx
not bx
mov di, cs:word_3E9B3
mov ah, byte ptr cs:word_3E9B5
push ds
mov ds, cs:word_3E9E2
assume ds:nothing
loc_3F0AB:
and [di], bh
or [di], dh
inc di
mov cx, bp
rep stosb
and [di], bl
or [di], dl
add di, si
dec ah
jnz short loc_3F0AB
pop ds
assume ds:dseg
inc cs:byte_3E9BA
cmp cs:byte_3E9BA, 4
jnz short loc_3F074
loc_3F0CC:
pop di
pop si
pop ds
pop es
assume es:nothing
pop bp
retf
sub_3EF35 endp
; Attributes: bp-based frame
sub_3F0D2 proc far
arg_0= word ptr 6
arg_2= word ptr 8
arg_4= word ptr 0Ah
arg_6= byte ptr 0Ch
push bp
mov bp, sp
push si
push di
push es
push ds
mov ax, cs
mov es, ax
assume es:seg024
lds si, cs:characterBitmasksP
mov ax, [bp+arg_4]
sub ah, ah
shl ax, 1
shl ax, 1
shl ax, 1
add si, ax
mov di, offset byte_3E9CC
mov cl, byte ptr [bp+arg_2]
and cl, 7
cld
sub ax, ax
lodsb
ror ax, cl
stosw
sub ax, ax
lodsb
ror ax, cl
stosw
sub ax, ax
lodsb
ror ax, cl
stosw
sub ax, ax
lodsb
ror ax, cl
stosw
sub ax, ax
lodsb
ror ax, cl
stosw
sub ax, ax
lodsb
ror ax, cl
stosw
sub ax, ax
lodsb
ror ax, cl
stosw
sub ax, ax
lodsb
ror ax, cl
stosw
mov ax, es
mov ds, ax
assume ds:seg024
mov ax, 0A000h
mov es, ax
assume es:nothing
mov si, offset byte_3E9CC
mov dx, [bp+arg_0]
and dl, 0FEh
shl dx, 1
shl dx, 1
shl dx, 1
mov di, dx
shl dx, 1
shl dx, 1
add di, dx
mov ax, [bp+arg_2]
shr ax, 1
shr ax, 1
shr ax, 1
add di, ax
mov dx, 3C4h
mov al, 2
out dx, al ; EGA: sequencer address reg
; map mask: data bits 0-3 enable writes to bit planes 0-3
mov dx, 3CEh
mov al, 4
out dx, al ; EGA: graph 1 and 2 addr reg:
; read map select.
; Data bits 0-2 select map # for read mode 00.
mov bx, 1
test [bp+arg_6], 1
jnz short loc_3F196
loc_3F169:
push si
push di
mov dx, 3C5h
mov al, bl
shl bl, 1
out dx, al ; EGA port: sequencer data register
mov dx, 3CFh
mov al, bh
inc bh
out dx, al ; EGA port: graphics controller data register
mov cx, 4
loc_3F17E:
lodsw
or es:[di], ax
lodsw
or es:[di+28h], ax
add di, 50h
loop loc_3F17E
pop di
pop si
cmp bh, 4
jnz short loc_3F169
jmp short loc_3F1C4
db 90h ;
loc_3F196:
push si
push di
mov dx, 3C5h
mov al, bl
shl bl, 1
out dx, al ; EGA port: sequencer data register
mov dx, 3CFh
mov al, bh
inc bh
out dx, al ; EGA port: graphics controller data register
mov cx, 4
loc_3F1AB:
lodsw
not ax
and es:[di], ax
lodsw
not ax
and es:[di+28h], ax
add di, 50h
loop loc_3F1AB
pop di
pop si
cmp bh, 4
jnz short loc_3F196
loc_3F1C4:
pop ds
assume ds:dseg
pop es
assume es:nothing
pop di
pop si
pop bp
retf
sub_3F0D2 endp
; Attributes: bp-based frame
sub_3F1CA proc far
arg_0= dword ptr 6
arg_4= dword ptr 0Ah
push bp
mov bp, sp
push es
push si
push di
push ds
lds si, [bp+arg_0]
les di, [bp+arg_4]
mov al, 2
mov dx, 3C4h
out dx, al ; EGA: sequencer address reg
; map mask: data bits 0-3 enable writes to bit planes 0-3
inc dx
mov al, 0Fh
out dx, al ; EGA port: sequencer data register
mov bx, 8000
cld
loc_3F1E5:
lodsw
rcl al, 1
rcl dh, 1
rcl al, 1
rcl dl, 1
rcl al, 1
rcl ch, 1
rcl al, 1
rcl cl, 1
rcl al, 1
rcl dh, 1
rcl al, 1
rcl dl, 1
rcl al, 1
rcl ch, 1
rcl al, 1
rcl cl, 1
rcl ah, 1
rcl dh, 1
rcl ah, 1
rcl dl, 1
rcl ah, 1
rcl ch, 1
rcl ah, 1
rcl cl, 1
rcl ah, 1
rcl dh, 1
rcl ah, 1
rcl dl, 1
rcl ah, 1
rcl ch, 1
rcl ah, 1
rcl cl, 1
lodsw
rcl al, 1
rcl dh, 1
rcl al, 1
rcl dl, 1
rcl al, 1
rcl ch, 1
rcl al, 1
rcl cl, 1
rcl al, 1
rcl dh, 1
rcl al, 1
rcl dl, 1
rcl al, 1
rcl ch, 1
rcl al, 1
rcl cl, 1
rcl ah, 1
rcl dh, 1
rcl ah, 1
rcl dl, 1
rcl ah, 1
rcl ch, 1
rcl ah, 1
rcl cl, 1
rcl ah, 1
rcl dh, 1
rcl ah, 1
rcl dl, 1
rcl ah, 1
rcl ch, 1
rcl ah, 1
rcl cl, 1
mov es:[di+5DC0h], dh
mov es:[di+3E80h], dl
mov es:[di+1F40h], ch
mov es:[di], cl
inc di
dec bx
jz short loc_3F280
jmp loc_3F1E5
loc_3F280:
lds si, [bp+arg_4]
mov ax, 0A000h
mov es, ax
assume es:nothing
mov bl, 1
sub ch, ch
loc_3F28C:
mov dx, 3DAh
in al, dx ; Video status bits:
; 0: retrace. 1=display is in vert or horiz retrace.
; 1: 1=light pen is triggered; 0=armed
; 2: 1=light pen switch is open; 0=closed
; 3: 1=vertical sync pulse is occurring.
and al, 8
jz short loc_3F28C
loc_3F294:
mov dx, 3DAh
in al, dx ; Video status bits:
; 0: retrace. 1=display is in vert or horiz retrace.
; 1: 1=light pen is triggered; 0=armed
; 2: 1=light pen switch is open; 0=closed
; 3: 1=vertical sync pulse is occurring.
and al, 8
jnz short loc_3F294
mov al, 2
mov dx, 3C4h
out dx, al ; EGA: sequencer address reg
; map mask: data bits 0-3 enable writes to bit planes 0-3
loc_3F2A2:
xor di, di
mov al, bl
shl bl, 1
mov dl, 0C5h
out dx, al ; EGA port: sequencer data register
mov bh, 0C8h
mov dl, 14h
loc_3F2AF:
mov cl, dl
rep movsw
dec bh
jnz short loc_3F2AF
test bl, 10h
jz short loc_3F2A2
pop ds
pop di
pop si
pop es
assume es:nothing
pop bp
retf
sub_3F1CA endp
; Attributes: bp-based frame
sub_3F2C2 proc far
push bp
mov bp, sp
push si
push di
push es
push ds
mov ax, 0A000h
mov ds, ax
assume ds:nothing
mov es, ax
assume es:nothing
cld
mov cs:byte_3E9BA, 2
loc_3F2D7:
mov di, 105h
mov si, di
add si, 50h
mov dx, 3C4h
mov al, 2
out dx, al ; EGA: sequencer address reg
; map mask: data bits 0-3 enable writes to bit planes 0-3
mov dx, 3CEh
mov al, 4
out dx, al ; EGA: graph 1 and 2 addr reg:
; read map select.
; Data bits 0-2 select map # for read mode 00.
loc_3F2EB:
mov dx, 3DAh
in al, dx ; Video status bits:
; 0: retrace. 1=display is in vert or horiz retrace.
; 1: 1=light pen is triggered; 0=armed
; 2: 1=light pen switch is open; 0=closed
; 3: 1=vertical sync pulse is occurring.
and al, 8
jz short loc_3F2EB
loc_3F2F3:
mov dx, 3DAh
in al, dx ; Video status bits:
; 0: retrace. 1=display is in vert or horiz retrace.
; 1: 1=light pen is triggered; 0=armed
; 2: 1=light pen switch is open; 0=closed
; 3: 1=vertical sync pulse is occurring.
and al, 8
jnz short loc_3F2F3
sub ch, ch
mov dx, 3C5h
mov al, 0Fh
out dx, al ; EGA port: sequencer data register
mov dx, 3CFh
sub al, al
out dx, al ; EGA port: graphics controller data register
mov ax, 16h
mov dl, 9
mov bl, 60h
loc_3F310:
mov cl, dl
rep movsw
add si, ax
add di, ax
dec bl
jnz short loc_3F310
dec cs:byte_3E9BA
jnz short loc_3F2D7
pop ds
assume ds:dseg
pop es
assume es:nothing
pop di
pop si
pop bp
retf
sub_3F2C2 endp
; Attributes: bp-based frame
_vid_drawBigpic proc far
arg_0= dword ptr 6
arg_4= dword ptr 0Ah
push bp
mov bp, sp
push es
push si
push di
push ds
lds si, [bp+arg_0] ; source Buffer
les di, [bp+arg_4] ; destination buffer
mov al, 2
mov dx, 3C4h
out dx, al ; EGA: sequencer address reg
; map mask: data bits 0-3 enable writes to bit planes 0-3
inc dx
mov al, 0Fh
out dx, al ; EGA port: sequencer data register
mov bx, 4D0h
loc_3F343:
lodsw
rcl al, 1
rcl dh, 1
rcl al, 1
rcl dl, 1
rcl al, 1
rcl ch, 1
rcl al, 1
rcl cl, 1
rcl al, 1
rcl dh, 1
rcl al, 1
rcl dl, 1
rcl al, 1
rcl ch, 1
rcl al, 1
rcl cl, 1
rcl ah, 1
rcl dh, 1
rcl ah, 1
rcl dl, 1
rcl ah, 1
rcl ch, 1
rcl ah, 1
rcl cl, 1
rcl ah, 1
rcl dh, 1
rcl ah, 1
rcl dl, 1
rcl ah, 1
rcl ch, 1
rcl ah, 1
rcl cl, 1
lodsw
rcl al, 1
rcl dh, 1
rcl al, 1
rcl dl, 1
rcl al, 1
rcl ch, 1
rcl al, 1
rcl cl, 1
rcl al, 1
rcl dh, 1
rcl al, 1
rcl dl, 1
rcl al, 1
rcl ch, 1
rcl al, 1
rcl cl, 1
rcl ah, 1
rcl dh, 1
rcl ah, 1
rcl dl, 1
rcl ah, 1
rcl ch, 1
rcl ah, 1
rcl cl, 1
rcl ah, 1
rcl dh, 1
rcl ah, 1
rcl dl, 1
rcl ah, 1
rcl ch, 1
rcl ah, 1
rcl cl, 1
mov es:[di+0E70h], dh
mov es:[di+9A0h], dl
mov es:[di+4D0h], ch
mov es:[di], cl
inc di
dec bx
jz short loc_3F3DE
jmp loc_3F343
loc_3F3DE:
lds si, [bp+arg_4]
mov ax, 0A000h
mov es, ax
assume es:nothing
mov bl, 1
sub ch, ch
loc_3F3EA:
mov dx, 3DAh
in al, dx ; Video status bits:
; 0: retrace. 1=display is in vert or horiz retrace.
; 1: 1=light pen is triggered; 0=armed
; 2: 1=light pen switch is open; 0=closed
; 3: 1=vertical sync pulse is occurring.
and al, 8
jz short loc_3F3EA
loc_3F3F2:
mov dx, 3DAh
in al, dx ; Video status bits:
; 0: retrace. 1=display is in vert or horiz retrace.
; 1: 1=light pen is triggered; 0=armed
; 2: 1=light pen switch is open; 0=closed
; 3: 1=vertical sync pulse is occurring.
and al, 8
jnz short loc_3F3F2
mov al, 2
mov dx, 3C4h
out dx, al ; EGA: sequencer address reg
; map mask: data bits 0-3 enable writes to bit planes 0-3
loc_3F400:
mov di, 25Ah
mov al, bl
shl bl, 1
mov dl, 0C5h
out dx, al ; EGA port: sequencer data register
mov bh, 58h
mov ax, 1Ah
mov dl, 7
loc_3F411:
mov cl, dl
rep movsw
add di, ax
dec bh
jnz short loc_3F411
test bl, 10h
jz short loc_3F400
pop ds
pop di
pop si
pop es
assume es:nothing
pop bp
retf
_vid_drawBigpic endp
; Attributes: bp-based frame
sub_3F426 proc far
arg_0= word ptr 6
push bp
mov bp, sp
push di
push ds
mov dx, 3C4h
mov al, 2
out dx, al ; EGA: sequencer address reg
; map mask: data bits 0-3 enable writes to bit planes 0-3
inc dx
dec al
out dx, al ; EGA port: sequencer data register
mov dx, 3CEh
mov al, 4
out dx, al ; EGA: graph 1 and 2 addr reg:
; read map select.
; Data bits 0-2 select map # for read mode 00.
inc dx
sub al, al
out dx, al ; EGA port: graphics controller data register
mov ax, [bp+arg_0]
mov cl, 6
shl ax, cl
mov di, ax
shl ax, 1
shl ax, 1
add di, ax
add di, 0DDh
mov cx, 8
mov ax, 0A000h
mov ds, ax
assume ds:nothing
sub ax, ax
dec ax