VESA - new algorithm for showing mouse pointer without a blink

git-svn-id: svn://kolibrios.org@2430 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-03-07 15:50:41 +00:00
parent d955a6bf75
commit b39e0fcab7
9 changed files with 1152 additions and 369 deletions

View File

@ -210,7 +210,7 @@ BANK_SWITCH equ (OS_BASE+0x000E030)
;unused ? store mousepointer ;unused ? store mousepointer
MOUSE_PICTURE equ (OS_BASE+0x000F200) MOUSE_PICTURE equ (OS_BASE+0x000F200)
MOUSE_VISIBLE equ (OS_BASE+0x000F204) ;MOUSE_VISIBLE equ (OS_BASE+0x000F204)
WIN_TEMP_XY equ (OS_BASE+0x000F300) WIN_TEMP_XY equ (OS_BASE+0x000F300)
KEY_COUNT equ (OS_BASE+0x000F400) KEY_COUNT equ (OS_BASE+0x000F400)
KEY_BUFF equ (OS_BASE+0x000F401) KEY_BUFF equ (OS_BASE+0x000F401)
@ -512,8 +512,9 @@ struct display_t
show_cursor dd ? show_cursor dd ?
move_cursor dd ? move_cursor dd ?
restore_cursor dd ? restore_cursor dd ?
disable_mouse dd ?
mask_seqno dd ? mask_seqno dd ?
check_mouse dd ?
check_m_pixel dd ?
ends ends
struct BOOT_DATA struct BOOT_DATA

View File

@ -170,7 +170,8 @@ draw_line dd __sys_draw_line
draw_pointer dd __sys_draw_pointer draw_pointer dd __sys_draw_pointer
;//mike.dld, 2006-08-02 [ ;//mike.dld, 2006-08-02 [
;drawbar dd __sys_drawbar ;drawbar dd __sys_drawbar
drawbar dd __sys_drawbar.forced ;drawbar dd __sys_drawbar.forced
drawbar dd vesa20_drawbar
;//mike.dld, 2006-08-02 ] ;//mike.dld, 2006-08-02 ]
putpixel dd __sys_putpixel putpixel dd __sys_putpixel
; } mike.dld ; } mike.dld
@ -292,7 +293,8 @@ endofcode:
gdte: gdte:
align 16 align 16
cur_saved_data rb 4096 cur_saved_data:
rb 4096
fpu_data: fpu_data:
rb 512 rb 512
@ -393,13 +395,8 @@ windowtypechanged rd 1
hd_entries rd 1 ;unused ? 0xfe10 hd_entries rd 1 ;unused ? 0xfe10
;* start code - Mario79
mouse_active rd 1 mouse_active rd 1
mouse_pause rd 1 mouse_pause rd 1
MouseTickCounter rd 1
;* end code - Mario79
img_background rd 1 img_background rd 1
mem_BACKGROUND rd 1 mem_BACKGROUND rd 1

View File

@ -33,8 +33,6 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
.1: .1:
; } \\ Alver \\ ; } \\ Alver \\
pushad pushad
call [_display.disable_mouse]
movsx eax, bx ; eax=y movsx eax, bx ; eax=y
sar ebx, 16 ; ebx=x sar ebx, 16 ; ebx=x
xchg eax, ebx ; eax=x, ebx=y xchg eax, ebx ; eax=x, ebx=y
@ -71,6 +69,7 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
shr dl, 1 shr dl, 1
jz .pixloop1end jz .pixloop1end
jnc .nopix jnc .nopix
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel] call [putpixel]
jmp .pixloop1cont jmp .pixloop1cont
.nopix: .nopix:
@ -78,6 +77,7 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
jz .pixloop1cont jz .pixloop1cont
push ecx push ecx
mov ecx, [esp+4+20h+20h] mov ecx, [esp+4+20h+20h]
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel] call [putpixel]
pop ecx pop ecx
.pixloop1cont: .pixloop1cont:
@ -103,6 +103,7 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
.pixloop2: .pixloop2:
shr dl, 1 shr dl, 1
jnc .nopix2 jnc .nopix2
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel] call [putpixel]
jmp .pixloop2cont jmp .pixloop2cont
.nopix2: .nopix2:
@ -110,6 +111,7 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
jz .pixloop2cont jz .pixloop2cont
push ecx push ecx
mov ecx, [esp+12+20h+20h] mov ecx, [esp+12+20h+20h]
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel] call [putpixel]
pop ecx pop ecx
.pixloop2cont: .pixloop2cont:

View File

@ -43,10 +43,7 @@ syscall_draw_window: ;///// system function 0 /////////////////////////////////
jae .exit jae .exit
push eax push eax
inc [mouse_pause]
call [_display.disable_mouse]
call window._.sys_set_window call window._.sys_set_window
call [_display.disable_mouse]
pop eax pop eax
or al, al or al, al
@ -62,7 +59,6 @@ syscall_draw_window: ;///// system function 0 /////////////////////////////////
; type II - only reserve area, no draw ; type II - only reserve area, no draw
call sys_window_mouse call sys_window_mouse
dec [mouse_pause]
call [draw_pointer] call [draw_pointer]
jmp .exit jmp .exit
@ -622,7 +618,7 @@ draw_rectangle: ;//////////////////////////////////////////////////////////////
; set line color ; set line color
mov ecx, esi mov ecx, esi
sub esi, 1 shl 25 ; sub esi, 1 shl 25
; draw top border ; draw top border
rol ebx, 16 rol ebx, 16
push ebx push ebx
@ -2054,9 +2050,6 @@ window._.draw_window_caption: ;////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
;? <description> ;? <description>
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
inc [mouse_pause]
call [_display.disable_mouse]
xor eax, eax xor eax, eax
mov edx, [TASK_COUNT] mov edx, [TASK_COUNT]
movzx edx, word[WIN_POS + edx * 2] movzx edx, word[WIN_POS + edx * 2]
@ -2168,7 +2161,6 @@ window._.draw_window_caption: ;////////////////////////////////////////////////
call dtext_asciiz_esi call dtext_asciiz_esi
.exit: .exit:
dec [mouse_pause]
call [draw_pointer] call [draw_pointer]
ret ret

View File

