Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
431 serge 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1 ha 17
 
593 mikedld 18
$Revision: 996 $
1 ha 19
 
593 mikedld 20
 
673 serge 21
TRIDENT       equ 0
22
S3_VIDEO      equ 0
23
INTEL_VIDEO   equ 0
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
 
1 ha 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
 
5 halyavin 58
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
59
; set_bank for Trident videocards, work on Trident 9440
60
; modified by Mario79
1 ha 61
 
673 serge 62
if TRIDENT
63
set_bank:
64
           pushfd
65
           cli
928 serge 66
           cmp al, byte [bank_rw]
673 serge 67
           je .retsb
5 halyavin 68
 
928 serge 69
           mov byte [bank_rw],al
673 serge 70
           push dx
71
           mov dx,3D8h
72
           out  dx,al
73
           pop dx
74
.retsb:
75
           popfd
76
           ret
77
end if
78
 
5 halyavin 79
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
80
; set_bank for S3 videocards, work on S3 ViRGE PCI (325)
379 serge 81
; modified by kmeaw
673 serge 82
 
83
if S3_VIDEO
379 serge 84
set_bank:
673 serge 85
           pushfd
86
           cli
928 serge 87
           cmp al, byte [bank_rw]
673 serge 88
           je .retsb
89
 
928 serge 90
           mov byte [bank_rw],al
673 serge 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
1 ha 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
 
673 serge 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
1 ha 163
 
164
;Set bank function for Intel 810/815 chipsets
165
; *****Modified by Protopopius, Russia.*****
166
; ********* http://menuetos.hut.ru **************
167
; ************************************************
168
 
673 serge 169
if INTEL_VIDEO
170
 
171
set_bank:
172
           pushfd
173
           cli
174
 
928 serge 175
           cmp al, byte [bank_rw]
673 serge 176
           je .retsb
177
 
928 serge 178
           mov byte [bank_rw],al
673 serge 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
 
1 ha 201
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
202
 
673 serge 203
if (TRIDENT or S3_VIDEO or INTEL_VIDEO)
204
else
205
set_bank:
206
           pushfd
207
           cli
1 ha 208
 
928 serge 209
           cmp al, byte [bank_rw]
673 serge 210
           je .retsb
1 ha 211
 
928 serge 212
           mov byte [bank_rw],al
673 serge 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
 
1 ha 243
vesa12_drawbackground:
244
 
245
        call  [disable_mouse]
246
 
247
        push  eax
248
        push  ebx
249
        push  ecx
250
        push  edx
251
 
252
        xor   edx,edx
527 diamond 253
        mov   eax,dword[BgrDataWidth]
254
        mov   ebx,dword[BgrDataHeight]
1 ha 255
        mul   ebx
256
        mov   ebx,3
257
        mul   ebx
258
        mov   [imax],eax
115 poddubny 259
        mov   eax,[draw_data+32+RECT.left]
260
        mov   ebx,[draw_data+32+RECT.top]
1 ha 261
        mov   edi,0 ;no force
262
 
263
      v12dp3:
264
 
265
        push  eax
266
        push  ebx
267
 
527 diamond 268
        cmp   [BgrDrawMode],dword 1     ; tiled background
1 ha 269
        jne   no_vesa12_tiled_bgr
270
 
271
        push  edx
272
 
273
        xor   edx,edx
527 diamond 274
        div   dword [BgrDataWidth]
1 ha 275
 
527 diamond 276
        push  edx
1 ha 277
        mov   eax,ebx
278
        xor   edx,edx
527 diamond 279
        div   dword [BgrDataHeight]
1 ha 280
        mov   ebx,edx
281
        pop   eax
282
 
283
        pop   edx
284
 
285
      no_vesa12_tiled_bgr:
286
 
527 diamond 287
        cmp   [BgrDrawMode],dword 2     ; stretched background
1 ha 288
        jne   no_vesa12_stretched_bgr
289
 
290
        push  edx
291
 
527 diamond 292
        mul   dword [BgrDataWidth]
753 serge 293
        mov   ecx,[Screen_Max_X]
1 ha 294
        inc   ecx
295
        div   ecx
296
 
297
        push  eax
298
        mov   eax,ebx
527 diamond 299
        mul   dword [BgrDataHeight]
753 serge 300
        mov   ecx,[Screen_Max_Y]
1 ha 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
 
