Subversion Repositories Kolibri OS

Rev

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

Rev 593 Rev 753
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: 593 $
20
$Revision: 753 $
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
;ScreenWidth             equ     0xfe00
26
;Screen_Max_X             equ     0xfe00
27
;ScreenHeight            equ     0xfe04
27
;Screen_Max_Y            equ     0xfe04
Line 170... Line 170...
170
;     lea     eax, [eax + eax * 2]
170
;     lea     eax, [eax + eax * 2]
171
     call    esi
171
     call    esi
172
     add     eax, [putimg.arg_0]
172
     add     eax, [putimg.arg_0]
173
     mov     [putimg.line_increment], eax
173
     mov     [putimg.line_increment], eax
174
; winmap new line increment
174
; winmap new line increment
175
     mov     eax, [ScreenWidth]
175
     mov     eax, [Screen_Max_X]
176
     inc     eax
176
     inc     eax
177
     sub     eax, [putimg.real_sx]
177
     sub     eax, [putimg.real_sx]
178
     mov     [putimg.winmap_newline], eax
178
     mov     [putimg.winmap_newline], eax
179
; screen new line increment
179
; screen new line increment
180
     mov     eax, [BytesPerScanLine]
180
     mov     eax, [BytesPerScanLine]
Line 195... Line 195...
195
     imul    eax, ebx
195
     imul    eax, ebx
196
     add     edx, eax
196
     add     edx, eax
197
     add     edx, [LFBAddress]
197
     add     edx, [LFBAddress]
198
; pointer to pixel map
198
; pointer to pixel map
199
     mov     eax, [putimg.abs_cy]
199
     mov     eax, [putimg.abs_cy]
200
     imul    eax, [ScreenWidth]
200
     imul    eax, [Screen_Max_X]
201
     add     eax, [putimg.abs_cy]
201
     add     eax, [putimg.abs_cy]
202
     add     eax, [putimg.abs_cx]
202
     add     eax, [putimg.abs_cx]
203
     add     eax, WinMapAddress
203
     add     eax, WinMapAddress
204
     xchg    eax, ebp
204
     xchg    eax, ebp
205
; get process number
205
; get process number
Line 230... Line 230...
230
     dec     ecx
230
     dec     ecx
231
     jnz     .new_x
231
     jnz     .new_x
232
;     pop     edx ebp
232
;     pop     edx ebp
233
     add     esi, [putimg.line_increment]
233
     add     esi, [putimg.line_increment]
234
     add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
234
     add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
235
     add     ebp, [putimg.winmap_newline] ;[ScreenWidth]
235
     add     ebp, [putimg.winmap_newline] ;[Screen_Max_X]
236
;     inc     ebp
236
;     inc     ebp
237
     dec     edi
237
     dec     edi
238
     jnz     .new_line
238
     jnz     .new_line
239
.finish:
239
.finish:
240
     add     esp, putimg.stack_data
240
     add     esp, putimg.stack_data
Line 263... Line 263...
263
     dec     ecx
263
     dec     ecx
264
     jnz     .new_x
264
     jnz     .new_x
265
;     pop     edx ebp
265
;     pop     edx ebp
266
     add     esi, [putimg.line_increment]
266
     add     esi, [putimg.line_increment]
267
     add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
267
     add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
268
     add     ebp, [putimg.winmap_newline] ;[ScreenWidth]
268
     add     ebp, [putimg.winmap_newline] ;[Screen_Max_X]
269
;     inc     ebp
269
;     inc     ebp
270
     dec     edi
270
     dec     edi
271
     jnz     .new_line
271
     jnz     .new_line
272
.finish:
272
.finish:
273
     add     esp, putimg.stack_data
273
     add     esp, putimg.stack_data
Line 295... Line 295...
295
     call  checkpixel
295
     call  checkpixel
296
     test  ecx,ecx
296
     test  ecx,ecx
297
     pop   ecx
297
     pop   ecx
298
     jnz   .exit
298
     jnz   .exit
299
.forced:
299
.forced:
300
     cmp   [ScreenWidth], eax
300
     cmp   [Screen_Max_X], eax
301
     jb    .exit
301
     jb    .exit
302
     cmp   [ScreenHeight], ebx
302
     cmp   [Screen_Max_Y], ebx
303
     jb    .exit
303
     jb    .exit
304
.ok:
304
.ok:
305
; check if negation
305
; check if negation
306
     test  ecx,0x01000000
306
     test  ecx,0x01000000
307
     jz    .noneg
307
     jz    .noneg
Line 344... Line 344...
344
;*************************************************
344
;*************************************************
Line 345... Line 345...
345
 
345
 
346
;align 4
346
;align 4
347
calculate_edi:
347
calculate_edi:
348
     mov     edi, ebx
348
     mov     edi, ebx
349
     imul    edi, [ScreenWidth]
349
     imul    edi, [Screen_Max_X]
350
     add     edi, ebx
350
     add     edi, ebx
351
     add     edi, eax
351
     add     edi, eax
Line 352... Line 352...
352
     ret
352
     ret
Line 601... Line 601...
601
     jbe     .end_y
601
     jbe     .end_y
602
     mov     ebx, [drbar.bar_sy]
602
     mov     ebx, [drbar.bar_sy]
603
.end_y:
603
.end_y:
604
     mov     [drbar.real_sy], ebx
604
     mov     [drbar.real_sy], ebx
605
; line_inc_map
605
; line_inc_map
606
     mov     eax, [ScreenWidth]
606
     mov     eax, [Screen_Max_X]
607
     sub     eax, [drbar.real_sx]
607
     sub     eax, [drbar.real_sx]
608
     inc     eax
608
     inc     eax
609
     mov     [drbar.line_inc_map], eax
609
     mov     [drbar.line_inc_map], eax
610
; line_inc_scr
610
; line_inc_scr
611
     mov     eax, [drbar.real_sx]
611
     mov     eax, [drbar.real_sx]
Line 624... Line 624...
624
     imul    eax, ebx
624
     imul    eax, ebx
625
     add     edx, eax
625
     add     edx, eax
626
     add     edx, [LFBAddress]
626
     add     edx, [LFBAddress]
627
; pointer to pixel map
627
; pointer to pixel map
628
     mov     eax, [drbar.abs_cy]
628
     mov     eax, [drbar.abs_cy]
629
     imul    eax, [ScreenWidth]
629
     imul    eax, [Screen_Max_X]
630
     add     eax, [drbar.abs_cy]
630
     add     eax, [drbar.abs_cy]
631
     add     eax, [drbar.abs_cx]
631
     add     eax, [drbar.abs_cx]
632
     add     eax, WinMapAddress
632
     add     eax, WinMapAddress
633
     xchg    eax, ebp
633
     xchg    eax, ebp
634
; get process number
634
; get process number
Line 724... Line 724...
724
 
724
 
Line 725... Line 725...
725
;     pusha
725
;     pusha
726
 
726
 
727
;     xor edx,edx
727
;     xor edx,edx
728
;     mov eax,ebp
728
;     mov eax,ebp
729
;     mov ebx,[ScreenWidth] ; Screen_X_size
729
;     mov ebx,[Screen_Max_X] ; Screen_X_size
730
;     inc ebx   ; +1
730
;     inc ebx   ; +1
731
;     sub eax,WinMapAddress ; -AddrBuffer
731
;     sub eax,WinMapAddress ; -AddrBuffer
732
;     div ebx ;
732
;     div ebx ;
Line 750... Line 750...
750
;dbcplimit:
750
;dbcplimit:
Line 751... Line 751...
751
 
751
 
Line 752... Line 752...
752
;        pusha
752
;        pusha
753
 
753
 
754
;        xor  edx,edx
754
;        xor  edx,edx
755
;        mov  ebx,[ScreenWidth]
755
;        mov  ebx,[Screen_Max_X]
756
;        inc  ebx
756
;        inc  ebx
757
;        sub  eax,WinMapAddress
757
;        sub  eax,WinMapAddress
758
;        div  ebx
758
;        div  ebx
Line 862... Line 862...
862
 
862
 
863
vesa20_drawbackground_stretch:
863
vesa20_drawbackground_stretch:
864
        call    [disable_mouse]
864
        call    [disable_mouse]
865
        pushad
865
        pushad
866
; Helper variables
866
; Helper variables
867
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
867
; calculate 2^32*(BgrDataWidth-1) mod (Screen_Max_X-1)
868
        mov     eax, [BgrDataWidth]
868
        mov     eax, [BgrDataWidth]
869
        dec     eax
869
        dec     eax
870
        xor     edx, edx
870
        xor     edx, edx
871
        div     dword [ScreenWidth]
871
        div     dword [Screen_Max_X]
872
        push    eax     ; high
872
        push    eax     ; high
873
        xor     eax, eax
873
        xor     eax, eax
874
        div     dword [ScreenWidth]
874
        div     dword [Screen_Max_X]
875
        push    eax     ; low
875
        push    eax     ; low
876
; the same for height
876
; the same for height
877
        mov     eax, [BgrDataHeight]
877
        mov     eax, [BgrDataHeight]
878
        dec     eax
878
        dec     eax
879
        xor     edx, edx
879
        xor     edx, edx
880
        div     dword [ScreenHeight]
880
        div     dword [Screen_Max_Y]
881
        push    eax     ; high
881
        push    eax     ; high
882
        xor     eax, eax
882
        xor     eax, eax
883
        div     dword [ScreenHeight]
883
        div     dword [Screen_Max_Y]
884
        push    eax     ; low
884
        push    eax     ; low
885
; External loop for all y from start to end
885
; External loop for all y from start to end
886
        mov     ebx, [draw_data+32+RECT.top]    ; y start
886
        mov     ebx, [draw_data+32+RECT.top]    ; y start
887
        mov     ebp, [draw_data+32+RECT.left]   ; x start
