Subversion Repositories Kolibri OS

Rev

Rev 840 | 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: 914 $
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
66
           cmp al,[BANK_RW]
67
           je .retsb
5 halyavin 68
 
673 serge 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
 
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
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
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
 
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
 
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
 
673 serge 209
           cmp al,[BANK_RW]
210
           je .retsb
1 ha 211
 
673 serge 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
 
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]
381 serge 339
        cmp   [ScreenBPP],byte 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
381 serge 413
    cmp  [ScreenBPP],byte 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
381 serge 428
    cmp  [ScreenBPP],byte 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]
441
    mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.left]
1 ha 442
    cmp  ecx,0
443
    jnz  dbcblimitlset12
379 serge 444
    mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.top]
1 ha 445
    cmp  ecx,0
446
    jnz  dbcblimitlset12
379 serge 447
    mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.right]
753 serge 448
    cmp  ecx,[Screen_Max_X]
1 ha 449
    jnz  dbcblimitlset12
379 serge 450
    mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom]
753 serge 451
    cmp  ecx,[Screen_Max_Y]
1 ha 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
 
381 serge 466
    cmp  [ScreenBPP],byte 24     ; 24 or 32 bpp ?
1 ha 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
673 serge 496
      sub  eax,VGABasePtr
1 ha 497
      mov  ebx,3
498
      div  ebx
840 serge 499
      add  eax, [_display_data]
379 serge 500
      mov   ebx,[CURRENT_TASK]
1 ha 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
673 serge 519
        sub  eax,VGABasePtr
1 ha 520
        shr  eax,16
521
        call set_bank
522
        and  edi,0xffff
381 serge 523
        add  edi,VGABasePtr
1 ha 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
381 serge 561
    add  edi,[BytesPerScanLine]
1 ha 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
673 serge 588
      sub  eax,VGABasePtr
1 ha 589
      shr  eax,2
840 serge 590
      add  eax, [_display_data]
379 serge 591
      mov   ebx,[CURRENT_TASK]
1 ha 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
673 serge 610
        sub  eax,VGABasePtr
1 ha 611
        shr  eax,16
612
        call set_bank
613
        and  edi,0xffff
381 serge 614
        add  edi,VGABasePtr
1 ha 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
381 serge 653
    add  edi,[BytesPerScanLine]
1 ha 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]
381 serge 669
        mov  ebx,[BytesPerScanLine]
1 ha 670
        mul  ebx
671
        add  edi,eax
672
        mov  eax,edi
673
        shr  eax,16
674
        call set_bank
675
        and  edi,65535
381 serge 676
        add  edi,VGABasePtr
1 ha 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
381 serge 691
        mov  ebx,[BytesPerScanLine]
1 ha 692
        mul  ebx
693
        add  edi,eax
694
        mov  eax,edi
695
        shr  eax,16
696
        call set_bank
697
        and  edi,65535
381 serge 698
        add  edi,VGABasePtr
1 ha 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]
381 serge 710
        mov  ebx,[BytesPerScanLine]
1 ha 711
        mul  ebx
712
        add  edi,eax
713
        mov  eax,edi
714
        shr  eax,16
715
        call set_bank
716
        and  edi,65535
381 serge 717
        add  edi,VGABasePtr
1 ha 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
381 serge 729
        mov  ebx,[BytesPerScanLine]
1 ha 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
381 serge 737
        add  edi,VGABasePtr
1 ha 738
        mov  ecx,[edi]
739
        and  ecx,255*256*256+255*256+255
740
        sti
741
 
742
        ret
743
 
744
 
745
 
746
vesa12_putimage:
283 diamond 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
1 ha 753
 
754
;    mov  ebx,image
755
;    mov  ecx,320*65536+240
756
;    mov  edx,20*65536+20
757
 
758
    call  [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]
379 serge 769
    mov   ecx,[TASK_BASE]
115 poddubny 770
    add   eax,[ecx-twdw+WDATA.box.left]
