Subversion Repositories Kolibri OS

Rev

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

Rev 2442 Rev 2465
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;
2
;;
3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved.
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved.
4
;; PROGRAMMING:
4
;; PROGRAMMING:
5
;; Ivan Poddubny
5
;; Ivan Poddubny
6
;; Marat Zakiyanov (Mario79)
6
;; Marat Zakiyanov (Mario79)
7
;; VaStaNi
7
;; VaStaNi
8
;; Trans
8
;; Trans
Line 67... Line 67...
67
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
67
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 68... Line 68...
68
 
68
 
69
include 'macros.inc'
69
include 'macros.inc'
Line 70... Line 70...
70
include 'struct.inc'
70
include 'struct.inc'
Line 71... Line 71...
71
 
71
 
Line 72... Line 72...
72
$Revision: 2442 $
72
$Revision: 2465 $
Line 328... Line 328...
328
tmp_page_tabs   dd ?
328
tmp_page_tabs   dd ?
Line 329... Line 329...
329
 
329
 
330
 
330
 
331
__DEBUG__       fix 1
-
 
332
__DEBUG_LEVEL__ fix 1
-
 
333
include 'fdo.inc'
331
__DEBUG__       fix 1
Line 334... Line 332...
334
 
332
__DEBUG_LEVEL__ fix 1
Line -... Line 333...
-
 
333
include 'init.inc'
-
 
334
 
335
include 'init.inc'
335
org OS_BASE+$
336
 
336
 
337
org OS_BASE+$
337
include 'fdo.inc'
Line 338... Line 338...
338
 
338
 
Line 1113... Line 1113...
1113
;                    MAIN OS LOOP START                              ;
1113
;                    MAIN OS LOOP START                              ;
1114
;                                                                    ;
1114
;                                                                    ;
1115
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1115
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1116
align 32
1116
align 32
1117
osloop:
1117
osloop:
1118
        call    [draw_pointer]
1118
;        call    [draw_pointer]
-
 
1119
        call    __sys_draw_pointer
1119
        call    window_check_events
1120
        call    window_check_events
1120
        call    mouse_check_events
1121
        call    mouse_check_events
1121
        call    checkmisc
1122
        call    checkmisc
1122
        call    checkVga_N13
1123
        call    checkVga_N13
1123
        call    stack_handler
1124
        call    stack_handler
Line 2020... Line 2021...
2020
    waitterm:            ; wait here for termination
2021
    waitterm:            ; wait here for termination
2021
        mov     ebx, 100
2022
        mov     ebx, 100
2022
        call    delay_hs
2023
        call    delay_hs
2023
        jmp     waitterm
2024
        jmp     waitterm
2024
;------------------------------------------------------------------------------
2025
;------------------------------------------------------------------------------
-
 
2026
align 4
2025
restore_default_cursor_before_killing:
2027
restore_default_cursor_before_killing:
2026
        mov     eax, [def_cursor]
2028
        mov     eax, [def_cursor]
2027
        mov     [ecx+APPDATA.cursor], eax
2029
        mov     [ecx+APPDATA.cursor], eax
Line 2028... Line 2030...
2028
 
2030
 
2029
        movzx   eax, word [MOUSE_Y]
2031
        movzx   eax, word [MOUSE_Y]
2030
        movzx   ebx, word [MOUSE_X]
2032
        movzx   ebx, word [MOUSE_X]
2031
        mov     ecx, [Screen_Max_X]
2033
;        mov     ecx, [Screen_Max_X]
2032
        inc     ecx
2034
;        inc     ecx
-
 
2035
;        mul     ecx
-
 
2036
        mov     eax, [d_width_calc_area + eax*4]
2033
        mul     ecx
2037
 
2034
        add     eax, [_WinMapAddress]
2038
        add     eax, [_WinMapAddress]
2035
        movzx   edx, byte [ebx+eax]
2039
        movzx   edx, byte [ebx+eax]
2036
        shl     edx, 8
2040
        shl     edx, 8
-
 
2041
        mov     esi, [edx+SLOT_BASE+APPDATA.cursor]
-
 
2042
 
-
 
2043
        cmp     esi, [current_cursor]
-
 
2044
        je      @f
2037
        mov     esi, [edx+SLOT_BASE+APPDATA.cursor]
2045
 
2038
        push    esi
2046
        push    esi
2039
        call    [_display.select_cursor]
2047
        call    [_display.select_cursor]
-
 
2048
        mov     [current_cursor], esi
-
 
2049
@@:
-
 
2050
        mov     [redrawmouse_unconditional], 1
-
 
2051
;        call    [draw_pointer]
2040
        mov     [current_cursor], esi