887
        mov     ebp, [draw_data+32+RECT.left]   ; x start
Line 906... Line 906...
906
        push    eax
906
        push    eax
907
; 2) Calculate offset in background memory block
907
; 2) Calculate offset in background memory block
908
        mov     eax, ebx
908
        mov     eax, ebx
909
        imul    ebx, dword [esp+12]
909
        imul    ebx, dword [esp+12]
910
        mul     dword [esp+8]
910
        mul     dword [esp+8]
911
        add     edx, ebx        ; edx:eax = y * 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
911
        add     edx, ebx        ; edx:eax = y * 2^32*(BgrDataHeight-1)/(Screen_Max_Y-1)
912
        mov     esi, edx
912
        mov     esi, edx
913
        imul    esi, [BgrDataWidth]
913
        imul    esi, [BgrDataWidth]
914
        push    edx
914
        push    edx
915
        push    eax
915
        push    eax
916
        mov     eax, [esp+8]
916
        mov     eax, [esp+8]
917
        mul     dword [esp+28]
917
        mul     dword [esp+28]
918
        push    eax
918
        push    eax
919
        mov     eax, [esp+12]
919
        mov     eax, [esp+12]
920
        mul     dword [esp+28]
920
        mul     dword [esp+28]
921
        add     [esp], edx
921
        add     [esp], edx
922
        pop     edx             ; edx:eax = x * 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
922
        pop     edx             ; edx:eax = x * 2^32*(BgrDataWidth-1)/(Screen_Max_X-1)
923
        add     esi, edx
923
        add     esi, edx
924
        lea     esi, [esi*3]
924
        lea     esi, [esi*3]
925
        add     esi, [img_background]
925
        add     esi, [img_background]
926
        push    eax
926
        push    eax
927
        push    edx
927
        push    edx
Line 955... Line 955...
955
; 4) Loop through redraw rectangle and copy background data
955
; 4) Loop through redraw rectangle and copy background data
956
; Registers meaning:
956
; Registers meaning:
957
; esi = offset in current line, edi -> output
957
; esi = offset in current line, edi -> output
958
; ebp = offset in WinMapAddress
958
; ebp = offset in WinMapAddress
959
; dword [esp] = offset in bgr data
959
; dword [esp] = offset in bgr data
960
; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-1)
960
; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (Screen_Max_X-1)
961
; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (ScreenHeight-1)
961
; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (Screen_Max_Y-1)
962
; dword [esp+20] = x
962
; dword [esp+20] = x
963
; dword [esp+24] = y
963
; dword [esp+24] = y
964
; precalculated constants:
964
; precalculated constants:
965
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
965
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(Screen_Max_Y-1)
966
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
966
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(Screen_Max_X-1)
967
sdp3a:
967
sdp3a:
968
        cmp     [ebp+WinMapAddress], byte 1
968
        cmp     [ebp+WinMapAddress], byte 1
969
        jnz     snbgp
969
        jnz     snbgp
970
        mov     eax, [bgr_cur_line+esi]
970
        mov     eax, [bgr_cur_line+esi]
971
        test    ecx, ecx
971
        test    ecx, ecx
Line 994... Line 994...
994
        cmp     ebx, [draw_data+32+RECT.bottom]
994
        cmp     ebx, [draw_data+32+RECT.bottom]
995
        ja      sdpdone
995
        ja      sdpdone
996
; advance edi, ebp to next scan line
996
; advance edi, ebp to next scan line
997
        sub     eax, [draw_data+32+RECT.left]
997
        sub     eax, [draw_data+32+RECT.left]
998
        sub     ebp, eax
998
        sub     ebp, eax
999
        add     ebp, [ScreenWidth]
999
        add     ebp, [Screen_Max_X]
1000
        add     ebp, 1
1000
        add     ebp, 1
1001
        sub     edi, eax
1001
        sub     edi, eax
1002
        sub     edi, eax
1002
        sub     edi, eax
1003
        sub     edi, eax
1003
        sub     edi, eax
1004
        cmp     [ScreenBPP], byte 24
1004
        cmp     [ScreenBPP], byte 24
Line 1024... Line 1024...
1024
        cmp     ebx, -1
1024
        cmp     ebx, -1
1025
        jnz     bgr_resmooth0
1025
        jnz     bgr_resmooth0
1026
        push    edi
1026
        push    edi
1027
        mov     esi, bgr_next_line
1027
        mov     esi, bgr_next_line
1028
        mov     edi, bgr_cur_line
1028
        mov     edi, bgr_cur_line
1029
        mov     ecx, [ScreenWidth]
1029
        mov     ecx, [Screen_Max_X]
1030
        inc     ecx
1030
        inc     ecx
1031
        rep     movsd
1031
        rep     movsd
1032
        jmp     bgr_resmooth1
1032
        jmp     bgr_resmooth1
1033
sdpdone:
1033
sdpdone:
1034
        add     esp, 44
1034
        add     esp, 44