Subversion Repositories Kolibri OS

Rev

Rev 9679 | Rev 9715 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
5363 yogev_ezra 3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
2288 clevermous 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;  VESA12.INC                                                  ;;
7
;;                                                              ;;
8
;;  Vesa 1.2 functions for MenuetOS                             ;;
9
;;                                                              ;;
10
;;  Copyright 2002 Ville Turjanmaa                              ;;
11
;;                                                              ;;
12
;;  quickcode@mail.ru - bankswitch for S3 cards                 ;;
13
;;                                                              ;;
14
;;  See file COPYING for details                                ;;
15
;;                                                              ;;
16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17
 
18
$Revision: 9709 $
19
 
20
 
7136 dunkaist 21
TRIDENT       = 0
22
S3_VIDEO      = 0
23
INTEL_VIDEO   = 0
2288 clevermous 24
 
25
if TRIDENT
26
  if S3_VIDEO or INTEL_VIDEO
27
    stop
28
  end if
29
end if
30
 
31
if S3_VIDEO
32
  if TRIDENT or INTEL_VIDEO
33
    stop
34
  end if
35
end if
36
 
37
if INTEL_VIDEO
38
  if S3_VIDEO or TRIDENT
39
    stop
40
  end if
41
end if
42
 
43
 
44
; A complete video driver should include the following types of function
45
;
46
; Putpixel
47
; Getpixel
48
;
49
; Drawimage
50
; Drawbar
51
;
52
; Drawbackground
53
;
54
;
55
; Modifying the set_bank -function is mostly enough
56
; for different Vesa 1.2 setups.
57
 
58
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
59
; set_bank for Trident videocards, work on Trident 9440
60
; modified by Mario79
61
 
62
if TRIDENT
63
set_bank:
64
        pushfd
65
        cli
66
        cmp     al, [BANK_RW]
67
        je      .retsb
68
 
69
        mov     [BANK_RW], al
70
        push    dx
71
        mov     dx, 3D8h
72
        out     dx, al
73
        pop     dx
74
.retsb:
75
        popfd
76
        ret
77
end if
78
 
79
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
80
; set_bank for S3 videocards, work on S3 ViRGE PCI (325)
81
; modified by kmeaw
82
 
83
if S3_VIDEO
84
set_bank:
85
        pushfd
86
        cli
87
        cmp     al, [BANK_RW]
88
        je      .retsb
89
 
90
        mov     [BANK_RW], al
91
        push    ax
92
        push    dx
93
        push    cx
94
        mov     cl, al
95
        mov     dx, 0x3D4
96
        mov     al, 0x38
97
        out     dx, al    ;CR38 Register Lock 1 ;Note: Traditionally 48h is used to
98
                          ;unlock and 00h to lock
99
        inc     dx
100
        mov     al, 0x48
101
        out     dx, al    ;3d5 -?
102
        dec     dx
103
        mov     al, 0x31
104
        out     dx, al    ;CR31 Memory Configuration Register
105
;0  Enable Base Address Offset (CPUA BASE). Enables bank operation if set, ;disables if clear.
106
;4-5  Bit 16-17 of the Display Start Address. For the 801/5,928 see index 51h,
107
;for the 864/964 see index 69h.
108
 
109
        inc     dx
110
        in      al, dx
111
        dec     dx
112
        mov     ah, al
113
        mov     al, 0x31
114
        out     dx, ax
115
        mov     al, ah
116
        or      al, 9
117
        inc     dx
118
        out     dx, al
119
        dec     dx
120
        mov     al, 0x35
121
        out     dx, al  ;CR35 CRT Register Lock
122
        inc     dx
123
        in      al, dx
124
        dec     dx
125
        and     al, 0xF0
126
        mov     ch, cl
127
        and     ch, 0x0F
128
        or      ch, al
129
        mov     al, 0x35
130
        out     dx, al
131
        inc     dx
132
        mov     al, ch
133
        out     dx, ax
134
        dec     dx
135
        mov     al, 0x51 ;Extended System Control 2 Register
136
        out     dx, al
137
        inc     dx
138
        in      al, dx
139
        dec     dx
140
        and     al, 0xF3
141
        shr     cl, 2
