Subversion Repositories Kolibri OS

Rev

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