2010-10-01 11:21:55 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
2015-06-01 21:18:07 +02:00
|
|
|
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
2010-10-01 11:21:55 +02:00
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
$Revision$
|
|
|
|
|
|
|
|
|
|
|
|
LOAD_FROM_FILE equ 0
|
|
|
|
LOAD_FROM_MEM equ 1
|
|
|
|
LOAD_INDIRECT equ 2
|
|
|
|
LOAD_SYSTEM equ 3
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
struct BITMAPINFOHEADER
|
|
|
|
Size dd ?
|
|
|
|
Width dd ?
|
|
|
|
Height dd ?
|
|
|
|
Planes dw ?
|
|
|
|
BitCount dw ?
|
|
|
|
Compression dd ?
|
|
|
|
SizeImage dd ?
|
|
|
|
XPelsPerMeter dd ?
|
|
|
|
YPelsPerMeter dd ?
|
|
|
|
ClrUsed dd ?
|
|
|
|
ClrImportant dd ?
|
|
|
|
ends
|
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
|
|
|
proc init_cursor stdcall, dst:dword, src:dword
|
|
|
|
locals
|
|
|
|
rBase dd ?
|
|
|
|
pQuad dd ?
|
|
|
|
pBits dd ?
|
|
|
|
pAnd dd ?
|
|
|
|
width dd ?
|
|
|
|
height dd ?
|
|
|
|
counter dd ?
|
|
|
|
endl
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, [src]
|
|
|
|
add esi, [esi+18]
|
|
|
|
mov eax, esi
|
|
|
|
|
|
|
|
cmp [esi+BITMAPINFOHEADER.BitCount], 24
|
|
|
|
je .img_24
|
|
|
|
cmp [esi+BITMAPINFOHEADER.BitCount], 8
|
|
|
|
je .img_8
|
|
|
|
cmp [esi+BITMAPINFOHEADER.BitCount], 4
|
|
|
|
je .img_4
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.img_2:
|
2012-03-08 09:33:38 +01:00
|
|
|
add eax, [esi]
|
|
|
|
mov [pQuad], eax
|
|
|
|
add eax, 8
|
|
|
|
mov [pBits], eax
|
|
|
|
add eax, 128
|
|
|
|
mov [pAnd], eax
|
|
|
|
mov eax, [esi+4]
|
|
|
|
mov [width], eax
|
|
|
|
mov ebx, [esi+8]
|
|
|
|
shr ebx, 1
|
|
|
|
mov [height], ebx
|
|
|
|
|
|
|
|
mov edi, [dst]
|
|
|
|
add edi, 32*31*4
|
|
|
|
mov [rBase], edi
|
|
|
|
|
|
|
|
mov esi, [pQuad]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.l21:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ebx, [pBits]
|
|
|
|
mov ebx, [ebx]
|
|
|
|
bswap ebx
|
|
|
|
mov eax, [pAnd]
|
|
|
|
mov eax, [eax]
|
|
|
|
bswap eax
|
|
|
|
mov [counter], 32
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
xor edx, edx
|
|
|
|
shl eax, 1
|
|
|
|
setc dl
|
|
|
|
dec edx
|
|
|
|
|
|
|
|
xor ecx, ecx
|
|
|
|
shl ebx, 1
|
|
|
|
setc cl
|
|
|
|
mov ecx, [esi+ecx*4]
|
|
|
|
and ecx, edx
|
|
|
|
and edx, 0xFF000000
|
|
|
|
or edx, ecx
|
|
|
|
mov [edi], edx
|
|
|
|
|
|
|
|
add edi, 4
|
|
|
|
dec [counter]
|
|
|
|
jnz @B
|
|
|
|
|
|
|
|
add [pBits], 4
|
|
|
|
add [pAnd], 4
|
|
|
|
mov edi, [rBase]
|
|
|
|
sub edi, 128
|
|
|
|
mov [rBase], edi
|
|
|
|
sub [height], 1
|
|
|
|
jnz .l21
|
|
|
|
ret
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.img_4:
|
2012-03-08 09:33:38 +01:00
|
|
|
add eax, [esi]
|
|
|
|
mov [pQuad], eax
|
|
|
|
add eax, 64
|
|
|
|
mov [pBits], eax
|
|
|
|
add eax, 0x200
|
|
|
|
mov [pAnd], eax
|
|
|
|
mov eax, [esi+4]
|
|
|
|
mov [width], eax
|
|
|
|
mov ebx, [esi+8]
|
|
|
|
shr ebx, 1
|
|
|
|
mov [height], ebx
|
|
|
|
|
|
|
|
mov edi, [dst]
|
|
|
|
add edi, 32*31*4
|
|
|
|
mov [rBase], edi
|
|
|
|
|
|
|
|
mov esi, [pQuad]
|
|
|
|
mov ebx, [pBits]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.l4:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [pAnd]
|
|
|
|
mov eax, [eax]
|
|
|
|
bswap eax
|
|
|
|
mov [counter], 16
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
xor edx, edx
|
|
|
|
shl eax, 1
|
|
|
|
setc dl
|
|
|
|
dec edx
|
|
|
|
|
|
|
|
movzx ecx, byte [ebx]
|
|
|
|
and cl, 0xF0
|
|
|
|
shr ecx, 2
|
|
|
|
mov ecx, [esi+ecx]
|
|
|
|
and ecx, edx
|
|
|
|
and edx, 0xFF000000
|
|
|
|
or edx, ecx
|
|
|
|
mov [edi], edx
|
|
|
|
|
|
|
|
xor edx, edx
|
|
|
|
shl eax, 1
|
|
|
|
setc dl
|
|
|
|
dec edx
|
|
|
|
|
|
|
|
movzx ecx, byte [ebx]
|
|
|
|
and cl, 0x0F
|
|
|
|
mov ecx, [esi+ecx*4]
|
|
|
|
and ecx, edx
|
|
|
|
and edx, 0xFF000000
|
|
|
|
or edx, ecx
|
|
|
|
mov [edi+4], edx
|
|
|
|
|
|
|
|
inc ebx
|
|
|
|
add edi, 8
|
|
|
|
dec [counter]
|
|
|
|
jnz @B
|
|
|
|
|
|
|
|
add [pAnd], 4
|
|
|
|
mov edi, [rBase]
|
|
|
|
sub edi, 128
|
|
|
|
mov [rBase], edi
|
|
|
|
sub [height], 1
|
|
|
|
jnz .l4
|
|
|
|
ret
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.img_8:
|
2012-03-08 09:33:38 +01:00
|
|
|
add eax, [esi]
|
|
|
|
mov [pQuad], eax
|
|
|
|
add eax, 1024
|
|
|
|
mov [pBits], eax
|
|
|
|
add eax, 1024
|
|
|
|
mov [pAnd], eax
|
|
|
|
mov eax, [esi+4]
|
|
|
|
mov [width], eax
|
|
|
|
mov ebx, [esi+8]
|
|
|
|
shr ebx, 1
|
|
|
|
mov [height], ebx
|
|
|
|
|
|
|
|
mov edi, [dst]
|
|
|
|
add edi, 32*31*4
|
|
|
|
mov [rBase], edi
|
|
|
|
|
|
|
|
mov esi, [pQuad]
|
|
|
|
mov ebx, [pBits]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.l81:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [pAnd]
|
|
|
|
mov eax, [eax]
|
|
|
|
bswap eax
|
|
|
|
mov [counter], 32
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
xor edx, edx
|
|
|
|
shl eax, 1
|
|
|
|
setc dl
|
|
|
|
dec edx
|
|
|
|
|
|
|
|
movzx ecx, byte [ebx]
|
|
|
|
mov ecx, [esi+ecx*4]
|
|
|
|
and ecx, edx
|
|
|
|
and edx, 0xFF000000
|
|
|
|
or edx, ecx
|
|
|
|
mov [edi], edx
|
|
|
|
|
|
|
|
inc ebx
|
|
|
|
add edi, 4
|
|
|
|
dec [counter]
|
|
|
|
jnz @B
|
|
|
|
|
|
|
|
add [pAnd], 4
|
|
|
|
mov edi, [rBase]
|
|
|
|
sub edi, 128
|
|
|
|
mov [rBase], edi
|
|
|
|
sub [height], 1
|
|
|
|
jnz .l81
|
|
|
|
ret
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.img_24:
|
2012-03-08 09:33:38 +01:00
|
|
|
add eax, [esi]
|
|
|
|
mov [pQuad], eax
|
|
|
|
add eax, 0xC00
|
|
|
|
mov [pAnd], eax
|
|
|
|
mov eax, [esi+BITMAPINFOHEADER.Width]
|
|
|
|
mov [width], eax
|
|
|
|
mov ebx, [esi+BITMAPINFOHEADER.Height]
|
|
|
|
shr ebx, 1
|
|
|
|
mov [height], ebx
|
|
|
|
|
|
|
|
mov edi, [dst]
|
|
|
|
add edi, 32*31*4
|
|
|
|
mov [rBase], edi
|
|
|
|
|
|
|
|
mov esi, [pAnd]
|
|
|
|
mov ebx, [pQuad]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.row_24:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [esi]
|
|
|
|
bswap eax
|
|
|
|
mov [counter], 32
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
xor edx, edx
|
|
|
|
shl eax, 1
|
|
|
|
setc dl
|
|
|
|
dec edx
|
|
|
|
|
|
|
|
mov ecx, [ebx]
|
|
|
|
and ecx, 0x00FFFFFF
|
|
|
|
and ecx, edx
|
|
|
|
and edx, 0xFF000000
|
|
|
|
or edx, ecx
|
|
|
|
mov [edi], edx
|
|
|
|
add ebx, 3
|
|
|
|
add edi, 4
|
|
|
|
dec [counter]
|
|
|
|
jnz @B
|
|
|
|
|
|
|
|
add esi, 4
|
|
|
|
mov edi, [rBase]
|
|
|
|
sub edi, 128
|
|
|
|
mov [rBase], edi
|
|
|
|
sub [height], 1
|
|
|
|
jnz .row_24
|
|
|
|
ret
|
2010-10-01 11:21:55 +02:00
|
|
|
endp
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
|
|
|
proc set_cursor stdcall, hcursor:dword
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [hcursor]
|
|
|
|
cmp [eax+CURSOR.magic], 'CURS'
|
|
|
|
jne .fail
|
2010-10-01 11:21:55 +02:00
|
|
|
; cmp [eax+CURSOR.size], CURSOR_SIZE
|
|
|
|
; jne .fail
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ebx, [current_slot]
|
|
|
|
xchg eax, [ebx+APPDATA.cursor]
|
2014-12-01 04:51:07 +01:00
|
|
|
jmp .end
|
2012-03-08 09:33:38 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.fail:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [def_cursor]
|
|
|
|
mov ebx, [current_slot]
|
|
|
|
xchg eax, [ebx+APPDATA.cursor]
|
2014-12-01 04:51:07 +01:00
|
|
|
align 4
|
|
|
|
.end:
|
|
|
|
mov [redrawmouse_unconditional], 1
|
|
|
|
call __sys_draw_pointer
|
2012-03-08 09:33:38 +01:00
|
|
|
ret
|
2010-10-01 11:21:55 +02:00
|
|
|
endp
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
; param
|
|
|
|
; eax= pid
|
|
|
|
; ebx= src
|
|
|
|
; ecx= flags
|
|
|
|
|
|
|
|
create_cursor:
|
|
|
|
.src equ esp
|
|
|
|
.flags equ esp+4
|
|
|
|
.hcursor equ esp+8
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
sub esp, 4 ;space for .hcursor
|
|
|
|
push ecx
|
|
|
|
push ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ebx, eax
|
|
|
|
mov eax, sizeof.CURSOR
|
|
|
|
call create_kernel_object
|
|
|
|
test eax, eax
|
|
|
|
jz .fail
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [.hcursor], eax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
xor ebx, ebx
|
|
|
|
mov [eax+CURSOR.magic], 'CURS'
|
|
|
|
mov [eax+CURSOR.destroy], destroy_cursor
|
|
|
|
mov [eax+CURSOR.hot_x], ebx
|
|
|
|
mov [eax+CURSOR.hot_y], ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
stdcall kernel_alloc, 0x1000
|
|
|
|
test eax, eax
|
|
|
|
jz .fail
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edi, [.hcursor]
|
|
|
|
mov [edi+CURSOR.base], eax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, [.src]
|
|
|
|
mov ebx, [.flags]
|
|
|
|
cmp bx, LOAD_INDIRECT
|
|
|
|
je .indirect
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
movzx ecx, word [esi+10]
|
|
|
|
movzx edx, word [esi+12]
|
|
|
|
mov [edi+CURSOR.hot_x], ecx
|
|
|
|
mov [edi+CURSOR.hot_y], edx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
stdcall init_cursor, eax, esi
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-10-12 20:24:48 +02:00
|
|
|
align 4
|
|
|
|
.add_cursor:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [.hcursor]
|
|
|
|
lea ecx, [ecx+CURSOR.list_next]
|
|
|
|
lea edx, [_display.cr_list.next]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
pushfd
|
|
|
|
cli
|
|
|
|
list_add ecx, edx ;list_add_tail(new, head)
|
|
|
|
popfd
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [.hcursor]
|
|
|
|
cmp [_display.init_cursor], 0
|
|
|
|
je .fail
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
push eax
|
|
|
|
call [_display.init_cursor]
|
|
|
|
add esp, 4
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [.hcursor]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.fail:
|
2012-03-08 09:33:38 +01:00
|
|
|
add esp, 12
|
|
|
|
ret
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.indirect:
|
2012-03-08 09:33:38 +01:00
|
|
|
shr ebx, 16
|
|
|
|
movzx ecx, bh
|
|
|
|
movzx edx, bl
|
2012-10-12 20:24:48 +02:00
|
|
|
mov [edi+CURSOR.hot_x], ecx
|
|
|
|
mov [edi+CURSOR.hot_y], edx
|
2012-03-08 09:33:38 +01:00
|
|
|
|
|
|
|
xchg edi, eax
|
|
|
|
mov ecx, 1024
|
|
|
|
cld
|
|
|
|
rep movsd
|
2012-10-12 20:24:48 +02:00
|
|
|
jmp .add_cursor
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
|
|
|
proc load_cursor stdcall, src:dword, flags:dword
|
|
|
|
locals
|
|
|
|
handle dd ?
|
|
|
|
endl
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
xor eax, eax
|
|
|
|
cmp [create_cursor], eax
|
|
|
|
je .fail2
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [handle], eax
|
|
|
|
cmp word [flags], LOAD_FROM_FILE
|
|
|
|
jne @F
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
stdcall load_file, [src]
|
|
|
|
test eax, eax
|
|
|
|
jz .fail
|
|
|
|
mov [src], eax
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
push ebx
|
|
|
|
push esi
|
|
|
|
push edi
|
|
|
|
|
|
|
|
mov eax, [CURRENT_TASK]
|
|
|
|
shl eax, 5
|
|
|
|
mov eax, [CURRENT_TASK+eax+4]
|
|
|
|
mov ebx, [src]
|
|
|
|
mov ecx, [flags]
|
|
|
|
call create_cursor ;eax, ebx, ecx
|
|
|
|
mov [handle], eax
|
|
|
|
|
|
|
|
cmp word [flags], LOAD_FROM_FILE
|
|
|
|
jne .exit
|
|
|
|
stdcall kernel_free, [src]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.exit:
|
2012-03-08 09:33:38 +01:00
|
|
|
pop edi
|
|
|
|
pop esi
|
|
|
|
pop ebx
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.fail:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [handle]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.fail2:
|
2012-03-08 09:33:38 +01:00
|
|
|
ret
|
2010-10-01 11:21:55 +02:00
|
|
|
endp
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
|
|
|
proc delete_cursor stdcall, hcursor:dword
|
2013-02-07 10:10:30 +01:00
|
|
|
|
|
|
|
; DEBUGF 1,'K : delete_cursor %x\n', [hcursor]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, [hcursor]
|
2013-02-07 10:10:30 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp [esi+CURSOR.magic], 'CURS'
|
|
|
|
jne .fail
|
|
|
|
|
|
|
|
mov ebx, [CURRENT_TASK]
|
|
|
|
shl ebx, 5
|
|
|
|
mov ebx, [CURRENT_TASK+ebx+4]
|
|
|
|
cmp ebx, [esi+CURSOR.pid]
|
|
|
|
jne .fail
|
|
|
|
|
|
|
|
mov ebx, [current_slot]
|
|
|
|
cmp esi, [ebx+APPDATA.cursor]
|
|
|
|
jne @F
|
|
|
|
mov eax, [def_cursor]
|
|
|
|
mov [ebx+APPDATA.cursor], eax
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [hcursor]
|
|
|
|
call [eax+APPOBJ.destroy]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.fail:
|
2012-03-08 09:33:38 +01:00
|
|
|
ret
|
2010-10-01 11:21:55 +02:00
|
|
|
endp
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
; param
|
|
|
|
; eax= cursor
|
|
|
|
destroy_cursor:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
push eax
|
|
|
|
stdcall kernel_free, [eax+CURSOR.base]
|
|
|
|
|
|
|
|
mov eax, [esp]
|
|
|
|
lea eax, [eax+CURSOR.list_next]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
pushfd
|
|
|
|
cli
|
|
|
|
list_del eax
|
|
|
|
popfd
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
pop eax
|
|
|
|
call destroy_kernel_object
|
|
|
|
ret
|
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
|
|
|
select_cursor:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [esp+4]
|
|
|
|
mov [_display.cursor], eax
|
|
|
|
ret 4
|
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
|
|
|
proc restore_24 stdcall, x:dword, y:dword
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
push ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ebx, [cur_saved_base]
|
|
|
|
mov edx, [cur.h]
|
|
|
|
test edx, edx
|
|
|
|
jz .ret
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
push esi
|
|
|
|
push edi
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, cur_saved_data
|
|
|
|
mov ecx, [cur.w]
|
|
|
|
lea ecx, [ecx+ecx*2]
|
|
|
|
push ecx
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edi, ebx
|
2015-06-01 21:18:07 +02:00
|
|
|
add ebx, [_display.lfb_pitch]
|
2012-03-08 09:33:38 +01:00
|
|
|
|
|
|
|
mov ecx, [esp]
|
|
|
|
rep movsb
|
|
|
|
dec edx
|
|
|
|
jnz @B
|
|
|
|
|
|
|
|
pop ecx
|
|
|
|
pop edi
|
|
|
|
pop esi
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.ret:
|
2012-03-08 09:33:38 +01:00
|
|
|
pop ebx
|
|
|
|
ret
|
2010-10-01 11:21:55 +02:00
|
|
|
endp
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
|
|
|
proc restore_32 stdcall, x:dword, y:dword
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
push ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ebx, [cur_saved_base]
|
|
|
|
mov edx, [cur.h]
|
|
|
|
test edx, edx
|
|
|
|
jz .ret
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
push esi
|
|
|
|
push edi
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, cur_saved_data
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edi, ebx
|
2015-06-01 21:18:07 +02:00
|
|
|
add ebx, [_display.lfb_pitch]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [cur.w]
|
|
|
|
rep movsd
|
|
|
|
dec edx
|
|
|
|
jnz @B
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
pop edi
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.ret:
|
2012-03-08 09:33:38 +01:00
|
|
|
pop esi
|
|
|
|
pop ebx
|
|
|
|
ret
|
2010-10-01 11:21:55 +02:00
|
|
|
endp
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
proc restore_16 stdcall, x:dword, y:dword
|
|
|
|
|
|
|
|
push ebx
|
|
|
|
|
|
|
|
mov ebx, [cur_saved_base]
|
|
|
|
mov edx, [cur.h]
|
|
|
|
test edx, edx
|
|
|
|
jz .ret
|
|
|
|
|
|
|
|
push esi
|
|
|
|
push edi
|
|
|
|
|
|
|
|
mov esi, cur_saved_data
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
mov edi, ebx
|
2015-06-01 21:18:07 +02:00
|
|
|
add ebx, [_display.lfb_pitch]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
mov ecx, [cur.w]
|
|
|
|
rep movsw
|
|
|
|
dec edx
|
|
|
|
jnz @B
|
|
|
|
|
|
|
|
pop edi
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.ret:
|
|
|
|
pop esi
|
|
|
|
pop ebx
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
|
|
|
|
locals
|
|
|
|
h dd ?
|
|
|
|
_dx dd ?
|
|
|
|
_dy dd ?
|
|
|
|
endl
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, [hcursor]
|
|
|
|
mov ecx, [x]
|
|
|
|
mov eax, [y]
|
2012-03-15 13:41:29 +01:00
|
|
|
; mov ebx, [BytesPerScanLine]
|
2012-03-08 09:33:38 +01:00
|
|
|
|
|
|
|
xor edx, edx
|
|
|
|
sub ecx, [esi+CURSOR.hot_x]
|
|
|
|
lea ebx, [ecx+32-1]
|
|
|
|
mov [x], ecx
|
|
|
|
sets dl
|
|
|
|
dec edx
|
|
|
|
and ecx, edx ;clip x to 0<=x
|
|
|
|
mov [cur.left], ecx
|
|
|
|
mov edi, ecx
|
|
|
|
sub edi, [x]
|
|
|
|
mov [_dx], edi
|
|
|
|
|
|
|
|
xor edx, edx
|
|
|
|
sub eax, [esi+CURSOR.hot_y]
|
|
|
|
lea edi, [eax+32-1]
|
|
|
|
mov [y], eax
|
|
|
|
sets dl
|
|
|
|
dec edx
|
|
|
|
and eax, edx ;clip y to 0<=y
|
|
|
|
mov [cur.top], eax
|
|
|
|
mov edx, eax
|
|
|
|
sub edx, [y]
|
|
|
|
mov [_dy], edx
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; mul dword [BytesPerScanLine]
|
2012-10-12 20:24:48 +02:00
|
|
|
mov eax, [BPSLine_calc_area+eax*4]
|
2012-03-08 09:33:38 +01:00
|
|
|
lea edx, [LFB_BASE+ecx*3]
|
|
|
|
add edx, eax
|
|
|
|
mov [cur_saved_base], edx
|
|
|
|
|
2013-11-24 10:18:47 +01:00
|
|
|
cmp ebx, [_display.width]
|
|
|
|
jb @F
|
|
|
|
mov ebx, [_display.width]
|
2012-03-08 09:33:38 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2013-11-24 10:18:47 +01:00
|
|
|
cmp edi, [_display.height]
|
|
|
|
jb @F
|
|
|
|
mov edi, [_display.height]
|
2012-03-08 09:33:38 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
sub ebx, [x]
|
|
|
|
sub edi, [y]
|
2012-10-12 20:24:48 +02:00
|
|
|
sub ebx, [_dx]
|
|
|
|
sub edi, [_dy]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [cur.w], ebx
|
|
|
|
mov [cur.h], edi
|
|
|
|
mov [h], edi
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, edi
|
|
|
|
mov edi, cur_saved_data
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, edx
|
2015-06-01 21:18:07 +02:00
|
|
|
add edx, [_display.lfb_pitch]
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [cur.w]
|
|
|
|
lea ecx, [ecx+ecx*2]
|
|
|
|
rep movsb
|
|
|
|
dec eax
|
|
|
|
jnz @B
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
;draw cursor
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ebx, [cur_saved_base]
|
|
|
|
mov eax, [_dy]
|
|
|
|
shl eax, 5
|
|
|
|
add eax, [_dx]
|
|
|
|
|
|
|
|
mov esi, [hcursor]
|
|
|
|
mov esi, [esi+CURSOR.base]
|
|
|
|
lea edx, [esi+eax*4]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.row:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [cur.w]
|
|
|
|
mov esi, edx
|
|
|
|
mov edi, ebx
|
|
|
|
add edx, 32*4
|
2015-06-01 21:18:07 +02:00
|
|
|
add ebx, [_display.lfb_pitch]
|
2012-03-08 09:33:38 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.pix:
|
2012-03-08 09:33:38 +01:00
|
|
|
lodsd
|
|
|
|
test eax, 0xFF000000
|
|
|
|
jz @F
|
|
|
|
mov [edi], ax
|
|
|
|
shr eax, 16
|
|
|
|
mov [edi+2], al
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
add edi, 3
|
|
|
|
dec ecx
|
|
|
|
jnz .pix
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
dec [h]
|
|
|
|
jnz .row
|
|
|
|
ret
|
2010-10-01 11:21:55 +02:00
|
|
|
endp
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
|
|
|
proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
|
|
|
|
locals
|
|
|
|
h dd ?
|
|
|
|
_dx dd ?
|
|
|
|
_dy dd ?
|
|
|
|
endl
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, [hcursor]
|
|
|
|
mov ecx, [x]
|
|
|
|
mov eax, [y]
|
|
|
|
|
|
|
|
xor edx, edx
|
|
|
|
sub ecx, [esi+CURSOR.hot_x]
|
|
|
|
lea ebx, [ecx+32-1]
|
|
|
|
mov [x], ecx
|
|
|
|
sets dl
|
|
|
|
dec edx
|
|
|
|
and ecx, edx ;clip x to 0<=x
|
|
|
|
mov [cur.left], ecx
|
|
|
|
mov edi, ecx
|
|
|
|
sub edi, [x]
|
|
|
|
mov [_dx], edi
|
|
|
|
|
|
|
|
xor edx, edx
|
|
|
|
sub eax, [esi+CURSOR.hot_y]
|
|
|
|
lea edi, [eax+32-1]
|
|
|
|
mov [y], eax
|
|
|
|
sets dl
|
|
|
|
dec edx
|
|
|
|
and eax, edx ;clip y to 0<=y
|
|
|
|
mov [cur.top], eax
|
|
|
|
mov edx, eax
|
|
|
|
sub edx, [y]
|
|
|
|
mov [_dy], edx
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; mul dword [BytesPerScanLine]
|
2012-10-12 20:24:48 +02:00
|
|
|
mov eax, [BPSLine_calc_area+eax*4]
|
2012-03-08 09:33:38 +01:00
|
|
|
lea edx, [LFB_BASE+eax+ecx*4]
|
|
|
|
mov [cur_saved_base], edx
|
|
|
|
|
2013-11-24 10:18:47 +01:00
|
|
|
cmp ebx, [_display.width]
|
|
|
|
jb @F
|
|
|
|
mov ebx, [_display.width]
|
2012-03-08 09:33:38 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2013-11-24 10:18:47 +01:00
|
|
|
cmp edi, [_display.height]
|
|
|
|
jb @F
|
|
|
|
mov edi, [_display.height]
|
2012-03-08 09:33:38 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
sub ebx, [x]
|
|
|
|
sub edi, [y]
|
2012-10-12 20:24:48 +02:00
|
|
|
sub ebx, [_dx]
|
|
|
|
sub edi, [_dy]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [cur.w], ebx
|
|
|
|
mov [cur.h], edi
|
|
|
|
mov [h], edi
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, edi
|
|
|
|
mov edi, cur_saved_data
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, edx
|
2015-06-01 21:18:07 +02:00
|
|
|
add edx, [_display.lfb_pitch]
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [cur.w]
|
|
|
|
rep movsd
|
|
|
|
dec eax
|
|
|
|
jnz @B
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
;draw cursor
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ebx, [cur_saved_base]
|
|
|
|
mov eax, [_dy]
|
|
|
|
shl eax, 5
|
|
|
|
add eax, [_dx]
|
|
|
|
|
|
|
|
mov esi, [hcursor]
|
|
|
|
mov esi, [esi+CURSOR.base]
|
|
|
|
lea edx, [esi+eax*4]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.row:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [cur.w]
|
|
|
|
mov esi, edx
|
|
|
|
mov edi, ebx
|
|
|
|
add edx, 32*4
|
2015-06-01 21:18:07 +02:00
|
|
|
add ebx, [_display.lfb_pitch]
|
2012-03-08 09:33:38 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
.pix:
|
2012-03-08 09:33:38 +01:00
|
|
|
lodsd
|
|
|
|
test eax, 0xFF000000
|
|
|
|
jz @F
|
|
|
|
mov [edi], eax
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
add edi, 4
|
|
|
|
dec ecx
|
|
|
|
jnz .pix
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
dec [h]
|
|
|
|
jnz .row
|
|
|
|
ret
|
2010-10-01 11:21:55 +02:00
|
|
|
endp
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
proc move_cursor_16 stdcall, hcursor:dword, x:dword, y:dword
|
|
|
|
locals
|
|
|
|
h dd ?
|
|
|
|
_dx dd ?
|
|
|
|
_dy dd ?
|
|
|
|
endl
|
|
|
|
|
|
|
|
mov esi, [hcursor]
|
|
|
|
mov ecx, [x]
|
|
|
|
mov eax, [y]
|
|
|
|
|
|
|
|
xor edx, edx
|
|
|
|
sub ecx, [esi+CURSOR.hot_x]
|
|
|
|
lea ebx, [ecx+32-1]
|
|
|
|
mov [x], ecx
|
|
|
|
sets dl
|
|
|
|
dec edx
|
|
|
|
and ecx, edx ;clip x to 0<=x
|
|
|
|
mov [cur.left], ecx
|
|
|
|
mov edi, ecx
|
|
|
|
sub edi, [x]
|
|
|
|
mov [_dx], edi
|
|
|
|
|
|
|
|
xor edx, edx
|
|
|
|
sub eax, [esi+CURSOR.hot_y]
|
|
|
|
lea edi, [eax+32-1]
|
|
|
|
mov [y], eax
|
|
|
|
sets dl
|
|
|
|
dec edx
|
|
|
|
and eax, edx ;clip y to 0<=y
|
|
|
|
mov [cur.top], eax
|
|
|
|
mov edx, eax
|
|
|
|
sub edx, [y]
|
|
|
|
mov [_dy], edx
|
|
|
|
|
|
|
|
; mul dword [BytesPerScanLine]
|
|
|
|
mov eax, [BPSLine_calc_area+eax*4]
|
|
|
|
lea edx, [LFB_BASE+eax+ecx*2]
|
|
|
|
mov [cur_saved_base], edx
|
|
|
|
|
2015-06-01 21:18:07 +02:00
|
|
|
cmp ebx, [_display.width]
|
|
|
|
jb @F
|
|
|
|
mov ebx, [_display.width]
|
2014-12-01 04:51:07 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2015-06-01 21:18:07 +02:00
|
|
|
cmp edi, [_display.height]
|
|
|
|
jb @F
|
|
|
|
mov edi, [_display.height]
|
2014-12-01 04:51:07 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
sub ebx, [x]
|
|
|
|
sub edi, [y]
|
|
|
|
sub ebx, [_dx]
|
|
|
|
sub edi, [_dy]
|
|
|
|
|
|
|
|
mov [cur.w], ebx
|
|
|
|
mov [cur.h], edi
|
|
|
|
mov [h], edi
|
|
|
|
|
|
|
|
mov eax, edi
|
|
|
|
mov edi, cur_saved_data
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
mov esi, edx
|
2015-06-01 21:18:07 +02:00
|
|
|
add edx, [_display.lfb_pitch]
|
2014-12-01 04:51:07 +01:00
|
|
|
mov ecx, [cur.w]
|
|
|
|
|
|
|
|
rep movsw
|
|
|
|
dec eax
|
|
|
|
jnz @B
|
|
|
|
|
|
|
|
;draw cursor
|
|
|
|
mov ebx, [cur_saved_base]
|
|
|
|
mov eax, [_dy]
|
|
|
|
shl eax, 5
|
|
|
|
add eax, [_dx]
|
|
|
|
|
|
|
|
mov esi, [hcursor]
|
|
|
|
mov esi, [esi+CURSOR.base]
|
|
|
|
lea edx, [esi+eax*4]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.row:
|
|
|
|
mov ecx, [cur.w]
|
|
|
|
mov esi, edx
|
|
|
|
mov edi, ebx
|
|
|
|
add edx, 32*4
|
2015-06-01 21:18:07 +02:00
|
|
|
add ebx, [_display.lfb_pitch]
|
2014-12-01 04:51:07 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.pix:
|
|
|
|
lodsd
|
|
|
|
test eax, 0xFF000000
|
|
|
|
jz @F
|
|
|
|
; convert to 16 bpp and store to real LFB
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
|
|
|
mov [edi], ax
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
add edi, 2
|
|
|
|
dec ecx
|
|
|
|
jnz .pix
|
|
|
|
|
|
|
|
dec [h]
|
|
|
|
jnz .row
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2012-03-08 09:33:38 +01:00
|
|
|
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
|
2012-10-12 20:24:48 +02:00
|
|
|
movzx ecx, word [X_UNDER_subtraction_CUR_hot_x]
|
2012-03-08 09:33:38 +01:00
|
|
|
sub eax, ecx ; x1
|
|
|
|
; offset Y
|
2012-10-12 20:24:48 +02:00
|
|
|
movzx ecx, word [Y_UNDER_subtraction_CUR_hot_y]
|
2012-03-08 09:33:38 +01:00
|
|
|
sub ebx, ecx ; y1
|
|
|
|
;--------------------------------------
|
|
|
|
; ebx = offset y
|
|
|
|
; eax = offset x
|
|
|
|
imul ebx, [cur.w] ;y
|
|
|
|
add eax, ebx
|
|
|
|
mov ebx, eax
|
|
|
|
shl eax, 2
|
2014-12-01 04:51:07 +01:00
|
|
|
cmp byte [_display.bits_per_pixel], 32
|
|
|
|
je @f
|
|
|
|
sub eax, ebx
|
|
|
|
cmp byte [_display.bits_per_pixel], 24
|
2012-03-08 09:33:38 +01:00
|
|
|
je @f
|
|
|
|
sub eax, ebx
|
|
|
|
;--------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
2012-03-08 09:33:38 +01:00
|
|
|
@@:
|
|
|
|
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_sub_CUR_hot_y_add_curh]
|
|
|
|
jae .no_mouse_area
|
|
|
|
|
2012-10-12 20:24:48 +02:00
|
|
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
|
|
|
jb .no_mouse_area
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
rol ecx, 16
|
|
|
|
;--------------------------------------
|
|
|
|
; check for X
|
|
|
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
|
|
|
jae .no_mouse_area
|
2012-10-12 20:24:48 +02:00
|
|
|
|
|
|
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
|
|
|
jb .no_mouse_area
|
|
|
|
|
|
|
|
ror ecx, 16
|
2012-03-08 09:33:38 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.1:
|
|
|
|
push eax
|
|
|
|
;--------------------------------------
|
|
|
|
; ecx = (offset x) shl 16 + (offset y)
|
|
|
|
push ebx
|
|
|
|
mov ebx, ecx
|
|
|
|
shr ebx, 16 ; x
|
|
|
|
and ecx, 0xffff ; y
|
2012-10-12 20:24:48 +02:00
|
|
|
|
|
|
|
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:
|
2012-03-08 09:33:38 +01:00
|
|
|
; ecx = offset y
|
|
|
|
; ebx = offset x
|
|
|
|
push ebx ecx
|
|
|
|
imul ecx, [cur.w] ;y
|
|
|
|
add ecx, ebx
|
|
|
|
mov ebx, ecx
|
|
|
|
shl ecx, 2
|
2014-12-01 04:51:07 +01:00
|
|
|
cmp byte [_display.bits_per_pixel], 16
|
|
|
|
je .16
|
|
|
|
cmp byte [_display.bits_per_pixel], 24
|
2012-03-08 09:33:38 +01:00
|
|
|
je .24
|
|
|
|
and eax, 0xFFFFFF
|
|
|
|
mov [ecx + cur_saved_data], eax ;store new color to
|
|
|
|
jmp @f
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
.16:
|
|
|
|
sub ecx, ebx
|
|
|
|
sub ecx, ebx
|
|
|
|
; convert to 16 bpp and store to real LFB
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
|
|
|
mov [ecx + cur_saved_data], ax ;store new color to
|
|
|
|
jmp @f
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2012-03-08 09:33:38 +01:00
|
|
|
.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
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
shl ecx, 5
|
|
|
|
add ecx, ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [current_cursor]
|
|
|
|
mov eax, [eax+CURSOR.base]
|
|
|
|
lea eax, [eax+ecx*4]
|
|
|
|
mov eax, [eax]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
pop ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
test eax, 0xFF000000
|
|
|
|
jz @f
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-10-12 20:24:48 +02:00
|
|
|
add esp, 4
|
2012-03-08 09:33:38 +01:00
|
|
|
ret
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2012-10-12 20:24:48 +02:00
|
|
|
.sh:
|
|
|
|
mov ecx, -1
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
pop eax
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.no_mouse_area:
|
|
|
|
ret
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
get_display:
|
|
|
|
mov eax, _display
|
|
|
|
ret
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
init_display:
|
|
|
|
xor eax, eax
|
|
|
|
mov edi, _display
|
|
|
|
|
|
|
|
mov [edi+display_t.init_cursor], eax
|
|
|
|
mov [edi+display_t.select_cursor], eax
|
|
|
|
mov [edi+display_t.show_cursor], eax
|
|
|
|
mov [edi+display_t.move_cursor], eax
|
|
|
|
mov [edi+display_t.restore_cursor], eax
|
|
|
|
|
|
|
|
lea ecx, [edi+display_t.cr_list.next]
|
|
|
|
mov [edi+display_t.cr_list.next], ecx
|
|
|
|
mov [edi+display_t.cr_list.prev], ecx
|
|
|
|
|
|
|
|
cmp [SCR_MODE], word 0x13
|
|
|
|
jbe .fail
|
|
|
|
|
|
|
|
test word [SCR_MODE], 0x4000
|
|
|
|
jz .fail
|
|
|
|
|
|
|
|
mov ebx, restore_32
|
|
|
|
mov ecx, move_cursor_32
|
2013-05-28 21:09:31 +02:00
|
|
|
mov edx, Vesa20_putpixel32_new
|
2014-12-01 04:51:07 +01:00
|
|
|
mov eax, [_display.bits_per_pixel]
|
2013-05-28 21:09:31 +02:00
|
|
|
cmp al, 32
|
2014-12-01 04:51:07 +01:00
|
|
|
jne .not_32bpp
|
2012-03-08 09:33:38 +01:00
|
|
|
|
2013-05-28 21:09:31 +02:00
|
|
|
.set:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [_display.select_cursor], select_cursor
|
|
|
|
mov [_display.move_cursor], ecx
|
|
|
|
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
|
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
cmp [PUTPIXEL], dword VGA_putpixel
|
|
|
|
je @f
|
2013-05-28 21:09:31 +02:00
|
|
|
mov [PUTPIXEL], edx
|
2012-03-09 09:20:02 +01:00
|
|
|
@@:
|
2012-10-12 20:24:48 +02:00
|
|
|
stdcall load_cursor, clock_arrow, dword LOAD_FROM_MEM
|
|
|
|
mov [def_cursor_clock], eax
|
2012-03-08 09:33:38 +01:00
|
|
|
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
|
|
|
|
mov [def_cursor], eax
|
|
|
|
ret
|
2013-05-28 21:09:31 +02:00
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
.not_32bpp:
|
|
|
|
cmp al, 24
|
|
|
|
jne .not_24bpp
|
|
|
|
|
2013-05-28 21:09:31 +02:00
|
|
|
mov ebx, restore_24
|
|
|
|
mov ecx, move_cursor_24
|
|
|
|
mov edx, Vesa20_putpixel24_new
|
2014-12-01 04:51:07 +01:00
|
|
|
jmp .set
|
|
|
|
|
|
|
|
.not_24bpp:
|
|
|
|
cmp al, 16
|
|
|
|
jne .not_16bpp
|
|
|
|
mov ebx, restore_16
|
|
|
|
mov ecx, move_cursor_16
|
|
|
|
mov edx, Vesa20_putpixel16_new
|
|
|
|
jmp .set
|
|
|
|
|
|
|
|
.not_16bpp:
|
|
|
|
; cmp al, 15
|
|
|
|
; jne .fail
|
|
|
|
; mov ebx, restore_15
|
|
|
|
; mov ecx, move_cursor_15
|
|
|
|
; mov edx, Vesa20_putpixel15_new
|
|
|
|
; jmp .set
|
2013-05-28 21:09:31 +02:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
.fail:
|
2012-03-08 09:33:38 +01:00
|
|
|
xor eax, eax
|
|
|
|
mov [_display.select_cursor], eax
|
|
|
|
mov [_display.move_cursor], eax
|
|
|
|
ret
|
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
|
|
|
def_arrow:
|
|
|
|
file 'arrow.cur'
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2012-10-12 20:24:48 +02:00
|
|
|
align 4
|
|
|
|
clock_arrow:
|
|
|
|
file 'arrow_clock.cur'
|
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
|