142
        and     cl, 0x0C
143
        or      cl, al
144
        mov     al, 0x51
145
        out     dx, al
146
        inc     dx
147
        mov     al, cl
148
        out     dx, al
149
        dec     dx
150
        mov     al, 0x38
151
        out     dx, al
152
        inc     dx
153
        xor     al, al
154
        out     dx, al
155
        dec     dx
156
        pop     cx
157
        pop     dx
158
        pop     ax
159
.retsb:
160
        popfd
161
        ret
162
end if
163
 
164
;Set bank function for Intel 810/815 chipsets
165
; *****Modified by Protopopius, Russia.*****
166
; ********* http://menuetos.hut.ru **************
167
; ************************************************
168
 
169
if INTEL_VIDEO
170
 
171
set_bank:
172
        pushfd
173
        cli
174
 
175
        cmp     al, [BANK_RW]
176
        je      .retsb
177
 
178
        mov     [BANK_RW], al
179
        push    ax
180
        push    dx
181
        mov     dx, 3CEh
182
        mov     ah, al          ; Save value for later use
183
        mov     al, 10h         ; Index GR10 (Address Mapping)
184
        out     dx, al          ; Select GR10
185
        inc     dl
186
        mov     al, 3           ; Set bits 0 and 1 (Enable linear page mapping)
187
        out     dx, al          ; Write value
188
        dec     dl
189
        mov     al, 11h         ; Index GR11 (Page Selector)
190
        out     dx, al          ; Select GR11
191
        inc     dl
192
        mov     al, ah          ; Write address
193
        out     dx, al          ; Write the value
194
        pop     dx
195
        pop     ax
196
.retsb:
197
        popfd
198
        ret
199
end if
200
 
201
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
202
 
203
if (TRIDENT or S3_VIDEO or INTEL_VIDEO)
204
else
205
set_bank:
206
        pushfd
207
        cli
208
 
209
        cmp     al, [BANK_RW]
210
        je      .retsb
211
 
212
        mov     [BANK_RW], al
213
        push    ax
214
        push    dx
215
        mov     ah, al
216
        mov     dx, 0x03D4
217
        mov     al, 0x39
218
        out     dx, al
219
        inc     dl
220
        mov     al, 0xA5
221
        out     dx, al
222
        dec     dl
223
        mov     al, 6Ah
224
        out     dx, al
225
        inc     dl
226
        mov     al, ah
227
        out     dx, al
228
        dec     dl
229
        mov     al, 0x39
230
        out     dx, al
231
        inc     dl
232
        mov     al, 0x5A
233
        out     dx, al
234
        dec     dl
235
        pop     dx
236
        pop     ax
237
 
238
.retsb:
239
        popfd
240
        ret
241
end if
242
 
243
vesa12_drawbackground:
244
 
245
        call    [_display.disable_mouse]
246
 
247
        push    eax
248
        push    ebx
249
        push    ecx
250
        push    edx
251
 
252
        xor     edx, edx
253
        mov     eax, dword[BgrDataWidth]
254
        mov     ebx, dword[BgrDataHeight]
255
        mul     ebx
256
        mov     ebx, 3
257
        mul     ebx
258
        mov     [imax], eax
259
        mov     eax, [draw_data+32+RECT.left]
260
        mov     ebx, [draw_data+32+RECT.top]
261
        xor     edi, edi;no force
262
 
263
      v12dp3:
264
 
265
        push    eax
266
        push    ebx
267
 
268
        cmp     [BgrDrawMode], dword 1  ; tiled background
269
        jne     no_vesa12_tiled_bgr
270
 
271
        push    edx
272
 
273
        xor     edx, edx
274
        div     dword [BgrDataWidth]
275
 
276
        push    edx
277
        mov     eax, ebx
278
        xor     edx, edx
279
        div     dword [BgrDataHeight]
280
        mov     ebx, edx
281
        pop     eax
282
 
283
        pop     edx
284
 
285
      no_vesa12_tiled_bgr:
286
 
287
        cmp     [BgrDrawMode], dword 2  ; stretched background
288
        jne     no_vesa12_stretched_bgr
289
 
290
        push    edx
291
 
292
        mul     dword [BgrDataWidth]
293
        mov     ecx, [Screen_Max_X]
294
        inc     ecx
295
        div     ecx
296
 
297
        push    eax
298
        mov     eax, ebx
299
        mul     dword [BgrDataHeight]
300
        mov     ecx, [Screen_Max_Y]
301
        inc     ecx
302
        div     ecx
303
        mov     ebx, eax
304
        pop     eax
305
 
306
        pop     edx
307
 
308
      no_vesa12_stretched_bgr:
309
 
310
 
311
        mov     esi, ebx
312
        imul    esi, dword [BgrDataWidth]
313
        add     esi, eax
314
        lea     esi, [esi*3]
315
        add     esi, [img_background];IMG_BACKGROUND
316
        pop     ebx
317
        pop     eax
318
 
319
      v12di4:
320
 
321
        mov     cl, [esi+2]
322
        shl     ecx, 16
323
        mov     cx, [esi]
324
        pusha
325
        mov     esi, eax
326
        mov     edi, ebx
327
        mov     eax, [Screen_Max_X]
328
        add     eax, 1
329
        mul     ebx
330
        add     eax, [_WinMapAddress]
331
        cmp     [eax+esi], byte 1
332
        jnz     v12nbgp
333
        mov     eax, [BytesPerScanLine]
334
        mov     ebx, edi
335
        mul     ebx
336
        add     eax, esi
337
        lea     eax, [VGABasePtr+eax+esi*2]
338
        cmp     [ScreenBPP], byte 24
339
        jz      v12bgl3
340
        add     eax, esi
341
 
342
      v12bgl3:
343
 
344
        push    ebx
345
        push    eax
346
 
347
        sub     eax, VGABasePtr
348
 
349
        shr     eax, 16
350
        call    set_bank
351
        pop     eax
352
        and     eax, 65535
353
        add     eax, VGABasePtr
354
        pop     ebx
355
 
356
        mov     [eax], cx
357
        add     eax, 2
358
        shr     ecx, 16
359
        mov     [eax], cl
360
        sti
361
 
362
      v12nbgp:
363
 
364
        popa
365
        add     esi, 3
366
        inc     eax
367
        cmp     eax, [draw_data+32+RECT.right]
368
        jg      v12nodp31
369
        jmp     v12dp3
370
 
371
      v12nodp31:
372
 
373
        mov     eax, [draw_data+32+RECT.left]
374
        inc     ebx
375
        cmp     ebx, [draw_data+32+RECT.bottom]
376
        jg      v12dp4
377
        jmp     v12dp3
378
 
379
      v12dp4:
380
 
381
        pop     edx
382
        pop     ecx
383
        pop     ebx
384
        pop     eax
385
        ret
386
 
387
 
388
vesa12_drawbar:
389
 
390
        call    [_display.disable_mouse]
391
 
392
;;    mov  [novesachecksum],dword 0
393
        sub     edx, ebx
394
        sub     ecx, eax
395
        push    esi
396
        push    edi
397
        push    eax
398
        push    ebx
399
        push    ecx
400
        push    edx
9679 Doczom 401
        mov     ecx, [current_slot_idx]
402
        shl     ecx, 5
403
        add     eax, [ecx + window_data + WDATA.box.left]
404
        add     ebx, [ecx + window_data + WDATA.box.top]
2288 clevermous 405
        push    eax
406
        mov     eax, ebx ; y
407
        mov     ebx, [BytesPerScanLine]
408
        mul     ebx
409
        pop     ecx
410
        add     eax, ecx ; x
411
        add     eax, ecx
412
        add     eax, ecx
413
        cmp     [ScreenBPP], byte 24; 24 or 32 bpp ? - x start
414
        jz      dbpi2412
415
        add     eax, ecx
416
 
417
  dbpi2412:
418
 
419
        add     eax, VGABasePtr
420
        mov     edi, eax
421
 
422
    ; x size
423
 
424
        mov     eax, [esp+4]; [esp+6]
425
        mov     ecx, eax
426
        add     ecx, eax
427
        add     ecx, eax
428
        cmp     [ScreenBPP], byte 24; 24 or 32 bpp ? - x size
429
        jz      dbpi24312
430
        add     ecx, eax