2052
        call    __sys_draw_pointer
2041
        ret
2053
        ret
2042
;------------------------------------------------------------------------------
2054
;------------------------------------------------------------------------------
2043
iglobal
2055
iglobal
2044
align 4
2056
align 4
Line 2108... Line 2120...
2108
        add     ecx, CURRENT_TASK+TASKDATA.state
2120
        add     ecx, CURRENT_TASK+TASKDATA.state
2109
        cmp     byte [ecx], 9
2121
        cmp     byte [ecx], 9
2110
        jz      noprocessterminate
2122
        jz      noprocessterminate
2111
;--------------------------------------
2123
;--------------------------------------
2112
        cmp     [_display.select_cursor], 0
2124
        cmp     [_display.select_cursor], 0
2113
        je      @f
2125
        je      .restore_end
2114
; restore default cursor before killing
2126
; restore default cursor before killing
2115
        pusha
2127
        pusha
2116
        mov     ecx, [esp+32]
2128
        mov     ecx, [esp+32]
2117
        shl     ecx, 8
2129
        shl     ecx, 8
2118
        add     ecx, SLOT_BASE
2130
        add     ecx, SLOT_BASE
-
 
2131
        mov     eax, [def_cursor]
-
 
2132
        cmp     [ecx+APPDATA.cursor], eax
-
 
2133
        je      @f
2119
        call    restore_default_cursor_before_killing
2134
        call    restore_default_cursor_before_killing
2120
        popa
-
 
2121
@@:
2135
@@:
-
 
2136
        popa
-
 
2137
.restore_end:
2122
        add     esp, 4
2138
        add     esp, 4
2123
;--------------------------------------
2139
;--------------------------------------
2124
     ;call MEM_Heap_Lock      ;guarantee that process isn't working with heap
2140
     ;call MEM_Heap_Lock      ;guarantee that process isn't working with heap
2125
        mov     [ecx], byte 3; clear possible i40's
2141
        mov     [ecx], byte 3; clear possible i40's
2126
     ;call MEM_Heap_UnLock
2142
     ;call MEM_Heap_UnLock
Line 2499... Line 2515...
2499
        mov     [BgrDataHeight], eax
2515
        mov     [BgrDataHeight], eax
2500
@@:
2516
@@:
2501
        mov     eax, [BgrDataWidth]
2517
        mov     eax, [BgrDataWidth]
2502
        imul    eax, [BgrDataHeight]
2518
        imul    eax, [BgrDataHeight]
2503
        lea     eax, [eax*3]
2519
        lea     eax, [eax*3]
-
 
2520
; it is reserved with aligned to the boundary of 4 KB pages,
-
 
2521
; otherwise there may be exceptions a page fault for vesa20_drawbackground_tiled
-
 
2522
; because the 32 bit read is used for  high performance: "mov eax,[esi]"
-
 
2523
        shr     eax, 12
-
 
2524
        inc     eax
-
 
2525
        shl     eax, 12
2504
        mov     [mem_BACKGROUND], eax
2526
        mov     [mem_BACKGROUND], eax
2505
; get memory for new background
2527
; get memory for new background
2506
        stdcall kernel_alloc, eax
2528
        stdcall kernel_alloc, eax
2507
        test    eax, eax
2529
        test    eax, eax
2508
        jz      .memfailed
2530
        jz      .memfailed
Line 3154... Line 3176...
3154
;---------------------------------------------------------------------------------------------
3176
;---------------------------------------------------------------------------------------------
Line 3155... Line 3177...
3155
 
3177
 
Line 3156... Line 3178...
3156
 
3178
 
3157
; check if pixel is allowed to be drawn
3179
; check if pixel is allowed to be drawn
3158
 
-
 
3159
checkpixel:
-
 
3160
        push    eax edx
-
 
3161
 
-
 
3162
        mov     edx, [Screen_Max_X] ; screen x size
-
 
3163
        inc     edx
-
 
Line -... Line 3180...
-
 
3180
 
-
 
3181
;checkpixel:
-
 
3182
;        push    eax edx
-
 
3183
 
-
 
3184
;;        mov     edx, [Screen_Max_X] ; screen x size
-
 
3185
;;        inc     edx
-
 
3186
;;        imul    edx, ebx
3164
        imul    edx, ebx
3187
;        mov     edx, [d_width_calc_area + ebx*4]
3165
        add     eax, [_WinMapAddress]
3188
;        add     eax, [_WinMapAddress]
3166
        mov     dl, [eax+edx]; lea eax, [...]
3189
;        mov     dl, [eax+edx]; lea eax, [...]
3167
 
3190
 
Line 3168... Line 3191...
3168
        xor     ecx, ecx
