Subversion Repositories Kolibri OS

Rev

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

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