771
    add   ebx,[ecx-twdw+WDATA.box.top]
1 ha 772
    push  eax
773
    mov   eax,ebx         ; y
381 serge 774
    mul   dword [BytesPerScanLine]
1 ha 775
    pop   ecx
776
    add   eax,ecx         ; x
777
    add   eax,ecx
778
    add   eax,ecx
381 serge 779
    cmp  [ScreenBPP],byte 24     ; 24 or 32 bpp ? - x start
1 ha 780
    jz   pi2412
781
    add  eax,ecx
782
 
783
  pi2412:
784
 
673 serge 785
    add  eax,VGABasePtr
1 ha 786
    mov  edi,eax
787
 
788
    ; x size
789
 
283 diamond 790
    movzx ecx,word [esp+6]
1 ha 791
 
792
    mov   esi,[esp+8]
793
    movzx ebx,word [esp+4]
794
 
795
    ; check limits while draw ?
796
 
797
    push  ecx
379 serge 798
    mov  eax,[TASK_BASE]
799
    cmp  dword [eax+draw_data-CURRENT_TASK+RECT.left], 0
1 ha 800
    jnz  dbcblimitlset212
379 serge 801
    cmp  dword [eax+draw_data-CURRENT_TASK+RECT.top], 0
1 ha 802
    jnz  dbcblimitlset212
379 serge 803
    mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.right]
753 serge 804
    cmp  ecx,[Screen_Max_X]
1 ha 805
    jnz  dbcblimitlset212
379 serge 806
    mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom]
753 serge 807
    cmp  ecx,[Screen_Max_Y]
1 ha 808
    jnz  dbcblimitlset212
809
    pop  ecx
283 diamond 810
    push 0
1 ha 811
    jmp  dbcblimitlno212
812
 
813
  dbcblimitlset212:
814
 
815
    pop  ecx
283 diamond 816
    push 1
1 ha 817
 
818
  dbcblimitlno212:
819
 
381 serge 820
    cmp  [ScreenBPP],byte 24     ; 24 or 32 bpp ?
283 diamond 821
    jnz  pi32bit12
1 ha 822
 
823
  pi24bit12:
824
 
825
  newpi12:
826
 
827
    push edi
828
    push ecx
829
    push ebx
830
 
283 diamond 831
      mov  edx,edi
673 serge 832
      sub  edx,VGABasePtr
1 ha 833
      mov  ebx,3
834
      div  ebx
840 serge 835
      add  edx,[_display_data]
379 serge 836
      mov  ebx,[CURRENT_TASK]
283 diamond 837
      mov  bh,[esp+4*3]
1 ha 838
 
839
      np2412:
840
 
283 diamond 841
        cmp  bl,[edx]
1 ha 842
        jnz  imp24no12
283 diamond 843
;        mov  eax,[esi]
844
        push    dword [esp+4*3+20]
845
        call    ebp
846
;        cmp  bh,0
847
;        jz   imp24yes12
1 ha 848
;        call dbcplimit
849
;        jnz  imp24no12
850
 
851
     imp24yes12:
852
 
283 diamond 853
        push edi
1 ha 854
        push eax
855
        mov  eax,edi
673 serge 856
        sub  eax,VGABasePtr
1 ha 857
        shr  eax,16
858
        call set_bank
283 diamond 859
        pop  eax
1 ha 860
        and  edi,0xffff
381 serge 861
        add  edi,VGABasePtr
283 diamond 862
        mov  [edi],ax
863
        shr  eax,16
864
        mov  [edi+2],al
1 ha 865
        pop  edi
866
 
867
     imp24no12:
868
 
283 diamond 869
        inc  edx
870
;        add  esi,3
1 ha 871
        add  edi,3
872
        dec  ecx
873
        jnz  np2412
874
 
875
      np24d12:
876
 
877
     pop  ebx
878
     pop  ecx
879
     pop  edi
