Subversion Repositories Kolibri OS

Rev

Rev 914 | Rev 996 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 914 Rev 928
Line 15... Line 15...
15
;;                                                              ;;
15
;;                                                              ;;
16
;;  See file COPYING for details                                ;;
16
;;  See file COPYING for details                                ;;
17
;;                                                              ;;
17
;;                                                              ;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 19... Line 19...
19
 
19
 
Line 20... Line 20...
20
$Revision: 914 $
20
$Revision: 928 $
21
 
21
 
Line 22... Line -...
22
 
-
 
23
; If you're planning to write your own video driver I suggest
-
 
24
; you replace the VESA12.INC file and see those instructions.
-
 
25
 
-
 
26
;Screen_Max_X             equ     0xfe00
-
 
27
;Screen_Max_Y            equ     0xfe04
-
 
Line 28... Line 22...
28
;BytesPerScanLine        equ     0xfe08
22
 
29
;LFBAddress              equ     0xfe80
23
; If you're planning to write your own video driver I suggest
30
;ScreenBPP               equ     0xfbf1
24
; you replace the VESA12.INC file and see those instructions.
31
 
25
 
Line 40... Line 34...
40
; ret:
34
; ret:
41
; ecx = 00 RR GG BB
35
; ecx = 00 RR GG BB
Line 42... Line 36...
42
 
36
 
43
getpixel:
37
getpixel:
44
     push    eax ebx edx edi
38
     push    eax ebx edx edi
45
     call    dword [GETPIXEL]
39
     call    [get_pixel]
46
     pop     edi edx ebx eax
40
     pop     edi edx ebx eax
Line 47... Line 41...
47
     ret
41
     ret
48
 
42
 
49
Vesa20_getpixel24:
43
Vesa20_getpixel24:
50
; eax = x
44
; eax = x
51
; ebx = y
45
; ebx = y
52
     imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
46
     imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
-
 
47
     lea     edi, [eax+eax*2] ; edi = x*3
53
     lea     edi, [eax+eax*2] ; edi = x*3
48
     add     edi, ebx         ; edi = x*3+(y*y multiplier)
-
 
49
if SHADOWFB
54
     add     edi, ebx         ; edi = x*3+(y*y multiplier)
50
     mov     ecx, [SHADOWFB+edi]
-
 
51
else
55
     add     edi, [LFBAddress]    ; ebx = where pixel is in memory
52
     mov     ecx, [LFB_BASE+edi]
56
     mov     ecx, [edi]
53
end if
Line 57... Line 54...
57
     and     ecx, 0xffffff
54
     and     ecx, 0xffffff
58
     ret
55
     ret
59
 
56
 
-
 
57
Vesa20_getpixel32:
60
Vesa20_getpixel32:
58
     imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
-
 
59
     lea     edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
61
     imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
60
if SHADOWFB
-
 
61
     mov     ecx, [SHADOWFB+edi]
62
     lea     edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
62
else
63
     add     edi, [LFBAddress]    ; ebx = where pixel is in memory
63
     mov     ecx, [LFB_BASE+edi]
Line 64... Line 64...
64
     mov     ecx, [edi]
64
end if
Line 175... Line 175...
175
     inc     eax
175
     inc     eax
176
     sub     eax, [putimg.real_sx]
176
     sub     eax, [putimg.real_sx]
177
     mov     [putimg.winmap_newline], eax
177
     mov     [putimg.winmap_newline], eax
178
; screen new line increment
178
; screen new line increment
179
     mov     eax, [BytesPerScanLine]
179
     mov     eax, [BytesPerScanLine]
180
     movzx   ebx, byte [ScreenBPP]
180
     mov     ebx, [ScreenBPP]
181
     shr     ebx, 3
181
     shr     ebx, 3
182
     imul    ecx, ebx
182
     imul    ecx, ebx
183
     sub     eax, ecx
183
     sub     eax, ecx
184
     mov     [putimg.screen_newline], eax
184
     mov     [putimg.screen_newline], eax
185
; pointer to image
185
; pointer to image
186
     mov     esi, [putimg.pti]
186
     mov     esi, [putimg.pti]
187
; pointer to screen
187
; pointer to screen
188
     mov     edx, [putimg.abs_cy]