@ -22,36 +22,32 @@ $Revision$
; FCFF com1/ps2 buffer count starting from FC00 ; FCFF com1/ps2 buffer count starting from FC00
uglobal uglobal
;--------------------------------------
align 4
mousecount dd 0x0 mousecount dd 0x0
mousedata 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
X_UNDER_sub_CUR_hot_x_add_curh:
dd 0
endg endg
iglobal iglobal
;--------------------------------------
align 4
mouse_delay dd 10 mouse_delay dd 10
mouse_speed_factor: mouse_speed_factor:
dd 3 dd 3
mouse_timer_ticks dd 0 mouse_timer_ticks dd 0
endg endg
;-----------------------------------------------------------------------------
;include 'm_com.inc' align 4
;test_mario79:
; push esi
; push eax
; mov [write_error_to],process_test_m79+43
; movzx eax,al ;[DevErrorCode]
; call writehex
; mov esi,process_test_m79
; call sys_msg_board_str
; pop eax
; pop esi
; ret
;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0
draw_mouse_under: draw_mouse_under:
; return old picture ; return old picture
cmp [_display.restore_cursor], 0 cmp [_display.restore_cursor], 0
je @F je @F
@ -61,11 +57,14 @@ draw_mouse_under:
stdcall [_display.restore_cursor], eax, ebx stdcall [_display.restore_cursor], eax, ebx
popad popad
ret ret
;--------------------------------------
align 4
@@: @@:
pushad pushad
xor ecx, ecx xor ecx, ecx
xor edx, edx xor edx, edx
align 4 ;--------------------------------------
align 4
mres: mres:
movzx eax, word [X_UNDER] movzx eax, word [X_UNDER]
movzx ebx, word [Y_UNDER] movzx ebx, word [Y_UNDER]
@ -83,7 +82,8 @@ mres:
mov ecx, [eax] mov ecx, [eax]
pop ebx pop ebx
pop eax pop eax
mov edi, 1;force mov edi, 1 ; force
or ecx, 0x04000000 ; don't save to mouseunder area
call [putpixel] call [putpixel]
pop edx pop edx
pop ecx pop ecx
@ -96,9 +96,9 @@ mres:
jnz mres jnz mres
popad popad
ret ret
;-----------------------------------------------------------------------------
align 4
save_draw_mouse: save_draw_mouse:
cmp [_display.move_cursor], 0 cmp [_display.move_cursor], 0
je .no_hw_cursor je .no_hw_cursor
pushad pushad
@ -124,17 +124,22 @@ save_draw_mouse:
push esi push esi
call [_display.select_cursor] call [_display.select_cursor]
mov [current_cursor], esi mov [current_cursor], esi
;--------------------------------------
align 4
.draw: .draw:
stdcall [_display.move_cursor], esi stdcall [_display.move_cursor], esi
popad popad
ret ret
.fail: ;--------------------------------------
mov ecx, [def_cursor] ;align 4
mov [edx+SLOT_BASE+APPDATA.cursor], ecx ;.fail:
stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax ; mov ecx, [def_cursor]
popad ; mov [edx+SLOT_BASE+APPDATA.cursor], ecx
ret ; stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax
; popad
; ret
;--------------------------------------
align 4
.no_hw_cursor: .no_hw_cursor:
pushad pushad
; save & draw ; save & draw
@ -144,7 +149,8 @@ save_draw_mouse:
push ebx push ebx
mov ecx, 0 mov ecx, 0
mov edx, 0 mov edx, 0
align 4 ;--------------------------------------
align 4
drm: drm:
push eax push eax
push ebx push ebx
@ -155,6 +161,7 @@ drm:
add eax, ecx; save picture under mouse add eax, ecx; save picture under mouse
add ebx, edx add ebx, edx
push ecx push ecx
or ecx, 0x04000000 ; don't load to mouseunder area
call getpixel call getpixel
mov [COLOR_TEMP], ecx mov [COLOR_TEMP], ecx
pop ecx pop ecx
@ -164,6 +171,7 @@ drm:
add eax, ecx add eax, ecx
add eax, mouseunder add eax, mouseunder
mov ebx, [COLOR_TEMP] mov ebx, [COLOR_TEMP]
and ebx, 0xffffff
mov [eax], ebx mov [eax], ebx
pop ecx pop ecx
mov edi, edx ; y cycle mov edi, edx ; y cycle
@ -178,6 +186,7 @@ drm:
push ecx push ecx
mov ecx, [COLOR_TEMP] mov ecx, [COLOR_TEMP]
call combine_colors call combine_colors
and ecx, 0xffffff
mov [MOUSE_COLOR_MEM], ecx mov [MOUSE_COLOR_MEM], ecx
pop ecx pop ecx
pop edx pop edx
@ -188,7 +197,8 @@ drm:
add ebx, edx ; and y coord+cycle add ebx, edx ; and y coord+cycle
push ecx push ecx
mov ecx, [MOUSE_COLOR_MEM] mov ecx, [MOUSE_COLOR_MEM]
mov edi, 1 mov edi, 1 ; force
or ecx, 0x04000000 ; don't save to mouseunder area
call [putpixel] call [putpixel]
pop ecx pop ecx
mov ebx, [esp+0] ; pure y coord again mov ebx, [esp+0] ; pure y coord again
@ -203,8 +213,8 @@ drm:
add esp, 8 add esp, 8
popad popad
ret ret
;-----------------------------------------------------------------------------
align 4
combine_colors: combine_colors:
; in ; in
; ecx - color ( 00 RR GG BB ) ; ecx - color ( 00 RR GG BB )
@ -272,107 +282,133 @@ combine_colors:
pop ebx pop ebx
pop eax pop eax
ret ret
;-----------------------------------------------------------------------------
align 4
check_mouse_area_for_getpixel:
; in:
; eax = x
; ebx = y
; out:
; ecx = new color
push eax ebx
; check for Y
xor ecx, ecx
mov cx, [Y_UNDER] ; [MOUSE_Y]
__sys_disable_mouse:
cmp dword [MOUSE_VISIBLE], dword 0
je @f
ret
@@:
pushad
cmp [CURRENT_TASK], dword 1
je disable_m
mov edx, [CURRENT_TASK]
shl edx, 5
add edx, window_data
movzx eax, word [MOUSE_X]
movzx ebx, word [MOUSE_Y]
mov ecx, [Screen_Max_X]
inc ecx
imul ecx, ebx
add ecx, eax
add ecx, [_WinMapAddress]
mov eax, [CURRENT_TASK]
cmp al, [ecx]
je yes_mouse_disable
cmp al, [ecx+16]
je yes_mouse_disable
add ebx, 10
cmp ebx, [Screen_Max_Y]
jae no_mouse_disable
mov ebx, [Screen_Max_X]
inc ebx
imul ebx, 10
add ecx, ebx
cmp al, [ecx]
je yes_mouse_disable
cmp al, [ecx+16]
je yes_mouse_disable
jmp no_mouse_disable
yes_mouse_disable:
mov edx, [CURRENT_TASK]
shl edx, 5
add edx, window_data
movzx eax, word [MOUSE_X]
movzx ebx, word [MOUSE_Y]
mov ecx, [edx+0]; mouse inside the area ?
add eax, 10
cmp eax, ecx
jb no_mouse_disable
sub eax, 10
add ecx, [edx+8]
cmp eax, ecx
jg no_mouse_disable
mov ecx, [edx+4]
add ebx, 14
cmp ebx, ecx cmp ebx, ecx
jb no_mouse_disable jb .no_mouse_area
sub ebx, 14 add ecx, 23 ; mouse cursor Y size
add ecx, [edx+12]
cmp ebx, ecx cmp ebx, ecx
jg no_mouse_disable ja .no_mouse_area
disable_m: ; offset Y
cmp dword [MOUSE_VISIBLE], dword 0 sub bx, [Y_UNDER] ;[MOUSE_Y]
jne no_mouse_disable ;--------------------------------------
pushf ; check for X
cli xor ecx, ecx
call draw_mouse_under mov cx, [X_UNDER] ;[MOUSE_X]
popf cmp eax, ecx
mov [MOUSE_VISIBLE], dword 1 jb .no_mouse_area
no_mouse_disable: add ecx, 15 ; mouse cursor X size
popad cmp eax, ecx
ja .no_mouse_area
; offset X
sub ax, [X_UNDER] ;[MOUSE_X]
;--------------------------------------
; eax = offset x
; ebx = offset y
shl ebx, 6 ;y
shl eax, 2 ;x
add eax, ebx
add eax, mouseunder
mov ecx, [eax]
and ecx, 0xffffff
or ecx, 0xff000000
pop ebx eax
ret ret
;--------------------------------------
__sys_draw_pointer: align 4
cmp [mouse_pause], 0 .no_mouse_area:
je @f xor ecx, ecx
pop ebx eax
ret ret
@@: ;-----------------------------------------------------------------------------
align 4
check_mouse_area_for_putpixel:
; in:
; ecx = x shl 16 + y
; eax = color
; out:
; eax = new color
push eax push eax
mov eax, [timer_ticks] ; check for Y
sub eax, [MouseTickCounter] mov ax, [Y_UNDER] ; [MOUSE_Y]
cmp eax, 1 cmp cx, ax
ja @f jb .no_mouse_area
add ax, 23 ; mouse cursor Y size
cmp cx, ax
ja .no_mouse_area
; offset Y
sub cx, [Y_UNDER] ;[MOUSE_Y]
mov ax, cx
shl eax, 16
;--------------------------------------
; check for X
mov ax, [X_UNDER] ;[MOUSE_X]
shr ecx, 16
cmp cx, ax
jb .no_mouse_area
add ax, 15 ; mouse cursor X size
cmp cx, ax
ja .no_mouse_area
; offset X
sub cx, [X_UNDER] ;[MOUSE_X]
mov ax, cx
;--------------------------------------
; eax = (offset y) shl 16 + (offset x)
pop ecx
push eax ebx
mov ebx, eax
shr ebx, 16 ;y
and eax, 0xffff ;x
shl ebx, 6
shl eax, 2
add eax, ebx
add eax, mouseunder
and ecx, 0xFFFFFF
mov [eax], ecx
pop ebx eax
push esi edi
rol eax, 16
movzx edi, ax ; y cycle
shl edi, 4 ; *16 bytes per row
shr eax, 16
add edi, eax ; x cycle
lea edi, [edi*3]
add edi, [MOUSE_PICTURE] ; we have our str address
mov esi, edi
add esi, 16*24*3
call combine_colors
pop edi esi
;--------------------------------------
align 4
.end:
mov eax, ecx
ret
;--------------------------------------
align 4
.no_mouse_area:
pop eax pop eax
ret ret
@@: ;-----------------------------------------------------------------------------
mov eax, [timer_ticks] align 4
mov [MouseTickCounter], eax __sys_draw_pointer:
pop eax
pushad pushad
cmp dword [MOUSE_VISIBLE], dword 0; mouse visible ?
je chms00
mov [MOUSE_VISIBLE], dword 0
movzx ebx, word [MOUSE_Y]
movzx eax, word [MOUSE_X]
pushfd
cli
call save_draw_mouse
popfd
nodmu2:
popad
ret
chms00:
movzx ecx, word [X_UNDER] movzx ecx, word [X_UNDER]
movzx edx, word [Y_UNDER] movzx edx, word [Y_UNDER]
movzx ebx, word [MOUSE_Y] movzx ebx, word [MOUSE_Y]
@ -380,18 +416,44 @@ chms00:
cmp eax, ecx cmp eax, ecx
jne redrawmouse jne redrawmouse
cmp ebx, edx cmp ebx, edx
jne redrawmouse je nodmp
jmp nodmp ;--------------------------------------
align 4
redrawmouse: redrawmouse:
pushfd pushfd
cli cli
call draw_mouse_under call draw_mouse_under
call save_draw_mouse call save_draw_mouse
mov eax, [_display.select_cursor]
test eax, eax
jz @f
xor eax, eax
mov esi, [current_cursor]
mov ax, [Y_UNDER]
sub eax, [esi+CURSOR.hot_y]
mov [Y_UNDER_subtraction_CUR_hot_y], eax
add eax, [cur.h]
mov [Y_UNDER_sub_CUR_hot_y_add_curh], eax
mov ax, [X_UNDER]
sub eax, [esi+CURSOR.hot_x]
mov [X_UNDER_subtraction_CUR_hot_x], eax
add eax, [cur.w]
mov [X_UNDER_sub_CUR_hot_x_add_curh], eax
;--------------------------------------
align 4
@@:
popfd popfd
;--------------------------------------
align 4
nodmp: nodmp:
popad popad
ret ret
;-----------------------------------------------------------------------------
align 4
proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword
mov eax, [BtnState] mov eax, [BtnState]
@ -404,11 +466,14 @@ proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScro
jge @@M1 jge @@M1
mov eax, 0 mov eax, 0
jmp @@M2 jmp @@M2
;--------------------------------------
align 4
@@M1: @@M1:
cmp ax, [Screen_Max_X];ScreenLength cmp ax, [Screen_Max_X];ScreenLength
jl @@M2 jl @@M2
mov ax, [Screen_Max_X];ScreenLength-1 mov ax, [Screen_Max_X];ScreenLength-1
;--------------------------------------
align 4
@@M2: @@M2:
mov [MOUSE_X], ax;[XCoordinate] mov [MOUSE_X], ax;[XCoordinate]
@ -421,11 +486,14 @@ proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScro
jge @@M3 jge @@M3
mov ax, 0 mov ax, 0
jmp @@M4 jmp @@M4
;--------------------------------------
align 4
@@M3: @@M3:
cmp ax, [Screen_Max_Y];ScreenHeigth cmp ax, [Screen_Max_Y];ScreenHeigth
jl @@M4 jl @@M4
mov ax, [Screen_Max_Y];ScreenHeigth-1 mov ax, [Screen_Max_Y];ScreenHeigth-1
;--------------------------------------
align 4
@@M4: @@M4:
mov [MOUSE_Y], ax;[YCoordinate] mov [MOUSE_Y], ax;[YCoordinate]
@ -440,7 +508,8 @@ proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScro
mov [mouse_timer_ticks], eax mov [mouse_timer_ticks], eax
ret ret
endp endp
;-----------------------------------------------------------------------------
align 4
mouse_acceleration: mouse_acceleration:
push eax push eax
mov eax, [timer_ticks] mov eax, [timer_ticks]
@ -451,6 +520,8 @@ mouse_acceleration:
;push edx ;push edx
imul eax, [mouse_speed_factor] imul eax, [mouse_speed_factor]
;pop edx ;pop edx
;--------------------------------------
align 4
@@: @@:
ret ret
;-----------------------------------------------------------------------------