431
 
432
  dbpi24312:
433
 
434
        mov     ebx, [esp+0]
435
 
436
    ; check limits ?
437
 
438
        push    eax
439
        push    ecx
440
        mov     eax, [TASK_BASE]
441
        mov     ecx, [eax+draw_data-CURRENT_TASK+RECT.left]
442
        cmp     ecx, 0
443
        jnz     dbcblimitlset12
444
        mov     ecx, [eax+draw_data-CURRENT_TASK+RECT.top]
445
        cmp     ecx, 0
446
        jnz     dbcblimitlset12
447
        mov     ecx, [eax+draw_data-CURRENT_TASK+RECT.right]
448
        cmp     ecx, [Screen_Max_X]
449
        jnz     dbcblimitlset12
450
        mov     ecx, [eax+draw_data-CURRENT_TASK+RECT.bottom]
451
        cmp     ecx, [Screen_Max_Y]
452
        jnz     dbcblimitlset12
453
        pop     ecx
454
        pop     eax
455
        push    dword 0
456
        jmp     dbcblimitlno12
457
 
458
  dbcblimitlset12:
459
 
460
        pop     ecx
461
        pop     eax
462
        push    dword 1
463
 
464
  dbcblimitlno12:
465
 
466
        cmp     [ScreenBPP], byte 24; 24 or 32 bpp ?
467
        jz      dbpi24bit12
468
        jmp     dbpi32bit12
469
 
470
 
471
; DRAWBAR 24 BBP
472
 
473
 
474
dbpi24bit12:
475
 
476
        push    eax
477
        push    ebx
478
        push    edx
479
        mov     eax, ecx
480
        mov     ebx, 3
481
        div     ebx
482
        mov     ecx, eax
483
        pop     edx
484
        pop     ebx
485
        pop     eax
486
        cld
487
 
488
  dbnewpi12:
489
 
490
        push    ebx
491
        push    edi
492
        push    ecx
493
 
494
        xor     edx, edx
495
        mov     eax, edi
496
        sub     eax, VGABasePtr
497
        mov     ebx, 3
498
        div     ebx
499
        add     eax, [_WinMapAddress]
500
        mov     ebx, [CURRENT_TASK]
501
        cld
502
 
503
      dbnp2412:
504
 
505
        mov     dl, [eax]
506
        push    eax
507
        push    ecx
508
        cmp     dl, bl
509
        jnz     dbimp24no12
510
        cmp     [esp+5*4], dword 0
511
        jz      dbimp24yes12
512
;        call dbcplimit
513
;        jnz  dbimp24no12
514
 
515
     dbimp24yes12:
516
 
517
        push    edi
518
        mov     eax, edi
519
        sub     eax, VGABasePtr
520
        shr     eax, 16
521
        call    set_bank
522
        and     edi, 0xffff
523
        add     edi, VGABasePtr
524
        mov     eax, [esp+8+3*4+16+4+4]
525
        stosw
526
        shr     eax, 16
527
        stosb
528
        sti
529
        pop     edi
530
        add     edi, 3
531
        pop     ecx
532
        pop     eax
533
        inc     eax
534
        loop    dbnp2412
535
        jmp     dbnp24d12
536
 
537
      dbimp24no12:
538
 
539
        pop     ecx
540
        pop     eax
541
        cld
542
        add     edi, 3
543
        inc     eax
544
        loop    dbnp2412
545
 
546
      dbnp24d12:
547
 
548
        mov     eax, [esp+3*4+16+4]
549
        test    eax, 0x80000000
550
        jz      nodbgl2412
551
        cmp     al, 0
552
        jz      nodbgl2412
553
        dec     eax
554
        mov     [esp+3*4+16+4], eax
555
 
556
      nodbgl2412:
557
 
558
        pop     ecx
559
        pop     edi
560
        pop     ebx
561
        add     edi, [BytesPerScanLine]
562
        dec     ebx
563
        jz      dbnonewpi12
564
        jmp     dbnewpi12
565
 
566
  dbnonewpi12:
567
 
568
        add     esp, 7*4
569
 
570
        ret
571
 
572
 
573
; DRAWBAR 32 BBP
574
 
575
 
576
  dbpi32bit12:
