Subversion Repositories Kolibri OS

Rev

Rev 5596 | Rev 6078 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5596 Rev 5984
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
7
 
8
$Revision: 5596 $
8
$Revision: 5984 $
9
 
9
 
10
 
10
 
11
;   check mouse
11
;   check mouse
12
;
12
;
13
;
13
;
14
;   FB00  ->   FB0F   mouse memory 00 chunk count - FB0A-B x - FB0C-D y
14
;   FB00  ->   FB0F   mouse memory 00 chunk count - FB0A-B x - FB0C-D y
15
;   FB10  ->   FB17   mouse color mem
15
;   FB10  ->   FB17   mouse color mem
16
;   FB21              x move
16
;   FB21              x move
17
;   FB22              y move
17
;   FB22              y move
18
;   FB30              color temp
18
;   FB30              color temp
19
;   FB28              high bits temp
19
;   FB28              high bits temp
20
;   FB4A  ->   FB4D   FB4A-B x-under - FB4C-D y-under
20
;   FB4A  ->   FB4D   FB4A-B x-under - FB4C-D y-under
21
;   FC00  ->   FCFE   com1/ps2 buffer
21
;   FC00  ->   FCFE   com1/ps2 buffer
22
;   FCFF              com1/ps2 buffer count starting from FC00
22
;   FCFF              com1/ps2 buffer count starting from FC00
23
 
23
 
24
uglobal
24
uglobal
25
;--------------------------------------
25
;--------------------------------------
26
align 4
26
align 4
27
mousecount                      dd ?
27
mousecount                      dd ?
28
mousedata                       dd ?
28
mousedata                       dd ?
29
Y_UNDER_sub_CUR_hot_y_add_curh  dw ?
29
Y_UNDER_sub_CUR_hot_y_add_curh  dw ?
30
Y_UNDER_subtraction_CUR_hot_y   dw ?
30
Y_UNDER_subtraction_CUR_hot_y   dw ?
31
X_UNDER_sub_CUR_hot_x_add_curh  dw ?
31
X_UNDER_sub_CUR_hot_x_add_curh  dw ?
32
X_UNDER_subtraction_CUR_hot_x   dw ?
32
X_UNDER_subtraction_CUR_hot_x   dw ?
33
endg
33
endg
34
 
34
 
35
iglobal
35
iglobal
36
;--------------------------------------
36
;--------------------------------------
37
align 4
37
align 4
38
mouse_delay             dd 10
-
 
39
mouse_speed_factor:
38
mouse_speed_factor      dw 1
40
                        dd 3
39
mouse_delay             db 1
41
mouse_timer_ticks       dd 0
40
mouse_doubleclick_delay db 64
42
endg
41
endg
43
 
42
 
44
;-----------------------------------------------------------------------------
43
;-----------------------------------------------------------------------------
45
 
44
 
46
align 4
45
align 4
47
draw_mouse_under:
46
draw_mouse_under:
48
 
47
 
49
        ; return old picture
48
        ; return old picture
50
        cmp     [_display.restore_cursor], 0
49
        cmp     [_display.restore_cursor], 0
51
        je      @F
50
        je      @F
52
 
51
 
53
        pushad
52
        pushad
54
        movzx   eax, word [X_UNDER]
53
        movzx   eax, word [X_UNDER]
55
        movzx   ebx, word [Y_UNDER]
54
        movzx   ebx, word [Y_UNDER]
56
        stdcall [_display.restore_cursor], eax, ebx
55
        stdcall [_display.restore_cursor], eax, ebx
57
        popad
56
        popad
58
        ret
57
        ret
59
 
58
 
60
  @@:
59
  @@:
61
        pushad
60
        pushad
62
        xor     ecx, ecx
61
        xor     ecx, ecx
63
        xor     edx, edx
62
        xor     edx, edx
64
 
63
 
65
  mres:
64
  mres:
66
        movzx   eax, word [X_UNDER]
65
        movzx   eax, word [X_UNDER]
67
        movzx   ebx, word [Y_UNDER]
66
        movzx   ebx, word [Y_UNDER]
68
        add     eax, ecx
67
        add     eax, ecx
69
        add     ebx, edx
68
        add     ebx, edx
70
        push    ecx
69
        push    ecx
71
        push    edx
70
        push    edx
72
        push    eax
71
        push    eax
73
        push    ebx
72
        push    ebx
74
        mov     eax, edx
73
        mov     eax, edx
75
        shl     eax, 6
74
        shl     eax, 6
76
        shl     ecx, 2
75
        shl     ecx, 2
77
        add     eax, ecx
76
        add     eax, ecx
78
        add     eax, mouseunder
77
        add     eax, mouseunder
79
        mov     ecx, [eax]
78
        mov     ecx, [eax]
80
        pop     ebx
79
        pop     ebx
81
        pop     eax
80
        pop     eax
82
        mov     edi, 1 ; force
81
        mov     edi, 1 ; force
83
        or      ecx, 0x04000000  ; don't save to mouseunder area
82
        or      ecx, 0x04000000  ; don't save to mouseunder area
84
;        call    [putpixel]
83
;        call    [putpixel]
85
        call    __sys_putpixel
84
        call    __sys_putpixel
86
        pop     edx
85
        pop     edx
87
        pop     ecx
86
        pop     ecx
88
        inc     ecx
87
        inc     ecx
89
        cmp     ecx, 16
88
        cmp     ecx, 16
90
        jnz     mres
89
        jnz     mres
91
        xor     ecx, ecx
90
        xor     ecx, ecx
92
        inc     edx
91
        inc     edx
93
        cmp     edx, 24
92
        cmp     edx, 24
94
        jnz     mres
93
        jnz     mres
95
        popad
94
        popad
96
        ret
95
        ret
97
 
96
 
98
;-----------------------------------------------------------------------------
97
;-----------------------------------------------------------------------------
99
 
98
 
100
align 4
99
align 4
101
save_draw_mouse:
100
save_draw_mouse:
102
        cmp     [_display.move_cursor], 0
101
        cmp     [_display.move_cursor], 0
103
        je      .no_hw_cursor
102
        je      .no_hw_cursor
104
        pushad
103
        pushad
105
 
104
 
106
        mov     [X_UNDER], ax
105
        mov     [X_UNDER], ax
107
        mov     [Y_UNDER], bx
106
        mov     [Y_UNDER], bx
108
        movzx   eax, word [MOUSE_Y]
107
        movzx   eax, word [MOUSE_Y]
109
        movzx   ebx, word [MOUSE_X]
108
        movzx   ebx, word [MOUSE_X]
110
        push    eax
109
        push    eax
111
        push    ebx
110
        push    ebx
112
 
111
 
113
;        mov     ecx, [Screen_Max_X]
112
;        mov     ecx, [Screen_Max_X]
114
;        inc     ecx
113
;        inc     ecx
115
;        mul     ecx
114
;        mul     ecx
116
        mov     eax, [d_width_calc_area + eax*4]
115
        mov     eax, [d_width_calc_area + eax*4]
117
 
116
 
118
        add     eax, [_display.win_map]
117
        add     eax, [_display.win_map]
119
        movzx   edx, byte [ebx+eax]
118
        movzx   edx, byte [ebx+eax]
120
        shl     edx, 8
119
        shl     edx, 8
121
        mov     esi, [edx+SLOT_BASE+APPDATA.cursor]
120
        mov     esi, [edx+SLOT_BASE+APPDATA.cursor]
122
 
121
 
123
        cmp     esi, [current_cursor]
122
        cmp     esi, [current_cursor]
124
        je      .draw
123
        je      .draw
125
 
124
 
126
        mov     eax, [TASK_COUNT]
125
        mov     eax, [TASK_COUNT]
127
        movzx   eax, word [WIN_POS+eax*2]
126
        movzx   eax, word [WIN_POS+eax*2]
128
        shl     eax, 8
127
        shl     eax, 8
129
 
128
 
130
        cmp     eax, edx
129
        cmp     eax, edx
131
        je      @F
130
        je      @F
132
 
131
 
133
        mov     esi, [def_cursor]
132
        mov     esi, [def_cursor]
134
        cmp     esi, [current_cursor]
133
        cmp     esi, [current_cursor]
135
        je      .draw
134
        je      .draw
136
 
135
 
137
@@:
136
@@:
138
        push    esi
137
        push    esi
139
        call    [_display.select_cursor]
138
        call    [_display.select_cursor]
140
        mov     [current_cursor], esi
139
        mov     [current_cursor], esi
141
;--------------------------------------
140
;--------------------------------------
142
align 4
141
align 4
143
.draw:
142
.draw:
144
        stdcall [_display.move_cursor], esi
143
        stdcall [_display.move_cursor], esi
145
        popad
144
        popad
146
        ret