View File

@ -374,7 +374,6 @@ high_code:
mov [_display.bpp], eax mov [_display.bpp], eax
mov [_display.vrefresh], 60 mov [_display.vrefresh], 60
mov [_display.disable_mouse], __sys_disable_mouse
movzx eax, word [BOOT_VAR+0x900A]; X max movzx eax, word [BOOT_VAR+0x900A]; X max
mov [_display.width], eax mov [_display.width], eax
@ -671,6 +670,10 @@ end if
stdcall read_file, char, FONT_I, 0, 2304 stdcall read_file, char, FONT_I, 0, 2304
stdcall read_file, char2, FONT_II, 0, 2560 stdcall read_file, char2, FONT_II, 0, 2560
mov [MOUSE_PICTURE], dword mousepointer
mov [_display.check_mouse], check_mouse_area_for_putpixel
mov [_display.check_m_pixel], check_mouse_area_for_getpixel
mov esi, boot_fonts mov esi, boot_fonts
call boot_log call boot_log
@ -1917,7 +1920,30 @@ detect_devices:
ret ret
sys_end: sys_end:
;--------------------------------------
cmp [_display.select_cursor], 0
je @f
; 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
popa
@@:
;--------------------------------------
mov ecx, [current_slot] mov ecx, [current_slot]
mov eax, [ecx+APPDATA.tls_base] mov eax, [ecx+APPDATA.tls_base]
test eax, eax test eax, eax
@ -1996,12 +2022,38 @@ sysfn_terminate: ; 18.2 = TERMINATE
cmp ecx, edx cmp ecx, edx
ja noprocessterminate ja noprocessterminate
mov eax, [TASK_COUNT] mov eax, [TASK_COUNT]
push ecx
shl ecx, 5 shl ecx, 5
mov edx, [ecx+CURRENT_TASK+TASKDATA.pid] mov edx, [ecx+CURRENT_TASK+TASKDATA.pid]
add ecx, CURRENT_TASK+TASKDATA.state add ecx, CURRENT_TASK+TASKDATA.state
cmp byte [ecx], 9 cmp byte [ecx], 9
jz noprocessterminate jz noprocessterminate
;--------------------------------------
cmp [_display.select_cursor], 0
je @f
; restore default cursor before killing
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
popa
@@:
add esp, 4
;--------------------------------------
;call MEM_Heap_Lock ;guarantee that process isn't working with heap ;call MEM_Heap_Lock ;guarantee that process isn't working with heap
mov [ecx], byte 3; clear possible i40's mov [ecx], byte 3; clear possible i40's
;call MEM_Heap_UnLock ;call MEM_Heap_UnLock
@ -3181,8 +3233,6 @@ markz:
no_mark_system_shutdown: no_mark_system_shutdown:
call [_display.disable_mouse]
dec byte [SYS_SHUTDOWN] dec byte [SYS_SHUTDOWN]
je system_shutdown je system_shutdown
@ -3679,37 +3729,23 @@ no_mask_io:
; popad ; end disable io map ; popad ; end disable io map
xor eax, eax xor eax, eax
ret ret
;-----------------------------------------------------------------------------
align 4 align 4
drawbackground: drawbackground:
inc [mouse_pause] dbrv20:
; cmp [SCR_MODE], word 0x12
; je dbrv20
; dbrv12:
; cmp [SCR_MODE], word 0100000000000000b
; jge dbrv20
; cmp [SCR_MODE], word 0x13
; je dbrv20
; call vesa12_drawbackground
; dec [mouse_pause]
; call [draw_pointer]
; ret
dbrv20:
cmp [BgrDrawMode], dword 1 cmp [BgrDrawMode], dword 1
jne bgrstr jne bgrstr
call vesa20_drawbackground_tiled call vesa20_drawbackground_tiled
dec [mouse_pause]
call [draw_pointer] call [draw_pointer]
ret ret
bgrstr: ;--------------------------------------
call vesa20_drawbackground_stretch align 4
dec [mouse_pause] bgrstr:
call [draw_pointer] call vesa20_drawbackground_stretch
ret call [draw_pointer]
ret
;-----------------------------------------------------------------------------
align 4 align 4
syscall_putimage: ; PutImage syscall_putimage: ; PutImage
sys_putimage: sys_putimage:
test ecx, 0x80008000 test ecx, 0x80008000
@ -3718,36 +3754,32 @@ sys_putimage:
jz .exit jz .exit
test ecx, 0xFFFF0000 test ecx, 0xFFFF0000
jnz @f jnz @f
.exit: ;--------------------------------------
align 4
.exit:
ret ret
@@: ;--------------------------------------
align 4
@@:
mov edi, [current_slot] mov edi, [current_slot]
add dx, word[edi+APPDATA.wnd_clientbox.top] add dx, word[edi+APPDATA.wnd_clientbox.top]
rol edx, 16 rol edx, 16
add dx, word[edi+APPDATA.wnd_clientbox.left] add dx, word[edi+APPDATA.wnd_clientbox.left]
rol edx, 16 rol edx, 16
.forced: ;--------------------------------------
align 4
.forced:
push ebp esi 0 push ebp esi 0
mov ebp, putimage_get24bpp mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp mov esi, putimage_init24bpp
;--------------------------------------
align 4
sys_putimage_bpp: sys_putimage_bpp:
; call [disable_mouse] ; this will be done in xxx_putimage call vesa20_putimage
; mov eax, vga_putimage
; cmp [SCR_MODE], word 0x12
; jz @f ;.doit
; mov eax, vesa12_putimage
; cmp [SCR_MODE], word 0100000000000000b
; jae @f
; cmp [SCR_MODE], word 0x13
; jnz .doit
;@@:
mov eax, vesa20_putimage
.doit:
inc [mouse_pause]
call eax
dec [mouse_pause]
pop ebp esi ebp pop ebp esi ebp
jmp [draw_pointer] ret
; jmp [draw_pointer]
;-----------------------------------------------------------------------------
align 4 align 4
sys_putimage_palette: sys_putimage_palette:
; ebx = pointer to image ; ebx = pointer to image
@ -3762,6 +3794,8 @@ sys_putimage_palette:
rol edx, 16 rol edx, 16
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left] add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
rol edx, 16 rol edx, 16
;--------------------------------------
align 4
.forced: .forced:
cmp esi, 1 cmp esi, 1
jnz @f jnz @f
@ -3776,6 +3810,8 @@ sys_putimage_palette:
add esp, 12 add esp, 12
pop edi pop edi
ret ret
;--------------------------------------
align 4
@@: @@:
cmp esi, 2 cmp esi, 2
jnz @f jnz @f
@ -3786,6 +3822,8 @@ sys_putimage_palette:
pop eax pop eax
pop edi pop edi
ret ret
;--------------------------------------
align 4
@@: @@:
cmp esi, 4 cmp esi, 4
jnz @f jnz @f
@ -3796,6 +3834,8 @@ sys_putimage_palette:
pop eax pop eax
pop edi pop edi
ret ret
;--------------------------------------
align 4
@@: @@:
push ebp esi ebp push ebp esi ebp
cmp esi, 8 cmp esi, 8
@ -3803,55 +3843,71 @@ sys_putimage_palette:
mov ebp, putimage_get8bpp mov ebp, putimage_get8bpp
mov esi, putimage_init8bpp mov esi, putimage_init8bpp
jmp sys_putimage_bpp jmp sys_putimage_bpp
;--------------------------------------
align 4
@@: @@:
cmp esi, 15 cmp esi, 15
jnz @f jnz @f
mov ebp, putimage_get15bpp mov ebp, putimage_get15bpp
mov esi, putimage_init15bpp mov esi, putimage_init15bpp
jmp sys_putimage_bpp jmp sys_putimage_bpp
;--------------------------------------
align 4
@@: @@:
cmp esi, 16 cmp esi, 16
jnz @f jnz @f
mov ebp, putimage_get16bpp mov ebp, putimage_get16bpp
mov esi, putimage_init16bpp mov esi, putimage_init16bpp
jmp sys_putimage_bpp jmp sys_putimage_bpp
;--------------------------------------
align 4
@@: @@:
cmp esi, 24 cmp esi, 24
jnz @f jnz @f
mov ebp, putimage_get24bpp mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp mov esi, putimage_init24bpp
jmp sys_putimage_bpp jmp sys_putimage_bpp
;--------------------------------------
align 4
@@: @@:
cmp esi, 32 cmp esi, 32
jnz @f jnz @f
mov ebp, putimage_get32bpp mov ebp, putimage_get32bpp
mov esi, putimage_init32bpp mov esi, putimage_init32bpp
jmp sys_putimage_bpp jmp sys_putimage_bpp
;--------------------------------------
align 4
@@: @@:
pop ebp esi ebp pop ebp esi ebp
ret ret
;-----------------------------------------------------------------------------
align 4
put_mono_image: put_mono_image:
push ebp esi ebp push ebp esi ebp
mov ebp, putimage_get1bpp mov ebp, putimage_get1bpp
mov esi, putimage_init1bpp mov esi, putimage_init1bpp
jmp sys_putimage_bpp jmp sys_putimage_bpp
;-----------------------------------------------------------------------------
align 4
put_2bit_image: put_2bit_image:
push ebp esi ebp push ebp esi ebp
mov ebp, putimage_get2bpp mov ebp, putimage_get2bpp
mov esi, putimage_init2bpp mov esi, putimage_init2bpp
jmp sys_putimage_bpp jmp sys_putimage_bpp
;-----------------------------------------------------------------------------
align 4
put_4bit_image: put_4bit_image:
push ebp esi ebp push ebp esi ebp
mov ebp, putimage_get4bpp mov ebp, putimage_get4bpp
mov esi, putimage_init4bpp mov esi, putimage_init4bpp
jmp sys_putimage_bpp jmp sys_putimage_bpp
;-----------------------------------------------------------------------------
align 4
putimage_init24bpp: putimage_init24bpp:
lea eax, [eax*3] lea eax, [eax*3]
putimage_init8bpp: putimage_init8bpp:
ret ret
;-----------------------------------------------------------------------------
align 16 align 16
putimage_get24bpp: putimage_get24bpp:
movzx eax, byte [esi+2] movzx eax, byte [esi+2]
@ -3859,6 +3915,7 @@ putimage_get24bpp:
mov ax, [esi] mov ax, [esi]
add esi, 3 add esi, 3
ret 4 ret 4
;-----------------------------------------------------------------------------
align 16 align 16
putimage_get8bpp: putimage_get8bpp:
movzx eax, byte [esi] movzx eax, byte [esi]
@ -3868,7 +3925,8 @@ putimage_get8bpp:
pop edx pop edx
inc esi inc esi
ret 4 ret 4
;-----------------------------------------------------------------------------
align 4
putimage_init1bpp: putimage_init1bpp:
add eax, ecx add eax, ecx
push ecx push ecx
@ -3879,6 +3937,7 @@ putimage_init1bpp:
sub eax, ecx sub eax, ecx
pop ecx pop ecx
ret ret
;-----------------------------------------------------------------------------
align 16 align 16
putimage_get1bpp: putimage_get1bpp:
push edx push edx
@ -3895,7 +3954,8 @@ putimage_get1bpp:
add eax, [edx+4] add eax, [edx+4]
pop edx pop edx
ret 4 ret 4
;-----------------------------------------------------------------------------
align 4
putimage_init2bpp: putimage_init2bpp:
add eax, ecx add eax, ecx
push ecx push ecx
@ -3906,6 +3966,7 @@ putimage_init2bpp:
sub eax, ecx sub eax, ecx
pop ecx pop ecx
ret ret
;-----------------------------------------------------------------------------
align 16 align 16
putimage_get2bpp: putimage_get2bpp:
push edx push edx
@ -3927,7 +3988,8 @@ putimage_get2bpp:
mov eax, [edx+eax*4] mov eax, [edx+eax*4]
pop edx pop edx
ret 4 ret 4
;-----------------------------------------------------------------------------
align 4
putimage_init4bpp: putimage_init4bpp:
add eax, ecx add eax, ecx
push ecx push ecx
@ -3938,6 +4000,7 @@ putimage_init4bpp:
sub eax, ecx sub eax, ecx
pop ecx pop ecx
ret ret
;-----------------------------------------------------------------------------
align 16 align 16
putimage_get4bpp: putimage_get4bpp:
push edx push edx
@ -3959,19 +4022,23 @@ putimage_get4bpp:
mov eax, [edx+eax*4] mov eax, [edx+eax*4]
pop edx pop edx
ret 4 ret 4
;-----------------------------------------------------------------------------
align 4
putimage_init32bpp: putimage_init32bpp:
shl eax, 2 shl eax, 2
ret ret
;-----------------------------------------------------------------------------
align 16 align 16
putimage_get32bpp: putimage_get32bpp:
lodsd lodsd
ret 4 ret 4
;-----------------------------------------------------------------------------
align 4
putimage_init15bpp: putimage_init15bpp:
putimage_init16bpp: putimage_init16bpp:
add eax, eax add eax, eax
ret ret
;-----------------------------------------------------------------------------
align 16 align 16
putimage_get15bpp: putimage_get15bpp:
; 0RRRRRGGGGGBBBBB -> 00000000RRRRR000GGGGG000BBBBB000 ; 0RRRRRGGGGGBBBBB -> 00000000RRRRR000GGGGG000BBBBB000
@ -3990,7 +4057,7 @@ putimage_get15bpp:
or eax, edx or eax, edx
pop edx ecx pop edx ecx
ret 4 ret 4
;-----------------------------------------------------------------------------
align 16 align 16
putimage_get16bpp: putimage_get16bpp:
; RRRRRGGGGGGBBBBB -> 00000000RRRRR000GGGGGG00BBBBB000 ; RRRRRGGGGGGBBBBB -> 00000000RRRRR000GGGGGG00BBBBB000
@ -4009,41 +4076,27 @@ putimage_get16bpp:
or eax, edx or eax, edx
pop edx ecx pop edx ecx
ret 4 ret 4
;-----------------------------------------------------------------------------
;align 4
; eax x beginning ; eax x beginning
; ebx y beginning ; ebx y beginning
; ecx x end ; ecx x end
; edx y end ; edx y end
; edi color ; edi color
;__sys_drawbar:
__sys_drawbar: ; mov esi, [current_slot]
mov esi, [current_slot] ; add eax, [esi+APPDATA.wnd_clientbox.left]
add eax, [esi+APPDATA.wnd_clientbox.left] ; add ecx, [esi+APPDATA.wnd_clientbox.left]
add ecx, [esi+APPDATA.wnd_clientbox.left] ; add ebx, [esi+APPDATA.wnd_clientbox.top]
add ebx, [esi+APPDATA.wnd_clientbox.top] ; add edx, [esi+APPDATA.wnd_clientbox.top]
add edx, [esi+APPDATA.wnd_clientbox.top] ;--------------------------------------
.forced: ;align 4
inc [mouse_pause] ;.forced:
; call [disable_mouse] ; call vesa20_drawbar
; cmp [SCR_MODE], word 0x12
; je dbv20
; sdbv20:
; cmp [SCR_MODE], word 0100000000000000b
; jge dbv20
; cmp [SCR_MODE], word 0x13
; je dbv20
; call vesa12_drawbar
; dec [mouse_pause]
; call [draw_pointer] ; call [draw_pointer]
; ret ; ret
; dbv20: ;-----------------------------------------------------------------------------
call vesa20_drawbar align 4
dec [mouse_pause]
call [draw_pointer]
ret
kb_read: kb_read:
push ecx edx push ecx edx
@ -4069,8 +4122,8 @@ kb_read:
pop edx ecx pop edx ecx
ret ret
;-----------------------------------------------------------------------------
align 4
kb_write: kb_write:
push ecx edx push ecx edx
@ -4123,8 +4176,8 @@ kb_write:
pop edx ecx pop edx ecx
ret ret
;-----------------------------------------------------------------------------
align 4
kb_cmd: kb_cmd:
mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's
@ -4155,7 +4208,7 @@ kb_cmd:
setmouse: ; set mousepicture -pointer setmouse: ; set mousepicture -pointer
; ps2 mouse enable ; ps2 mouse enable
mov [MOUSE_PICTURE], dword mousepointer ; mov [MOUSE_PICTURE], dword mousepointer
cli cli
@ -4460,8 +4513,7 @@ syscall_setpixel: ; SetPixel
add eax, [edi+APPDATA.wnd_clientbox.left] add eax, [edi+APPDATA.wnd_clientbox.left]
add ebx, [edi+APPDATA.wnd_clientbox.top] add ebx, [edi+APPDATA.wnd_clientbox.top]
xor edi, edi ; no force xor edi, edi ; no force
; mov edi, 1 and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [_display.disable_mouse]
jmp [putpixel] jmp [putpixel]
align 4 align 4
@ -4601,6 +4653,7 @@ syscall_getpixel: ; GetPixel
div ecx div ecx
mov ebx, edx mov ebx, edx
xchg eax, ebx xchg eax, ebx
and ecx, 0xFBFFFFFF ;negate 0x04000000 use mouseunder area
call dword [GETPIXEL]; eax - x, ebx - y call dword [GETPIXEL]; eax - x, ebx - y
mov [esp + 32], ecx mov [esp + 32], ecx
ret ret
@ -4613,20 +4666,6 @@ syscall_getarea:
;ecx = [size x]*65536 + [size y] ;ecx = [size x]*65536 + [size y]
;edx = [start x]*65536 + [start y] ;edx = [start x]*65536 + [start y]
pushad pushad
inc [mouse_pause]
; Check of use of the hardware cursor.
cmp [_display.disable_mouse], __sys_disable_mouse
jne @f
; Since the test for the coordinates of the mouse should not be used,
; then use the call [disable_mouse] is not possible!
cmp dword [MOUSE_VISIBLE], dword 0
jne @f
pushf
cli
call draw_mouse_under
popf
mov [MOUSE_VISIBLE], dword 1
@@:
mov edi, ebx mov edi, ebx
mov eax, edx mov eax, edx
shr eax, 16 shr eax, 16
@ -4663,6 +4702,7 @@ syscall_getarea:
push eax ebx ecx push eax ebx ecx
add eax, ecx add eax, ecx
and ecx, 0xFBFFFFFF ;negate 0x04000000 use mouseunder area
call dword [GETPIXEL]; eax - x, ebx - y call dword [GETPIXEL]; eax - x, ebx - y
mov [ebp], cx mov [ebp], cx
@ -4677,12 +4717,6 @@ syscall_getarea:
dec ebx dec ebx
dec edx dec edx
jnz .start_y jnz .start_y
dec [mouse_pause]
; Check of use of the hardware cursor.
cmp [_display.disable_mouse], __sys_disable_mouse
jne @f
call [draw_pointer]
@@:
popad popad
ret ret

