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