3191
;        xor     ecx, ecx
3169
        mov     eax, [CURRENT_TASK]
3192
;        mov     eax, [CURRENT_TASK]
Line 3170... Line 3193...
3170
        cmp     al, dl
3193
;        cmp     al, dl
3171
        setne   cl
3194
;        setne   cl
3172
 
3195
 
Line 3801... Line 3824...
3801
drawbackground:
3824
drawbackground:
3802
dbrv20:
3825
dbrv20:
3803
        cmp     [BgrDrawMode], dword 1
3826
        cmp     [BgrDrawMode], dword 1
3804
        jne     bgrstr
3827
        jne     bgrstr
3805
        call    vesa20_drawbackground_tiled
3828
        call    vesa20_drawbackground_tiled
3806
        call    [draw_pointer]
3829
;        call    [draw_pointer]
-
 
3830
        call    __sys_draw_pointer
3807
        ret
3831
        ret
3808
;--------------------------------------
3832
;--------------------------------------
3809
align 4
3833
align 4
3810
bgrstr:
3834
bgrstr:
3811
        call    vesa20_drawbackground_stretch
3835
        call    vesa20_drawbackground_stretch
3812
        call    [draw_pointer]
3836
;        call    [draw_pointer]
-
 
3837
        call    __sys_draw_pointer
3813
        ret
3838
        ret
3814
;-----------------------------------------------------------------------------
3839
;-----------------------------------------------------------------------------
3815
align 4
3840
align 4
3816
syscall_putimage:                       ; PutImage
3841
syscall_putimage:                       ; PutImage
3817
sys_putimage:
3842
sys_putimage:
Line 4579... Line 4604...
4579
        mov     edi, [current_slot]
4604
        mov     edi, [current_slot]
4580
        add     eax, [edi+APPDATA.wnd_clientbox.left]
4605
        add     eax, [edi+APPDATA.wnd_clientbox.left]
4581
        add     ebx, [edi+APPDATA.wnd_clientbox.top]
4606
        add     ebx, [edi+APPDATA.wnd_clientbox.top]
4582
        xor     edi, edi ; no force
4607
        xor     edi, edi ; no force
4583
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
4608
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
4584
        jmp     [putpixel]
4609
;        jmp     [putpixel]
-
 
4610
        jmp     __sys_putpixel
Line 4585... Line 4611...
4585
 
4611
 
Line 4586... Line 4612...
4586
align 4
4612
align 4
Line 4636... Line 4662...
4636
 
4662
 
4637
        add     eax, [esi + APPDATA.wnd_clientbox.left]
4663
        add     eax, [esi + APPDATA.wnd_clientbox.left]
4638
        add     ebx, [esi + APPDATA.wnd_clientbox.top]
4664
        add     ebx, [esi + APPDATA.wnd_clientbox.top]
4639
        add     ecx, eax
4665
        add     ecx, eax
4640
        add     edx, ebx
4666
        add     edx, ebx
-
 
4667
;        jmp     [drawbar]
4641
        jmp     [drawbar]
4668
        jmp     vesa20_drawbar
4642
.drectr:
4669
.drectr:
Line 4643... Line 4670...
4643
        ret
4670
        ret
4644
 
4671
 
Line 4807... Line 4834...
4807
        add     ebp, ecx
4834
        add     ebp, ecx
4808
        shl     ebx, 16
4835
        shl     ebx, 16
4809
        xor     edi, edi
4836
        xor     edi, edi
4810
        add     ebx, ebp
4837
        add     ebx, ebp
4811
        mov     ecx, edx
4838
        mov     ecx, edx
4812
        jmp     [draw_line]
4839
;        jmp     [draw_line]
4813
 
-
 
-
 
4840
        jmp     __sys_draw_line
Line 4814... Line 4841...
4814
 
4841
 
4815
 
4842
 
Line 4878... Line 4905...
4878
        ret
4905
        ret
4879
;------------------------------------------------------------------------------
4906
;------------------------------------------------------------------------------
4880
align 4
4907
align 4
4881
calculate_fast_getting_offset_for_WinMapAddress:
4908
calculate_fast_getting_offset_for_WinMapAddress:
4882
; calculate data area for fast getting offset to _WinMapAddress
4909
; calculate data area for fast getting offset to _WinMapAddress
4883
        mov     eax, [_display.width]
4910
        xor     eax, eax
4884
        mov     ecx, [_display.height]
4911
        mov     ecx, [_display.height]
4885
        inc     ecx
4912
        inc     ecx
4886
        mov     edi, d_width_calc_area
4913
        mov     edi, d_width_calc_area
4887
        cld
4914
        cld
4888
@@:
4915
@@: