Subversion Repositories Kolibri OS

Rev

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

Rev 837 Rev 840
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: 784 $
20
$Revision: 840 $
21
 
21
 
Line 22... Line 22...
22
 
22
 
23
; If you're planning to write your own video driver I suggest
23
; If you're planning to write your own video driver I suggest
24
; you replace the VESA12.INC file and see those instructions.
24
; you replace the VESA12.INC file and see those instructions.
25
 
25
 
26
;Screen_Max_X             equ     0xfe00
26
;Screen_Max_X             equ     0xfe00
27
;Screen_Max_Y            equ     0xfe04
-
 
28
;BytesPerScanLine        equ     0xfe08
-
 
Line 29... Line 27...
29
;LFBAddress              equ     0xfe80
27
;Screen_Max_Y            equ     0xfe04
30
;ScreenBPP               equ     0xfbf1
28
;BytesPerScanLine        equ     0xfe08
31
;WinMapAddress           equ     0x460000
29
;LFBAddress              equ     0xfe80
Line 198... Line 196...
198
; pointer to pixel map
196
; pointer to pixel map
199
     mov     eax, [putimg.abs_cy]
197
     mov     eax, [putimg.abs_cy]
200
     imul    eax, [Screen_Max_X]
198
     imul    eax, [Screen_Max_X]
201
     add     eax, [putimg.abs_cy]
199
     add     eax, [putimg.abs_cy]
202
     add     eax, [putimg.abs_cx]
200
     add     eax, [putimg.abs_cx]
203
     add     eax, WinMapAddress
201
     add     eax, [_display_data]
204
     xchg    eax, ebp
202
     xchg    eax, ebp
205
; get process number
203
; get process number
206
     mov     ebx, [CURRENT_TASK]
204
     mov     ebx, [CURRENT_TASK]
207
     cmp     byte [ScreenBPP], 32
205
     cmp     byte [ScreenBPP], 32
208
     je      put_image_end_32
206
     je      put_image_end_32
Line 627... Line 625...
627
; pointer to pixel map
625
; pointer to pixel map
628
     mov     eax, [drbar.abs_cy]
626
     mov     eax, [drbar.abs_cy]
629
     imul    eax, [Screen_Max_X]
627
     imul    eax, [Screen_Max_X]
630
     add     eax, [drbar.abs_cy]
628
     add     eax, [drbar.abs_cy]
631
     add     eax, [drbar.abs_cx]
629
     add     eax, [drbar.abs_cx]
632
     add     eax, WinMapAddress
630
     add     eax, [_display_data]
633
     xchg    eax, ebp
631
     xchg    eax, ebp
634
; get process number
632
; get process number
635
     mov     ebx, [CURRENT_TASK]
633
     mov     ebx, [CURRENT_TASK]
636
     cmp     byte [ScreenBPP], 24
634
     cmp     byte [ScreenBPP], 24
637
     jne     draw_bar_end_32
635
     jne     draw_bar_end_32
Line 726... Line 724...
726
 
724
 
727
;     xor edx,edx
725
;     xor edx,edx
728
;     mov eax,ebp
726
;     mov eax,ebp
729
;     mov ebx,[Screen_Max_X] ; Screen_X_size
727
;     mov ebx,[Screen_Max_X] ; Screen_X_size
730
;     inc ebx   ; +1
728
;     inc ebx   ; +1
731
;     sub eax,WinMapAddress ; -AddrBuffer
729
;     sub eax,display_data ; -AddrBuffer
732
;     div ebx ;
730
;     div ebx ;
733
;     mov ebx,eax ; ebx:=Y
731
;     mov ebx,eax ; ebx:=Y
734
;     mov eax,edx ; eax:=X
732
;     mov eax,edx ; eax:=X
Line 752... Line 750...
752
;        pusha
750
;        pusha
Line 753... Line 751...
753
 
751
 
754
;        xor  edx,edx
752
;        xor  edx,edx
755
;        mov  ebx,[Screen_Max_X]
753
;        mov  ebx,[Screen_Max_X]
756
;        inc  ebx
754
;        inc  ebx
757
;        sub  eax,WinMapAddress
755
;        sub  eax,display_data
758
;        div  ebx
756
;        div  ebx
759
;        mov  ebx,eax
757
;        mov  ebx,eax
760
;        mov  eax,edx
758
;        mov  eax,edx
Line 776... Line 774...
776
        pushad
774
        pushad
777
; External loop for all y from start to end
775
; External loop for all y from start to end
778
        mov     ebx, [draw_data+32+RECT.top]    ; y start
776
        mov     ebx, [draw_data+32+RECT.top]    ; y start
779
dp2:
777
dp2:
780
        mov     ebp, [draw_data+32+RECT.left]   ; x start
778
        mov     ebp, [draw_data+32+RECT.left]   ; x start
781
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
779
; 1) Calculate pointers in display_data (does pixel belong to OS thread?) [ebp]
782
;                       and LFB data (output for our function) [edi]
780
;                       and LFB data (output for our function) [edi]
783
        mov     eax, [BytesPerScanLine]
781
        mov     eax, [BytesPerScanLine]
784
        mul     ebx
782
        mul     ebx
785
        xchg    ebp, eax