527 diamond 311
        mov   esi,ebx
312
        imul  esi, dword [BgrDataWidth]
1 ha 313
        add   esi,eax
527 diamond 314
        lea   esi,[esi*3]
469 serge 315
        add   esi,[img_background]   ;IMG_BACKGROUND
1 ha 316
        pop   ebx
317
        pop   eax
318
 
319
      v12di4:
320
 
527 diamond 321
        mov   cl,[esi+2]
322
        shl   ecx,16
323
        mov   cx,[esi]
1 ha 324
        pusha
325
        mov   esi,eax
326
        mov   edi,ebx
753 serge 327
        mov   eax,[Screen_Max_X]
1 ha 328
        add   eax,1
329
        mul   ebx
840 serge 330
        mov   ebx, [_display_data]
331
        add   ebx, esi
332
        cmp   [eax+ebx],byte 1
1 ha 333
        jnz   v12nbgp
381 serge 334
        mov   eax,[BytesPerScanLine]
1 ha 335
        mov   ebx,edi
336
        mul   ebx
673 serge 337
        add   eax, esi
338
        lea   eax, [VGABasePtr+eax+esi*2]
928 serge 339
        cmp   byte [ScreenBPP], 24
1 ha 340
        jz    v12bgl3
341
        add   eax,esi
342
 
343
      v12bgl3:
344
 
345
        push ebx
346
        push eax
347
 
673 serge 348
        sub  eax,VGABasePtr
1 ha 349
 
350
        shr  eax,16
351
        call set_bank
352
        pop  eax
353
        and  eax,65535
381 serge 354
        add  eax,VGABasePtr
1 ha 355
        pop  ebx
356
 
357
        mov   [eax],cx
358
        add   eax,2
359
        shr   ecx,16
360
        mov   [eax],cl
361
        sti
362
 
363
      v12nbgp:
364
 
365
        popa
366
        add   esi,3
367
        inc   eax
115 poddubny 368
        cmp   eax,[draw_data+32+RECT.right]
1 ha 369
        jg    v12nodp31
370
        jmp   v12dp3
371
 
372
      v12nodp31:
373
 
115 poddubny 374
        mov   eax,[draw_data+32+RECT.left]
1 ha 375
        inc   ebx
115 poddubny 376
        cmp   ebx,[draw_data+32+RECT.bottom]
1 ha 377
        jg    v12dp4
378
        jmp   v12dp3
379
 
380
      v12dp4:
381
 
382
        pop   edx
383
        pop   ecx
384
        pop   ebx
385
        pop   eax
386
        ret
387
 
388
 
389
vesa12_drawbar:
390
 
391
    call  [disable_mouse]
392
 
393
;;    mov  [novesachecksum],dword 0
394
    sub  edx,ebx
395
    sub  ecx,eax
396
    push esi
397
    push edi
398
    push eax
399
    push ebx
400
    push ecx
401
    push edx
379 serge 402
    mov  ecx,[TASK_BASE]
115 poddubny 403
    add  eax,[ecx-twdw+WDATA.box.left]
404
    add  ebx,[ecx-twdw+WDATA.box.top]
1 ha 405
    push eax
406
    mov  eax,ebx         ; y
381 serge 407
    mov  ebx,[BytesPerScanLine]
1 ha 408
    mul  ebx
409
    pop  ecx
410
    add  eax,ecx         ; x
411
    add  eax,ecx
412
    add  eax,ecx
928 serge 413
    cmp  byte [ScreenBPP], 24     ; 24 or 32 bpp ? - x start
1 ha 414
    jz   dbpi2412
415
    add  eax,ecx
416
 
417
  dbpi2412:
418
 
673 serge 419
    add  eax,VGABasePtr
1 ha 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
928 serge 428
    cmp  byte [ScreenBPP], 24     ; 24 or 32 bpp ? - x size
1 ha 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
379 serge 440
    mov  eax,[TASK_BASE]
996 serge 441
    sub  eax, CURRENT_TASK
442
    mov  ecx,[eax+draw_data+RECT.left]
1 ha 443
    cmp  ecx,0
444
    jnz  dbcblimitlset12
996 serge 445
    mov  ecx,[eax+draw_data+RECT.top]
1 ha 446
    cmp  ecx,0
447
    jnz  dbcblimitlset12
996 serge 448
    mov  ecx,[eax+draw_data+RECT.right]
