Rev 2382 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2382 | Rev 2540 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2012. 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 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 2382 $ |
8 | $Revision $ |
9 | 9 | ||
10 | 10 | ||
Line 20... | Line 20... | ||
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 |
Line 23... | Line 23... | ||
23 | 23 | ||
- | 24 | uglobal |
|
- | 25 | ;-------------------------------------- |
|
24 | uglobal |
26 | align 4 |
25 | mousecount dd 0x0 |
27 | mousecount dd 0x0 |
- | 28 | mousedata dd 0x0 |
|
- | 29 | Y_UNDER_subtraction_CUR_hot_y: |
|
- | 30 | dd 0 |
|
- | 31 | X_UNDER_subtraction_CUR_hot_x: |
|
- | 32 | dd 0 |
|
- | 33 | Y_UNDER_sub_CUR_hot_y_add_curh: |
|
- | 34 | dd 0 |
|
- | 35 | X_UNDER_sub_CUR_hot_x_add_curh: |
|
26 | mousedata dd 0x0 |
36 | dd 0 |
Line 27... | Line 37... | ||
27 | endg |
37 | endg |
- | 38 | ||
- | 39 | iglobal |
|
28 | 40 | ;-------------------------------------- |
|
29 | iglobal |
41 | align 4 |
30 | mouse_delay dd 10 |
42 | mouse_delay dd 10 |
31 | mouse_speed_factor: |
43 | mouse_speed_factor: |
32 | dd 3 |
44 | dd 3 |
33 | mouse_timer_ticks dd 0 |
- | |
34 | endg |
- | |
35 | - | ||
36 | ;include 'm_com.inc' |
- | |
37 | - | ||
38 | - | ||
39 | ;test_mario79: |
- | |
40 | ; push esi |
45 | mouse_timer_ticks dd 0 |
41 | ; push eax |
- | |
42 | ; mov [write_error_to],process_test_m79+43 |
- | |
43 | ; movzx eax,al ;[DevErrorCode] |
- | |
44 | ; call writehex |
- | |
45 | ; mov esi,process_test_m79 |
- | |
46 | ; call sys_msg_board_str |
- | |
47 | ; pop eax |
46 | endg |
48 | ; pop esi |
- | |
49 | ; ret |
- | |
50 | ;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0 |
47 | ;----------------------------------------------------------------------------- |
51 | 48 | align 4 |
|
52 | draw_mouse_under: |
- | |
53 | ; return old picture |
49 | draw_mouse_under: |
54 | 50 | ; return old picture |
|
Line 55... | Line 51... | ||
55 | cmp [_display.restore_cursor], 0 |
51 | cmp [_display.restore_cursor], 0 |
56 | je @F |
52 | je @F |
57 | 53 | ||
58 | pushad |
54 | pushad |
59 | movzx eax, word [X_UNDER] |
55 | movzx eax, word [X_UNDER] |
60 | movzx ebx, word [Y_UNDER] |
56 | movzx ebx, word [Y_UNDER] |
- | 57 | stdcall [_display.restore_cursor], eax, ebx |
|
- | 58 | popad |
|
61 | stdcall [_display.restore_cursor], eax, ebx |
59 | ret |
62 | popad |
60 | ;-------------------------------------- |
63 | ret |
61 | align 4 |
64 | @@: |
62 | @@: |
- | 63 | pushad |
|
65 | pushad |
64 | xor ecx, ecx |
66 | xor ecx, ecx |
65 | xor edx, edx |
67 | xor edx, edx |
66 | ;-------------------------------------- |
68 | align 4 |
67 | align 4 |
69 | mres: |
68 | mres: |
Line 82... | Line 81... | ||
82 | add eax, mouseunder |
81 | add eax, mouseunder |
83 | mov ecx, [eax] |
82 | mov ecx, [eax] |
84 | pop ebx |
83 | pop ebx |
85 | pop eax |
84 | pop eax |
86 | mov edi, 1;force |
85 | mov edi, 1 ; force |
- | 86 | or ecx, 0x04000000 ; don't save to mouseunder area |
|
87 | call [putpixel] |
87 | ; call [putpixel] |
- | 88 | call __sys_putpixel |
|
88 | pop edx |
89 | pop edx |
89 | pop ecx |
90 | pop ecx |
90 | inc ecx |
91 | inc ecx |
91 | cmp ecx, 16 |
92 | cmp ecx, 16 |
92 | jnz mres |
93 | jnz mres |
Line 94... | Line 95... | ||
94 | inc edx |
95 | inc edx |
95 | cmp edx, 24 |
96 | cmp edx, 24 |
96 | jnz mres |
97 | jnz mres |
97 | popad |
98 | popad |
98 | ret |
99 | ret |
- | 100 | ;----------------------------------------------------------------------------- |
|
99 | 101 | align 4 |
|
100 | save_draw_mouse: |
102 | save_draw_mouse: |
101 | - | ||
102 | cmp [_display.move_cursor], 0 |
103 | cmp [_display.move_cursor], 0 |
103 | je .no_hw_cursor |
104 | je .no_hw_cursor |
104 | pushad |
105 | pushad |
Line 105... | Line 106... | ||
105 | 106 | ||
Line 108... | Line 109... | ||
108 | movzx eax, word [MOUSE_Y] |
109 | movzx eax, word [MOUSE_Y] |
109 | movzx ebx, word [MOUSE_X] |
110 | movzx ebx, word [MOUSE_X] |
110 | push eax |
111 | push eax |
111 | push ebx |
112 | push ebx |
Line 112... | Line 113... | ||
112 | 113 | ||
113 | mov ecx, [Screen_Max_X] |
114 | ; mov ecx, [Screen_Max_X] |
114 | inc ecx |
115 | ; inc ecx |
- | 116 | ; mul ecx |
|
- | 117 | mov eax, [d_width_calc_area + eax*4] |
|
115 | mul ecx |
118 | |
116 | add eax, [_WinMapAddress] |
119 | add eax, [_WinMapAddress] |
117 | movzx edx, byte [ebx+eax] |
120 | movzx edx, byte [ebx+eax] |
118 | shl edx, 8 |
121 | shl edx, 8 |
Line 122... | Line 125... | ||
122 | je .draw |
125 | je .draw |
Line 123... | Line 126... | ||
123 | 126 | ||
124 | push esi |
127 | push esi |
125 | call [_display.select_cursor] |
128 | call [_display.select_cursor] |
- | 129 | mov [current_cursor], esi |
|
- | 130 | ;-------------------------------------- |
|
126 | mov [current_cursor], esi |
131 | align 4 |
127 | .draw: |
132 | .draw: |
128 | stdcall [_display.move_cursor], esi |
133 | stdcall [_display.move_cursor], esi |
129 | popad |
134 | popad |
- | 135 | ret |
|
- | 136 | ;-------------------------------------- |
|
130 | ret |
137 | ;align 4 |
131 | .fail: |
138 | ;.fail: |
132 | mov ecx, [def_cursor] |
139 | ; mov ecx, [def_cursor] |
133 | mov [edx+SLOT_BASE+APPDATA.cursor], ecx |
140 | ; mov [edx+SLOT_BASE+APPDATA.cursor], ecx |
134 | stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax |
141 | ; stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax |
135 | popad |
142 | ; popad |
- | 143 | ; ret |
|
136 | ret |
144 | ;-------------------------------------- |
137 | 145 | align 4 |
|
138 | .no_hw_cursor: |
146 | .no_hw_cursor: |
139 | pushad |
147 | pushad |
140 | ; save & draw |
148 | ; save & draw |
141 | mov [X_UNDER], ax |
149 | mov [X_UNDER], ax |
142 | mov [Y_UNDER], bx |
150 | mov [Y_UNDER], bx |
143 | push eax |
151 | push eax |
144 | push ebx |
152 | push ebx |
145 | mov ecx, 0 |
153 | mov ecx, 0 |
- | 154 | mov edx, 0 |
|
146 | mov edx, 0 |
155 | ;-------------------------------------- |
147 | align 4 |
156 | align 4 |
148 | drm: |
157 | drm: |
149 | push eax |
158 | push eax |
150 | push ebx |
159 | push ebx |
Line 153... | Line 162... | ||
153 | ; helloworld |
162 | ; helloworld |
154 | push ecx |
163 | push ecx |
155 | add eax, ecx; save picture under mouse |
164 | add eax, ecx; save picture under mouse |
156 | add ebx, edx |
165 | add ebx, edx |
157 | push ecx |
166 | push ecx |
- | 167 | or ecx, 0x04000000 ; don't load to mouseunder area |
|
158 | call getpixel |
168 | call getpixel |
159 | mov [COLOR_TEMP], ecx |
169 | mov [COLOR_TEMP], ecx |
160 | pop ecx |
170 | pop ecx |
161 | mov eax, edx |
171 | mov eax, edx |
162 | shl eax, 6 |
172 | shl eax, 6 |
163 | shl ecx, 2 |
173 | shl ecx, 2 |
164 | add eax, ecx |
174 | add eax, ecx |
165 | add eax, mouseunder |
175 | add eax, mouseunder |
166 | mov ebx, [COLOR_TEMP] |
176 | mov ebx, [COLOR_TEMP] |
- | 177 | and ebx, 0xffffff |
|
167 | mov [eax], ebx |
178 | mov [eax], ebx |
168 | pop ecx |
179 | pop ecx |
169 | mov edi, edx ; y cycle |
180 | mov edi, edx ; y cycle |
170 | shl edi, 4 ; *16 bytes per row |
181 | shl edi, 4 ; *16 bytes per row |
171 | add edi, ecx ; x cycle |
182 | add edi, ecx ; x cycle |
Line 176... | Line 187... | ||
176 | mov esi, edi |
187 | mov esi, edi |
177 | add esi, 16*24*3 |
188 | add esi, 16*24*3 |
178 | push ecx |
189 | push ecx |
179 | mov ecx, [COLOR_TEMP] |
190 | mov ecx, [COLOR_TEMP] |
180 | call combine_colors |
191 | call combine_colors |
- | 192 | and ecx, 0xffffff |
|
181 | mov [MOUSE_COLOR_MEM], ecx |
193 | mov [MOUSE_COLOR_MEM], ecx |
182 | pop ecx |
194 | pop ecx |
183 | pop edx |
195 | pop edx |
184 | pop ecx |
196 | pop ecx |
185 | pop ebx |
197 | pop ebx |
186 | pop eax |
198 | pop eax |
187 | add eax, ecx ; we have x coord+cycle |
199 | add eax, ecx ; we have x coord+cycle |
188 | add ebx, edx ; and y coord+cycle |
200 | add ebx, edx ; and y coord+cycle |
189 | push ecx |
201 | push ecx |
190 | mov ecx, [MOUSE_COLOR_MEM] |
202 | mov ecx, [MOUSE_COLOR_MEM] |
191 | mov edi, 1 |
203 | mov edi, 1 ; force |
- | 204 | or ecx, 0x04000000 ; don't save to mouseunder area |
|
192 | call [putpixel] |
205 | ; call [putpixel] |
- | 206 | call __sys_putpixel |
|
193 | pop ecx |
207 | pop ecx |
194 | mov ebx, [esp+0] ; pure y coord again |
208 | mov ebx, [esp+0] ; pure y coord again |
195 | mov eax, [esp+4] ; and x |
209 | mov eax, [esp+4] ; and x |
196 | inc ecx ; +1 cycle |
210 | inc ecx ; +1 cycle |
197 | cmp ecx, 16 ; if more than 16 |
211 | cmp ecx, 16 ; if more than 16 |
Line 201... | Line 215... | ||
201 | cmp edx, 24 |
215 | cmp edx, 24 |
202 | jnz drm |
216 | jnz drm |
203 | add esp, 8 |
217 | add esp, 8 |
204 | popad |
218 | popad |
205 | ret |
219 | ret |
206 | - | ||
- | 220 | ;----------------------------------------------------------------------------- |
|
207 | 221 | align 4 |
|
208 | combine_colors: |
222 | combine_colors: |
209 | ; in |
223 | ; in |
210 | ; ecx - color ( 00 RR GG BB ) |
224 | ; ecx - color ( 00 RR GG BB ) |
211 | ; edi - ref to new color byte |
225 | ; edi - ref to new color byte |
212 | ; esi - ref to alpha byte |
226 | ; esi - ref to alpha byte |
Line 270... | Line 284... | ||
270 | pop eax |
284 | pop eax |
271 | pop edx |
285 | pop edx |
272 | pop ebx |
286 | pop ebx |
273 | pop eax |
287 | pop eax |
274 | ret |
288 | ret |
- | 289 | ;----------------------------------------------------------------------------- |
|
- | 290 | align 4 |
|
- | 291 | check_mouse_area_for_getpixel: |
|
- | 292 | ; in: |
|
- | 293 | ; eax = x |
|
- | 294 | ; ebx = y |
|
- | 295 | ; out: |
|
- | 296 | ; ecx = new color |
|
- | 297 | push eax ebx |
|
- | 298 | ; check for Y |
|
- | 299 | xor ecx, ecx |
|
- | 300 | mov cx, [Y_UNDER] ; [MOUSE_Y] |
|
Line 275... | Line -... | ||
275 | - | ||
276 | - | ||
277 | __sys_disable_mouse: |
- | |
278 | cmp dword [MOUSE_VISIBLE], dword 0 |
- | |
279 | je @f |
- | |
280 | ret |
- | |
281 | @@: |
- | |
282 | pushad |
- | |
283 | cmp [CURRENT_TASK], dword 1 |
- | |
284 | je disable_m |
- | |
285 | mov edx, [CURRENT_TASK] |
- | |
286 | shl edx, 5 |
- | |
287 | add edx, window_data |
- | |
288 | movzx eax, word [MOUSE_X] |
- | |
289 | movzx ebx, word [MOUSE_Y] |
- | |
290 | mov ecx, [Screen_Max_X] |
- | |
291 | inc ecx |
- | |
292 | imul ecx, ebx |
- | |
293 | add ecx, eax |
- | |
294 | add ecx, [_WinMapAddress] |
- | |
295 | mov eax, [CURRENT_TASK] |
- | |
296 | cmp al, [ecx] |
- | |
297 | je yes_mouse_disable |
- | |
298 | cmp al, [ecx+16] |
- | |
299 | je yes_mouse_disable |
- | |
300 | add ebx, 10 |
- | |
301 | cmp ebx, [Screen_Max_Y] |
- | |
302 | jae no_mouse_disable |
- | |
303 | mov ebx, [Screen_Max_X] |
- | |
304 | inc ebx |
- | |
305 | imul ebx, 10 |
- | |
306 | add ecx, ebx |
- | |
307 | cmp al, [ecx] |
- | |
308 | je yes_mouse_disable |
- | |
309 | cmp al, [ecx+16] |
- | |
310 | je yes_mouse_disable |
- | |
311 | jmp no_mouse_disable |
- | |
312 | yes_mouse_disable: |
- | |
313 | mov edx, [CURRENT_TASK] |
- | |
314 | shl edx, 5 |
- | |
315 | add edx, window_data |
- | |
316 | movzx eax, word [MOUSE_X] |
- | |
317 | movzx ebx, word [MOUSE_Y] |
- | |
318 | mov ecx, [edx+0]; mouse inside the area ? |
- | |
319 | add eax, 10 |
- | |
320 | cmp eax, ecx |
- | |
321 | jb no_mouse_disable |
- | |
322 | sub eax, 10 |
- | |
323 | add ecx, [edx+8] |
- | |
324 | cmp eax, ecx |
- | |
325 | jg no_mouse_disable |
- | |
326 | mov ecx, [edx+4] |
- | |
327 | add ebx, 14 |
301 | |
328 | cmp ebx, ecx |
302 | cmp ebx, ecx |
329 | jb no_mouse_disable |
- | |
330 | sub ebx, 14 |
303 | jb .no_mouse_area |
331 | add ecx, [edx+12] |
304 | add ecx, 23 ; mouse cursor Y size |
332 | cmp ebx, ecx |
305 | cmp ebx, ecx |
333 | jg no_mouse_disable |
306 | ja .no_mouse_area |
- | 307 | ; offset Y |
|
- | 308 | sub bx, [Y_UNDER] ;[MOUSE_Y] |
|
- | 309 | ;-------------------------------------- |
|
- | 310 | ; check for X |
|
334 | disable_m: |
311 | xor ecx, ecx |
- | 312 | mov cx, [X_UNDER] ;[MOUSE_X] |
|
335 | cmp dword [MOUSE_VISIBLE], dword 0 |
313 | cmp eax, ecx |
- | 314 | jb .no_mouse_area |
|
336 | jne no_mouse_disable |
315 | add ecx, 15 ; mouse cursor X size |
- | 316 | cmp eax, ecx |
|
337 | pushf |
317 | ja .no_mouse_area |
- | 318 | ; offset X |
|
- | 319 | sub ax, [X_UNDER] ;[MOUSE_X] |
|
- | 320 | ;-------------------------------------- |
|
- | 321 | ; eax = offset x |
|
- | 322 | ; ebx = offset y |
|
- | 323 | shl ebx, 6 ;y |
|
- | 324 | shl eax, 2 ;x |
|
338 | cli |
325 | add eax, ebx |
339 | call draw_mouse_under |
326 | add eax, mouseunder |
340 | popf |
327 | mov ecx, [eax] |
341 | mov [MOUSE_VISIBLE], dword 1 |
328 | and ecx, 0xffffff |
342 | no_mouse_disable: |
329 | or ecx, 0xff000000 |
343 | popad |
330 | pop ebx eax |
- | 331 | ret |
|
344 | ret |
332 | ;-------------------------------------- |
345 | 333 | align 4 |
|
346 | __sys_draw_pointer: |
334 | .no_mouse_area: |
347 | cmp [mouse_pause], 0 |
335 | xor ecx, ecx |
348 | je @f |
336 | pop ebx eax |
- | 337 | ret |
|
- | 338 | ;----------------------------------------------------------------------------- |
|
- | 339 | align 4 |
|
349 | ret |
340 | check_mouse_area_for_putpixel: |
- | 341 | ; in: |
|
- | 342 | ; ecx = x shl 16 + y |
|
- | 343 | ; eax = color |
|
- | 344 | ; out: |
|
350 | @@: |
345 | ; eax = new color |
- | 346 | push eax |
|
- | 347 | ; check for Y |
|
- | 348 | mov ax, [Y_UNDER] ; [MOUSE_Y] |
|
- | 349 | cmp cx, ax |
|
- | 350 | jb .no_mouse_area |
|
- | 351 | add ax, 23 ; mouse cursor Y size |
|
- | 352 | cmp cx, ax |
|
- | 353 | ja .no_mouse_area |
|
- | 354 | ; offset Y |
|
351 | push eax |
355 | sub cx, [Y_UNDER] ;[MOUSE_Y] |
- | 356 | mov ax, cx |
|
- | 357 | shl eax, 16 |
|
- | 358 | ;-------------------------------------- |
|
- | 359 | ; check for X |
|
- | 360 | mov ax, [X_UNDER] ;[MOUSE_X] |
|
- | 361 | shr ecx, 16 |
|
- | 362 | cmp cx, ax |
|
352 | mov eax, [timer_ticks] |
363 | jb .no_mouse_area |
353 | sub eax, [MouseTickCounter] |
364 | add ax, 15 ; mouse cursor X size |
- | 365 | cmp cx, ax |
|
- | 366 | ja .no_mouse_area |
|
- | 367 | ; offset X |
|
354 | cmp eax, 1 |
368 | sub cx, [X_UNDER] ;[MOUSE_X] |
- | 369 | mov ax, cx |
|
- | 370 | ;-------------------------------------- |
|
- | 371 | ; eax = (offset y) shl 16 + (offset x) |
|
355 | ja @f |
372 | |
- | 373 | pop ecx |
|
- | 374 | ||
- | 375 | push eax ebx |
|
- | 376 | ||
- | 377 | mov ebx, eax |
|
- | 378 | shr ebx, 16 ;y |
|
- | 379 | and eax, 0xffff ;x |
|
- | 380 | ||
- | 381 | shl ebx, 6 |
|
- | 382 | shl eax, 2 |
|
- | 383 | add eax, ebx |
|
- | 384 | add eax, mouseunder |
|
- | 385 | and ecx, 0xFFFFFF |
|
- | 386 | mov [eax], ecx |
|
- | 387 | ||
- | 388 | pop ebx eax |
|
- | 389 | ||
- | 390 | push esi edi |
|
- | 391 | rol eax, 16 |
|
- | 392 | movzx edi, ax ; y cycle |
|
- | 393 | shl edi, 4 ; *16 bytes per row |
|
- | 394 | shr eax, 16 |
|
- | 395 | add edi, eax ; x cycle |
|
- | 396 | lea edi, [edi*3] |
|
- | 397 | add edi, [MOUSE_PICTURE] ; we have our str address |
|
- | 398 | mov esi, edi |
|
- | 399 | add esi, 16*24*3 |
|
- | 400 | call combine_colors |
|
- | 401 | pop edi esi |
|
- | 402 | ;-------------------------------------- |
|
- | 403 | align 4 |
|
- | 404 | .end: |
|
356 | pop eax |
405 | mov eax, ecx |
- | 406 | ret |
|
357 | ret |
407 | ;-------------------------------------- |
358 | @@: |
- | |
359 | mov eax, [timer_ticks] |
408 | align 4 |
360 | mov [MouseTickCounter], eax |
409 | .no_mouse_area: |
361 | pop eax |
- | |
362 | pushad |
- | |
363 | cmp dword [MOUSE_VISIBLE], dword 0; mouse visible ? |
- | |
364 | je chms00 |
- | |
365 | mov [MOUSE_VISIBLE], dword 0 |
- | |
366 | movzx ebx, word [MOUSE_Y] |
- | |
367 | movzx eax, word [MOUSE_X] |
- | |
368 | pushfd |
- | |
369 | cli |
- | |
370 | call save_draw_mouse |
- | |
371 | popfd |
- | |
372 | nodmu2: |
- | |
373 | popad |
410 | pop eax |
- | 411 | ret |
|
374 | ret |
412 | ;----------------------------------------------------------------------------- |
- | 413 | align 4 |
|
- | 414 | __sys_draw_pointer: |
|
375 | chms00: |
415 | pushad |
376 | movzx ecx, word [X_UNDER] |
416 | movzx ecx, word [X_UNDER] |
377 | movzx edx, word [Y_UNDER] |
417 | movzx edx, word [Y_UNDER] |
378 | movzx ebx, word [MOUSE_Y] |
418 | movzx ebx, word [MOUSE_Y] |
- | 419 | movzx eax, word [MOUSE_X] |
|
- | 420 | cmp [redrawmouse_unconditional], 0 |
|
- | 421 | je @f |
|
- | 422 | mov [redrawmouse_unconditional], 0 |
|
- | 423 | jmp redrawmouse |
|
- | 424 | ;-------------------------------------- |
|
- | 425 | align 4 |
|
379 | movzx eax, word [MOUSE_X] |
426 | @@: |
380 | cmp eax, ecx |
427 | cmp eax, ecx |
381 | jne redrawmouse |
428 | jne redrawmouse |
382 | cmp ebx, edx |
429 | cmp ebx, edx |
383 | jne redrawmouse |
430 | je nodmp |
- | 431 | ;-------------------------------------- |
|
384 | jmp nodmp |
432 | align 4 |
385 | redrawmouse: |
433 | redrawmouse: |
386 | pushfd |
434 | pushfd |
387 | cli |
435 | cli |
388 | call draw_mouse_under |
436 | call draw_mouse_under |
- | 437 | call save_draw_mouse |
|
- | 438 | ||
- | 439 | ; mov eax, [_display.select_cursor] |
|
- | 440 | ; test eax, eax |
|
- | 441 | ; jz @f |
|
- | 442 | cmp [_display.select_cursor], select_cursor |
|
- | 443 | jne @f |
|
- | 444 | ||
- | 445 | xor eax, eax |
|
- | 446 | mov esi, [current_cursor] |
|
- | 447 | ||
- | 448 | mov ax, [Y_UNDER] |
|
- | 449 | sub eax, [esi+CURSOR.hot_y] |
|
- | 450 | mov [Y_UNDER_subtraction_CUR_hot_y], eax |
|
- | 451 | add eax, [cur.h] |
|
- | 452 | mov [Y_UNDER_sub_CUR_hot_y_add_curh], eax |
|
- | 453 | ||
- | 454 | mov ax, [X_UNDER] |
|
- | 455 | sub eax, [esi+CURSOR.hot_x] |
|
- | 456 | mov [X_UNDER_subtraction_CUR_hot_x], eax |
|
- | 457 | add eax, [cur.w] |
|
- | 458 | mov [X_UNDER_sub_CUR_hot_x_add_curh], eax |
|
- | 459 | ;-------------------------------------- |
|
- | 460 | align 4 |
|
389 | call save_draw_mouse |
461 | @@: |
- | 462 | popfd |
|
- | 463 | ;-------------------------------------- |
|
390 | popfd |
464 | align 4 |
391 | nodmp: |
465 | nodmp: |
392 | popad |
466 | popad |
- | 467 | ret |
|
393 | ret |
468 | ;----------------------------------------------------------------------------- |
394 | 469 | align 4 |
|
Line 395... | Line 470... | ||
395 | proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword |
470 | proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword |
396 | 471 | ||
Line 402... | Line 477... | ||
402 | add ax, [MOUSE_X];[XCoordinate] |
477 | add ax, [MOUSE_X];[XCoordinate] |
403 | cmp ax, 0 |
478 | cmp ax, 0 |
404 | jge @@M1 |
479 | jge @@M1 |
405 | mov eax, 0 |
480 | mov eax, 0 |
406 | jmp @@M2 |
481 | jmp @@M2 |
- | 482 | ;-------------------------------------- |
|
- | 483 | align 4 |
|
407 | @@M1: |
484 | @@M1: |
408 | cmp ax, [Screen_Max_X];ScreenLength |
485 | cmp ax, [Screen_Max_X];ScreenLength |
409 | jl @@M2 |
486 | jl @@M2 |
410 | mov ax, [Screen_Max_X];ScreenLength-1 |
487 | mov ax, [Screen_Max_X];ScreenLength-1 |
- | 488 | ;-------------------------------------- |
|
411 | 489 | align 4 |
|
412 | @@M2: |
490 | @@M2: |
413 | mov [MOUSE_X], ax;[XCoordinate] |
491 | mov [MOUSE_X], ax;[XCoordinate] |
Line 414... | Line 492... | ||
414 | 492 | ||
415 | mov eax, [YMoving] |
493 | mov eax, [YMoving] |
Line 419... | Line 497... | ||
419 | add ax, [MOUSE_Y];[YCoordinate] |
497 | add ax, [MOUSE_Y];[YCoordinate] |
420 | cmp ax, 0 |
498 | cmp ax, 0 |
421 | jge @@M3 |
499 | jge @@M3 |
422 | mov ax, 0 |
500 | mov ax, 0 |
423 | jmp @@M4 |
501 | jmp @@M4 |
- | 502 | ;-------------------------------------- |
|
- | 503 | align 4 |
|
424 | @@M3: |
504 | @@M3: |
425 | cmp ax, [Screen_Max_Y];ScreenHeigth |
505 | cmp ax, [Screen_Max_Y];ScreenHeigth |
426 | jl @@M4 |
506 | jl @@M4 |
427 | mov ax, [Screen_Max_Y];ScreenHeigth-1 |
507 | mov ax, [Screen_Max_Y];ScreenHeigth-1 |
- | 508 | ;-------------------------------------- |
|
428 | 509 | align 4 |
|
429 | @@M4: |
510 | @@M4: |
430 | mov [MOUSE_Y], ax;[YCoordinate] |
511 | mov [MOUSE_Y], ax;[YCoordinate] |
Line 431... | Line 512... | ||
431 | 512 | ||
432 | mov eax, [VScroll] |
513 | mov eax, [VScroll] |
Line 438... | Line 519... | ||
438 | mov [mouse_active], 1 |
519 | mov [mouse_active], 1 |
439 | mov eax, [timer_ticks] |
520 | mov eax, [timer_ticks] |
440 | mov [mouse_timer_ticks], eax |
521 | mov [mouse_timer_ticks], eax |
441 | ret |
522 | ret |
442 | endp |
523 | endp |
- | 524 | ;----------------------------------------------------------------------------- |
|
443 | 525 | align 4 |
|
444 | mouse_acceleration: |
526 | mouse_acceleration: |
445 | push eax |
527 | push eax |
446 | mov eax, [timer_ticks] |
528 | mov eax, [timer_ticks] |
447 | sub eax, [mouse_timer_ticks] |
529 | sub eax, [mouse_timer_ticks] |
448 | cmp eax, [mouse_delay] |
530 | cmp eax, [mouse_delay] |
449 | pop eax |
531 | pop eax |
450 | ja @f |
532 | ja @f |
451 | ;push edx |
533 | ;push edx |
452 | imul eax, [mouse_speed_factor] |
534 | imul eax, [mouse_speed_factor] |
453 | ;pop edx |
535 | ;pop edx |
- | 536 | ;-------------------------------------- |
|
- | 537 | align 4 |
|
454 | @@: |
538 | @@: |
455 | ret |
539 | ret |
456 | - | ||
- | 540 | ;----------------------------------------------------------------------------- |