188
     mov     edx, [putimg.abs_cy]
189
     imul    edx, [BytesPerScanLine]
189
     imul    edx, [BytesPerScanLine]
190
     mov     eax, [putimg.abs_cx]
190
     mov     eax, [putimg.abs_cx]
191
     movzx   ebx, byte [ScreenBPP]
191
     mov     ebx, [ScreenBPP]
192
     shr     ebx, 3
192
     shr     ebx, 3
193
     imul    eax, ebx
193
     imul    eax, ebx
194
     add     edx, eax
194
     add     edx, eax
195
     add     edx, [LFBAddress]
-
 
196
; pointer to pixel map
195
; pointer to pixel map
197
     mov     eax, [putimg.abs_cy]
196
     mov     eax, [putimg.abs_cy]
198
     imul    eax, [Screen_Max_X]
197
     imul    eax, [Screen_Max_X]
199
     add     eax, [putimg.abs_cy]
198
     add     eax, [putimg.abs_cy]
200
     add     eax, [putimg.abs_cx]
199
     add     eax, [putimg.abs_cx]
Line 216... Line 215...
216
     mov     eax, [putimg.ebp+4]
215
     mov     eax, [putimg.ebp+4]
217
     call    eax
216
     call    eax
218
     cmp     [ebp], bl
217
     cmp     [ebp], bl
219
     jne     .skip
218
     jne     .skip
220
;     mov     eax, [esi]        ; eax = RRBBGGRR
219
;     mov     eax, [esi]        ; eax = RRBBGGRR
-
 
220
if SHADOWFB
-
 
221
     mov     [SHADOWFB+edx], ax
-
 
222
end if
221
     mov     [edx], ax
223
     mov     [LFB_BASE+edx], ax
222
     shr     eax, 16
224
     shr     eax, 16
-
 
225
if SHADOWFB
-
 
226
     mov     [SHADOWFB+edx+2], al
-
 
227
end if
223
     mov     [edx+2], al
228
     mov     [LFB_BASE+edx+2], al
224
.skip:
229
.skip:
225
;     add     esi, 3 ;[putimg.source_bpp]
230
;     add     esi, 3 ;[putimg.source_bpp]
226
     add     edx, 3
231
     add     edx, 3
227
     inc     ebp
232
     inc     ebp
228
     dec     ecx
233
     dec     ecx
Line 259... Line 264...
259
     mov     eax, [putimg.ebp+4]
264
     mov     eax, [putimg.ebp+4]
260
     call    eax
265
     call    eax
261
     cmp     [ebp], bl
266
     cmp     [ebp], bl
262
     jne     .skip
267
     jne     .skip
263
;     mov     eax, [esi]        ; ecx = RRBBGGRR
268
;     mov     eax, [esi]        ; ecx = RRBBGGRR
-
 
269
if SHADOWFB
-
 
270
     mov     [SHADOWFB+edx], eax
-
 
271
end if
264
     mov     [edx], eax
272
     mov     [LFB_BASE+edx], eax
265
.skip:
273
.skip:
266
;     add     esi, [putimg.source_bpp]
274
;     add     esi, [putimg.source_bpp]
267
     add     edx, 4
275
     add     edx, 4
268
     inc     ebp
276
     inc     ebp
269
     dec     ecx
277
     dec     ecx
Line 322... Line 330...
322
     call  getpixel
330
     call  getpixel
323
     not   ecx
331
     not   ecx
324
     mov   [esp+32-8],ecx
332
     mov   [esp+32-8],ecx
325
.noneg:
333
.noneg:
326
; OK to set pixel
334
; OK to set pixel
327
     call  dword [PUTPIXEL]    ; call the real put_pixel function
335
     call  [put_pixel]    ; call the real put_pixel function
328
.exit:
336
.exit:
329
     popad
337
     popad
330
     ret
338
     ret
Line 331... Line 339...
331
 
339
 
Line 334... Line 342...
334
; eax = x
342
; eax = x
335
; ebx = y
343
; ebx = y
336
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
344
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
337
     lea     edi, [eax+eax*2]  ; edi = x*3
345
     lea     edi, [eax+eax*2]  ; edi = x*3
338
     mov     eax, [esp+32-8+4]
346
     mov     eax, [esp+32-8+4]