753 serge 449
    cmp  ecx,[Screen_Max_X]
1 ha 450
    jnz  dbcblimitlset12
996 serge 451
    mov  ecx,[eax+draw_data+RECT.bottom]
753 serge 452
    cmp  ecx,[Screen_Max_Y]
1 ha 453
    jnz  dbcblimitlset12
454
    pop  ecx
455
    pop  eax
456
    push dword 0
457
    jmp  dbcblimitlno12
458
 
459
  dbcblimitlset12:
460
 
461
    pop  ecx
462
    pop  eax
463
    push dword 1
464
 
465
  dbcblimitlno12:
466
 
928 serge 467
    cmp  byte [ScreenBPP], 24     ; 24 or 32 bpp ?
1 ha 468
    jz   dbpi24bit12
469
    jmp  dbpi32bit12
470
 
471
 
472
; DRAWBAR 24 BBP
473
 
474
 
475
dbpi24bit12:
476
 
477
    push eax
478
    push ebx
479
    push edx
480
    mov  eax,ecx
481
    mov  ebx,3
482
    div  ebx
483
    mov  ecx,eax
484
    pop  edx
485
    pop  ebx
486
    pop  eax
487
    cld
488
 
489
  dbnewpi12:
490
 
491
    push ebx
492
    push edi
493
    push ecx
494
 
495
      xor  edx,edx
496
      mov  eax,edi
673 serge 497
      sub  eax,VGABasePtr
1 ha 498
      mov  ebx,3
499
      div  ebx
840 serge 500
      add  eax, [_display_data]
379 serge 501
      mov   ebx,[CURRENT_TASK]
1 ha 502
      cld
503
 
504
      dbnp2412:
505
 
506
        mov  dl,[eax]
507
        push eax
508
        push ecx
509
        cmp  dl,bl
510
        jnz  dbimp24no12
511
        cmp  [esp+5*4],dword 0
512
        jz   dbimp24yes12
513
;        call dbcplimit
514
;        jnz  dbimp24no12
515
 
516
     dbimp24yes12:
517
 
518
        push edi
519
        mov  eax,edi
673 serge 520
        sub  eax,VGABasePtr
1 ha 521
        shr  eax,16
522
        call set_bank
523
        and  edi,0xffff
381 serge 524
        add  edi,VGABasePtr
1 ha 525
        mov  eax,[esp+8+3*4+16+4+4]
526
        stosw
527
        shr  eax,16
528
        stosb
529
        sti
530
        pop  edi
531
        add  edi,3
532
        pop  ecx
533
        pop  eax
534
        inc  eax
535
        loop dbnp2412
536
        jmp  dbnp24d12
537
 
538
      dbimp24no12:
539
 
540
        pop  ecx
541
        pop  eax
542
        cld
543
        add  edi,3
544
        inc  eax
545
        loop dbnp2412
546
 
547
      dbnp24d12:
548
 
549
        mov  eax,[esp+3*4+16+4]
550
        test eax,0x80000000
551
        jz   nodbgl2412
552
        cmp  al,0
553
        jz   nodbgl2412
554
        dec  eax
555
        mov  [esp+3*4+16+4],eax
556
 
557
      nodbgl2412:
558
 
559
    pop  ecx
560
    pop  edi
561
    pop  ebx
381 serge 562
    add  edi,[BytesPerScanLine]
1 ha 563
    dec  ebx
564
    jz   dbnonewpi12
565
    jmp  dbnewpi12
566
 
567
  dbnonewpi12:
568
 
569
    add  esp,7*4
570
 
571
    ret
572
 
573
 
574
; DRAWBAR 32 BBP
575
 
576
 
577
  dbpi32bit12:
578
 
579
    cld
580
    shr  ecx,2
581
 
582
   dbnewpi3212:
583
 
584
    push ebx
585
    push edi
586
    push ecx
587
 
588
      mov  eax,edi
673 serge 589
      sub  eax,VGABasePtr
1 ha 590
      shr  eax,2
840 serge 591
      add  eax, [_display_data]
379 serge 592
      mov   ebx,[CURRENT_TASK]
1 ha 593
      cld
594
 
595
      dbnp3212:
596
 
597
        mov  dl,[eax]
598
        push eax
599
        push ecx
600
        cmp  dl,bl
601
        jnz  dbimp32no12