577
 
578
        cld
579
        shr     ecx, 2
580
 
581
   dbnewpi3212:
582
 
583
        push    ebx
584
        push    edi
585
        push    ecx
586
 
587
        mov     eax, edi
588
        sub     eax, VGABasePtr
589
        shr     eax, 2
590
        add     eax, [_WinMapAddress]
591
        mov     ebx, [CURRENT_TASK]
592
        cld
593
 
594
      dbnp3212:
595
 
596
        mov     dl, [eax]
597
        push    eax
598
        push    ecx
599
        cmp     dl, bl
600
        jnz     dbimp32no12
601
        cmp     [esp+5*4], dword 0
602
        jz      dbimp32yes12
603
;        call dbcplimit
604
;        jnz  dbimp32no12
605
 
606
      dbimp32yes12:
607
 
608
        push    edi
609
        mov     eax, edi
610
        sub     eax, VGABasePtr
611
        shr     eax, 16
612
        call    set_bank
613
        and     edi, 0xffff
614
        add     edi, VGABasePtr
615
        mov     eax, [esp+8+3*4+16+4+4]
616
        stosw
617
        shr     eax, 16
618
        stosb
619
        sti
620
        pop     edi
621
        add     edi, 4
622
        inc     ebp
623
        pop     ecx
624
        pop     eax
625
        inc     eax
626
        loop    dbnp3212
627
        jmp     dbnp32d12
628
 
629
      dbimp32no12:
630
 
631
        pop     ecx
632
        pop     eax
633
        inc     eax
634
        add     edi, 4
635
        inc     ebp
636
        loop    dbnp3212
637
 
638
      dbnp32d12:
639
 
640
        mov     eax, [esp+12+16+4]
641
        test    eax, 0x80000000
642
        jz      nodbgl3212
643
        cmp     al, 0
644
        jz      nodbgl3212
645
        dec     eax
646
        mov     [esp+12+16+4], eax
647
 
648
      nodbgl3212:
649
 
650
        pop     ecx
651
        pop     edi
652
        pop     ebx
653
        add     edi, [BytesPerScanLine]
654
        dec     ebx
655
        jz      nodbnewpi3212
656
        jmp     dbnewpi3212
657
 
658
  nodbnewpi3212:
659
 
660
        add     esp, 7*4
661
        ret
662
 
663
 
664
Vesa12_putpixel24:
665
 
666
        mov     edi, eax; x
667
        mov     eax, ebx; y
668
        lea     edi, [edi+edi*2]
669
        mov     ebx, [BytesPerScanLine]
670
        mul     ebx
671
        add     edi, eax
672
        mov     eax, edi
673
        shr     eax, 16
674
        call    set_bank
675
        and     edi, 65535
676
        add     edi, VGABasePtr
677
        mov     eax, [esp+28]
678
        stosw
679
        shr     eax, 16
680
        mov     [edi], al
681
        sti
682
        ret
683
 
684
 
685
 
686
Vesa12_putpixel32:
687
 
688
        mov     edi, eax; x
689
        mov     eax, ebx; y
690
        shl     edi, 2
691
        mov     ebx, [BytesPerScanLine]
692
        mul     ebx
693
        add     edi, eax
694
        mov     eax, edi
695
        shr     eax, 16
696
        call    set_bank
697
        and     edi, 65535
698
        add     edi, VGABasePtr
699
        mov     ecx, [esp+28]
700
        mov     [edi], ecx
701
        sti
702
        ret
703
 
704
 
705
Vesa12_getpixel24:
706
 
707
        mov     edi, eax; x
708
        mov     eax, ebx; y
709
        lea     edi, [edi+edi*2]
710
        mov     ebx, [BytesPerScanLine]
711
        mul     ebx
712
        add     edi, eax
713
        mov     eax, edi
714
        shr     eax, 16
715
        call    set_bank
716
        and     edi, 65535
717
        add     edi, VGABasePtr
718
        mov     ecx, [edi]
719
        and     ecx, 255*256*256+255*256+255
720
        sti
721
        ret
722
 
723
 
724
Vesa12_getpixel32:
725
 
726
        mov     edi, eax; x
727
        mov     eax, ebx; y
