Subversion Repositories Kolibri OS

Rev

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

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