339
     add     edi, [LFBAddress]
347
if SHADOWFB
340
     add     edi, ebx          ; ebx = where to put pixel in memory
348
     mov     [SHADOWFB+ebx+edi], ax
-
 
349
end if
341
     mov     [edi], ax
350
     mov     [LFB_BASE+ebx+edi], ax
342
     shr     eax, 16
351
     shr     eax, 16
-
 
352
if SHADOWFB
-
 
353
     mov     [SHADOWFB+ebx+edi+2], al
-
 
354
end if
343
     mov     [edi+2], al
355
     mov     [LFB_BASE+ebx+edi+2], al
344
     ret
356
     ret
Line 345... Line 357...
345
 
357
 
346
 
358
 
347
align 4
359
align 4
348
Vesa20_putpixel32:
360
Vesa20_putpixel32:
349
; eax = x
361
; eax = x
350
; ebx = y
362
; ebx = y
351
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
363
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
-
 
364
     lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
352
     lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
365
     mov     eax, [esp+32-8+4] ; eax = color
-
 
366
if SHADOWFB
353
     mov     eax, [esp+32-8+4] ; eax = color
367
     mov     [SHADOWFB+edi], eax
354
     add     edi, [LFBAddress]     ; ebx = where to put pixel in memory
368
end if
Line 355... Line 369...
355
     mov     [edi], eax
369
     mov     [LFB_BASE+edi], eax
Line 356... Line 370...
356
     ret
370
     ret
Line 621... Line 635...
621
     sub     eax, [drbar.real_sx]
635
     sub     eax, [drbar.real_sx]
622
     inc     eax
636
     inc     eax
623
     mov     [drbar.line_inc_map], eax
637
     mov     [drbar.line_inc_map], eax
624
; line_inc_scr
638
; line_inc_scr
625
     mov     eax, [drbar.real_sx]
639
     mov     eax, [drbar.real_sx]
626
     movzx   ebx, byte [ScreenBPP]
640
     mov     ebx, [ScreenBPP]
627
     shr     ebx, 3
641
     shr     ebx, 3
628
     imul    eax, ebx
642
     imul    eax, ebx
629
     neg     eax
643
     neg     eax
630
     add     eax, [BytesPerScanLine]
644
     add     eax, [BytesPerScanLine]
631
     mov     [drbar.line_inc_scr], eax
645
     mov     [drbar.line_inc_scr], eax
632
; pointer to screen
646
; pointer to screen
633
     mov     edx, [drbar.abs_cy]
647
     mov     edx, [drbar.abs_cy]
634
     imul    edx, [BytesPerScanLine]
648
     imul    edx, [BytesPerScanLine]
635
     mov     eax, [drbar.abs_cx]
649
     mov     eax, [drbar.abs_cx]
636
;     movzx   ebx, byte [ScreenBPP]
650
;     mov    ebx, [ScreenBPP]
637
;     shr     ebx, 3
651
;     shr     ebx, 3
638
     imul    eax, ebx
652
     imul    eax, ebx
639
     add     edx, eax
653
     add     edx, eax
640
     add     edx, [LFBAddress]
-
 
641
; pointer to pixel map
654
; pointer to pixel map
642
     mov     eax, [drbar.abs_cy]
655
     mov     eax, [drbar.abs_cy]
643
     imul    eax, [Screen_Max_X]
656
     imul    eax, [Screen_Max_X]
644
     add     eax, [drbar.abs_cy]
657
     add     eax, [drbar.abs_cy]
645
     add     eax, [drbar.abs_cx]
658
     add     eax, [drbar.abs_cx]
Line 666... Line 679...
666
     mov     edi, [drbar.real_sx]
679
     mov     edi, [drbar.real_sx]
667
align   4
680
align   4
668
.new_x:
681
.new_x:
669
     cmp     byte [ebp], bl
682
     cmp     byte [ebp], bl
670
     jne     .skip
683
     jne     .skip
-
 
684
if SHADOWFB
671
     mov     [edx], bh
685
     mov     [SHADOWFB+edx], bh
672
     mov     [edx + 1], ax
686
     mov     [SHADOWFB+edx + 1], ax
-
 
687
end if
-
 
688
     mov     [LFB_BASE+edx], bh
-
 