View File

@ -324,15 +324,19 @@ blit_32:
test eax, eax test eax, eax
jne .L57 jne .L57
inc [mouse_pause]
call [_display.disable_mouse]
mov eax, [TASK_BASE] mov eax, [TASK_BASE]
mov ebx, [esp+BLITTER.dst_x] mov ebx, [esp+BLITTER.dst_x]
mov ebp, [esp+BLITTER.dst_y] mov ebp, [esp+BLITTER.dst_y]
add ebx, [eax-twdw + WDATA.box.left] add ebx, [eax-twdw + WDATA.box.left]
add ebp, [eax-twdw + WDATA.box.top] add ebp, [eax-twdw + WDATA.box.top]
mov ecx, ebx
add ecx, [esp+BLITTER.w]
shl ecx, 16
mov cx, bp
add ecx, [esp+BLITTER.h]
mov edi, ebp mov edi, ebp
imul edi, [_display.pitch] imul edi, [_display.pitch]
@ -346,6 +350,7 @@ blit_32:
lea esi, [eax+esi*4] lea esi, [eax+esi*4]
add esi, [esp+BLITTER.bitmap] add esi, [esp+BLITTER.bitmap]
mov eax, ecx
mov ecx, [esp+BLITTER.h] mov ecx, [esp+BLITTER.h]
mov edx, [esp+BLITTER.w] mov edx, [esp+BLITTER.w]
@ -361,7 +366,6 @@ blit_32:
lea edi, [edi+ebx*4] lea edi, [edi+ebx*4]
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
align 4 align 4
.outer32: .outer32:
xor ecx, ecx xor ecx, ecx
@ -370,9 +374,26 @@ align 4
.inner32: .inner32:
cmp [ebp+ecx], bl cmp [ebp+ecx], bl
jne @F jne @F
;--------------------------------------
push eax
mov eax, [esi+ecx*4] mov eax, [esi+ecx*4]
push ecx
mov ecx, [esp+4]
ror ecx, 16
sub ecx, edx
rol ecx, 16
sub ecx, [esp+BLITTER.h + 8]
; check mouse area for putpixel
call [_display.check_mouse]
pop ecx
; store to real LFB
mov [LFB_BASE+edi+ecx*4], eax mov [LFB_BASE+edi+ecx*4], eax
pop eax
;--------------------------------------
align 4
@@: @@:
inc ecx inc ecx
dec edx dec edx
@ -387,7 +408,6 @@ align 4
jnz .outer32 jnz .outer32
.done: .done:
dec [mouse_pause]
call [draw_pointer] call [draw_pointer]
.L57: .L57:
add esp, 72 add esp, 72
@ -411,13 +431,31 @@ align 4
.inner24: .inner24:
cmp [ebp+ecx], bl cmp [ebp+ecx], bl
jne @F jne @F
;--------------------------------------
push eax
mov eax, [esi+ecx*4] mov eax, [esi+ecx*4]
lea edi, [edi+ecx*2] lea edi, [edi+ecx*2]
push ecx
mov ecx, [esp+4]
ror ecx, 16
sub ecx, edx
rol ecx, 16
sub ecx, [esp+BLITTER.h + 8]
; check mouse area for putpixel
call [_display.check_mouse]
pop ecx
mov [edi+ecx], ax mov [edi+ecx], ax
shr eax, 16 shr eax, 16
mov [edi+ecx+2], al mov [edi+ecx+2], al
pop eax
;--------------------------------------
align 4
@@: @@:
mov edi, [esp+64] mov edi, [esp+64]
inc ecx inc ecx

