-
Notifications
You must be signed in to change notification settings - Fork 0
/
SVGAXMS.ASM
1050 lines (885 loc) · 25.7 KB
/
SVGAXMS.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
;#############################################################################
;
; XMS/SVGA routines made by Future Software
; for BASIC programming
;
;#############################################################################
.model medium
.stack 10h
.386
EXTRN MoveToXMS:FAR
EXTRN MoveFromXMS:FAR
EXTRN XResolution:word
EXTRN YResolution:word
EXTRN BytesPerScanLine:word
EXTRN OffsetDATA:word
EXTRN SegmentDATA:word
EXTRN VideoSegment:word
EXTRN ActivePageX:word
EXTRN ActivePageY:word
EXTRN BytesPP:word
EXTRN XshiftFactor:byte
EXTRN MaskColor:dword
EXTRN BitsPerPixel:byte
EXTRN BMapStatus:word
EXTRN BMapSEG:word
EXTRN BMapOFF:word
EXTRN SetVESABank:FAR
EXTRN SetEMSBank:FAR
EXTRN IsXMSinstalled:FAR
.data
EXTRN X1VP:word
EXTRN Y1VP:word
EXTRN X2VP:word
EXTRN Y2VP:word
EXTRN XMSControl:dword
ByteLength dd 0 ; 32-bit number of bytes to transfer
SourceHandle dw 0 ; Handle of source block
SourceOffset dd 0 ; 32-bit offset into source
DestHandle dw 0 ; Handle of destination block
DestOffset dd 0 ; 32-bit offset into destination block
D1 dd 0
D2 dd 0
X1 dw 0
Y1 dw 0
X2 dw 0
Y2 dw 0
temp1 dw 0
temp2 dw 0
temp3 dw 0
temp4 dd 0
temp dd 0
xmsxdim dw 0
xmsydim dw 0
bytemem db 0
.code
;#############################################################################
;SetXMSsize (Xsize, Ysize, handle%)
;
; returns nothing (moves x/y data into the 4 four bytes of the handle)
;#############################################################################
PUBLIC SetXMSsize
SetXMSsize proc BASIC
mov bx,sp
mov ax,[bx+06]
mov cx,[bx+08]
mov xmsydim,ax
mov xmsxdim,cx
mov ax,[bx+04]
push ax
mov ax,@data
push ax
mov ax,offset xmsxdim
push ax
mov eax,4
push eax
mov eax,0
push eax
call MoveToXMS
retf 6
SetXMSsize endp
;#############################################################################
;SVGAxmsput (XMSoffset, tempbuffersegment, tempbufferoffset, X, Y, xmshandle, DimX, DimY)
;
; returns nothing
;#############################################################################
PUBLIC SVGAxmsput
SVGAxmsput proc BASIC
push bp
mov bp,sp
push fs
push eax
push ebx
push ecx
push edx
cmp XMSControl,0
jnz @F
call IsXMSinstalled
@@:
mov ax,[bp+10] ;handle ;get xms picture dimenstion
push ax ;
mov ax,@data ;
push ax ;
mov ax,offset xmsxdim ;
push ax ;
mov eax,4 ;
push eax ;
mov eax,0 ;start offset (0)
push eax ;
call MoveFromXMS ;
mov eax,[bp+20] ;now index
mov temp4,eax
xor eax,eax
mov ax,xmsxdim
inc eax
mov temp,eax
xor eax,eax
mov ax,xmsydim
inc eax
mul temp
mul temp4
mov temp4,eax
mov cl,XshiftFactor
mov ax,[bp+16]
mov OffsetDATA,ax
mov ax,[bp+18]
mov fs,ax
mov SegmentDATA,ax
mov ax,[bp+10]
mov SourceHandle,ax
mov eax,temp4 ;picture start offset in pixels
shl eax,cl
.if BitsPerPixel == 24
add eax,temp4
.endif
mov SourceOffset,eax
add SourceOffset,4
mov DestHandle,0
mov ax,VideoSegment
mov es,ax
mov word ptr [DestOffset+2],ax
mov ax,[bp+14] ;X
mov X1,ax
mov ax,xmsxdim ;[bp+08] ;DIMX
mov dx,ax ;dx=delta_x-1
add ax,X1
mov X2,ax
inc dx ;dx=delta_x
mov temp3,dx
shl dx,cl
.if BitsPerPixel == 24
add dx,temp3
.endif
cmp ax,X1VP;0
jl XmsNoput
mov ax,[bp+12] ;Y
mov Y1,ax
mov ax,xmsydim ;[bp+06] ;DIMY
add ax,Y1
mov Y2,ax
cmp ax,Y1VP;0
jl XmsNoput
mov ax,X2
cmp ax,X2VP;XResolution
jl @F
mov ax,X2VP;XResolution
dec ax
mov X2,ax
@@:
mov ax,X1
cmp ax,X1VP;0
jge @F
sub ax,X1VP
neg ax ;clip left
mov temp3,ax
shl ax,cl
.if BitsPerPixel == 24
add ax,temp3
.endif
add OffsetDATA,ax
cwde ;ax->eax
add SourceOffset,eax
mov ax,X1VP
mov X1,ax;0
@@:
mov ax,X2
sub ax,X1
inc ax
mov temp1,ax
shl ax,cl
.if BitsPerPixel == 24
add ax,temp1
.endif
cwde
mov ByteLength,eax
mov ax,X1
cmp ax,X2VP;XResolution
jge XmsNoput
mov ax,Y1
cmp ax,Y2VP;YResolution
jge XmsNoput
mov ax,xmsxdim;[bp+08]
inc ax
mov temp3,ax
shl ax,cl
.if BitsPerPixel == 24
add ax,temp3
.endif
cwde
mov d1,eax ;SourceOffset increasement per scanline
mov ax,Y2VP;YResolution
cmp ax,Y2
jg @F
dec ax
mov Y2,ax
@@:
mov ax,Y1
cmp ax,Y1VP;0
jge @F
sub ax,Y1VP
neg ax
cwde ;ax->eax
xor ebx,ebx
mov bx,dx
mul ebx
add SourceOffset,eax
mov ax,Y1VP
mov Y1,ax;0
@@:
mov bx,X1
mov ax,Y1
add ax,ActivePageY
add bx,ActivePageX
mul BytesPerScanLine
mov temp3,bx
shl bx,cl
.if BitsPerPixel == 24
add bx,temp3
.endif
add ax,bx
adc dx,0
mov di,ax
mov word ptr [DestOffset],di
mov bp,Y1
mov ax,BytesPerScanLine
mov bx,temp1
shl bx,cl
.if BitsPerPixel == 24
add bx,temp1
.endif
sub ax,bx
mov temp2,ax
mov ax, OffsetDATA
mov word ptr [D2],ax
mov bx, SegmentDATA
mov word ptr [D2+2],bx
Xmsputloop: ;all clipping have been done outside the main loop
cmp VideoSegment,0a000h
jnz EMSIsActive69
push dx
Call SetVESABank
pop dx
jmp @F
EMSIsActive69:
push dx
Call SetEMSBank
pop dx
@@:
.if BMapStatus > 0
jmp @F
.endif
cmp MaskColor,0 ;if filter is on, always use single byte
jge @F ;put
mov bx,temp1
mov cl,XshiftFactor
shl bx,cl
.if BitsPerPixel == 24
add bx,temp1
.endif
add bx,di ;do we at any time cross a bank border?
jae DoXmsBlit ;if no, then blit
@@:
mov cx,temp1
push DestOffset
mov eax,D2
mov DestOffset,eax
mov si,offset ByteLength
mov ah,0bh
call [XMSControl]
mov ax, OffsetDATA
mov si,ax
xor eax,eax
mov bx,BytesPP
Xmspixelloop:
.if bx == 1
mov al,fs:[si]
.elseif bx == 2
mov ax,fs:[si]
.elseif bx == 3
mov eax,fs:[si]
and eax,00ffffffh
.elseif bx == 4
and eax, 0ffffffh
mov eax,fs:[si]
.endif
cmp MaskColor,0
jl XmsfilterOff
cmp MaskColor,eax
jz XmsFilerOut
XmsFilterOff:
.if bx == 1
.if BMapStatus == 1
mov bx,BmapSEG
mov gs,bx
mov bl,es:[di]
mov bh,al
add bx,BMapOFF
mov al,gs:[bx]
mov bx,1
.endif
mov es:[di],al
.elseif bx == 2
.if BMapStatus > 0
.if BitsPerPixel == 16
shl edx,16
shl ecx,16
mov cx,BMapStatus
xor ebx,ebx
and eax,0FFFFh
mov bx, es:[di];BGB ;get background color
shl eax,11
shl ebx,11
shr ax,3
shr bx,3
shr eax,6
shr ebx,6
shr ax,2
shr bx,2
and ebx, 000111110011111100011111b
rol eax,16 ;GB*R
rol ebx,16 ;GB*R
xor ah, ah ;Clear ah
xor bh, bh
and al, 00011111b
and bl, 00011111b
;shl al,3
;shl bl,3
sub ax, bx ;(Signed) Subtract the Background Blue value
mul cx ;Multiply it by the alpha blend (0 to 255)
sar ax, 8 ;(Signed) Divide by 256
add ax, bx ;(Signed) Add the Background Blue value
;shr al,3
;shr bl,3
mov ah,al
rol eax,8 ;Br*G
rol ebx,8 ;Br*G
xor ah, ah ;Clear ah
xor bh, bh
and al, 00111111b
and bl, 00111111b
;shl al,2
;shl bl,2
sub ax, bx ;(Signed) Subtract the Background Green value
mul cx ;Multiply it by the alpha blend (0 to 255)
sar ax, 8 ;(Signed) Divide by 256
add ax, bx ;(Signed) Add the Background Green value
;shr al,2
;shr bl,2
mov ah,al
rol eax,8 ;rg*B
rol ebx,8 ;rg*B
xor ah, ah ;Clear ah
xor bh, bh
and al, 00011111b
and bl, 00011111b
;shl al,3
;shl bl,3
sub ax, bx ;(Signed)Subtract the Background Red value
mul cx ;Multiply it by the fixed alpha blend (0 to 255)
sar ax, 8 ;(Signed)Divide by 256
add ax, bx ;(Signed)Add the Background Red value
;shr al,3
;shr bl,3
mov ah,al
shr eax,8
shl ax,2
shl eax,6
shl ax,3
shr eax,11
mov es:[di],ax ;draw result colors
shr ecx,16
shr edx,16
.else
shl edx,16
shl ecx,16
mov cx,BMapStatus
xor ebx,ebx
and eax,0FFFFh
mov bx, es:[di];BGB ;get background color
shl eax,11
shl ebx,11
shr ax,3
shr bx,3
shr eax,5
shr ebx,5
shr ax,3
shr bx,3
and ebx, 000111110001111100011111b
rol eax,16 ;GB*R
rol ebx,16 ;GB*R
xor ah, ah ;Clear ah
xor bh, bh
and al, 00011111b
and bl, 00011111b
sub ax, bx ;(Signed) Subtract the Background Blue value
mul cx ;Multiply it by the alpha blend (0 to 255)
sar ax, 8 ;(Signed) Divide by 256
add ax, bx ;(Signed) Add the Background Blue value
mov ah,al
rol eax,8 ;Br*G
rol ebx,8 ;Br*G
xor ah, ah ;Clear ah
xor bh, bh
and al, 00011111b
and bl, 00011111b
sub ax, bx ;(Signed) Subtract the Background Green value
mul cx ;Multiply it by the alpha blend (0 to 255)
sar ax, 8 ;(Signed) Divide by 256
add ax, bx ;(Signed) Add the Background Green value
mov ah,al
rol eax,8 ;rg*B
rol ebx,8 ;rg*B
xor ah, ah ;Clear ah
xor bh, bh
and al, 00011111b
and bl, 00011111b
sub ax, bx ;(Signed)Subtract the Background Red value
mul cx ;Multiply it by the fixed alpha blend (0 to 255)
sar ax, 8 ;(Signed)Divide by 256
add ax, bx ;(Signed)Add the Background Red value
mov ah,al
shr eax,8
shl ax,3
shl eax,5
shl ax,3
shr eax,11
mov es:[di],ax ;draw result colors
shr ecx,16
shr edx,16
.endif
mov bx,2
.else
mov es:[di],ax
.endif
.elseif bx == 3
.if di <= 1111111111111100b
mov es:[di],ax
shr eax,16
mov es:[di+2],al
.else
mov bytemem,3
pixel_xmsput24:
mov es:[di],al
add di,1
jnc @F
inc dx
push eax
push dx
push bx
push cx
.if VideoSegment == 0a000h
Call SetVESABank
.else
Call SetEMSBank
.endif
pop cx
pop bx
pop dx
pop eax
@@:
ror eax,8
dec bytemem
jnz pixel_xmsput24
add si,bx
jmp NoInc210219
.endif
.elseif bx == 4
.if BMapStatus > 0
shl edx,16
shl ecx,16
mov cx,BMapStatus
mov ebx, es:[di];BGB ;get background color
rol eax,16 ;GB*R
rol ebx,16 ;GB*R
xor ah, ah ;Clear ah
xor bh, bh
sub ax, bx ;(Signed) Subtract the Background Blue value
mul cx ;Multiply it by the alpha blend (0 to 255)
sar ax, 8 ;(Signed) Divide by 256
add ax, bx ;(Signed) Add the Background Blue value
mov ah,al
rol eax,8 ;Br*G
rol ebx,8 ;Br*G
xor ah, ah ;Clear ah
xor bh, bh
sub ax, bx ;(Signed) Subtract the Background Green value
mul cx ;Multiply it by the alpha blend (0 to 255)
sar ax, 8 ;(Signed) Divide by 256
add ax, bx ;(Signed) Add the Background Green value
mov ah,al
rol eax,8 ;rg*B
rol ebx,8 ;rg*B
xor ah, ah ;Clear ah
xor bh, bh
sub ax, bx ;(Signed)Subtract the Background Red value
mul cx ;Multiply it by the fixed alpha blend (0 to 255)
sar ax, 8 ;(Signed)Divide by 256
add ax, bx ;(Signed)Add the Background Red value
mov ah,al
shr eax,8
mov es:[di],eax ;draw result colors
shr ecx,16
shr edx,16
mov bx,4
.endif
mov es:[di],eax
.endif
XmsFilerOut:
add si,bx
add di,bx
jae NoInc210219
inc dx
push eax
push cx
push dx
push bx
cmp VideoSegment,0a000h
jnz EMSIsActive79
Call SetVESABank
jmp @F
EMSIsActive79:
Call SetEMSBank
@@:
pop bx
pop dx
pop cx
pop eax
NoInc210219:
dec cx
jnz Xmspixelloop ;if zero then done
pop DestOffset
jmp XmsDoneline
DoXmsBlit:
mov si,offset ByteLength
mov ah,0bh
call [XMSControl]
add di,word ptr ByteLength
XmsDoneline:
add di,temp2
adc dx,0
mov word ptr [DestOffset],di
mov eax,d1
add SourceOffset,eax
inc bp
cmp bp,Y2
jle Xmsputloop
XmsNoput:
pop edx
pop ecx
pop ebx
pop eax
pop fs
pop bp
retf 18
SVGAxmsput endp
;#############################################################################
;SVGAxmsget (XMSoffset, tempbuffersegment, tempbufferoffset, X, Y, xmshandle, DimX, DimY)
;
; returns nothing
;#############################################################################
PUBLIC SVGAxmsget
SVGAxmsget proc BASIC
push bp
mov bp,sp
push fs
push eax
push edx
cmp XMSControl,0
jnz @F
call IsXMSinstalled
@@:
mov eax,[bp+20] ;now index
.if eax == 0 ;if index?
mov ax,[bp+06] ;save xdim and ydim in xms
mov xmsydim,ax ;
mov ax,[bp+08] ;
mov xmsxdim,ax ;
mov ax,[bp+10]
push ax
mov ax,@data
push ax
mov ax,offset xmsxdim
push ax
mov eax,4
push eax
mov eax,0
push eax
call MoveToXMS
.else
mov ax,[bp+10] ;handle ;get xms picture dimenstion
push ax ;
mov ax,@data ;
push ax ;
mov ax,offset xmsxdim ;
push ax ;
mov eax,4 ;
push eax ;
mov eax,0 ;start offset (0)
push eax ;
call MoveFromXMS ;
.endif
mov eax,[bp+20] ;now index
mov temp4,eax
xor eax,eax
mov ax,xmsxdim
inc eax
mov temp,eax
xor eax,eax
mov ax,xmsydim
inc eax
mul temp
mul temp4
mov temp4,eax
mov cl,XshiftFactor
mov ax,[bp+16]
mov OffsetDATA,ax
mov ax,[bp+18]
mov fs,ax
mov SegmentDATA,ax
mov ax,[bp+10]
mov DestHandle,ax
mov SourceHandle,0
mov eax,temp4
shl eax,cl
.if BitsPerPixel == 24
add eax,temp4
.endif
mov DestOffset,eax
add DestOffset,4
mov ax,VideoSegment
mov es,ax
mov word ptr [SourceOffset+2],ax ;update segment
mov ax,[bp+14] ;X
mov X1,ax
mov ax,[bp+08]
mov dx,ax ;dx=delta_x-1
add ax,X1
mov X2,ax
inc dx ;dx=delta_x
mov temp3,dx
shl dx,cl
.if BitsPerPixel == 24
add dx,temp3
.endif
cmp ax,0
jl XmsNoget
mov ax,[bp+12] ;Y
mov Y1,ax
mov ax,[bp+06]
add ax,Y1
mov Y2,ax
cmp ax,0
jl XmsNoget
mov ax,XResolution
cmp ax,X2
jg @F
dec ax
mov X2,ax
@@:
mov ax,X1
cmp ax,0
jge @F
neg ax ;clip left
mov temp3,ax
shl ax,cl
.if BitsPerPixel == 24
add ax,temp3
.endif
add OffsetDATA,ax
cwde ;ax->eax
add DestOffset,eax
mov X1,0
@@:
mov ax,X2
sub ax,X1
inc ax
mov temp1,ax
shl ax,cl
.if BitsPerPixel == 24
add ax,temp1
.endif
cwde
mov ByteLength,eax
mov ax,X1
cmp ax,XResolution
jge XmsNoget
mov ax,Y1
cmp ax,YResolution
jge XmsNoget
mov ax,[bp+08]
inc ax
mov temp3,ax
shl ax,cl
.if BitsPerPixel == 24
add ax,temp3
.endif
cwde
mov d1,eax ;DestOffset increasement per scanline
mov ax,Y1
cmp ax,0
jge @F
neg ax
cwde ;ax->eax
mov temp,0
mov word ptr [temp],dx
mul temp
add DestOffset,eax
mov Y1,0
@@:
mov ax,YResolution
cmp ax,Y2
jg @F
dec ax
mov Y2,ax
@@:
mov bx,X1
mov ax,Y1
add ax,ActivePageY
add bx,ActivePageX
mul BytesPerScanLine
mov temp3,bx
shl bx,cl
.if BitsPerPixel == 24
add bx,temp3
.endif
add ax,bx
adc dx,0
mov di,ax
mov word ptr [SourceOffset],di
mov bp,Y1
mov ax,BytesPerScanLine
mov bx,temp1
shl bx,cl
.if BitsPerPixel == 24
add bx,temp1
.endif
sub ax,bx
mov temp2,ax
mov ax, OffsetDATA
mov word ptr [D2],ax
mov bx, SegmentDATA
mov word ptr [D2+2],bx
Xmsgetloop: ;all clipping have been done outside the main loop
cmp VideoSegment,0a000h
jnz EMSIsActive699
push dx
Call SetVESABank
pop dx
jmp @F
EMSIsActive699:
push dx
Call SetEMSBank
pop dx
@@:
mov ax,temp1
mov cl,XshiftFactor
shl ax,cl
.if BitsPerPixel == 24
add ax,temp1
.endif
add ax,di ;do we at any time cross a bank border?
jae DoXmsgetBlit ;if no, then blit
mov cx,temp1
push SourceOffset
mov eax,D2
mov SourceOffset,eax
mov ax,OffsetDATA
mov si,ax
mov bx,BytesPP
Xmspixelgetloop:
.if bx == 1
mov al,es:[di]
mov fs:[si],al
.elseif bx == 2
mov ax,es:[di]
mov fs:[si],ax
.elseif bx == 3
.if di <= 1111111111111100b
mov eax,es:[di]
mov fs:[si],ax
shr eax,16
mov fs:[si+2],al
.else
mov bytemem,3
pixel_xmsget24:
mov al,es:[di]
add di,1
jnc @F
inc dx
push eax
push dx
push bx
push cx
.if VideoSegment == 0a000h
Call SetVESABank
.else
Call SetEMSBank
.endif
pop cx
pop bx
pop dx
pop eax
@@:
ror eax,8
dec bytemem
jnz pixel_xmsget24
ror eax,8
mov fs:[si],ax
shr eax,16
mov fs:[si+2],al
add si,bx
jmp NoInc2102199
.endif
.elseif bx == 4
mov eax,es:[di]
mov fs:[si],eax
.endif
add si,bx
add di,bx
jae NoInc2102199
inc dx
push ax
push cx
push dx
push bx
cmp VideoSegment,0a000h
jnz EMSIsActive799