689
     mov     [LFB_BASE+edx + 1], ax
673
.skip:
690
.skip:
674
; add pixel
691
; add pixel
675
     add     edx, 3
692
     add     edx, 3
676
     inc     ebp
693
     inc     ebp
677
     dec     edi
694
     dec     edi
Line 702... Line 719...
702
     mov     edi, [drbar.real_sx]
719
     mov     edi, [drbar.real_sx]
703
align   4
720
align   4
704
.new_x:
721
.new_x:
705
     cmp     byte [ebp], bl
722
     cmp     byte [ebp], bl
706
     jne     .skip
723
     jne     .skip
-
 
724
if SHADOWFB
-
 
725
     mov     [SHADOWFB+edx], eax
-
 
726
end if
707
     mov     [edx], eax
727
     mov     [LFB_BASE+edx], eax
708
.skip:
728
.skip:
709
; add pixel
729
; add pixel
710
     add     edx, 4
730
     add     edx, 4
711
     inc     ebp
731
     inc     ebp
712
     dec     edi
732
     dec     edi
Line 729... Line 749...
729
     call    VGA_draw_bar
749
     call    VGA_draw_bar
730
     xor     eax, eax
750
     xor     eax, eax
731
     mov     [EGA_counter],1
751
     mov     [EGA_counter],1
732
     ret
752
     ret
Line 733... Line -...
733
 
-
 
734
;voodoodbcplimit:
-
 
735
 
-
 
736
; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer
-
 
737
 
-
 
738
 
-
 
739
;     pusha
-
 
740
 
-
 
741
;     xor edx,edx
-
 
742
;     mov eax,ebp
-
 
743
;     mov ebx,[Screen_Max_X] ; Screen_X_size
-
 
744
;     inc ebx   ; +1
-
 
745
;     sub eax,display_data ; -AddrBuffer
-
 
746
;     div ebx ;
-
 
747
;     mov ebx,eax ; ebx:=Y
-
 
748
;     mov eax,edx ; eax:=X
-
 
749
;     call cplimit
-
 
750
 
-
 
751
;     test ecx,ecx
-
 
752
;     jne  dbcpl12
-
 
753
;     popa
-
 
754
;     clc
-
 
755
;     ret
-
 
756
;   dbcpl12:
-
 
757
;     popa
-
 
758
;     stc
-
 
759
;     ret
-
 
760
 
-
 
761
 
-
 
762
 
-
 
763
 
-
 
764
;dbcplimit:
-
 
765
 
-
 
766
;        pusha
-
 
767
 
-
 
768
;        xor  edx,edx
-
 
769
;        mov  ebx,[Screen_Max_X]
-
 
770
;        inc  ebx
-
 
771
;        sub  eax,display_data
-
 
772
;        div  ebx
-
 
773
;        mov  ebx,eax
-
 
774
;        mov  eax,edx
-
 
775
;        call cplimit
-
 
776
 
-
 
777
;        test ecx,ecx
-
 
778
;        jne  dbcpl1
-
 
779
;        popa
-
 
780
;        clc
-
 
781
;        ret
-
 
782
;     dbcpl1:
-
 
783
;        popa
-
 
784
;        stc
-
 
785
;        ret
-
 
Line 786... Line 753...
786
 
753
 
787
 
754
 
788
vesa20_drawbackground_tiled:
755
vesa20_drawbackground_tiled:
789
        call    [disable_mouse]
756
        call    [disable_mouse]
Line 798... Line 765...
798
        mul     ebx
765
        mul     ebx
799
        xchg    ebp, eax
766
        xchg    ebp, eax
800
        add     ebp, eax
767
        add     ebp, eax
801
        add     ebp, eax
768
        add     ebp, eax
802
        add     ebp, eax
769
        add     ebp, eax
803
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
770
        cmp     byte [ScreenBPP], 24    ; 24 or 32 bpp ? - x size
804
        jz      @f
771
        jz      @f
805
        add     ebp, eax
772
        add     ebp, eax
806
@@:
773
@@:
807
        add     ebp, [LFBAddress]
774
       ; add     ebp, LFB_BASE
808
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
775
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
809
        call    calculate_edi
776
        call    calculate_edi
810
        xchg    edi, ebp
777
        xchg    edi, ebp