783
        xchg    ebp, eax
786
        add     ebp, eax
784
        add     ebp, eax
Line 792... Line 790...
792
@@:
790
@@:
793
        add     ebp, [LFBAddress]
791
        add     ebp, [LFBAddress]
794
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
792
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
795
        call    calculate_edi
793
        call    calculate_edi
796
        xchg    edi, ebp
794
        xchg    edi, ebp
-
 
795
 
-
 
796
        add ebp, [_display_data]
-
 
797
 
797
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
798
; Now eax=x, ebx=y, edi->output, ebp=offset in display_data
798
; 2) Calculate offset in background memory block
799
; 2) Calculate offset in background memory block
799
        push    eax
800
        push    eax
800
        xor     edx, edx
801
        xor     edx, edx
801
        mov     eax, ebx
802
        mov     eax, ebx
802
        div     dword [BgrDataHeight]   ; edx := y mod BgrDataHeight
803
        div     dword [BgrDataHeight]   ; edx := y mod BgrDataHeight
Line 818... Line 819...
818
; Registers meaning:
819
; Registers meaning:
819
; eax = x, ebx = y (screen coordinates)
820
; eax = x, ebx = y (screen coordinates)
820
; ecx = deltax - number of pixels left in current tile block
821
; ecx = deltax - number of pixels left in current tile block
821
; edx = 1
822
; edx = 1
822
; esi -> bgr memory, edi -> output
823
; esi -> bgr memory, edi -> output
823
; ebp = offset in WinMapAddress
824
; ebp = offset in display_data
824
dp3:
825
dp3:
825
        cmp     [ebp+WinMapAddress], dl
826
        cmp     [ebp], dl
826
        jnz     nbgp
827
        jnz     nbgp
827
        movsb
828
        movsb
828
        movsb
829
        movsb
829
        movsb
830
        movsb
830
        jmp     @f
831
        jmp     @f
Line 883... Line 884...
883
        div     dword [Screen_Max_Y]
884
        div     dword [Screen_Max_Y]
884
        push    eax     ; low
885
        push    eax     ; low
885
; External loop for all y from start to end
886
; External loop for all y from start to end
886
        mov     ebx, [draw_data+32+RECT.top]    ; y start
887
        mov     ebx, [draw_data+32+RECT.top]    ; y start
887
        mov     ebp, [draw_data+32+RECT.left]   ; x start
888
        mov     ebp, [draw_data+32+RECT.left]   ; x start
888
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
889
; 1) Calculate pointers in display_data (does pixel belong to OS thread?) [ebp]
889
;                       and LFB data (output for our function) [edi]
890
;                       and LFB data (output for our function) [edi]
890
        mov     eax, [BytesPerScanLine]
891
        mov     eax, [BytesPerScanLine]
891
        mul     ebx
892
        mul     ebx
892
        xchg    ebp, eax
893
        xchg    ebp, eax
893
        add     ebp, eax
894
        add     ebp, eax
Line 899... Line 900...
899
@@:
900
@@:
900
        add     ebp, [LFBAddress]
901
        add     ebp, [LFBAddress]
901
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
902
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
902
        call    calculate_edi
903
        call    calculate_edi
903
        xchg    edi, ebp
904
        xchg    edi, ebp
904
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
905
; Now eax=x, ebx=y, edi->output, ebp=offset in display_data
905
        push    ebx
906
        push    ebx
906
        push    eax
907
        push    eax
907
; 2) Calculate offset in background memory block
908
; 2) Calculate offset in background memory block
908
        mov     eax, ebx
909
        mov     eax, ebx
909
        imul    ebx, dword [esp+12]
910
        imul    ebx, dword [esp+12]
Line 953... Line 954...
953
        xor     esi, esi
954
        xor     esi, esi
954
        mov     ecx, [esp+12]
955
        mov     ecx, [esp+12]
955
; 4) Loop through redraw rectangle and copy background data
956
; 4) Loop through redraw rectangle and copy background data
956
; Registers meaning:
957
; Registers meaning:
957
; esi = offset in current line, edi -> output
958
; esi = offset in current line, edi -> output
958
; ebp = offset in WinMapAddress
959
; ebp = offset in display_data
959
; dword [esp] = offset in bgr data
960
; dword [esp] = offset in bgr data
960
; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-1)
961
; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-1)
961
; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (ScreenHeight-1)
962
; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (ScreenHeight-1)
962
; dword [esp+20] = x
963
; dword [esp+20] = x
963
; dword [esp+24] = y
964
; dword [esp+24] = y
964
; precalculated constants:
965
; precalculated constants:
965
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
966
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
966
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
967
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
967
sdp3a:
968
sdp3a:
-
 
969
        mov eax, [_display_data]
968
        cmp     [ebp+WinMapAddress], byte 1
970
        cmp     [ebp+eax], byte 1
969
        jnz     snbgp
971
        jnz     snbgp
970
        mov     eax, [bgr_cur_line+esi]
972
        mov     eax, [bgr_cur_line+esi]
971
        test    ecx, ecx
973
        test    ecx, ecx
972
        jz      .novert
974
        jz      .novert
973
        mov     ebx, [bgr_next_line+esi]
975
        mov     ebx, [bgr_next_line+esi]