Subversion Repositories Kolibri OS

Rev

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

Rev 2288 Rev 2430
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: 2288 $
8
$Revision: 2430 $
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
        pop     edx
88
        pop     edx
89
        pop     ecx
89
        pop     ecx
90
        inc     ecx
90
        inc     ecx
91
        cmp     ecx, 16
91
        cmp     ecx, 16
Line 94... Line 94...
94
        inc     edx
94
        inc     edx
95
        cmp     edx, 24
95
        cmp     edx, 24
96
        jnz     mres
96
        jnz     mres
97
        popad
97
        popad
98
        ret
98
        ret
-
 
99
;-----------------------------------------------------------------------------
99
 
100
align 4
100
save_draw_mouse:
101
save_draw_mouse:
101
 
-
 
102
        cmp     [_display.move_cursor], 0
102
        cmp     [_display.move_cursor], 0
103
        je      .no_hw_cursor
103
        je      .no_hw_cursor
104
        pushad
104
        pushad
Line 105... Line 105...
105
 
105
 
Line 122... Line 122...
122
        je      .draw
122
        je      .draw
Line 123... Line 123...
123
 
123
 
124
        push    esi
124
        push    esi
125
        call    [_display.select_cursor]
125
        call    [_display.select_cursor]
-
 
126
        mov     [current_cursor], esi
-
 
127
;--------------------------------------
126
        mov     [current_cursor], esi
128
align 4
127
.draw:
129
.draw:
128
        stdcall [_display.move_cursor], esi
130
        stdcall [_display.move_cursor], esi
129
        popad
131
        popad
-
 
132
        ret
-
 
133
;--------------------------------------
130
        ret
134
;align 4
131
.fail:
135
;.fail:
132
        mov     ecx, [def_cursor]
136
;        mov     ecx, [def_cursor]
133
        mov     [edx+SLOT_BASE+APPDATA.cursor], ecx
137
;        mov     [edx+SLOT_BASE+APPDATA.cursor], ecx
134
        stdcall [_display.move_cursor], ecx        ; stdcall: [esp]=ebx,eax
138
;        stdcall [_display.move_cursor], ecx        ; stdcall: [esp]=ebx,eax
135
        popad
139
;        popad
-
 
140
;        ret
136
        ret
141
;--------------------------------------
137
 
142
align 4
138
.no_hw_cursor:
143
.no_hw_cursor:
139
        pushad
144
        pushad
140
        ; save & draw
145
        ; save & draw
141
        mov     [X_UNDER], ax
146
        mov     [X_UNDER], ax
142
        mov     [Y_UNDER], bx
147
        mov     [Y_UNDER], bx
143
        push    eax
148
        push    eax
144
        push    ebx
149
        push    ebx
145
        mov     ecx, 0
150
        mov     ecx, 0
-
 
151
        mov     edx, 0
146
        mov     edx, 0
152
;--------------------------------------
147
        align  4
153
align 4
148
drm:
154
drm:
149
        push    eax
155
        push    eax
150
        push    ebx
156
        push    ebx
Line 153... Line 159...
153
        ; helloworld
159
        ; helloworld
154
        push    ecx
160
        push    ecx
155
        add     eax, ecx; save picture under mouse
161
        add     eax, ecx; save picture under mouse
156
        add     ebx, edx
162
        add     ebx, edx
157
        push    ecx
163
        push    ecx
-
 
164
        or      ecx, 0x04000000  ; don't load to mouseunder area
158
        call    getpixel
165
        call    getpixel
159
        mov     [COLOR_TEMP], ecx
166
        mov     [COLOR_TEMP], ecx
160
        pop     ecx
167
        pop     ecx
161
        mov     eax, edx
168
        mov     eax, edx
162
        shl     eax, 6
169
        shl     eax, 6
163
        shl     ecx, 2
170
        shl     ecx, 2
164
        add     eax, ecx
171
        add     eax, ecx
165
        add     eax, mouseunder
172
        add     eax, mouseunder
166
        mov     ebx, [COLOR_TEMP]
173
        mov     ebx, [COLOR_TEMP]
-
 
174
        and     ebx, 0xffffff
167
        mov     [eax], ebx
175
        mov     [eax], ebx
168
        pop     ecx
176
        pop     ecx
169
        mov     edi, edx     ; y cycle
177
        mov     edi, edx     ; y cycle
170
        shl     edi, 4     ; *16 bytes per row
178
        shl     edi, 4     ; *16 bytes per row
171
        add     edi, ecx     ; x cycle
179
        add     edi, ecx     ; x cycle
Line 176... Line 184...
176
        mov     esi, edi
184
        mov     esi, edi
177
        add     esi, 16*24*3
185
        add     esi, 16*24*3
178
        push    ecx
186
        push    ecx
179
        mov     ecx, [COLOR_TEMP]
187
        mov     ecx, [COLOR_TEMP]
180
        call    combine_colors
188
        call    combine_colors
-
 
189
        and     ecx, 0xffffff
181
        mov     [MOUSE_COLOR_MEM], ecx
190
        mov     [MOUSE_COLOR_MEM], ecx
182
        pop     ecx
191
        pop     ecx
183
        pop     edx
192
        pop     edx
184
        pop     ecx
193
        pop     ecx
185
        pop     ebx
194
        pop     ebx
186
        pop     eax
195
        pop     eax
187
        add     eax, ecx     ; we have x coord+cycle
196
        add     eax, ecx     ; we have x coord+cycle
188
        add     ebx, edx     ; and y coord+cycle
197
        add     ebx, edx     ; and y coord+cycle
189
        push    ecx
198
        push    ecx
190
        mov     ecx, [MOUSE_COLOR_MEM]
199
        mov     ecx, [MOUSE_COLOR_MEM]
191
        mov     edi, 1
200
        mov     edi, 1 ; force
-
 
201
        or      ecx, 0x04000000  ; don't save to mouseunder area
192
        call    [putpixel]
202
        call    [putpixel]
193
        pop     ecx
203
        pop     ecx
194
        mov     ebx, [esp+0]    ; pure y coord again
204
        mov     ebx, [esp+0]    ; pure y coord again
195
        mov     eax, [esp+4]    ; and x
205
        mov     eax, [esp+4]    ; and x
196
        inc     ecx         ; +1 cycle
206
        inc     ecx         ; +1 cycle
Line 201... Line 211...
201
        cmp     edx, 24
211
        cmp     edx, 24
202
        jnz     drm
212
        jnz     drm
203
        add     esp, 8
213
        add     esp, 8
204
        popad
214
        popad
205
        ret
215
        ret
206
 
-
 
-
 
216
;-----------------------------------------------------------------------------
207
 
217
align 4
208
combine_colors:
218
combine_colors:
209
      ; in
219
      ; in
210
      ; ecx - color ( 00 RR GG BB )
220
      ; ecx - color ( 00 RR GG BB )
211
      ; edi - ref to new color byte
221
      ; edi - ref to new color byte
212
      ; esi - ref to alpha byte
222
      ; esi - ref to alpha byte
Line 270... Line 280...
270
        pop     eax
280
        pop     eax
271
        pop     edx
281
        pop     edx
272
        pop     ebx
282
        pop     ebx
273
        pop     eax
283
        pop     eax
274
        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 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
297
 
328
        cmp     ebx, ecx
298
        cmp     ebx, ecx
329
        jb      no_mouse_disable
-
 
330
        sub     ebx, 14
299
        jb      .no_mouse_area
331
        add     ecx, [edx+12]
300
        add     ecx, 23  ; mouse cursor Y size
332
        cmp     ebx, ecx
301
        cmp     ebx, ecx
333
        jg      no_mouse_disable
302
        ja      .no_mouse_area
-
 
303
; offset Y
-
 
304
        sub     bx, [Y_UNDER]  ;[MOUSE_Y]
-
 
305
;--------------------------------------
-
 
306
; check for X
334
disable_m:
307
        xor     ecx, ecx
-
 
308
        mov     cx, [X_UNDER]  ;[MOUSE_X]
335
        cmp     dword [MOUSE_VISIBLE], dword 0
309
        cmp     eax, ecx
-
 
310
        jb      .no_mouse_area
336
        jne     no_mouse_disable
311
        add     ecx, 15  ; mouse cursor X size
-
 
312
        cmp     eax, ecx
337
        pushf
313
        ja      .no_mouse_area
-
 
314
; offset X
-
 
315
        sub     ax, [X_UNDER]  ;[MOUSE_X]
-
 
316
;--------------------------------------
-
 
317
; eax = offset x
-
 
318
; ebx = offset y
-
 
319
        shl     ebx, 6  ;y
-
 
320
        shl     eax, 2  ;x
338
        cli
321
        add     eax, ebx
339
        call    draw_mouse_under
322
        add     eax, mouseunder
340
        popf
323
        mov     ecx, [eax]
341
        mov     [MOUSE_VISIBLE], dword 1
324
        and     ecx, 0xffffff
342
no_mouse_disable:
325
        or      ecx, 0xff000000
343
        popad
326
        pop     ebx eax
-
 
327
        ret
344
        ret
328
;--------------------------------------
345
 
329
align 4
346
__sys_draw_pointer:
330
.no_mouse_area:
347
        cmp     [mouse_pause], 0
331
        xor     ecx, ecx
348
        je      @f
332
        pop     ebx eax
-
 
333
        ret
-
 
334
;-----------------------------------------------------------------------------
-
 
335
align 4
349
        ret
336
check_mouse_area_for_putpixel:
-
 
337
; in:
-
 
338
; ecx = x shl 16 + y
-
 
339
; eax = color
-
 
340
; out:
350
@@:
341
; eax = new color
-
 
342
        push    eax
-
 
343
; check for Y
-
 
344
        mov     ax, [Y_UNDER]  ; [MOUSE_Y]
-
 
345
        cmp     cx, ax
-
 
346
        jb      .no_mouse_area
-
 
347
        add     ax, 23  ; mouse cursor Y size
-
 
348
        cmp     cx, ax
-
 
349
        ja      .no_mouse_area
-
 
350
; offset Y
351
        push    eax
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
352
        mov     eax, [timer_ticks]
359
        jb      .no_mouse_area
353
        sub     eax, [MouseTickCounter]
360
        add     ax, 15  ; mouse cursor X size
-
 
361
        cmp     cx, ax
-
 
362
        ja      .no_mouse_area
-
 
363
; offset X
354
        cmp     eax, 1
364
        sub     cx, [X_UNDER]  ;[MOUSE_X]
-
 
365
        mov     ax, cx
-
 
366
;--------------------------------------
-
 
367
; eax = (offset y) shl 16 + (offset x)
355
        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:
356
        pop     eax
401
        mov     eax, ecx
-
 
402
        ret
357
        ret
403
;--------------------------------------
358
@@:
-
 
359
        mov     eax, [timer_ticks]
404
align 4
360
        mov     [MouseTickCounter], eax
405
.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
406
        pop     eax
-
 
407
        ret
374
        ret
408
;-----------------------------------------------------------------------------
-
 
409
align 4
-
 
410
__sys_draw_pointer:
375
chms00:
411
        pushad
376
        movzx   ecx, word [X_UNDER]
412
        movzx   ecx, word [X_UNDER]
377
        movzx   edx, word [Y_UNDER]
413
        movzx   edx, word [Y_UNDER]
378
        movzx   ebx, word [MOUSE_Y]
414
        movzx   ebx, word [MOUSE_Y]
379
        movzx   eax, word [MOUSE_X]
415
        movzx   eax, word [MOUSE_X]
380
        cmp     eax, ecx
416
        cmp     eax, ecx
381
        jne     redrawmouse
417
        jne     redrawmouse
382
        cmp     ebx, edx
418
        cmp     ebx, edx
383
        jne     redrawmouse
419
        je      nodmp
-
 
420
;--------------------------------------
384
        jmp     nodmp
421
align 4
385
redrawmouse:
422
redrawmouse:
386
        pushfd
423
        pushfd
387
        cli
424
        cli
388
        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
389
        call    save_draw_mouse
448
@@:
-
 
449
        popfd
-
 
450
;--------------------------------------
390
        popfd
451
align 4
391
nodmp:
452
nodmp:
392
        popad
453
        popad
-
 
454
        ret
393
        ret
455
;-----------------------------------------------------------------------------
394
 
456
align 4
Line 395... Line 457...
395
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
396
 
458
 
Line 402... Line 464...
402
        add     ax, [MOUSE_X];[XCoordinate]
464
        add     ax, [MOUSE_X];[XCoordinate]
403
        cmp     ax, 0
465
        cmp     ax, 0
404
        jge     @@M1
466
        jge     @@M1
405
        mov     eax, 0
467
        mov     eax, 0
406
        jmp     @@M2
468
        jmp     @@M2
-
 
469
;--------------------------------------
-
 
470
align 4
407
@@M1:
471
@@M1:
408
        cmp     ax, [Screen_Max_X];ScreenLength
472
        cmp     ax, [Screen_Max_X];ScreenLength
409
        jl      @@M2
473
        jl      @@M2
410
        mov     ax, [Screen_Max_X];ScreenLength-1
474
        mov     ax, [Screen_Max_X];ScreenLength-1
-
 
475
;--------------------------------------
411
 
476
align 4
412
@@M2:
477
@@M2:
413
        mov     [MOUSE_X], ax;[XCoordinate]
478
        mov     [MOUSE_X], ax;[XCoordinate]
Line 414... Line 479...
414
 
479
 
415
        mov     eax, [YMoving]
480
        mov     eax, [YMoving]
Line 419... Line 484...
419
        add     ax, [MOUSE_Y];[YCoordinate]
484
        add     ax, [MOUSE_Y];[YCoordinate]
420
        cmp     ax, 0
485
        cmp     ax, 0
421
        jge     @@M3
486
        jge     @@M3
422
        mov     ax, 0
487
        mov     ax, 0
423
        jmp     @@M4
488
        jmp     @@M4
-
 
489
;--------------------------------------
-
 
490
align 4
424
@@M3:
491
@@M3:
425
        cmp     ax, [Screen_Max_Y];ScreenHeigth
492
        cmp     ax, [Screen_Max_Y];ScreenHeigth
426
        jl      @@M4
493
        jl      @@M4
427
        mov     ax, [Screen_Max_Y];ScreenHeigth-1
494
        mov     ax, [Screen_Max_Y];ScreenHeigth-1
-
 
495
;--------------------------------------
428
 
496
align 4
429
@@M4:
497
@@M4:
430
        mov     [MOUSE_Y], ax;[YCoordinate]
498
        mov     [MOUSE_Y], ax;[YCoordinate]
Line 431... Line 499...
431
 
499
 
432
        mov     eax, [VScroll]
500
        mov     eax, [VScroll]
Line 438... Line 506...
438
        mov     [mouse_active], 1
506
        mov     [mouse_active], 1
439
        mov     eax, [timer_ticks]
507
        mov     eax, [timer_ticks]
440
        mov     [mouse_timer_ticks], eax
508
        mov     [mouse_timer_ticks], eax
441
        ret
509
        ret
442
endp
510
endp
-
 
511
;-----------------------------------------------------------------------------
443
 
512
align 4
444
mouse_acceleration:
513
mouse_acceleration:
445
        push    eax
514
        push    eax
446
        mov     eax, [timer_ticks]
515
        mov     eax, [timer_ticks]
447
        sub     eax, [mouse_timer_ticks]
516
        sub     eax, [mouse_timer_ticks]
448
        cmp     eax, [mouse_delay]
517
        cmp     eax, [mouse_delay]
449
        pop     eax
518
        pop     eax
450
        ja      @f
519
        ja      @f
451
        ;push  edx
520
        ;push  edx
452
        imul    eax, [mouse_speed_factor]
521
        imul    eax, [mouse_speed_factor]
453
        ;pop   edx
522
        ;pop   edx
-
 
523
;--------------------------------------
-
 
524
align 4
454
@@:
525
@@:
455
        ret
526
        ret
456
-
 
-
 
527
;-----------------------------------------------------------------------------