728
        shl     edi, 2
729
        mov     ebx, [BytesPerScanLine]
730
        xor     edx, edx
731
        mul     ebx
732
        add     edi, eax
733
        mov     eax, edi
734
        shr     eax, 16
735
        call    set_bank
736
        and     edi, 65535
737
        add     edi, VGABasePtr
738
        mov     ecx, [edi]
739
        and     ecx, 255*256*256+255*256+255
740
        sti
741
 
742
        ret
743
 
744
 
745
 
746
vesa12_putimage:
747
; ebx = pointer to image
748
; ecx = size [x|y]
749
; edx = coordinates [x|y]
750
; ebp = pointer to 'get' function
751
; esi = pointer to 'init' function
752
; edi = parameter for 'get' function
753
 
754
;    mov  ebx,image
755
;    mov  ecx,320*65536+240
756
;    mov  edx,20*65536+20
757
 
758
        call    [_display.disable_mouse]
759
 
760
        mov     [novesachecksum], dword 0
761
        push    esi
762
        push    edi
763
        push    eax
764
        push    ebx
765
        push    ecx
766
        push    edx
767
        movzx   eax, word [esp+2]
768
        movzx   ebx, word [esp+0]
9679 Doczom 769
        mov     ecx, [current_slot_idx]
770
        shl     ecx, 5
771
        add     eax, [ecx + window_data + WDATA.box.left]
772
        add     ebx, [ecx + window_data + WDATA.box.top]
2288 clevermous 773
        push    eax
774
        mov     eax, ebx  ; y
775
        mul     dword [BytesPerScanLine]
776
        pop     ecx
777
        add     eax, ecx  ; x
778
        add     eax, ecx
779
        add     eax, ecx
780
        cmp     [ScreenBPP], byte 24; 24 or 32 bpp ? - x start
781
        jz      pi2412
782
        add     eax, ecx
783
 
784
  pi2412:
785
 
786
        add     eax, VGABasePtr
787
        mov     edi, eax
788
 
789
    ; x size
790
 
791
        movzx   ecx, word [esp+6]
792
 
793
        mov     esi, [esp+8]
794
        movzx   ebx, word [esp+4]
795
 
796
    ; check limits while draw ?
797
 
798
        push    ecx
799
        mov     eax, [TASK_BASE]
800
        cmp     dword [eax+draw_data-CURRENT_TASK+RECT.left], 0
801
        jnz     dbcblimitlset212
802
        cmp     dword [eax+draw_data-CURRENT_TASK+RECT.top], 0
803
        jnz     dbcblimitlset212
804
        mov     ecx, [eax+draw_data-CURRENT_TASK+RECT.right]
805
        cmp     ecx, [Screen_Max_X]
806
        jnz     dbcblimitlset212
807
        mov     ecx, [eax+draw_data-CURRENT_TASK+RECT.bottom]
808
        cmp     ecx, [Screen_Max_Y]
809
        jnz     dbcblimitlset212
810
        pop     ecx
811
        push    0
812
        jmp     dbcblimitlno212
813
 
814
  dbcblimitlset212:
815
 
816
        pop     ecx
817
        push    1
818
 
819
  dbcblimitlno212:
820
 
821
        cmp     [ScreenBPP], byte 24; 24 or 32 bpp ?
822
        jnz     pi32bit12
823
 
824
  pi24bit12:
825
 
826
  newpi12:
827
 
828
        push    edi
829
        push    ecx
830
        push    ebx
831
 
832
        mov     edx, edi
833
        sub     edx, VGABasePtr
834
        mov     ebx, 3
835
        div     ebx
836
        add     edx, [_WinMapAddress]
837
        mov     ebx, [CURRENT_TASK]
838
        mov     bh, [esp+4*3]
839
 
840
      np2412:
841
 
842
        cmp     bl, [edx]
843
        jnz     imp24no12
844
;        mov  eax,[esi]
845
        push    dword [esp+4*3+20]
846
        call    ebp
847
;        cmp  bh,0
848
;        jz   imp24yes12
849
;        call dbcplimit
850
;        jnz  imp24no12
851
 
852
     imp24yes12:
853
 
854
        push    edi
855
        push    eax
856
        mov     eax, edi
