Subversion Repositories Kolibri OS

Rev

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