diff --git a/kernel/trunk/hid/mousedrv.inc b/kernel/trunk/hid/mousedrv.inc index 3969e1223..7ae6c3a74 100644 --- a/kernel/trunk/hid/mousedrv.inc +++ b/kernel/trunk/hid/mousedrv.inc @@ -26,14 +26,14 @@ uglobal align 4 mousecount dd 0x0 mousedata dd 0x0 -Y_UNDER_subtraction_CUR_hot_y: - dd 0 -X_UNDER_subtraction_CUR_hot_x: - dd 0 Y_UNDER_sub_CUR_hot_y_add_curh: - dd 0 + dw 0 +Y_UNDER_subtraction_CUR_hot_y: + dw 0 X_UNDER_sub_CUR_hot_x_add_curh: - dd 0 + dw 0 +X_UNDER_subtraction_CUR_hot_x: + dw 0 endg iglobal @@ -447,15 +447,15 @@ redrawmouse: mov ax, [Y_UNDER] sub eax, [esi+CURSOR.hot_y] - mov [Y_UNDER_subtraction_CUR_hot_y], eax + mov [Y_UNDER_subtraction_CUR_hot_y], ax add eax, [cur.h] - mov [Y_UNDER_sub_CUR_hot_y_add_curh], eax + mov [Y_UNDER_sub_CUR_hot_y_add_curh], ax mov ax, [X_UNDER] sub eax, [esi+CURSOR.hot_x] - mov [X_UNDER_subtraction_CUR_hot_x], eax + mov [X_UNDER_subtraction_CUR_hot_x], ax add eax, [cur.w] - mov [X_UNDER_sub_CUR_hot_x_add_curh], eax + mov [X_UNDER_sub_CUR_hot_x_add_curh], ax ;-------------------------------------- align 4 @@: diff --git a/kernel/trunk/video/cursors.inc b/kernel/trunk/video/cursors.inc index a23bc07ee..5d344b188 100644 --- a/kernel/trunk/video/cursors.inc +++ b/kernel/trunk/video/cursors.inc @@ -835,10 +835,10 @@ check_mouse_area_for_getpixel_new: ;-------------------------------------- push eax ebx ; offset X - mov ecx, [X_UNDER_subtraction_CUR_hot_x] + movzx ecx, word [X_UNDER_subtraction_CUR_hot_x] sub eax, ecx ; x1 ; offset Y - mov ecx, [Y_UNDER_subtraction_CUR_hot_y] + movzx ecx, word [Y_UNDER_subtraction_CUR_hot_y] sub ebx, ecx ; y1 ;-------------------------------------- ; ebx = offset y @@ -874,41 +874,49 @@ check_mouse_area_for_putpixel_new: ; eax = new color ;-------------------------------------- ; check for Y - cmp cx, [Y_UNDER_subtraction_CUR_hot_y] - jb .no_mouse_area - cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] jae .no_mouse_area + sub cx, [Y_UNDER_subtraction_CUR_hot_y] + jb .no_mouse_area + rol ecx, 16 ;-------------------------------------- ; check for X - cmp cx, [X_UNDER_subtraction_CUR_hot_x] - jb .no_mouse_area - cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] jae .no_mouse_area + + sub cx, [X_UNDER_subtraction_CUR_hot_x] + jb .no_mouse_area + + ror ecx, 16 ;-------------------------------------- align 4 .1: push eax -; offset X - mov ax, [X_UNDER_subtraction_CUR_hot_x] - sub cx, ax ; x1 - ror ecx, 16 -; offset Y - mov ax, [Y_UNDER_subtraction_CUR_hot_y] - sub cx, ax ; y1 ;-------------------------------------- ; ecx = (offset x) shl 16 + (offset y) push ebx mov ebx, ecx shr ebx, 16 ; x and ecx, 0xffff ; y + + cmp ecx, [cur.h] + jae @f + + cmp ebx, [cur.w] + jb .ok +;-------------------------------------- +align 4 +@@: +; DEBUGF 1, "K : SHIT HAPPENS: %x %x \n", ecx,ebx + pop ebx + jmp .sh ; SORRY! SHIT HAPPENS! +;-------------------------------------- +align 4 +.ok: ; ecx = offset y ; ebx = offset x - mov eax, [esp + 4] - push ebx ecx imul ecx, [cur.w] ;y add ecx, ebx @@ -948,6 +956,10 @@ align 4 ret ;-------------------------------------- align 4 +.sh: + mov ecx, -1 +;-------------------------------------- +align 4 @@: pop eax ;-------------------------------------- diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index 2a92184bb..02a058073 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -406,29 +406,38 @@ align 4 jne .skip ;-------------------------------------- push ecx - mov ecx, [putimg.real_sy_and_abs_cy + 4] +;-------------------------------------- +align 4 +.sh: + neg ecx + add ecx, [putimg.real_sx_and_abs_cx + 4] +;-------------------------------------- +; check for X + cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] + jae .no_mouse_area + + sub cx, [X_UNDER_subtraction_CUR_hot_x] + jb .no_mouse_area + + shl ecx, 16 + + add ecx, [putimg.real_sy_and_abs_cy + 4] sub ecx, edi ;-------------------------------------- ; check for Y - cmp cx, [Y_UNDER_subtraction_CUR_hot_y] - jb .no_mouse_area - cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] jae .no_mouse_area - rol ecx, 16 - add ecx, [putimg.real_sx_and_abs_cx + 4] - sub ecx, [esp] -;-------------------------------------- -; check for X - cmp cx, [X_UNDER_subtraction_CUR_hot_x] + sub cx, [Y_UNDER_subtraction_CUR_hot_y] jb .no_mouse_area - - cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] - jae .no_mouse_area ;-------------------------------------- ; check mouse area for putpixel call check_mouse_area_for_putpixel_new.1 + cmp ecx, -1 ;SHIT HAPPENS? + jne .no_mouse_area + + mov ecx, [esp] + jmp .sh ;-------------------------------------- align 4 .no_mouse_area: @@ -608,29 +617,38 @@ align 4 jne .skip ;-------------------------------------- push ecx - mov ecx, [putimg.real_sy_and_abs_cy + 4] +;-------------------------------------- +align 4 +.sh: + neg ecx + add ecx, [putimg.real_sx_and_abs_cx + 4] +;-------------------------------------- +; check for X + cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] + jae .no_mouse_area + + sub cx, [X_UNDER_subtraction_CUR_hot_x] + jb .no_mouse_area + + shl ecx, 16 + + add ecx, [putimg.real_sy_and_abs_cy + 4] sub ecx, edi ;-------------------------------------- ; check for Y - cmp cx, [Y_UNDER_subtraction_CUR_hot_y] - jb .no_mouse_area - cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] jae .no_mouse_area - rol ecx, 16 - add ecx, [putimg.real_sx_and_abs_cx + 4] - sub ecx, [esp] -;-------------------------------------- -; check for X - cmp cx, [X_UNDER_subtraction_CUR_hot_x] + sub cx, [Y_UNDER_subtraction_CUR_hot_y] jb .no_mouse_area - - cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] - jae .no_mouse_area ;-------------------------------------- ; check mouse area for putpixel call check_mouse_area_for_putpixel_new.1 + cmp ecx, -1 ;SHIT HAPPENS? + jne .no_mouse_area + + mov ecx, [esp] + jmp .sh ;-------------------------------------- align 4 .no_mouse_area: @@ -767,21 +785,23 @@ Vesa20_putpixel24_new: jnz @f ;-------------------------------------- ; check for Y - cmp cx, [Y_UNDER_subtraction_CUR_hot_y] - jb @f - cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] jae @f + sub cx, [Y_UNDER_subtraction_CUR_hot_y] + jb @f + rol ecx, 16 ;-------------------------------------- ; check for X - cmp cx, [X_UNDER_subtraction_CUR_hot_x] - jb @f - cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] jae @f + sub cx, [X_UNDER_subtraction_CUR_hot_x] + jb @f + + ror ecx, 16 + call check_mouse_area_for_putpixel_new.1 ;-------------------------------------- align 4 @@ -841,21 +861,23 @@ Vesa20_putpixel32_new: jnz @f ;-------------------------------------- ; check for Y - cmp cx, [Y_UNDER_subtraction_CUR_hot_y] - jb @f - cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] jae @f + sub cx, [Y_UNDER_subtraction_CUR_hot_y] + jb @f + rol ecx, 16 ;-------------------------------------- ; check for X - cmp cx, [X_UNDER_subtraction_CUR_hot_x] - jb @f - cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] jae @f + sub cx, [X_UNDER_subtraction_CUR_hot_x] + jb @f + + ror ecx, 16 + call check_mouse_area_for_putpixel_new.1 ;-------------------------------------- align 4 @@ -1372,22 +1394,24 @@ align 4 sub ecx, esi ;-------------------------------------- ; check for Y - cmp cx, [Y_UNDER_subtraction_CUR_hot_y] - jb .no_mouse_area - cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] jae .no_mouse_area + sub cx, [Y_UNDER_subtraction_CUR_hot_y] + jb .no_mouse_area + rol ecx, 16 add ecx, [drbar.real_sx_and_abs_cx] sub ecx, edi ;-------------------------------------- ; check for X - cmp cx, [X_UNDER_subtraction_CUR_hot_x] - jb .no_mouse_area - cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] jae .no_mouse_area + + sub cx, [X_UNDER_subtraction_CUR_hot_x] + jb .no_mouse_area + + ror ecx, 16 ;-------------------------------------- ; check mouse area for putpixel push eax @@ -1557,22 +1581,24 @@ align 4 sub ecx, esi ;-------------------------------------- ; check for Y - cmp cx, [Y_UNDER_subtraction_CUR_hot_y] - jb .no_mouse_area - cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] jae .no_mouse_area + sub cx, [Y_UNDER_subtraction_CUR_hot_y] + jb .no_mouse_area + rol ecx, 16 add ecx, [drbar.real_sx_and_abs_cx] sub ecx, edi ;-------------------------------------- ; check for X - cmp cx, [X_UNDER_subtraction_CUR_hot_x] - jb .no_mouse_area - cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] jae .no_mouse_area + + sub cx, [X_UNDER_subtraction_CUR_hot_x] + jb .no_mouse_area + + ror ecx, 16 ;-------------------------------------- ; check mouse area for putpixel push eax