Subversion Repositories Kolibri OS

Rev

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

Rev 4592 Rev 5154
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2014. 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: 4592 $
8
$Revision: 5154 $
9
 
9
 
10
 
10
 
Line 22... Line 22...
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
24
uglobal
25
;--------------------------------------
25
;--------------------------------------
26
align 4
26
align 4
27
  mousecount  dd  0x0
27
mousecount                      dd ?
28
  mousedata   dd  0x0
28
mousedata                       dd ?
29
Y_UNDER_sub_CUR_hot_y_add_curh:
-
 
30
        dw 0
29
Y_UNDER_sub_CUR_hot_y_add_curh  dw ?
31
Y_UNDER_subtraction_CUR_hot_y:
-
 
32
        dw 0
30
Y_UNDER_subtraction_CUR_hot_y   dw ?
33
X_UNDER_sub_CUR_hot_x_add_curh:
-
 
34
        dw 0
31
X_UNDER_sub_CUR_hot_x_add_curh  dw ?
35
X_UNDER_subtraction_CUR_hot_x:
-
 
36
        dw 0
32
X_UNDER_subtraction_CUR_hot_x   dw ?
Line 37... Line 33...
37
endg
33
endg
38
 
34
 
39
iglobal
35
iglobal
40
;--------------------------------------
36
;--------------------------------------
41
align 4
37
align 4
42
mouse_delay        dd 10
38
mouse_delay             dd 10
43
mouse_speed_factor:
39
mouse_speed_factor:
44
                    dd 3
40
                        dd 3
-
 
41
mouse_timer_ticks       dd 0
45
mouse_timer_ticks  dd 0
42
endg
-
 
43
 
46
endg
44
;-----------------------------------------------------------------------------
47
;-----------------------------------------------------------------------------
45
 
-
 
46
align 4
48
align 4
47
draw_mouse_under:
49
draw_mouse_under:
48
 
50
        ; return old picture
49
        ; return old picture
Line 51... Line 50...
51
        cmp     [_display.restore_cursor], 0
50
        cmp     [_display.restore_cursor], 0
52
        je      @F
51
        je      @F
53
 
52
 
54
        pushad
53
        pushad
55
        movzx   eax, word [X_UNDER]
54
        movzx   eax, word [X_UNDER]
56
        movzx   ebx, word [Y_UNDER]
55
        movzx   ebx, word [Y_UNDER]
57
        stdcall [_display.restore_cursor], eax, ebx
-
 
58
        popad
56
        stdcall [_display.restore_cursor], eax, ebx
59
        ret
57
        popad
60
;--------------------------------------
58
        ret
61
align 4
59
 
62
@@:
60
  @@:
63
        pushad
-
 
64
        xor     ecx, ecx
61
        pushad
65
        xor     edx, edx
62
        xor     ecx, ecx
66
;--------------------------------------
63
        xor     edx, edx
67
align 4
64
 
68
mres:
65
  mres:
69
        movzx   eax, word [X_UNDER]
66
        movzx   eax, word [X_UNDER]
Line 95... Line 92...
95
        inc     edx
92
        inc     edx
96
        cmp     edx, 24
93
        cmp     edx, 24
97
        jnz     mres
94
        jnz     mres
98
        popad
95
        popad
99
        ret
96
        ret
-
 
97
 
100
;-----------------------------------------------------------------------------
98
;-----------------------------------------------------------------------------
-
 
99
 
101
align 4
100
align 4
102
save_draw_mouse:
101
save_draw_mouse:
103
        cmp     [_display.move_cursor], 0
102
        cmp     [_display.move_cursor], 0
104
        je      .no_hw_cursor
103
        je      .no_hw_cursor
105
        pushad
104
        pushad
Line 175... Line 174...
175
        push    ecx
174
        push    ecx
176
        add     eax, ecx; save picture under mouse
175
        add     eax, ecx        ; save picture under mouse
177
        add     ebx, edx
176
        add     ebx, edx
178
        push    ecx
177
        push    ecx
179
        or      ecx, 0x04000000  ; don't load to mouseunder area
178
        or      ecx, 0x04000000 ; don't load to mouseunder area
-
 
179
        push    eax ebx edx edi
180
        call    getpixel
180
        call    [GETPIXEL]
-
 
181
        pop     edi edx ebx eax
181
        mov     [COLOR_TEMP], ecx
182
        mov     [COLOR_TEMP], ecx
182
        pop     ecx
183
        pop     ecx
183
        mov     eax, edx
184
        mov     eax, edx
184
        shl     eax, 6
185
        shl     eax, 6
185
        shl     ecx, 2
186
        shl     ecx, 2
Line 227... Line 228...
227
        cmp     edx, 24
228
        cmp     edx, 24
228
        jnz     drm
229
        jnz     drm
229
        add     esp, 8
230
        add     esp, 8
230
        popad
231
        popad
231
        ret
232
        ret
-
 
233
 
232
;-----------------------------------------------------------------------------
234
;-----------------------------------------------------------------------------
-
 
235
 
233
align 4
236
align 4
234
combine_colors:
237
combine_colors:
235
      ; in
238
      ; in
236
      ; ecx - color ( 00 RR GG BB )
239
      ; ecx - color ( 00 RR GG BB )
237
      ; edi - ref to new color byte
240
      ; edi - ref to new color byte
Line 242... Line 245...
242
        push    eax
245
        push    eax
243
        push    ebx
246
        push    ebx
244
        push    edx
247
        push    edx
245
        push    ecx
248
        push    ecx
246
        xor     ecx, ecx
249
        xor     ecx, ecx
247
         ; byte 2
250
         ; byte 0
248
        mov     eax, 0xff
251
        mov     eax, 0xff
249
        sub     al, [esi+0]
252
        sub     al, [esi+0]
250
        mov     ebx, [esp]
253
        mov     ebx, [esp]
251
        shr     ebx, 16
254
        shr     ebx, 16
252
        and     ebx, 0xff
255
        and     ebx, 0xff
Line 296... Line 299...
296
        pop     eax
299
        pop     eax
297
        pop     edx
300
        pop     edx
298
        pop     ebx
301
        pop     ebx
299
        pop     eax
302
        pop     eax
300
        ret
303
        ret
-
 
304
 
301
;-----------------------------------------------------------------------------
305
;-----------------------------------------------------------------------------
-
 
306
 
302
align 4
307
align 4
303
check_mouse_area_for_getpixel:
308
check_mouse_area_for_getpixel:
304
; in:
309
; in:
305
; eax = x
310
; eax = x
306
; ebx = y
311
; ebx = y
Line 339... Line 344...
339
        mov     ecx, [eax]
344
        mov     ecx, [eax]
340
        and     ecx, 0xffffff
345
        and     ecx, 0xffffff
341
        or      ecx, 0xff000000
346
        or      ecx, 0xff000000
342
        pop     ebx eax
347
        pop     ebx eax
343
        ret
348
        ret
344
;--------------------------------------
-
 
345
align 4
349
 
346
.no_mouse_area:
350
  .no_mouse_area:
347
        xor     ecx, ecx
351
        xor     ecx, ecx
348
        pop     ebx eax
352
        pop     ebx eax
349
        ret
353
        ret
-
 
354
 
350
;-----------------------------------------------------------------------------
355
;-----------------------------------------------------------------------------
-
 
356
 
351
align 4
357
align 4
352
check_mouse_area_for_putpixel:
358
check_mouse_area_for_putpixel:
353
; in:
359
; in:
354
; ecx = x shl 16 + y
360
; ecx = x shl 16 + y
355
; eax = color
361
; eax = color
Line 365... Line 371...
365
        ja      .no_mouse_area
371
        ja      .no_mouse_area
366
; offset Y
372
; offset Y
367
        sub     cx, [Y_UNDER]  ;[MOUSE_Y]
373
        sub     cx, [Y_UNDER]   ; [MOUSE_Y]
368
        mov     ax, cx
374
        mov     ax, cx
369
        shl     eax, 16
375
        shl     eax, 16
370
;--------------------------------------
-
 
-
 
376
 
371
; check for X
377
; check for X
372
        mov     ax, [X_UNDER]  ;[MOUSE_X]
378
        mov     ax, [X_UNDER]   ; [MOUSE_X]
373
        shr     ecx, 16
379
        shr     ecx, 16
374
        cmp     cx, ax
380
        cmp     cx, ax
375
        jb      .no_mouse_area
381
        jb      .no_mouse_area
Line 377... Line 383...
377
        cmp     cx, ax
383
        cmp     cx, ax
378
        ja      .no_mouse_area
384
        ja      .no_mouse_area
379
; offset X
385
; offset X
380
        sub     cx, [X_UNDER]  ;[MOUSE_X]
386
        sub     cx, [X_UNDER]   ; [MOUSE_X]
381
        mov     ax, cx
387
        mov     ax, cx
382
;--------------------------------------
-
 
-
 
388
 
383
; eax = (offset y) shl 16 + (offset x)
389
; eax = (offset y) shl 16 + (offset x)
Line 384... Line 390...
384
 
390
 
Line 385... Line 391...
385
        pop     ecx
391
        pop     ecx
Line 409... Line 415...
409
        add     edi, [MOUSE_PICTURE]    ; we have our str address
415
        add     edi, [MOUSE_PICTURE]    ; we have our str address
410
        mov     esi, edi
416
        mov     esi, edi
411
        add     esi, 16*24*3
417
        add     esi, 16*24*3
412
        call    combine_colors
418
        call    combine_colors
413
        pop     edi esi
419
        pop     edi esi
414
;--------------------------------------
-
 
415
align 4
-
 
416
.end:
-
 
417
        mov     eax, ecx
420
        mov     eax, ecx
418
        ret
421
        ret
419
;--------------------------------------
-
 
420
align 4
422
 
421
.no_mouse_area:
423
  .no_mouse_area:
422
        pop     eax
424
        pop     eax
423
        ret
425
        ret
-
 
426
 
424
;-----------------------------------------------------------------------------
427
;-----------------------------------------------------------------------------
-
 
428
 
425
align 4
429
align 4
426
__sys_draw_pointer:
430
__sys_draw_pointer:
427
        pushad
431
        pushad
428
        movzx   ecx, word [X_UNDER]
432
        movzx   ecx, word [X_UNDER]
429
        movzx   edx, word [Y_UNDER]
433
        movzx   edx, word [Y_UNDER]
Line 431... Line 435...
431
        movzx   eax, word [MOUSE_X]
435
        movzx   eax, word [MOUSE_X]
432
        cmp     [redrawmouse_unconditional], 0
436
        cmp     [redrawmouse_unconditional], 0
433
        je      @f
437
        je      @f
434
        mov     [redrawmouse_unconditional], 0
438
        mov     [redrawmouse_unconditional], 0
435
        jmp     redrawmouse
439
        jmp     redrawmouse
436
;--------------------------------------
-
 
437
align 4
-
 
438
@@:
440
  @@:
439
        cmp     eax, ecx
441
        cmp     eax, ecx
440
        jne     redrawmouse
442
        jne     redrawmouse
441
        cmp     ebx, edx
443
        cmp     ebx, edx
442
        je      nodmp
444
        je      nodmp
-
 
445
 
443
;--------------------------------------
446
;--------------------------------------
-
 
447
 
444
align 4
448
align 4
445
redrawmouse:
449
redrawmouse:
446
        pushfd
450
        pushfd
447
        cli
451
        cli
448
        call    draw_mouse_under
452
        call    draw_mouse_under
Line 466... Line 470...
466
        mov     ax, [X_UNDER]
470
        mov     ax, [X_UNDER]
467
        sub     eax, [esi+CURSOR.hot_x]
471
        sub     eax, [esi+CURSOR.hot_x]
468
        mov     [X_UNDER_subtraction_CUR_hot_x], ax
472
        mov     [X_UNDER_subtraction_CUR_hot_x], ax
469
        add     eax, [cur.w]
473
        add     eax, [cur.w]
470
        mov     [X_UNDER_sub_CUR_hot_x_add_curh], ax
474
        mov     [X_UNDER_sub_CUR_hot_x_add_curh], ax
471
;--------------------------------------
-
 
472
align 4
-
 
473
@@:
475
  @@:
474
        popfd
476
        popfd
475
;--------------------------------------
-
 
476
align 4
-
 
477
nodmp:
477
  nodmp:
478
        popad
478
        popad
479
        ret
479
        ret
-
 
480
 
480
;-----------------------------------------------------------------------------
481
;-----------------------------------------------------------------------------
-
 
482
 
481
align 4
483
align 4
482
proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword
484
proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword
Line 483... Line 485...
483
 
485
 
484
        mov     eax, [BtnState]
486
        mov     eax, [BtnState]
Line 536... Line 538...
536
        mov     eax, [timer_ticks]
538
        mov     eax, [timer_ticks]
537
        mov     [mouse_timer_ticks], eax
539
        mov     [mouse_timer_ticks], eax
538
        call    wakeup_osloop
540
        call    wakeup_osloop
539
        ret
541
        ret
540
endp
542
endp
-
 
543
 
541
;-----------------------------------------------------------------------------
544
;-----------------------------------------------------------------------------
-
 
545
 
542
align 4
546
align 4
543
mouse_acceleration:
547
mouse_acceleration:
544
        push    eax
548
        push    eax
545
        mov     eax, [timer_ticks]
549
        mov     eax, [timer_ticks]
546
        sub     eax, [mouse_timer_ticks]
550
        sub     eax, [mouse_timer_ticks]
Line 548... Line 552...
548
        pop     eax
552
        pop     eax
549
        ja      @f
553
        ja      @f
550
        ;push  edx
554
        ;push  edx
551
        imul    eax, [mouse_speed_factor]
555
        imul    eax, [mouse_speed_factor]
552
        ;pop   edx
556
        ;pop   edx
553
;--------------------------------------
-
 
554
align 4
-
 
555
@@:
557
  @@:
556
        ret
558
        ret
557
;-----------------------------------------------------------------------------
-