857
        sub     eax, VGABasePtr
858
        shr     eax, 16
859
        call    set_bank
860
        pop     eax
861
        and     edi, 0xffff
862
        add     edi, VGABasePtr
863
        mov     [edi], ax
864
        shr     eax, 16
865
        mov     [edi+2], al
866
        pop     edi
867
 
868
     imp24no12:
869
 
870
        inc     edx
871
;        add  esi,3
872
        add     edi, 3
873
        dec     ecx
874
        jnz     np2412
875
 
876
      np24d12:
877
 
878
        pop     ebx
879
        pop     ecx
880
        pop     edi
881
 
882
        add     edi, [BytesPerScanLine]
883
        add     esi, [esp+32]
884
        cmp     ebp, putimage_get1bpp
885
        jz      .correct
886
        cmp     ebp, putimage_get2bpp
887
        jz      .correct
888
        cmp     ebp, putimage_get4bpp
889
        jnz     @f
890
.correct:
891
        mov     eax, [esp+20]
892
        mov     byte[eax], 80h
893
@@:
894
        dec     ebx
895
        jnz     newpi12
896
 
897
  nonewpi12:
898
 
899
        pop     eax edx ecx ebx eax edi esi
900
        xor     eax, eax
901
        ret
902
 
903
 
904
  pi32bit12:
905
 
906
   newpi3212:
907
 
908
        push    edi
909
        push    ecx
910
        push    ebx
911
 
912
        mov     edx, edi
913
        sub     edx, VGABasePtr
914
        shr     edx, 2
915
        add     edx, [_WinMapAddress]
916
        mov     ebx, [CURRENT_TASK]
917
        mov     bh, [esp+4*3]
918
 
919
      np3212:
920
 
921
        cmp     bl, [edx]
922
        jnz     imp32no12
923
;        mov  eax,[esi]
924
        push    dword [esp+4*3+20]
925
        call    ebp
926
;        cmp  bh,0
927
;        jz   imp32yes12
928
;        call dbcplimit
929
;        jnz  imp32no12
930
 
931
      imp32yes12:
932
 
933
        push    edi
934
        push    eax
935
        mov     eax, edi
936
        sub     eax, VGABasePtr
937
        shr     eax, 16
938
        call    set_bank
939
        pop     eax
940
        and     edi, 0xffff
941
        mov     [edi+VGABasePtr], eax
942
        pop     edi
943
 
944
      imp32no12:
945
 
946
        inc     edx
947
;        add  esi,3
948
        add     edi, 4
949
        dec     ecx
950
        jnz     np3212
951
 
952
      np32d12:
953
 
954
        pop     ebx
955
        pop     ecx
956
        pop     edi
957
 
958
        add     edi, [BytesPerScanLine]
959
        cmp     ebp, putimage_get1bpp
960
        jz      .correct
961
        cmp     ebp, putimage_get2bpp
962
        jz      .correct
963
        cmp     ebp, putimage_get4bpp
964
        jnz     @f
965
.correct:
966
        mov     eax, [esp+20]
967
        mov     byte[eax], 80h
968
@@:
969
        dec     ebx
970
        jnz     newpi3212
971
 
972
  nonewpi3212:
973
 
974
        pop     eax edx ecx ebx eax edi esi
975
        xor     eax, eax
976
        ret
977
 
978
 
979
vesa12_read_screen_pixel:
980
 
981
        and     eax, 0x3FFFFF
982
        cmp     [ScreenBPP], byte 24; 24 or 32 bpp ?
983
        jz      v12rsp24
984
        mov     edi, eax
985
        shl     edi, 2
986
        mov     eax, edi
987
        shr     eax, 16
988
        call    set_bank
989
        and     edi, 65535
990
        add     edi, VGABasePtr
991
        mov     eax, [edi]
992
        and     eax, 0x00ffffff
993
        ret
994
  v12rsp24:
995
 
996
        imul    eax, 3
997
        mov     edi, eax
998
        shr     eax, 16
999
        call    set_bank
1000
        and     edi, 65535
1001
        add     edi, VGABasePtr
1002
        mov     eax, [edi]
1003
        and     eax, 0x00ffffff
1004
        ret
1005