Line 811... Line 778...
811
 
778
 
Line 847... Line 814...
847
        jmp     @f
814
        jmp     @f
848
nbgp:
815
nbgp:
849
        add     esi, 3
816
        add     esi, 3
850
        add     edi, 3
817
        add     edi, 3
851
@@:
818
@@:
852
        cmp     [ScreenBPP], byte 25    ; 24 or 32 bpp?
819
        cmp     byte [ScreenBPP], 25    ; 24 or 32 bpp?
853
        sbb     edi, -1         ; +1 for 32 bpp
820
        sbb     edi, -1         ; +1 for 32 bpp
854
; I do not use 'inc eax' because this is slightly slower then 'add eax,1'
821
; I do not use 'inc eax' because this is slightly slower then 'add eax,1'
855
        add     ebp, edx
822
        add     ebp, edx
856
        add     eax, edx
823
        add     eax, edx
857
        cmp     eax, [draw_data+32+RECT.right]
824
        cmp     eax, [draw_data+32+RECT.right]
Line 908... Line 875...
908
        mul     ebx
875
        mul     ebx
909
        xchg    ebp, eax
876
        xchg    ebp, eax
910
        add     ebp, eax
877
        add     ebp, eax
911
        add     ebp, eax
878
        add     ebp, eax
912
        add     ebp, eax
879
        add     ebp, eax
913
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
880
        cmp     byte [ScreenBPP], 24    ; 24 or 32 bpp ? - x size
914
        jz      @f
881
        jz      @f
915
        add     ebp, eax
882
        add     ebp, eax
916
@@:
883
@@:
917
        add     ebp, [LFBAddress]
-
 
918
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
884
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
919
        call    calculate_edi
885
        call    calculate_edi
920
        xchg    edi, ebp
886
        xchg    edi, ebp
921
; Now eax=x, ebx=y, edi->output, ebp=offset in display_data
887
; Now eax=x, ebx=y, edi->output, ebp=offset in display_data
922
        push    ebx
888
        push    ebx
Line 989... Line 955...
989
        test    ecx, ecx
955
        test    ecx, ecx
990
        jz      .novert
956
        jz      .novert
991
        mov     ebx, [bgr_next_line+esi]
957
        mov     ebx, [bgr_next_line+esi]
992
        call    [overlapping_of_points_ptr]
958
        call    [overlapping_of_points_ptr]
993
.novert:
959
.novert:
-
 
960
if SHADOWFB
-
 
961
        mov     [SHADOWFB+edi], ax
-
 
962
end if
994
        mov     [edi], ax
963
        mov     [LFB_BASE+edi], ax
995
        shr     eax, 16
964
        shr     eax, 16
-
 
965
if SHADOWFB
-
 
966
        mov     [SHADOWFB+edi+2], al
-
 
967
end if
996
        mov     [edi+2], al
968
        mov     [LFB_BASE+edi+2], al
997
snbgp:
969
snbgp:
998
        cmp     [ScreenBPP], byte 25
970
        cmp     byte [ScreenBPP], 25
999
        sbb     edi, -4
971
        sbb     edi, -4
1000
        add     ebp, 1
972
        add     ebp, 1
1001
        mov     eax, [esp+20]
973
        mov     eax, [esp+20]
1002
        add     eax, 1
974
        add     eax, 1
1003
        mov     [esp+20], eax
975
        mov     [esp+20], eax
Line 1017... Line 989...
1017
        add     ebp, [Screen_Max_X]
989
        add     ebp, [Screen_Max_X]
1018
        add     ebp, 1
990
        add     ebp, 1
1019
        sub     edi, eax
991
        sub     edi, eax
1020
        sub     edi, eax
992
        sub     edi, eax
1021
        sub     edi, eax
993
        sub     edi, eax
1022
        cmp     [ScreenBPP], byte 24
994
        cmp     byte [ScreenBPP], 24
1023
        jz      @f
995
        jz      @f
1024
        sub     edi, eax
996
        sub     edi, eax
1025
@@:
997
@@:
1026
        add     edi, [BytesPerScanLine]
998
        add     edi, [BytesPerScanLine]
1027
; restore ecx,edx; advance esi to next background line
999
; restore ecx,edx; advance esi to next background line