602
        cmp  [esp+5*4],dword 0
603
        jz   dbimp32yes12
604
;        call dbcplimit
605
;        jnz  dbimp32no12
606
 
607
      dbimp32yes12:
608
 
609
        push edi
610
        mov  eax,edi
673 serge 611
        sub  eax,VGABasePtr
1 ha 612
        shr  eax,16
613
        call set_bank
614
        and  edi,0xffff
381 serge 615
        add  edi,VGABasePtr
1 ha 616
        mov  eax,[esp+8+3*4+16+4+4]
617
        stosw
618
        shr  eax,16
619
        stosb
620
        sti
621
        pop  edi
622
        add  edi,4
623
        inc  ebp
624
        pop  ecx
625
        pop  eax
626
        inc  eax
627
        loop dbnp3212
628
        jmp  dbnp32d12
629
 
630
      dbimp32no12:
631
 
632
        pop  ecx
633
        pop  eax
634
        inc  eax
635
        add  edi,4
636
        inc  ebp
637
        loop dbnp3212
638
 
639
      dbnp32d12:
640
 
641
        mov  eax,[esp+12+16+4]
642
        test eax,0x80000000
643
        jz   nodbgl3212
644
        cmp  al,0
645
        jz   nodbgl3212
646
        dec  eax
647
        mov  [esp+12+16+4],eax
648
 
649
      nodbgl3212:
650
 
651
    pop  ecx
652
    pop  edi
653
    pop  ebx
381 serge 654
    add  edi,[BytesPerScanLine]
1 ha 655
    dec  ebx
656
    jz   nodbnewpi3212
657
    jmp  dbnewpi3212
658
 
659
  nodbnewpi3212:
660
 
661
    add  esp,7*4
662
    ret
663
 
664
 
665
Vesa12_putpixel24:
666
 
667
        mov  edi,eax ; x
668
        mov  eax,ebx ; y
669
        lea  edi,[edi+edi*2]
381 serge 670
        mov  ebx,[BytesPerScanLine]
1 ha 671
        mul  ebx
672
        add  edi,eax
673
        mov  eax,edi
674
        shr  eax,16
675
        call set_bank
676
        and  edi,65535
381 serge 677
        add  edi,VGABasePtr
1 ha 678
        mov  eax,[esp+28]
679
        stosw
680
        shr  eax,16
681
        mov  [edi],al
682
        sti
683
        ret
684
 
685
 
686
 
687
Vesa12_putpixel32:
688
 
689
        mov  edi,eax ; x
690
        mov  eax,ebx ; y
691
        shl  edi,2
381 serge 692
        mov  ebx,[BytesPerScanLine]
1 ha 693
        mul  ebx
694
        add  edi,eax
695
        mov  eax,edi
696
        shr  eax,16
697
        call set_bank
698
        and  edi,65535
381 serge 699
        add  edi,VGABasePtr
1 ha 700
        mov  ecx,[esp+28]
701
        mov  [edi],ecx
702
        sti
703
        ret
704
 
705
 
706
Vesa12_getpixel24:
707
 
708
        mov  edi,eax ; x
709
        mov  eax,ebx ; y
710
        lea  edi,[edi+edi*2]
381 serge 711
        mov  ebx,[BytesPerScanLine]
1 ha 712
        mul  ebx
713
        add  edi,eax
714
        mov  eax,edi
715
        shr  eax,16
716
        call set_bank
717
        and  edi,65535
381 serge 718
        add  edi,VGABasePtr
1 ha 719
        mov  ecx,[edi]
720
        and  ecx,255*256*256+255*256+255
721
        sti
722
        ret
723
 
724
 
725
Vesa12_getpixel32:
726
 
727
        mov  edi,eax ; x
728
        mov  eax,ebx ; y
729
        shl  edi,2
381 serge 730
        mov  ebx,[BytesPerScanLine]
1 ha 731
        xor  edx,edx
732
        mul  ebx
733
        add  edi,eax
734
        mov  eax,edi
735
        shr  eax,16
736
        call set_bank
737
        and  edi,65535
381 serge 738
        add  edi,VGABasePtr
1 ha 739
        mov  ecx,[edi]
740
        and  ecx,255*256*256+255*256+255
741
        sti
742
 
743
        ret
744
 
745
 
746
 
747
vesa12_putimage:
283 diamond 748
; ebx = pointer to image
749
; ecx = size [x|y]
750
; edx = coordinates [x|y]
751
; ebp = pointer to 'get' function
752
; esi = pointer to 'init' function
753
; edi = parameter for 'get' function
1 ha 754
 
755
;    mov  ebx,image
756
;    mov  ecx,320*65536+240
757
;    mov  edx,20*65536+20
758
 
759
    call  [disable_mouse]
760
 
761
    mov   [novesachecksum],dword 0
762
    push  esi
763
    push  edi
764
    push  eax
765
    push  ebx
766
    push  ecx
767
    push  edx
768
    movzx eax,word [esp+2]
769
    movzx ebx,word [esp+0]
379 serge 770
    mov   ecx,[TASK_BASE]
115 poddubny 771
    add   eax,[ecx-twdw+WDATA.box.left]
772
    add   ebx,[ecx-twdw+WDATA.box.top]
1 ha 773
    push  eax
774
    mov   eax,ebx         ; y
381 serge 775
    mul   dword [BytesPerScanLine]
1 ha 776
    pop   ecx
777
    add   eax,ecx         ; x
778
    add   eax,ecx
779
    add   eax,ecx
928 serge 780
    cmp  byte [ScreenBPP], 24     ; 24 or 32 bpp ? - x start
1 ha 781
    jz   pi2412
782
    add  eax,ecx
783
 
784
  pi2412:
785
 
673 serge 786
    add  eax,VGABasePtr
1 ha 787
    mov  edi,eax
788
 
789
    ; x size
790
 
283 diamond 791
    movzx ecx,word [esp+6]
1 ha 792
 
793
    mov   esi,[esp+8]
794
    movzx ebx,word [esp+4]
795
 
796
    ; check limits while draw ?
797
 
798
    push  ecx
379 serge 799
    mov  eax,[TASK_BASE]
996 serge 800
    sub eax, CURRENT_TASK
801
    cmp  dword [eax+draw_data+RECT.left], 0
1 ha 802
    jnz  dbcblimitlset212
996 serge 803
    cmp  dword [eax+draw_data+RECT.top], 0
1 ha 804
    jnz  dbcblimitlset212
996 serge 805
    mov  ecx,[eax+draw_data+RECT.right]
753 serge 806
    cmp  ecx,[Screen_Max_X]
1 ha 807
    jnz  dbcblimitlset212
996 serge 808
    mov  ecx,[eax+draw_data+RECT.bottom]
753 serge 809
    cmp  ecx,[Screen_Max_Y]
1 ha 810
    jnz  dbcblimitlset212
811
    pop  ecx
283 diamond 812
    push 0
1 ha 813
    jmp  dbcblimitlno212
814
 
815
  dbcblimitlset212:
816
 
817
    pop  ecx
283 diamond 818
    push 1
1 ha 819
 
820
  dbcblimitlno212:
821
 
928 serge 822
    cmp  byte [ScreenBPP], 24     ; 24 or 32 bpp ?
283 diamond 823
    jnz  pi32bit12
1 ha 824
 
825
  pi24bit12:
826
 
827
  newpi12:
828
 
829
    push edi
830
    push ecx
831
    push ebx
832
 
283 diamond 833
      mov  edx,edi
673 serge 834
      sub  edx,VGABasePtr
1 ha 835
      mov  ebx,3
836
      div  ebx
840 serge 837
      add  edx,[_display_data]
379 serge 838
      mov  ebx,[CURRENT_TASK]
283 diamond 839
      mov  bh,[esp+4*3]
1 ha 840
 
841
      np2412:
842
 
283 diamond 843
        cmp  bl,[edx]
1 ha 844
        jnz  imp24no12
283 diamond 845
;        mov  eax,[esi]
846
        push    dword [esp+4*3+20]
847
        call    ebp
848
;        cmp  bh,0
849
;        jz   imp24yes12
1 ha 850
;        call dbcplimit
851
;        jnz  imp24no12
852
 
853
     imp24yes12:
854
 
283 diamond 855
        push edi
1 ha 856
        push eax
857
        mov  eax,edi
673 serge 858
        sub  eax,VGABasePtr
1 ha 859
        shr  eax,16
860
        call set_bank
283 diamond 861
        pop  eax
1 ha 862
        and  edi,0xffff
381 serge 863
        add  edi,VGABasePtr
283 diamond 864
        mov  [edi],ax
865
        shr  eax,16
866
        mov  [edi+2],al
1 ha 867
        pop  edi
868
 
869
     imp24no12:
870
 
283 diamond 871
        inc  edx
872
;        add  esi,3
1 ha 873
        add  edi,3
874
        dec  ecx
875
        jnz  np2412
876
 
877
      np24d12:
878
 
879
     pop  ebx
880
     pop  ecx
881
     pop  edi
882
 
381 serge 883
    add  edi,[BytesPerScanLine]
314 diamond 884
    add  esi,[esp+32]
914 serge 885
    cmp  ebp,putimage_get1bpp
886
    jz   .correct
887
    cmp  ebp,putimage_get4bpp
888
    jnz  @f
889
.correct:
890
    mov  eax,[esp+20]
891
    mov  byte[eax],80h
892
@@:
1 ha 893
    dec  ebx
283 diamond 894
    jnz  newpi12
1 ha 895
 
896
  nonewpi12:
897
 
283 diamond 898
        pop     eax edx ecx ebx eax edi esi
899
        xor     eax, eax
900
        ret
1 ha 901
 
902
 
903
  pi32bit12:
904
 
905
   newpi3212:
906
 
907
    push edi
908
    push ecx
909
    push ebx
910
 
283 diamond 911
      mov  edx,edi
673 serge 912
      sub  edx,VGABasePtr
283 diamond 913
      shr  edx,2
840 serge 914
      add  edx, [_display_data]
379 serge 915
      mov   ebx,[CURRENT_TASK]
283 diamond 916
      mov   bh,[esp+4*3]
1 ha 917
 
918
      np3212:
919
 
283 diamond 920
        cmp  bl,[edx]
1 ha 921
        jnz  imp32no12
283 diamond 922
;        mov  eax,[esi]
923
        push    dword [esp+4*3+20]
924
        call    ebp
925
;        cmp  bh,0
926
;        jz   imp32yes12
1 ha 927
;        call dbcplimit
928
;        jnz  imp32no12
929
 
930
      imp32yes12:
931
 
283 diamond 932
        push edi
1 ha 933
        push eax
934
        mov  eax,edi
673 serge 935
        sub  eax,VGABasePtr
1 ha 936
        shr  eax,16
937
        call set_bank
283 diamond 938
        pop  eax
1 ha 939
        and  edi,0xffff
381 serge 940
        mov  [edi+VGABasePtr],eax
1 ha 941
        pop  edi
942
 
943
      imp32no12:
944
 
283 diamond 945
        inc  edx
946
;        add  esi,3
1 ha 947
        add  edi,4
948
        dec  ecx
949
        jnz  np3212
950
 
951
      np32d12:
952
 
953
     pop  ebx
954
     pop  ecx
955
     pop  edi
956
 
381 serge 957
    add   edi,[BytesPerScanLine]
914 serge 958
    cmp   ebp,putimage_get1bpp
959
    jz    .correct
960
    cmp   ebp,putimage_get4bpp
961
    jnz   @f
962
.correct:
963
    mov   eax,[esp+20]
964
    mov   byte[eax],80h
965
@@:
1 ha 966
    dec   ebx
283 diamond 967
    jnz   newpi3212
1 ha 968
 
969
  nonewpi3212:
970
 
283 diamond 971
        pop     eax edx ecx ebx eax edi esi
972
        xor     eax, eax
973
        ret
1 ha 974
 
975
 
976
vesa12_read_screen_pixel:
977
 
978
     and   eax,0x3FFFFF
928 serge 979
     cmp   byte [ScreenBPP], 24      ; 24 or 32 bpp ?
1 ha 980
     jz    v12rsp24
981
     mov   edi,eax
982
     shl   edi,2
983
     mov   eax,edi
984
     shr   eax,16
985
     call  set_bank
986
     and   edi,65535
381 serge 987
     add   edi,VGABasePtr
1 ha 988
     mov   eax,[edi]
989
     and   eax,0x00ffffff
990
     ret
991
  v12rsp24:
992
 
993
     imul  eax,3
994
     mov   edi,eax
995
     shr   eax,16
996
     call  set_bank
997
     and   edi,65535
381 serge 998
     add   edi,VGABasePtr
1 ha 999
     mov   eax,[edi]
1000
     and   eax,0x00ffffff
1001
     ret
1002