880
 
381 serge 881
    add  edi,[BytesPerScanLine]
314 diamond 882
    add  esi,[esp+32]
914 serge 883
    cmp  ebp,putimage_get1bpp
884
    jz   .correct
885
    cmp  ebp,putimage_get4bpp
886
    jnz  @f
887
.correct:
888
    mov  eax,[esp+20]
889
    mov  byte[eax],80h
890
@@:
1 ha 891
    dec  ebx
283 diamond 892
    jnz  newpi12
1 ha 893
 
894
  nonewpi12:
895
 
283 diamond 896
        pop     eax edx ecx ebx eax edi esi
897
        xor     eax, eax
898
        ret
1 ha 899
 
900
 
901
  pi32bit12:
902
 
903
   newpi3212:
904
 
905
    push edi
906
    push ecx
907
    push ebx
908
 
283 diamond 909
      mov  edx,edi
673 serge 910
      sub  edx,VGABasePtr
283 diamond 911
      shr  edx,2
840 serge 912
      add  edx, [_display_data]
379 serge 913
      mov   ebx,[CURRENT_TASK]
283 diamond 914
      mov   bh,[esp+4*3]
1 ha 915
 
916
      np3212:
917
 
283 diamond 918
        cmp  bl,[edx]
1 ha 919
        jnz  imp32no12
283 diamond 920
;        mov  eax,[esi]
921
        push    dword [esp+4*3+20]
922
        call    ebp
923
;        cmp  bh,0
924
;        jz   imp32yes12
1 ha 925
;        call dbcplimit
926
;        jnz  imp32no12
927
 
928
      imp32yes12:
929
 
283 diamond 930
        push edi
1 ha 931
        push eax
932
        mov  eax,edi
673 serge 933
        sub  eax,VGABasePtr
1 ha 934
        shr  eax,16
935
        call set_bank
283 diamond 936
        pop  eax
1 ha 937
        and  edi,0xffff
381 serge 938
        mov  [edi+VGABasePtr],eax
1 ha 939
        pop  edi
940
 
941
      imp32no12:
942
 
283 diamond 943
        inc  edx
944
;        add  esi,3
1 ha 945
        add  edi,4
946
        dec  ecx
947
        jnz  np3212
948
 
949
      np32d12:
950
 
951
     pop  ebx
952
     pop  ecx
953
     pop  edi
954
 
381 serge 955
    add   edi,[BytesPerScanLine]
914 serge 956
    cmp   ebp,putimage_get1bpp
957
    jz    .correct
958
    cmp   ebp,putimage_get4bpp
959
    jnz   @f
960
.correct:
961
    mov   eax,[esp+20]
962
    mov   byte[eax],80h
963
@@:
1 ha 964
    dec   ebx
283 diamond 965
    jnz   newpi3212
1 ha 966
 
967
  nonewpi3212:
968
 
283 diamond 969
        pop     eax edx ecx ebx eax edi esi
970
        xor     eax, eax
971
        ret
1 ha 972
 
973
 
974
vesa12_read_screen_pixel:
975
 
976
     and   eax,0x3FFFFF
381 serge 977
     cmp   [ScreenBPP],byte 24      ; 24 or 32 bpp ?
1 ha 978
     jz    v12rsp24
979
     mov   edi,eax
980
     shl   edi,2
981
     mov   eax,edi
982
     shr   eax,16
983
     call  set_bank
984
     and   edi,65535
381 serge 985
     add   edi,VGABasePtr
1 ha 986
     mov   eax,[edi]
987
     and   eax,0x00ffffff
988
     ret
989
  v12rsp24:
990
 
991
     imul  eax,3
992
     mov   edi,eax
993
     shr   eax,16
994
     call  set_bank
995
     and   edi,65535
381 serge 996
     add   edi,VGABasePtr
1 ha 997
     mov   eax,[edi]
998
     and   eax,0x00ffffff
999
     ret
1000