145
        ret
147
;--------------------------------------
146
;--------------------------------------
148
;align 4
147
;align 4
149
;.fail:
148
;.fail:
150
;        mov     ecx, [def_cursor]
149
;        mov     ecx, [def_cursor]
151
;        mov     [edx+SLOT_BASE+APPDATA.cursor], ecx
150
;        mov     [edx+SLOT_BASE+APPDATA.cursor], ecx
152
;        stdcall [_display.move_cursor], ecx        ; stdcall: [esp]=ebx,eax
151
;        stdcall [_display.move_cursor], ecx        ; stdcall: [esp]=ebx,eax
153
;        popad
152
;        popad
154
;        ret
153
;        ret
155
;--------------------------------------
154
;--------------------------------------
156
align 4
155
align 4
157
.no_hw_cursor:
156
.no_hw_cursor:
158
        pushad
157
        pushad
159
        ; save & draw
158
        ; save & draw
160
        mov     [X_UNDER], ax
159
        mov     [X_UNDER], ax
161
        mov     [Y_UNDER], bx
160
        mov     [Y_UNDER], bx
162
        push    eax
161
        push    eax
163
        push    ebx
162
        push    ebx
164
        mov     ecx, 0
163
        mov     ecx, 0
165
        mov     edx, 0
164
        mov     edx, 0
166
;--------------------------------------
165
;--------------------------------------
167
align 4
166
align 4
168
drm:
167
drm:
169
        push    eax
168
        push    eax
170
        push    ebx
169
        push    ebx
171
        push    ecx
170
        push    ecx
172
        push    edx
171
        push    edx
173
        ; helloworld
172
        ; helloworld
174
        push    ecx
173
        push    ecx
175
        add     eax, ecx        ; save picture under mouse
174
        add     eax, ecx        ; save picture under mouse
176
        add     ebx, edx
175
        add     ebx, edx
177
        push    ecx
176
        push    ecx
178
        or      ecx, 0x04000000 ; don't load to mouseunder area
177
        or      ecx, 0x04000000 ; don't load to mouseunder area
179
        push    eax ebx edx edi
178
        push    eax ebx edx edi
180
        call    [GETPIXEL]
179
        call    [GETPIXEL]
181
        pop     edi edx ebx eax
180
        pop     edi edx ebx eax
182
        mov     [COLOR_TEMP], ecx
181
        mov     [COLOR_TEMP], ecx
183
        pop     ecx
182
        pop     ecx
184
        mov     eax, edx
183
        mov     eax, edx
185
        shl     eax, 6
184
        shl     eax, 6
186
        shl     ecx, 2
185
        shl     ecx, 2
187
        add     eax, ecx
186
        add     eax, ecx
188
        add     eax, mouseunder
187
        add     eax, mouseunder
189
        mov     ebx, [COLOR_TEMP]
188
        mov     ebx, [COLOR_TEMP]
190
        and     ebx, 0xffffff
189
        and     ebx, 0xffffff
191
        mov     [eax], ebx
190
        mov     [eax], ebx
192
        pop     ecx
191
        pop     ecx
193
        mov     edi, edx        ; y cycle
192
        mov     edi, edx        ; y cycle
194
        shl     edi, 4          ; *16 bytes per row
193
        shl     edi, 4          ; *16 bytes per row
195
        add     edi, ecx        ; x cycle
194
        add     edi, ecx        ; x cycle
196
        mov     esi, edi
195
        mov     esi, edi
197
        add     edi, esi
196
        add     edi, esi
198
        add     edi, esi        ; *3
197
        add     edi, esi        ; *3
199
        add     edi, [MOUSE_PICTURE]    ; we have our str address
198
        add     edi, [MOUSE_PICTURE]    ; we have our str address
200
        mov     esi, edi
199
        mov     esi, edi
201
        add     esi, 16*24*3
200
        add     esi, 16*24*3
202
        push    ecx
201
        push    ecx
203
        mov     ecx, [COLOR_TEMP]
202
        mov     ecx, [COLOR_TEMP]
204
        call    combine_colors
203
        call    combine_colors
205
        and     ecx, 0xffffff
204
        and     ecx, 0xffffff
206
        mov     [MOUSE_COLOR_MEM], ecx
205
        mov     [MOUSE_COLOR_MEM], ecx
207
        pop     ecx
206
        pop     ecx
208
        pop     edx
207
        pop     edx
209
        pop     ecx
208
        pop     ecx