Rev 840 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 840 | Rev 928 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2007. 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: 840 $ |
8 | $Revision: 928 $ |
9 | 9 | ||
10 | 10 | ||
Line 15... | Line 15... | ||
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 |
- | |
21 | ; FC00 -> FCFE com1/ps2 buffer |
- | |
22 | ; FCFF com1/ps2 buffer count starting from FC00 |
- | |
Line 23... | Line 20... | ||
23 | 20 | ||
24 | uglobal |
21 | uglobal |
25 | mousecount dd 0x0 |
22 | mousecount dd 0x0 |
26 | mousedata dd 0x0 |
23 | mousedata dd 0x0 |
Line 30... | Line 27... | ||
30 | mouse_delay dd 10 |
27 | mouse_delay dd 10 |
31 | mouse_speed_factor: dd 3 |
28 | mouse_speed_factor: dd 3 |
32 | mouse_timer_ticks dd 0 |
29 | mouse_timer_ticks dd 0 |
33 | endg |
30 | endg |
Line 34... | Line -... | ||
34 | - | ||
35 | ;include 'm_com.inc' |
- | |
36 | - | ||
37 | - | ||
38 | ;test_mario79: |
- | |
39 | ; push esi |
- | |
40 | ; push eax |
- | |
41 | ; mov [write_error_to],process_test_m79+43 |
- | |
42 | ; movzx eax,al ;[DevErrorCode] |
- | |
43 | ; call writehex |
- | |
44 | ; mov esi,process_test_m79 |
- | |
45 | ; call sys_msg_board_str |
- | |
46 | ; pop eax |
- | |
47 | ; pop esi |
31 | |
48 | ; ret |
- | |
49 | ;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0 |
- | |
50 | 32 | align 4 |
|
51 | draw_mouse_under: |
33 | draw_mouse_under: |
Line 52... | Line 34... | ||
52 | ; return old picture |
34 | ; return old picture |
53 | 35 | ||
54 | cmp [set_hw_cursor], 0 |
36 | cmp [set_hw_cursor], 0 |
55 | jz @F |
37 | jz @F |
56 | pushad |
38 | pushad |
57 | movzx eax,word [X_UNDER] |
39 | mov eax, [x_under] |
58 | movzx ebx,word [Y_UNDER] |
40 | mov ebx, [y_under] |
59 | stdcall [hw_restore], eax, ebx |
41 | stdcall [hw_restore], eax, ebx |
60 | popad |
42 | popad |
61 | ret |
43 | ret |
62 | @@: |
44 | @@: |
63 | pushad |
45 | pushad |
64 | xor ecx,ecx |
46 | xor ecx,ecx |
65 | xor edx,edx |
47 | xor edx,edx |
66 | align 4 |
48 | align 4 |
67 | mres: |
49 | mres: |
68 | movzx eax,word [X_UNDER] |
50 | mov eax, [x_under] |
69 | movzx ebx,word [Y_UNDER] |
51 | mov ebx, [y_under] |
70 | add eax,ecx |
52 | add eax,ecx |
71 | add ebx,edx |
53 | add ebx,edx |
72 | push ecx |
54 | push ecx |
Line 99... | Line 81... | ||
99 | 81 | ||
100 | cmp [set_hw_cursor], 0 |
82 | cmp [set_hw_cursor], 0 |
101 | je .no_hw_cursor |
83 | je .no_hw_cursor |
Line 102... | Line 84... | ||
102 | pushad |
84 | pushad |
103 | 85 | ||
104 | mov [X_UNDER],ax |
86 | mov [x_under], eax |
105 | mov [Y_UNDER],bx |
87 | mov [y_under], ebx |
106 | movzx eax,word [MOUSE_Y] |
88 | movzx eax,word [MOUSE_Y] |
107 | movzx ebx,word [MOUSE_X] |
89 | movzx ebx,word [MOUSE_X] |
Line 137... | Line 119... | ||
137 | ret |
119 | ret |
Line 138... | Line 120... | ||
138 | 120 | ||
139 | .no_hw_cursor: |
121 | .no_hw_cursor: |
140 | pushad |
122 | pushad |
141 | ; save & draw |
123 | ; save & draw |
142 | mov [X_UNDER],ax |
124 | mov [x_under], eax |
143 | mov [Y_UNDER],bx |
125 | mov [y_under], ebx |
144 | push eax |
126 | push eax |
145 | push ebx |
127 | push ebx |
146 | mov ecx,0 |
128 | mov ecx,0 |
147 | mov edx,0 |
129 | mov edx,0 |
Line 155... | Line 137... | ||
155 | push ecx |
137 | push ecx |
156 | add eax,ecx ; save picture under mouse |
138 | add eax,ecx ; save picture under mouse |
157 | add ebx,edx |
139 | add ebx,edx |
158 | push ecx |
140 | push ecx |
159 | call getpixel |
141 | call getpixel |
160 | mov [COLOR_TEMP],ecx |
142 | mov [color_temp],ecx |
161 | pop ecx |
143 | pop ecx |
162 | mov eax,edx |
144 | mov eax,edx |
163 | shl eax,6 |
145 | shl eax,6 |
164 | shl ecx,2 |
146 | shl ecx,2 |
165 | add eax,ecx |
147 | add eax,ecx |
166 | add eax,mouseunder |
148 | add eax,mouseunder |
167 | mov ebx,[COLOR_TEMP] |
149 | mov ebx,[color_temp] |
168 | mov [eax],ebx |
150 | mov [eax],ebx |
169 | pop ecx |
151 | pop ecx |
170 | mov edi,edx ; y cycle |
152 | mov edi,edx ; y cycle |
171 | shl edi,4 ; *16 bytes per row |
153 | shl edi,4 ; *16 bytes per row |
172 | add edi,ecx ; x cycle |
154 | add edi,ecx ; x cycle |
173 | mov esi, edi |
- | |
174 | add edi, esi |
- | |
175 | add edi, esi ; *3 |
- | |
176 | add edi,[MOUSE_PICTURE] ; we have our str address |
155 | lea edi, [mousepointer+edi+edi*2] ; we have our str address |
177 | mov esi, edi |
156 | mov esi, edi |
178 | add esi, 16*24*3 |
157 | add esi, 16*24*3 |
179 | push ecx |
158 | push ecx |
180 | mov ecx, [COLOR_TEMP] |
159 | mov ecx, [color_temp] |
181 | call combine_colors |
160 | call combine_colors |
182 | mov [MOUSE_COLOR_MEM], ecx |
161 | mov [mouse_color_mem], ecx |
183 | pop ecx |
162 | pop ecx |
184 | pop edx |
163 | pop edx |
185 | pop ecx |
164 | pop ecx |
186 | pop ebx |
165 | pop ebx |
187 | pop eax |
166 | pop eax |
188 | add eax,ecx ; we have x coord+cycle |
167 | add eax,ecx ; we have x coord+cycle |
189 | add ebx,edx ; and y coord+cycle |
168 | add ebx,edx ; and y coord+cycle |
190 | push ecx |
169 | push ecx |
191 | mov ecx, [MOUSE_COLOR_MEM] |
170 | mov ecx, [mouse_color_mem] |
192 | mov edi, 1 |
171 | mov edi, 1 |
193 | call [putpixel] |
172 | call [putpixel] |
194 | pop ecx |
173 | pop ecx |
195 | mov ebx,[esp+0] ; pure y coord again |
174 | mov ebx,[esp+0] ; pure y coord again |
196 | mov eax,[esp+4] ; and x |
175 | mov eax,[esp+4] ; and x |
Line 274... | Line 253... | ||
274 | pop eax |
253 | pop eax |
275 | ret |
254 | ret |
Line 276... | Line 255... | ||
276 | 255 | ||
277 | 256 | ||
278 | __sys_disable_mouse: |
257 | __sys_disable_mouse: |
279 | cmp dword [MOUSE_VISIBLE],dword 0 |
258 | cmp [MOUSE_VISIBLE], 0 |
280 | je @f |
259 | je @f |
281 | ret |
260 | ret |
282 | @@: |
261 | @@: |
Line 332... | Line 311... | ||
332 | sub ebx,14 |
311 | sub ebx,14 |
333 | add ecx,[edx+12] |
312 | add ecx,[edx+12] |
334 | cmp ebx,ecx |
313 | cmp ebx,ecx |
335 | jg no_mouse_disable |
314 | jg no_mouse_disable |
336 | disable_m: |
315 | disable_m: |
337 | cmp dword [MOUSE_VISIBLE],dword 0 |
316 | cmp [MOUSE_VISIBLE], 0 |
338 | jne no_mouse_disable |
317 | jne no_mouse_disable |
339 | pushf |
318 | pushf |
340 | cli |
319 | cli |
341 | call draw_mouse_under |
320 | call draw_mouse_under |
342 | popf |
321 | popf |
343 | mov [MOUSE_VISIBLE],dword 1 |
322 | mov [MOUSE_VISIBLE], 1 |
344 | no_mouse_disable: |
323 | no_mouse_disable: |
345 | popad |
324 | popad |
346 | ret |
325 | ret |
Line 347... | Line 326... | ||
347 | 326 | ||
Line 360... | Line 339... | ||
360 | @@: |
339 | @@: |
361 | mov eax,[timer_ticks] |
340 | mov eax,[timer_ticks] |
362 | mov [MouseTickCounter],eax |
341 | mov [MouseTickCounter],eax |
363 | pop eax |
342 | pop eax |
364 | pushad |
343 | pushad |
365 | cmp dword [MOUSE_VISIBLE],dword 0 ; mouse visible ? |
344 | cmp [MOUSE_VISIBLE], 0 ; mouse visible ? |
366 | je chms00 |
345 | je chms00 |
367 | mov [MOUSE_VISIBLE], dword 0 |
346 | mov [MOUSE_VISIBLE], 0 |
368 | movzx ebx,word [MOUSE_Y] |
347 | movzx ebx,word [MOUSE_Y] |
369 | movzx eax,word [MOUSE_X] |
348 | movzx eax,word [MOUSE_X] |
370 | pushfd |
349 | pushfd |
371 | cli |
350 | cli |
372 | call save_draw_mouse |
351 | call save_draw_mouse |
373 | popfd |
352 | popfd |
374 | nodmu2: |
353 | nodmu2: |
375 | popad |
354 | popad |
376 | ret |
355 | ret |
377 | chms00: |
356 | chms00: |
378 | movzx ecx,word [X_UNDER] |
357 | mov ecx, [x_under] |
379 | movzx edx,word [Y_UNDER] |
358 | mov edx, [y_under] |
380 | movzx ebx,word [MOUSE_Y] |
359 | movzx ebx,word [MOUSE_Y] |
381 | movzx eax,word [MOUSE_X] |
360 | movzx eax,word [MOUSE_X] |
382 | cmp eax,ecx |
361 | cmp eax,ecx |
383 | jne redrawmouse |
362 | jne redrawmouse |
384 | cmp ebx,edx |
363 | cmp ebx,edx |
Line 395... | Line 374... | ||
395 | ret |
374 | ret |
Line 396... | Line 375... | ||
396 | 375 | ||
Line 397... | Line 376... | ||
397 | proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword |
376 | proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword |
398 | 377 | ||
Line 399... | Line 378... | ||
399 | mov eax,[BtnState] |
378 | mov eax,[BtnState] |
400 | mov [BTN_DOWN],eax |
379 | mov [btn_down],eax |
401 | 380 | ||
402 | mov eax,[XMoving] |
381 | mov eax,[XMoving] |
403 | call mouse_acceleration |
382 | call mouse_acceleration |
404 | add ax,[MOUSE_X] ;[XCoordinate] |
383 | add ax,[MOUSE_X] ;[XCoordinate] |
405 | cmp ax,0 |
384 | cmp ax,0 |
406 | jge @@M1 |
385 | jge @@M1 |
407 | mov eax,0 |
386 | mov eax,0 |
408 | jmp @@M2 |
387 | jmp @@M2 |
409 | @@M1: |
388 | @@M1: |
Line 410... | Line 389... | ||
410 | cmp ax,[Screen_Max_X] ;ScreenLength |
389 | cmp ax, word [Screen_Max_X] ;ScreenLength |
411 | jl @@M2 |
390 | jl @@M2 |
Line 412... | Line 391... | ||
412 | mov ax,[Screen_Max_X] ;ScreenLength-1 |
391 | mov ax, word [Screen_Max_X] ;ScreenLength-1 |
Line 422... | Line 401... | ||
422 | cmp ax,0 |
401 | cmp ax,0 |
423 | jge @@M3 |
402 | jge @@M3 |
424 | mov ax,0 |
403 | mov ax,0 |
425 | jmp @@M4 |
404 | jmp @@M4 |
426 | @@M3: |
405 | @@M3: |
427 | cmp ax,[Screen_Max_Y] ;ScreenHeigth |
406 | cmp ax, word [Screen_Max_Y] ;ScreenHeigth |
428 | jl @@M4 |
407 | jl @@M4 |
429 | mov ax,[Screen_Max_Y] ;ScreenHeigth-1 |
408 | mov ax, word [Screen_Max_Y] ;ScreenHeigth-1 |
Line 430... | Line 409... | ||
430 | 409 | ||
431 | @@M4: |
410 | @@M4: |
Line 432... | Line 411... | ||
432 | mov [MOUSE_Y],ax ;[YCoordinate] |
411 | mov [MOUSE_Y],ax ;[YCoordinate] |
433 | 412 | ||
Line 434... | Line 413... | ||
434 | mov eax,[VScroll] |
413 | mov eax,[VScroll] |
435 | add [MOUSE_SCROLL_V],ax |
414 | add [mouse_scroll_v], eax |
Line 436... | Line 415... | ||
436 | 415 | ||
437 | mov eax,[HScroll] |
416 | mov eax,[HScroll] |
438 | add [MOUSE_SCROLL_H],ax |
417 | add [mouse_scroll_h], eax |
439 | 418 |