View File

@ -26,7 +26,7 @@ struct BITMAPINFOHEADER
ClrUsed dd ? ClrUsed dd ?
ClrImportant dd ? ClrImportant dd ?
ends ends
;------------------------------------------------------------------------------
align 4 align 4
proc init_cursor stdcall, dst:dword, src:dword proc init_cursor stdcall, dst:dword, src:dword
locals locals
@ -49,7 +49,8 @@ proc init_cursor stdcall, dst:dword, src:dword
je .img_8 je .img_8
cmp [esi+BITMAPINFOHEADER.BitCount], 4 cmp [esi+BITMAPINFOHEADER.BitCount], 4
je .img_4 je .img_4
;--------------------------------------
align 4
.img_2: .img_2:
add eax, [esi] add eax, [esi]
mov [pQuad], eax mov [pQuad], eax
@ -68,6 +69,8 @@ proc init_cursor stdcall, dst:dword, src:dword
mov [rBase], edi mov [rBase], edi
mov esi, [pQuad] mov esi, [pQuad]
;--------------------------------------
align 4
.l21: .l21:
mov ebx, [pBits] mov ebx, [pBits]
mov ebx, [ebx] mov ebx, [ebx]
@ -76,6 +79,8 @@ proc init_cursor stdcall, dst:dword, src:dword
mov eax, [eax] mov eax, [eax]
bswap eax bswap eax
mov [counter], 32 mov [counter], 32
;--------------------------------------
align 4
@@: @@:
xor edx, edx xor edx, edx
shl eax, 1 shl eax, 1
@ -103,7 +108,8 @@ proc init_cursor stdcall, dst:dword, src:dword
sub [height], 1 sub [height], 1
jnz .l21 jnz .l21
ret ret
;--------------------------------------
align 4
.img_4: .img_4:
add eax, [esi] add eax, [esi]
mov [pQuad], eax mov [pQuad], eax
@ -123,11 +129,15 @@ proc init_cursor stdcall, dst:dword, src:dword
mov esi, [pQuad] mov esi, [pQuad]
mov ebx, [pBits] mov ebx, [pBits]
;--------------------------------------
align 4
.l4: .l4:
mov eax, [pAnd] mov eax, [pAnd]
mov eax, [eax] mov eax, [eax]
bswap eax bswap eax
mov [counter], 16 mov [counter], 16
;--------------------------------------
align 4
@@: @@:
xor edx, edx xor edx, edx
shl eax, 1 shl eax, 1
@ -168,6 +178,8 @@ proc init_cursor stdcall, dst:dword, src:dword
sub [height], 1 sub [height], 1
jnz .l4 jnz .l4
ret ret
;--------------------------------------
align 4
.img_8: .img_8:
add eax, [esi] add eax, [esi]
mov [pQuad], eax mov [pQuad], eax
@ -187,11 +199,15 @@ proc init_cursor stdcall, dst:dword, src:dword
mov esi, [pQuad] mov esi, [pQuad]
mov ebx, [pBits] mov ebx, [pBits]
;--------------------------------------
align 4
.l81: .l81:
mov eax, [pAnd] mov eax, [pAnd]
mov eax, [eax] mov eax, [eax]
bswap eax bswap eax
mov [counter], 32 mov [counter], 32
;--------------------------------------
align 4
@@: @@:
xor edx, edx xor edx, edx
shl eax, 1 shl eax, 1
@ -217,6 +233,8 @@ proc init_cursor stdcall, dst:dword, src:dword
sub [height], 1 sub [height], 1
jnz .l81 jnz .l81
ret ret
;--------------------------------------
align 4
.img_24: .img_24:
add eax, [esi] add eax, [esi]
mov [pQuad], eax mov [pQuad], eax
@ -234,10 +252,14 @@ proc init_cursor stdcall, dst:dword, src:dword
mov esi, [pAnd] mov esi, [pAnd]
mov ebx, [pQuad] mov ebx, [pQuad]
;--------------------------------------
align 4
.row_24: .row_24:
mov eax, [esi] mov eax, [esi]
bswap eax bswap eax
mov [counter], 32 mov [counter], 32
;--------------------------------------
align 4
@@: @@:
xor edx, edx xor edx, edx
shl eax, 1 shl eax, 1
@ -263,7 +285,7 @@ proc init_cursor stdcall, dst:dword, src:dword
jnz .row_24 jnz .row_24
ret ret
endp endp
;------------------------------------------------------------------------------
align 4 align 4
proc set_cursor stdcall, hcursor:dword proc set_cursor stdcall, hcursor:dword
mov eax, [hcursor] mov eax, [hcursor]
@ -274,13 +296,16 @@ proc set_cursor stdcall, hcursor:dword
mov ebx, [current_slot] mov ebx, [current_slot]
xchg eax, [ebx+APPDATA.cursor] xchg eax, [ebx+APPDATA.cursor]
ret ret
;--------------------------------------
align 4
.fail: .fail:
mov eax, [def_cursor] mov eax, [def_cursor]
mov ebx, [current_slot] mov ebx, [current_slot]
xchg eax, [ebx+APPDATA.cursor] xchg eax, [ebx+APPDATA.cursor]
ret ret
endp endp
;------------------------------------------------------------------------------
align 4
; param ; param
; eax= pid ; eax= pid
; ebx= src ; ebx= src
@ -338,6 +363,8 @@ create_cursor:
popfd popfd
mov eax, [.hcursor] mov eax, [.hcursor]
;--------------------------------------
align 4
.check_hw: .check_hw:
cmp [_display.init_cursor], 0 cmp [_display.init_cursor], 0
je .fail je .fail
@ -347,9 +374,13 @@ create_cursor:
add esp, 4 add esp, 4
mov eax, [.hcursor] mov eax, [.hcursor]
;--------------------------------------
align 4
.fail: .fail:
add esp, 12 add esp, 12
ret ret
;--------------------------------------
align 4
.indirect: .indirect:
shr ebx, 16 shr ebx, 16
movzx ecx, bh movzx ecx, bh
@ -362,7 +393,7 @@ create_cursor:
cld cld
rep movsd rep movsd
jmp .check_hw jmp .check_hw
;------------------------------------------------------------------------------
align 4 align 4
proc load_cursor stdcall, src:dword, flags:dword proc load_cursor stdcall, src:dword, flags:dword
locals locals
@ -381,6 +412,8 @@ proc load_cursor stdcall, src:dword, flags:dword
test eax, eax test eax, eax
jz .fail jz .fail
mov [src], eax mov [src], eax
;--------------------------------------
align 4
@@: @@:
push ebx push ebx
push esi push esi
@ -397,16 +430,22 @@ proc load_cursor stdcall, src:dword, flags:dword
cmp word [flags], LOAD_FROM_FILE cmp word [flags], LOAD_FROM_FILE
jne .exit jne .exit
stdcall kernel_free, [src] stdcall kernel_free, [src]
;--------------------------------------
align 4
.exit: .exit:
pop edi pop edi
pop esi pop esi
pop ebx pop ebx
;--------------------------------------
align 4
.fail: .fail:
mov eax, [handle] mov eax, [handle]
;--------------------------------------
align 4
.fail2: .fail2:
ret ret
endp endp
;------------------------------------------------------------------------------
align 4 align 4
proc delete_cursor stdcall, hcursor:dword proc delete_cursor stdcall, hcursor:dword
locals locals
@ -433,17 +472,20 @@ proc delete_cursor stdcall, hcursor:dword
jne @F jne @F
mov eax, [def_cursor] mov eax, [def_cursor]
mov [ebx+APPDATA.cursor], eax mov [ebx+APPDATA.cursor], eax
;--------------------------------------
align 4
@@: @@:
mov eax, [hcursor] mov eax, [hcursor]
call [eax+APPOBJ.destroy] call [eax+APPOBJ.destroy]
;--------------------------------------
align 4
.fail: .fail:
ret ret
endp endp
;------------------------------------------------------------------------------
align 4
; param ; param
; eax= cursor ; eax= cursor
align 4
destroy_cursor: destroy_cursor:
push eax push eax
@ -460,13 +502,13 @@ destroy_cursor:
pop eax pop eax
call destroy_kernel_object call destroy_kernel_object
ret ret
;------------------------------------------------------------------------------
align 4 align 4
select_cursor: select_cursor:
mov eax, [esp+4] mov eax, [esp+4]
mov [_display.cursor], eax mov [_display.cursor], eax
ret 4 ret 4
;------------------------------------------------------------------------------
align 4 align 4
proc restore_24 stdcall, x:dword, y:dword proc restore_24 stdcall, x:dword, y:dword
@ -484,6 +526,8 @@ proc restore_24 stdcall, x:dword, y:dword
mov ecx, [cur.w] mov ecx, [cur.w]
lea ecx, [ecx+ecx*2] lea ecx, [ecx+ecx*2]
push ecx push ecx
;--------------------------------------
align 4
@@: @@:
mov edi, ebx mov edi, ebx
add ebx, [BytesPerScanLine] add ebx, [BytesPerScanLine]
@ -496,11 +540,13 @@ proc restore_24 stdcall, x:dword, y:dword
pop ecx pop ecx
pop edi pop edi
pop esi pop esi
;--------------------------------------
align 4
.ret: .ret:
pop ebx pop ebx
ret ret
endp endp
;------------------------------------------------------------------------------
align 4 align 4
proc restore_32 stdcall, x:dword, y:dword proc restore_32 stdcall, x:dword, y:dword
@ -515,6 +561,8 @@ proc restore_32 stdcall, x:dword, y:dword
push edi push edi
mov esi, cur_saved_data mov esi, cur_saved_data
;--------------------------------------
align 4
@@: @@:
mov edi, ebx mov edi, ebx
add ebx, [BytesPerScanLine] add ebx, [BytesPerScanLine]
@ -525,12 +573,14 @@ proc restore_32 stdcall, x:dword, y:dword
jnz @B jnz @B
pop edi pop edi
;--------------------------------------
align 4
.ret: .ret:
pop esi pop esi
pop ebx pop ebx
ret ret
endp endp
;------------------------------------------------------------------------------
align 4 align 4
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
locals locals
@ -576,10 +626,14 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
cmp ebx, [Screen_Max_X] cmp ebx, [Screen_Max_X]
jbe @F jbe @F
mov ebx, [Screen_Max_X] mov ebx, [Screen_Max_X]
;--------------------------------------
align 4
@@: @@:
cmp edi, [Screen_Max_Y] cmp edi, [Screen_Max_Y]
jbe @F jbe @F
mov edi, [Screen_Max_Y] mov edi, [Screen_Max_Y]
;--------------------------------------
align 4
@@: @@:
mov [cur.right], ebx mov [cur.right], ebx
mov [cur.bottom], edi mov [cur.bottom], edi
@ -595,6 +649,8 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
mov eax, edi mov eax, edi
mov edi, cur_saved_data mov edi, cur_saved_data
;--------------------------------------
align 4
@@: @@:
mov esi, edx mov esi, edx
add edx, [BytesPerScanLine] add edx, [BytesPerScanLine]
@ -613,12 +669,16 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
mov esi, [hcursor] mov esi, [hcursor]
mov esi, [esi+CURSOR.base] mov esi, [esi+CURSOR.base]
lea edx, [esi+eax*4] lea edx, [esi+eax*4]
;--------------------------------------
align 4
.row: .row:
mov ecx, [cur.w] mov ecx, [cur.w]
mov esi, edx mov esi, edx
mov edi, ebx mov edi, ebx
add edx, 32*4 add edx, 32*4
add ebx, [BytesPerScanLine] add ebx, [BytesPerScanLine]
;--------------------------------------
align 4
.pix: .pix:
lodsd lodsd
test eax, 0xFF000000 test eax, 0xFF000000
@ -626,6 +686,8 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
mov [edi], ax mov [edi], ax
shr eax, 16 shr eax, 16
mov [edi+2], al mov [edi+2], al
;--------------------------------------
align 4
@@: @@:
add edi, 3 add edi, 3
dec ecx dec ecx
@ -635,8 +697,7 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
jnz .row jnz .row
ret ret
endp endp
;------------------------------------------------------------------------------
align 4 align 4
proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
locals locals
@ -680,10 +741,14 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
cmp ebx, [Screen_Max_X] cmp ebx, [Screen_Max_X]
jbe @F jbe @F
mov ebx, [Screen_Max_X] mov ebx, [Screen_Max_X]
;--------------------------------------
align 4
@@: @@:
cmp edi, [Screen_Max_Y] cmp edi, [Screen_Max_Y]
jbe @F jbe @F
mov edi, [Screen_Max_Y] mov edi, [Screen_Max_Y]
;--------------------------------------
align 4
@@: @@:
mov [cur.right], ebx mov [cur.right], ebx
mov [cur.bottom], edi mov [cur.bottom], edi
@ -699,6 +764,8 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
mov eax, edi mov eax, edi
mov edi, cur_saved_data mov edi, cur_saved_data
;--------------------------------------
align 4
@@: @@:
mov esi, edx mov esi, edx
add edx, [BytesPerScanLine] add edx, [BytesPerScanLine]
@ -716,17 +783,23 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
mov esi, [hcursor] mov esi, [hcursor]
mov esi, [esi+CURSOR.base] mov esi, [esi+CURSOR.base]
lea edx, [esi+eax*4] lea edx, [esi+eax*4]
;--------------------------------------
align 4
.row: .row:
mov ecx, [cur.w] mov ecx, [cur.w]
mov esi, edx mov esi, edx
mov edi, ebx mov edi, ebx
add edx, 32*4 add edx, 32*4
add ebx, [BytesPerScanLine] add ebx, [BytesPerScanLine]
;--------------------------------------
align 4
.pix: .pix:
lodsd lodsd
test eax, 0xFF000000 test eax, 0xFF000000
jz @F jz @F
mov [edi], eax mov [edi], eax
;--------------------------------------
align 4
@@: @@:
add edi, 4 add edi, 4
dec ecx dec ecx
@ -736,16 +809,158 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
jnz .row jnz .row
ret ret
endp endp
;------------------------------------------------------------------------------
align 4
check_mouse_area_for_getpixel_new:
; in:
; eax = x
; ebx = y
; out:
; ecx = new color
;--------------------------------------
; check for Y
cmp bx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
cmp bx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area
;--------------------------------------
; check for X
cmp ax, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
cmp ax, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
;--------------------------------------
push eax ebx
; offset X
mov ecx, [X_UNDER_subtraction_CUR_hot_x]
sub eax, ecx ; x1
; offset Y
mov ecx, [Y_UNDER_subtraction_CUR_hot_y]
sub ebx, ecx ; y1
;--------------------------------------
; ebx = offset y
; eax = offset x
imul ebx, [cur.w] ;y
add eax, ebx
mov ebx, eax
shl eax, 2
cmp [ScreenBPP], byte 32
je @f
sub eax, ebx
;--------------------------------------
align 4
@@:
add eax, cur_saved_data
mov ecx, [eax]
and ecx, 0xffffff
add ecx, 0xff000000
pop ebx eax
ret
;--------------------------------------
align 4
.no_mouse_area:
xor ecx, ecx
ret
;-----------------------------------------------------------------------------
align 4
check_mouse_area_for_putpixel_new:
; in:
; ecx = x shl 16 + y
; eax = color
; out:
; 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
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
;--------------------------------------
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
; ecx = offset y
; ebx = offset x
mov eax, [esp + 4]
push ebx ecx
imul ecx, [cur.w] ;y
add ecx, ebx
mov ebx, ecx
shl ecx, 2
cmp [ScreenBPP], byte 24
je .24
and eax, 0xFFFFFF
mov [ecx + cur_saved_data], eax ;store new color to
jmp @f
;--------------------------------------
align 4
.24:
sub ecx, ebx
mov [ecx + cur_saved_data], ax ;store new color to
shr eax, 16
mov [ecx + cur_saved_data + 2], al ;store new color to
;--------------------------------------
align 4
@@:
pop ecx ebx
shl ecx, 5
add ecx, ebx
mov eax, [current_cursor]
mov eax, [eax+CURSOR.base]
lea eax, [eax+ecx*4]
mov eax, [eax]
pop ebx
test eax, 0xFF000000
jz @f
pop ecx
ret
;--------------------------------------
align 4
@@:
pop eax
;--------------------------------------
align 4
.no_mouse_area:
ret
;------------------------------------------------------------------------------
align 4 align 4
get_display: get_display:
mov eax, _display mov eax, _display
ret ret
;------------------------------------------------------------------------------
align 4 align 4
init_display: init_display:
xor eax, eax xor eax, eax
mov edi, _display mov edi, _display
@ -764,6 +979,7 @@ init_display:
test word [SCR_MODE], 0x4000 test word [SCR_MODE], 0x4000
jz .fail jz .fail
; jmp .fail
mov ebx, restore_32 mov ebx, restore_32
mov ecx, move_cursor_32 mov ecx, move_cursor_32
@ -775,22 +991,28 @@ init_display:
mov ecx, move_cursor_24 mov ecx, move_cursor_24
cmp eax, 24 cmp eax, 24
jne .fail jne .fail
;--------------------------------------
align 4
@@: @@:
mov [_display.select_cursor], select_cursor mov [_display.select_cursor], select_cursor
mov [_display.move_cursor], ecx mov [_display.move_cursor], ecx
mov [_display.restore_cursor], ebx mov [_display.restore_cursor], ebx
mov [_display.check_mouse], check_mouse_area_for_putpixel_new
mov [_display.check_m_pixel], check_mouse_area_for_getpixel_new
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax mov [def_cursor], eax
ret ret
;--------------------------------------
align 4
.fail: .fail:
xor eax, eax xor eax, eax
mov [_display.select_cursor], eax mov [_display.select_cursor], eax
mov [_display.move_cursor], eax mov [_display.move_cursor], eax
ret ret
;------------------------------------------------------------------------------
align 4 align 4
def_arrow: def_arrow:
file 'arrow.cur' file 'arrow.cur'
;------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff