diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 14667c34f8..29c9f6a26e 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -1926,21 +1926,7 @@ sys_end: ; restore default cursor before killing pusha mov ecx, [current_slot] - mov eax, [def_cursor] - mov [ecx+APPDATA.cursor], eax - - movzx eax, word [MOUSE_Y] - movzx ebx, word [MOUSE_X] - mov ecx, [Screen_Max_X] - inc ecx - mul ecx - add eax, [_WinMapAddress] - movzx edx, byte [ebx+eax] - shl edx, 8 - mov esi, [edx+SLOT_BASE+APPDATA.cursor] - push esi - call [_display.select_cursor] - mov [current_cursor], esi + call restore_default_cursor_before_killing popa @@: ;-------------------------------------- @@ -1959,7 +1945,25 @@ sys_end: mov ebx, 100 call delay_hs jmp waitterm +;------------------------------------------------------------------------------ +restore_default_cursor_before_killing: + mov eax, [def_cursor] + mov [ecx+APPDATA.cursor], eax + movzx eax, word [MOUSE_Y] + movzx ebx, word [MOUSE_X] + mov ecx, [Screen_Max_X] + inc ecx + mul ecx + add eax, [_WinMapAddress] + movzx edx, byte [ebx+eax] + shl edx, 8 + mov esi, [edx+SLOT_BASE+APPDATA.cursor] + push esi + call [_display.select_cursor] + mov [current_cursor], esi + ret +;------------------------------------------------------------------------------ iglobal align 4 sys_system_table: @@ -2035,21 +2039,8 @@ sysfn_terminate: ; 18.2 = TERMINATE pusha mov ecx, [esp+32] shl ecx, 8 - mov eax, [def_cursor] - mov [ecx+SLOT_BASE+APPDATA.cursor], eax - - movzx eax, word [MOUSE_Y] - movzx ebx, word [MOUSE_X] - mov ecx, [Screen_Max_X] - inc ecx - mul ecx - add eax, [_WinMapAddress] - movzx edx, byte [ebx+eax] - shl edx, 8 - mov esi, [edx+SLOT_BASE+APPDATA.cursor] - push esi - call [_display.select_cursor] - mov [current_cursor], esi + add ecx, SLOT_BASE + call restore_default_cursor_before_killing popa @@: add esp, 4 diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index 06ac387579..172a0349c0 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -243,13 +243,15 @@ align 4 mov ebx, [CURRENT_TASK] cmp byte [ScreenBPP], 32 je put_image_end_32 -;put_image_end_24: +;-------------------------------------- +put_image_end_24: mov edi, [putimg.real_sy] + cmp [_display.select_cursor], 0 + jne put_image_end_24_new ;-------------------------------------- align 4 .new_line: mov ecx, [putimg.real_sx] -; push ebp edx ;-------------------------------------- align 4 .new_x: @@ -268,7 +270,7 @@ align 4 sub ecx, edi ; check mouse area for putpixel - call [_display.check_mouse] + call check_mouse_area_for_putpixel pop ecx ; store to real LFB mov [LFB_BASE+edx], ax @@ -277,16 +279,15 @@ align 4 ;-------------------------------------- align 4 .skip: -; add esi, 3 ;[putimg.source_bpp] add edx, 3 inc ebp dec ecx jnz .new_x -; pop edx ebp + add esi, [putimg.line_increment] add edx, [putimg.screen_newline];[BytesPerScanLine] add ebp, [putimg.winmap_newline];[Screen_Max_X] -; inc ebp + cmp [putimg.ebp], putimage_get1bpp jz .correct cmp [putimg.ebp], putimage_get2bpp @@ -309,15 +310,93 @@ align 4 add esp, putimg.stack_data popad ret -;------------------------------------------------------------------------------ +;-------------------------------------- align 4 -put_image_end_32: - mov edi, [putimg.real_sy] +put_image_end_24_new: +;-------------------------------------- +align 4 +.new_line: + mov ecx, [putimg.real_sx] +;-------------------------------------- +align 4 +.new_x: + push [putimg.edi] + mov eax, [putimg.ebp+4] + call eax + cmp [ebp], bl + jne .skip +;-------------------------------------- + push ecx + mov 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] + 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 +;-------------------------------------- +align 4 +.no_mouse_area: + pop ecx +; store to real LFB + mov [LFB_BASE+edx], ax + shr eax, 16 + mov [LFB_BASE+edx+2], al +;-------------------------------------- +align 4 +.skip: + add edx, 3 + inc ebp + dec ecx + jnz .new_x + + add esi, [putimg.line_increment] + add edx, [putimg.screen_newline];[BytesPerScanLine] + add ebp, [putimg.winmap_newline];[Screen_Max_X] + + cmp [putimg.ebp], putimage_get1bpp + jz .correct + cmp [putimg.ebp], putimage_get2bpp + jz .correct + cmp [putimg.ebp], putimage_get4bpp + jnz @f +;-------------------------------------- +align 4 +.correct: + mov eax, [putimg.edi] + mov byte [eax], 80h +;-------------------------------------- +align 4 +@@: + dec edi + jnz .new_line + jmp put_image_end_24.finish +;------------------------------------------------------------------------------ +align 4 +put_image_end_32: + mov edi, [putimg.real_sy] + cmp [_display.select_cursor], 0 + jne put_image_end_32_new ;-------------------------------------- align 4 .new_line: mov ecx, [putimg.real_sx] -; push ebp edx ;-------------------------------------- align 4 .new_x: @@ -336,23 +415,22 @@ align 4 sub ecx, edi ; check mouse area for putpixel - call [_display.check_mouse] + call check_mouse_area_for_putpixel pop ecx ; store to real LFB mov [LFB_BASE+edx], eax ;-------------------------------------- align 4 .skip: -; add esi, [putimg.source_bpp] add edx, 4 inc ebp dec ecx jnz .new_x -; pop edx ebp + add esi, [putimg.line_increment] add edx, [putimg.screen_newline];[BytesPerScanLine] add ebp, [putimg.winmap_newline];[Screen_Max_X] -; inc ebp + cmp [putimg.ebp], putimage_get1bpp jz .correct cmp [putimg.ebp], putimage_get2bpp @@ -377,6 +455,81 @@ align 4 call VGA__putimage mov [EGA_counter], 1 ret +;-------------------------------------- +align 4 +put_image_end_32_new: +;-------------------------------------- +align 4 +.new_line: + mov ecx, [putimg.real_sx] +;-------------------------------------- +align 4 +.new_x: + push [putimg.edi] + mov eax, [putimg.ebp+4] + call eax + cmp [ebp], bl + jne .skip +;-------------------------------------- + push ecx + mov 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] + 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 +;-------------------------------------- +align 4 +.no_mouse_area: + pop ecx +; store to real LFB + mov [LFB_BASE+edx], eax +;-------------------------------------- +align 4 +.skip: + add edx, 4 + inc ebp + dec ecx + jnz .new_x + + add esi, [putimg.line_increment] + add edx, [putimg.screen_newline];[BytesPerScanLine] + add ebp, [putimg.winmap_newline];[Screen_Max_X] + + cmp [putimg.ebp], putimage_get1bpp + jz .correct + cmp [putimg.ebp], putimage_get2bpp + jz .correct + cmp [putimg.ebp], putimage_get4bpp + jnz @f +;-------------------------------------- +align 4 +.correct: + mov eax, [putimg.edi] + mov byte [eax], 80h +;-------------------------------------- +align 4 +@@: + dec edi + jnz .new_line + jmp put_image_end_32.finish ;------------------------------------------------------------------------------ align 4 __sys_putpixel: