Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2426 → Rev 2430

/kernel/trunk/const.inc
210,7 → 210,7
;unused ? store mousepointer
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)
KEY_COUNT equ (OS_BASE+0x000F400)
KEY_BUFF equ (OS_BASE+0x000F401)
512,8 → 512,9
show_cursor dd ?
move_cursor dd ?
restore_cursor dd ?
disable_mouse dd ?
mask_seqno dd ?
check_mouse dd ?
check_m_pixel dd ?
ends
 
struct BOOT_DATA
/kernel/trunk/data32.inc
170,7 → 170,8
draw_pointer dd __sys_draw_pointer
;//mike.dld, 2006-08-02 [
;drawbar dd __sys_drawbar
drawbar dd __sys_drawbar.forced
;drawbar dd __sys_drawbar.forced
drawbar dd vesa20_drawbar
;//mike.dld, 2006-08-02 ]
putpixel dd __sys_putpixel
; } mike.dld
292,7 → 293,8
gdte:
 
align 16
cur_saved_data rb 4096
cur_saved_data:
rb 4096
fpu_data:
rb 512
 
393,14 → 395,9
 
hd_entries rd 1 ;unused ? 0xfe10
 
;* start code - Mario79
 
mouse_active rd 1
mouse_pause rd 1
MouseTickCounter rd 1
 
;* end code - Mario79
 
img_background rd 1
mem_BACKGROUND rd 1
static_background_data rd 1
/kernel/trunk/gui/font.inc
33,8 → 33,6
.1:
; } \\ Alver \\
pushad
call [_display.disable_mouse]
 
movsx eax, bx ; eax=y
sar ebx, 16 ; ebx=x
xchg eax, ebx ; eax=x, ebx=y
71,6 → 69,7
shr dl, 1
jz .pixloop1end
jnc .nopix
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
jmp .pixloop1cont
.nopix:
78,6 → 77,7
jz .pixloop1cont
push ecx
mov ecx, [esp+4+20h+20h]
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
pop ecx
.pixloop1cont:
103,6 → 103,7
.pixloop2:
shr dl, 1
jnc .nopix2
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
jmp .pixloop2cont
.nopix2:
110,6 → 111,7
jz .pixloop2cont
push ecx
mov ecx, [esp+12+20h+20h]
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
pop ecx
.pixloop2cont:
/kernel/trunk/gui/window.inc
43,10 → 43,7
jae .exit
 
push eax
inc [mouse_pause]
call [_display.disable_mouse]
call window._.sys_set_window
call [_display.disable_mouse]
pop eax
 
or al, al
62,7 → 59,6
 
; type II - only reserve area, no draw
call sys_window_mouse
dec [mouse_pause]
call [draw_pointer]
jmp .exit
 
622,7 → 618,7
 
; set line color
mov ecx, esi
sub esi, 1 shl 25
; sub esi, 1 shl 25
; draw top border
rol ebx, 16
push ebx
2054,9 → 2050,6
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
inc [mouse_pause]
call [_display.disable_mouse]
 
xor eax, eax
mov edx, [TASK_COUNT]
movzx edx, word[WIN_POS + edx * 2]
2168,7 → 2161,6
call dtext_asciiz_esi
 
.exit:
dec [mouse_pause]
call [draw_pointer]
ret
 
/kernel/trunk/hid/mousedrv.inc
22,36 → 22,32
; FCFF com1/ps2 buffer count starting from FC00
 
uglobal
;--------------------------------------
align 4
mousecount dd 0x0
mousedata dd 0x0
Y_UNDER_subtraction_CUR_hot_y:
dd 0
X_UNDER_subtraction_CUR_hot_x:
dd 0
Y_UNDER_sub_CUR_hot_y_add_curh:
dd 0
X_UNDER_sub_CUR_hot_x_add_curh:
dd 0
endg
 
iglobal
;--------------------------------------
align 4
mouse_delay dd 10
mouse_speed_factor:
dd 3
mouse_timer_ticks dd 0
endg
 
;include 'm_com.inc'
 
 
;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
 
;-----------------------------------------------------------------------------
align 4
draw_mouse_under:
; return old picture
 
cmp [_display.restore_cursor], 0
je @F
 
61,10 → 57,13
stdcall [_display.restore_cursor], eax, ebx
popad
ret
;--------------------------------------
align 4
@@:
pushad
xor ecx, ecx
xor edx, edx
;--------------------------------------
align 4
mres:
movzx eax, word [X_UNDER]
84,6 → 83,7
pop ebx
pop eax
mov edi, 1;force
or ecx, 0x04000000 ; don't save to mouseunder area
call [putpixel]
pop edx
pop ecx
96,9 → 96,9
jnz mres
popad
ret
 
;-----------------------------------------------------------------------------
align 4
save_draw_mouse:
 
cmp [_display.move_cursor], 0
je .no_hw_cursor
pushad
124,17 → 124,22
push esi
call [_display.select_cursor]
mov [current_cursor], esi
;--------------------------------------
align 4
.draw:
stdcall [_display.move_cursor], esi
popad
ret
.fail:
mov ecx, [def_cursor]
mov [edx+SLOT_BASE+APPDATA.cursor], ecx
stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax
popad
ret
 
;--------------------------------------
;align 4
;.fail:
; mov ecx, [def_cursor]
; mov [edx+SLOT_BASE+APPDATA.cursor], ecx
; stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax
; popad
; ret
;--------------------------------------
align 4
.no_hw_cursor:
pushad
; save & draw
144,6 → 149,7
push ebx
mov ecx, 0
mov edx, 0
;--------------------------------------
align 4
drm:
push eax
155,6 → 161,7
add eax, ecx; save picture under mouse
add ebx, edx
push ecx
or ecx, 0x04000000 ; don't load to mouseunder area
call getpixel
mov [COLOR_TEMP], ecx
pop ecx
164,6 → 171,7
add eax, ecx
add eax, mouseunder
mov ebx, [COLOR_TEMP]
and ebx, 0xffffff
mov [eax], ebx
pop ecx
mov edi, edx ; y cycle
178,6 → 186,7
push ecx
mov ecx, [COLOR_TEMP]
call combine_colors
and ecx, 0xffffff
mov [MOUSE_COLOR_MEM], ecx
pop ecx
pop edx
188,7 → 197,8
add ebx, edx ; and y coord+cycle
push ecx
mov ecx, [MOUSE_COLOR_MEM]
mov edi, 1
mov edi, 1 ; force
or ecx, 0x04000000 ; don't save to mouseunder area
call [putpixel]
pop ecx
mov ebx, [esp+0] ; pure y coord again
203,8 → 213,8
add esp, 8
popad
ret
 
 
;-----------------------------------------------------------------------------
align 4
combine_colors:
; in
; ecx - color ( 00 RR GG BB )
272,107 → 282,133
pop ebx
pop eax
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 ebx, ecx
jb .no_mouse_area
add ecx, 23 ; mouse cursor Y size
cmp ebx, ecx
ja .no_mouse_area
; offset Y
sub bx, [Y_UNDER] ;[MOUSE_Y]
;--------------------------------------
; check for X
xor ecx, ecx
mov cx, [X_UNDER] ;[MOUSE_X]
cmp eax, ecx
jb no_mouse_disable
sub eax, 10
add ecx, [edx+8]
jb .no_mouse_area
add ecx, 15 ; mouse cursor X size
cmp eax, ecx
jg no_mouse_disable
mov ecx, [edx+4]
add ebx, 14
cmp ebx, ecx
jb no_mouse_disable
sub ebx, 14
add ecx, [edx+12]
cmp ebx, ecx
jg no_mouse_disable
disable_m:
cmp dword [MOUSE_VISIBLE], dword 0
jne no_mouse_disable
pushf
cli
call draw_mouse_under
popf
mov [MOUSE_VISIBLE], dword 1
no_mouse_disable:
popad
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
;--------------------------------------
align 4
.no_mouse_area:
xor ecx, ecx
pop ebx eax
ret
;-----------------------------------------------------------------------------
align 4
check_mouse_area_for_putpixel:
; in:
; ecx = x shl 16 + y
; eax = color
; out:
; eax = new color
push eax
; check for Y
mov ax, [Y_UNDER] ; [MOUSE_Y]
cmp cx, ax
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)
 
__sys_draw_pointer:
cmp [mouse_pause], 0
je @f
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
@@:
push eax
mov eax, [timer_ticks]
sub eax, [MouseTickCounter]
cmp eax, 1
ja @f
;--------------------------------------
align 4
.no_mouse_area:
pop eax
ret
@@:
mov eax, [timer_ticks]
mov [MouseTickCounter], eax
pop eax
;-----------------------------------------------------------------------------
align 4
__sys_draw_pointer:
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 edx, word [Y_UNDER]
movzx ebx, word [MOUSE_Y]
380,18 → 416,44
cmp eax, ecx
jne redrawmouse
cmp ebx, edx
jne redrawmouse
jmp nodmp
je nodmp
;--------------------------------------
align 4
redrawmouse:
pushfd
cli
call draw_mouse_under
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
;--------------------------------------
align 4
nodmp:
popad
ret
 
;-----------------------------------------------------------------------------
align 4
proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword
 
mov eax, [BtnState]
404,11 → 466,14
jge @@M1
mov eax, 0
jmp @@M2
;--------------------------------------
align 4
@@M1:
cmp ax, [Screen_Max_X];ScreenLength
jl @@M2
mov ax, [Screen_Max_X];ScreenLength-1
 
;--------------------------------------
align 4
@@M2:
mov [MOUSE_X], ax;[XCoordinate]
 
421,11 → 486,14
jge @@M3
mov ax, 0
jmp @@M4
;--------------------------------------
align 4
@@M3:
cmp ax, [Screen_Max_Y];ScreenHeigth
jl @@M4
mov ax, [Screen_Max_Y];ScreenHeigth-1
 
;--------------------------------------
align 4
@@M4:
mov [MOUSE_Y], ax;[YCoordinate]
 
440,7 → 508,8
mov [mouse_timer_ticks], eax
ret
endp
 
;-----------------------------------------------------------------------------
align 4
mouse_acceleration:
push eax
mov eax, [timer_ticks]
451,6 → 520,8
;push edx
imul eax, [mouse_speed_factor]
;pop edx
;--------------------------------------
align 4
@@:
ret
 
;-----------------------------------------------------------------------------
/kernel/trunk/kernel.asm
374,7 → 374,6
 
mov [_display.bpp], eax
mov [_display.vrefresh], 60
mov [_display.disable_mouse], __sys_disable_mouse
 
movzx eax, word [BOOT_VAR+0x900A]; X max
mov [_display.width], eax
671,6 → 670,10
stdcall read_file, char, FONT_I, 0, 2304
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
call boot_log
 
1917,7 → 1920,30
ret
 
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 eax, [ecx+APPDATA.tls_base]
test eax, eax
1996,12 → 2022,38
cmp ecx, edx
ja noprocessterminate
mov eax, [TASK_COUNT]
push ecx
shl ecx, 5
mov edx, [ecx+CURRENT_TASK+TASKDATA.pid]
add ecx, CURRENT_TASK+TASKDATA.state
cmp byte [ecx], 9
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
mov [ecx], byte 3; clear possible i40's
;call MEM_Heap_UnLock
3181,8 → 3233,6
 
no_mark_system_shutdown:
 
call [_display.disable_mouse]
 
dec byte [SYS_SHUTDOWN]
je system_shutdown
 
3679,37 → 3729,23
; popad ; end disable io map
xor eax, eax
ret
 
 
;-----------------------------------------------------------------------------
align 4
drawbackground:
inc [mouse_pause]
; 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
jne bgrstr
call vesa20_drawbackground_tiled
dec [mouse_pause]
call [draw_pointer]
ret
;--------------------------------------
align 4
bgrstr:
call vesa20_drawbackground_stretch
dec [mouse_pause]
call [draw_pointer]
ret
 
;-----------------------------------------------------------------------------
align 4
 
syscall_putimage: ; PutImage
sys_putimage:
test ecx, 0x80008000
3718,8 → 3754,12
jz .exit
test ecx, 0xFFFF0000
jnz @f
;--------------------------------------
align 4
.exit:
ret
;--------------------------------------
align 4
@@:
mov edi, [current_slot]
add dx, word[edi+APPDATA.wnd_clientbox.top]
3726,28 → 3766,20
rol edx, 16
add dx, word[edi+APPDATA.wnd_clientbox.left]
rol edx, 16
;--------------------------------------
align 4
.forced:
push ebp esi 0
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
;--------------------------------------
align 4
sys_putimage_bpp:
; call [disable_mouse] ; this will be done in xxx_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]
call vesa20_putimage
pop ebp esi ebp
jmp [draw_pointer]
ret
; jmp [draw_pointer]
;-----------------------------------------------------------------------------
align 4
sys_putimage_palette:
; ebx = pointer to image
3762,6 → 3794,8
rol edx, 16
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
rol edx, 16
;--------------------------------------
align 4
.forced:
cmp esi, 1
jnz @f
3776,6 → 3810,8
add esp, 12
pop edi
ret
;--------------------------------------
align 4
@@:
cmp esi, 2
jnz @f
3786,6 → 3822,8
pop eax
pop edi
ret
;--------------------------------------
align 4
@@:
cmp esi, 4
jnz @f
3796,6 → 3834,8
pop eax
pop edi
ret
;--------------------------------------
align 4
@@:
push ebp esi ebp
cmp esi, 8
3803,6 → 3843,8
mov ebp, putimage_get8bpp
mov esi, putimage_init8bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 15
jnz @f
3809,6 → 3851,8
mov ebp, putimage_get15bpp
mov esi, putimage_init15bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 16
jnz @f
3815,6 → 3859,8
mov ebp, putimage_get16bpp
mov esi, putimage_init16bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 24
jnz @f
3821,6 → 3867,8
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 32
jnz @f
3827,31 → 3875,39
mov ebp, putimage_get32bpp
mov esi, putimage_init32bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
pop ebp esi ebp
ret
 
;-----------------------------------------------------------------------------
align 4
put_mono_image:
push ebp esi ebp
mov ebp, putimage_get1bpp
mov esi, putimage_init1bpp
jmp sys_putimage_bpp
;-----------------------------------------------------------------------------
align 4
put_2bit_image:
push ebp esi ebp
mov ebp, putimage_get2bpp
mov esi, putimage_init2bpp
jmp sys_putimage_bpp
;-----------------------------------------------------------------------------
align 4
put_4bit_image:
push ebp esi ebp
mov ebp, putimage_get4bpp
mov esi, putimage_init4bpp
jmp sys_putimage_bpp
 
;-----------------------------------------------------------------------------
align 4
putimage_init24bpp:
lea eax, [eax*3]
putimage_init8bpp:
ret
 
;-----------------------------------------------------------------------------
align 16
putimage_get24bpp:
movzx eax, byte [esi+2]
3859,6 → 3915,7
mov ax, [esi]
add esi, 3
ret 4
;-----------------------------------------------------------------------------
align 16
putimage_get8bpp:
movzx eax, byte [esi]
3868,7 → 3925,8
pop edx
inc esi
ret 4
 
;-----------------------------------------------------------------------------
align 4
putimage_init1bpp:
add eax, ecx
push ecx
3879,6 → 3937,7
sub eax, ecx
pop ecx
ret
;-----------------------------------------------------------------------------
align 16
putimage_get1bpp:
push edx
3895,7 → 3954,8
add eax, [edx+4]
pop edx
ret 4
 
;-----------------------------------------------------------------------------
align 4
putimage_init2bpp:
add eax, ecx
push ecx
3906,6 → 3966,7
sub eax, ecx
pop ecx
ret
;-----------------------------------------------------------------------------
align 16
putimage_get2bpp:
push edx
3927,7 → 3988,8
mov eax, [edx+eax*4]
pop edx
ret 4
 
;-----------------------------------------------------------------------------
align 4
putimage_init4bpp:
add eax, ecx
push ecx
3938,6 → 4000,7
sub eax, ecx
pop ecx
ret
;-----------------------------------------------------------------------------
align 16
putimage_get4bpp:
push edx
3959,19 → 4022,23
mov eax, [edx+eax*4]
pop edx
ret 4
 
;-----------------------------------------------------------------------------
align 4
putimage_init32bpp:
shl eax, 2
ret
;-----------------------------------------------------------------------------
align 16
putimage_get32bpp:
lodsd
ret 4
 
;-----------------------------------------------------------------------------
align 4
putimage_init15bpp:
putimage_init16bpp:
add eax, eax
ret
;-----------------------------------------------------------------------------
align 16
putimage_get15bpp:
; 0RRRRRGGGGGBBBBB -> 00000000RRRRR000GGGGG000BBBBB000
3990,7 → 4057,7
or eax, edx
pop edx ecx
ret 4
 
;-----------------------------------------------------------------------------
align 16
putimage_get16bpp:
; RRRRRGGGGGGBBBBB -> 00000000RRRRR000GGGGGG00BBBBB000
4009,41 → 4076,27
or eax, edx
pop edx ecx
ret 4
 
;-----------------------------------------------------------------------------
;align 4
; eax x beginning
; ebx y beginning
; ecx x end
; edx y end
; edi color
 
__sys_drawbar:
mov esi, [current_slot]
add eax, [esi+APPDATA.wnd_clientbox.left]
add ecx, [esi+APPDATA.wnd_clientbox.left]
add ebx, [esi+APPDATA.wnd_clientbox.top]
add edx, [esi+APPDATA.wnd_clientbox.top]
.forced:
inc [mouse_pause]
; call [disable_mouse]
; 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]
;__sys_drawbar:
; mov esi, [current_slot]
; add eax, [esi+APPDATA.wnd_clientbox.left]
; add ecx, [esi+APPDATA.wnd_clientbox.left]
; add ebx, [esi+APPDATA.wnd_clientbox.top]
; add edx, [esi+APPDATA.wnd_clientbox.top]
;--------------------------------------
;align 4
;.forced:
; call vesa20_drawbar
; call [draw_pointer]
; ret
; dbv20:
call vesa20_drawbar
dec [mouse_pause]
call [draw_pointer]
ret
 
 
 
;-----------------------------------------------------------------------------
align 4
kb_read:
 
push ecx edx
4069,8 → 4122,8
pop edx ecx
 
ret
 
 
;-----------------------------------------------------------------------------
align 4
kb_write:
 
push ecx edx
4123,8 → 4176,8
pop edx ecx
 
ret
 
 
;-----------------------------------------------------------------------------
align 4
kb_cmd:
 
mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's
4155,7 → 4208,7
setmouse: ; set mousepicture -pointer
; ps2 mouse enable
 
mov [MOUSE_PICTURE], dword mousepointer
; mov [MOUSE_PICTURE], dword mousepointer
 
cli
 
4460,8 → 4513,7
add eax, [edi+APPDATA.wnd_clientbox.left]
add ebx, [edi+APPDATA.wnd_clientbox.top]
xor edi, edi ; no force
; mov edi, 1
call [_display.disable_mouse]
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
jmp [putpixel]
 
align 4
4601,6 → 4653,7
div ecx
mov ebx, edx
xchg eax, ebx
and ecx, 0xFBFFFFFF ;negate 0x04000000 use mouseunder area
call dword [GETPIXEL]; eax - x, ebx - y
mov [esp + 32], ecx
ret
4613,20 → 4666,6
;ecx = [size x]*65536 + [size y]
;edx = [start x]*65536 + [start y]
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 eax, edx
shr eax, 16
4663,6 → 4702,7
push eax ebx ecx
add eax, ecx
 
and ecx, 0xFBFFFFFF ;negate 0x04000000 use mouseunder area
call dword [GETPIXEL]; eax - x, ebx - y
 
mov [ebp], cx
4677,12 → 4717,6
dec ebx
dec edx
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
ret
 
/kernel/trunk/video/blitter.inc
324,9 → 324,6
test eax, eax
jne .L57
 
inc [mouse_pause]
call [_display.disable_mouse]
 
mov eax, [TASK_BASE]
 
mov ebx, [esp+BLITTER.dst_x]
333,6 → 330,13
mov ebp, [esp+BLITTER.dst_y]
add ebx, [eax-twdw + WDATA.box.left]
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
 
imul edi, [_display.pitch]
346,6 → 350,7
lea esi, [eax+esi*4]
add esi, [esp+BLITTER.bitmap]
 
mov eax, ecx
mov ecx, [esp+BLITTER.h]
mov edx, [esp+BLITTER.w]
 
361,7 → 366,6
lea edi, [edi+ebx*4]
 
mov ebx, [CURRENT_TASK]
 
align 4
.outer32:
xor ecx, ecx
370,9 → 374,26
.inner32:
cmp [ebp+ecx], bl
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
pop eax
;--------------------------------------
align 4
@@:
inc ecx
dec edx
387,7 → 408,6
jnz .outer32
 
.done:
dec [mouse_pause]
call [draw_pointer]
.L57:
add esp, 72
411,13 → 431,31
.inner24:
cmp [ebp+ecx], bl
jne @F
 
;--------------------------------------
push eax
mov eax, [esi+ecx*4]
 
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
shr eax, 16
mov [edi+ecx+2], al
 
pop eax
;--------------------------------------
align 4
@@:
mov edi, [esp+64]
inc ecx
/kernel/trunk/video/cursors.inc
26,7 → 26,7
ClrUsed dd ?
ClrImportant dd ?
ends
 
;------------------------------------------------------------------------------
align 4
proc init_cursor stdcall, dst:dword, src:dword
locals
49,7 → 49,8
je .img_8
cmp [esi+BITMAPINFOHEADER.BitCount], 4
je .img_4
 
;--------------------------------------
align 4
.img_2:
add eax, [esi]
mov [pQuad], eax
68,6 → 69,8
mov [rBase], edi
 
mov esi, [pQuad]
;--------------------------------------
align 4
.l21:
mov ebx, [pBits]
mov ebx, [ebx]
76,6 → 79,8
mov eax, [eax]
bswap eax
mov [counter], 32
;--------------------------------------
align 4
@@:
xor edx, edx
shl eax, 1
103,7 → 108,8
sub [height], 1
jnz .l21
ret
 
;--------------------------------------
align 4
.img_4:
add eax, [esi]
mov [pQuad], eax
123,11 → 129,15
 
mov esi, [pQuad]
mov ebx, [pBits]
;--------------------------------------
align 4
.l4:
mov eax, [pAnd]
mov eax, [eax]
bswap eax
mov [counter], 16
;--------------------------------------
align 4
@@:
xor edx, edx
shl eax, 1
168,6 → 178,8
sub [height], 1
jnz .l4
ret
;--------------------------------------
align 4
.img_8:
add eax, [esi]
mov [pQuad], eax
187,11 → 199,15
 
mov esi, [pQuad]
mov ebx, [pBits]
;--------------------------------------
align 4
.l81:
mov eax, [pAnd]
mov eax, [eax]
bswap eax
mov [counter], 32
;--------------------------------------
align 4
@@:
xor edx, edx
shl eax, 1
217,6 → 233,8
sub [height], 1
jnz .l81
ret
;--------------------------------------
align 4
.img_24:
add eax, [esi]
mov [pQuad], eax
234,10 → 252,14
 
mov esi, [pAnd]
mov ebx, [pQuad]
;--------------------------------------
align 4
.row_24:
mov eax, [esi]
bswap eax
mov [counter], 32
;--------------------------------------
align 4
@@:
xor edx, edx
shl eax, 1
263,7 → 285,7
jnz .row_24
ret
endp
 
;------------------------------------------------------------------------------
align 4
proc set_cursor stdcall, hcursor:dword
mov eax, [hcursor]
274,6 → 296,8
mov ebx, [current_slot]
xchg eax, [ebx+APPDATA.cursor]
ret
;--------------------------------------
align 4
.fail:
mov eax, [def_cursor]
mov ebx, [current_slot]
280,7 → 304,8
xchg eax, [ebx+APPDATA.cursor]
ret
endp
 
;------------------------------------------------------------------------------
align 4
; param
; eax= pid
; ebx= src
338,6 → 363,8
popfd
 
mov eax, [.hcursor]
;--------------------------------------
align 4
.check_hw:
cmp [_display.init_cursor], 0
je .fail
347,9 → 374,13
add esp, 4
 
mov eax, [.hcursor]
;--------------------------------------
align 4
.fail:
add esp, 12
ret
;--------------------------------------
align 4
.indirect:
shr ebx, 16
movzx ecx, bh
362,7 → 393,7
cld
rep movsd
jmp .check_hw
 
;------------------------------------------------------------------------------
align 4
proc load_cursor stdcall, src:dword, flags:dword
locals
381,6 → 412,8
test eax, eax
jz .fail
mov [src], eax
;--------------------------------------
align 4
@@:
push ebx
push esi
397,16 → 430,22
cmp word [flags], LOAD_FROM_FILE
jne .exit
stdcall kernel_free, [src]
;--------------------------------------
align 4
.exit:
pop edi
pop esi
pop ebx
;--------------------------------------
align 4
.fail:
mov eax, [handle]
;--------------------------------------
align 4
.fail2:
ret
endp
 
;------------------------------------------------------------------------------
align 4
proc delete_cursor stdcall, hcursor:dword
locals
433,17 → 472,20
jne @F
mov eax, [def_cursor]
mov [ebx+APPDATA.cursor], eax
;--------------------------------------
align 4
@@:
mov eax, [hcursor]
call [eax+APPOBJ.destroy]
;--------------------------------------
align 4
.fail:
ret
endp
 
;------------------------------------------------------------------------------
align 4
; param
; eax= cursor
 
align 4
destroy_cursor:
 
push eax
460,13 → 502,13
pop eax
call destroy_kernel_object
ret
 
;------------------------------------------------------------------------------
align 4
select_cursor:
mov eax, [esp+4]
mov [_display.cursor], eax
ret 4
 
;------------------------------------------------------------------------------
align 4
proc restore_24 stdcall, x:dword, y:dword
 
484,6 → 526,8
mov ecx, [cur.w]
lea ecx, [ecx+ecx*2]
push ecx
;--------------------------------------
align 4
@@:
mov edi, ebx
add ebx, [BytesPerScanLine]
496,11 → 540,13
pop ecx
pop edi
pop esi
;--------------------------------------
align 4
.ret:
pop ebx
ret
endp
 
;------------------------------------------------------------------------------
align 4
proc restore_32 stdcall, x:dword, y:dword
 
515,6 → 561,8
push edi
 
mov esi, cur_saved_data
;--------------------------------------
align 4
@@:
mov edi, ebx
add ebx, [BytesPerScanLine]
525,12 → 573,14
jnz @B
 
pop edi
;--------------------------------------
align 4
.ret:
pop esi
pop ebx
ret
endp
 
;------------------------------------------------------------------------------
align 4
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
locals
576,10 → 626,14
cmp ebx, [Screen_Max_X]
jbe @F
mov ebx, [Screen_Max_X]
;--------------------------------------
align 4
@@:
cmp edi, [Screen_Max_Y]
jbe @F
mov edi, [Screen_Max_Y]
;--------------------------------------
align 4
@@:
mov [cur.right], ebx
mov [cur.bottom], edi
595,6 → 649,8
 
mov eax, edi
mov edi, cur_saved_data
;--------------------------------------
align 4
@@:
mov esi, edx
add edx, [BytesPerScanLine]
613,6 → 669,8
mov esi, [hcursor]
mov esi, [esi+CURSOR.base]
lea edx, [esi+eax*4]
;--------------------------------------
align 4
.row:
mov ecx, [cur.w]
mov esi, edx
619,6 → 677,8
mov edi, ebx
add edx, 32*4
add ebx, [BytesPerScanLine]
;--------------------------------------
align 4
.pix:
lodsd
test eax, 0xFF000000
626,6 → 686,8
mov [edi], ax
shr eax, 16
mov [edi+2], al
;--------------------------------------
align 4
@@:
add edi, 3
dec ecx
635,8 → 697,7
jnz .row
ret
endp
 
 
;------------------------------------------------------------------------------
align 4
proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
locals
680,10 → 741,14
cmp ebx, [Screen_Max_X]
jbe @F
mov ebx, [Screen_Max_X]
;--------------------------------------
align 4
@@:
cmp edi, [Screen_Max_Y]
jbe @F
mov edi, [Screen_Max_Y]
;--------------------------------------
align 4
@@:
mov [cur.right], ebx
mov [cur.bottom], edi
699,6 → 764,8
 
mov eax, edi
mov edi, cur_saved_data
;--------------------------------------
align 4
@@:
mov esi, edx
add edx, [BytesPerScanLine]
716,6 → 783,8
mov esi, [hcursor]
mov esi, [esi+CURSOR.base]
lea edx, [esi+eax*4]
;--------------------------------------
align 4
.row:
mov ecx, [cur.w]
mov esi, edx
722,11 → 791,15
mov edi, ebx
add edx, 32*4
add ebx, [BytesPerScanLine]
;--------------------------------------
align 4
.pix:
lodsd
test eax, 0xFF000000
jz @F
mov [edi], eax
;--------------------------------------
align 4
@@:
add edi, 4
dec ecx
736,16 → 809,158
jnz .row
ret
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
get_display:
mov eax, _display
ret
 
;------------------------------------------------------------------------------
align 4
init_display:
 
xor eax, eax
mov edi, _display
 
764,6 → 979,7
 
test word [SCR_MODE], 0x4000
jz .fail
; jmp .fail
 
mov ebx, restore_32
mov ecx, move_cursor_32
775,22 → 991,28
mov ecx, move_cursor_24
cmp eax, 24
jne .fail
;--------------------------------------
align 4
@@:
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
 
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax
ret
;--------------------------------------
align 4
.fail:
xor eax, eax
mov [_display.select_cursor], eax
mov [_display.move_cursor], eax
ret
 
 
;------------------------------------------------------------------------------
align 4
def_arrow:
file 'arrow.cur'
;------------------------------------------------------------------------------
 
/kernel/trunk/video/vesa20.inc
31,7 → 31,7
 
 
 
;*************************************************
;-----------------------------------------------------------------------------
; getpixel
;
; in:
40,32 → 40,57
;
; ret:
; ecx = 00 RR GG BB
 
;-----------------------------------------------------------------------------
align 4
getpixel:
push eax ebx edx edi
call dword [GETPIXEL]
pop edi edx ebx eax
ret
 
;-----------------------------------------------------------------------------
align 4
Vesa20_getpixel24:
; eax = x
; ebx = y
;--------------------------------------
; check mouse area for putpixel
test ecx, 0x04000000 ; don't load to mouseunder area
jnz .no_mouseunder
call [_display.check_m_pixel]
test ecx, ecx ;0xff000000
jnz @f
.no_mouseunder:
;--------------------------------------
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [eax+eax*2]; edi = x*3
add edi, ebx ; edi = x*3+(y*y multiplier)
mov ecx, [LFB_BASE+edi]
;--------------------------------------
align 4
@@:
and ecx, 0xffffff
ret
 
;-----------------------------------------------------------------------------
align 4
Vesa20_getpixel32:
;--------------------------------------
; check mouse area for putpixel
test ecx, 0x04000000 ; don't load to mouseunder area
jnz .no_mouseunder
call [_display.check_m_pixel]
test ecx, ecx ;0xff000000
jnz @f
.no_mouseunder:
;--------------------------------------
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
mov ecx, [LFB_BASE+edi]
;--------------------------------------
align 4
@@:
and ecx, 0xffffff
ret
 
;*************************************************
 
;-----------------------------------------------------------------------------
virtual at esp
putimg:
.real_sx dd ?
80,7 → 105,9
.line_increment dd ?
.winmap_newline dd ?
.screen_newline dd ?
.stack_data = 4*12
.real_sx_and_abs_cx dd ?
.real_sy_and_abs_cy dd ?
.stack_data = 4*14
.edi dd ?
.esi dd ?
.ebp dd ?
92,7 → 119,7
.ret_addr dd ?
.arg_0 dd ?
end virtual
 
;-----------------------------------------------------------------------------
align 16
; ebx = pointer
; ecx = size [x|y]
100,10 → 127,8
; ebp = pointer to 'get' function
; esi = pointer to 'init' function
; edi = parameter for 'get' function
 
vesa20_putimage:
pushad
call [_display.disable_mouse]
sub esp, putimg.stack_data
; save pointer to image
mov [putimg.pti], ebx
138,10 → 163,14
add esp, putimg.stack_data
popad
ret
;--------------------------------------
align 4
@@:
cmp ebx, [putimg.image_sx]
jbe .end_x
mov ebx, [putimg.image_sx]
;--------------------------------------
align 4
.end_x:
mov [putimg.real_sx], ebx
; init real_sy
154,10 → 183,14
add esp, putimg.stack_data
popad
ret
;--------------------------------------
align 4
@@:
cmp ebx, [putimg.image_sy]
jbe .end_y
mov ebx, [putimg.image_sy]
;--------------------------------------
align 4
.end_y:
mov [putimg.real_sy], ebx
; line increment
198,6 → 231,14
add eax, [putimg.abs_cx]
add eax, [_WinMapAddress]
xchg eax, ebp
;--------------------------------------
mov ecx, [putimg.real_sx]
add ecx, [putimg.abs_cx]
mov [putimg.real_sx_and_abs_cx], ecx
mov ecx, [putimg.real_sy]
add ecx, [putimg.abs_cy]
mov [putimg.real_sy_and_abs_cy], ecx
;--------------------------------------
; get process number
mov ebx, [CURRENT_TASK]
cmp byte [ScreenBPP], 32
204,10 → 245,12
je put_image_end_32
;put_image_end_24:
mov edi, [putimg.real_sy]
;--------------------------------------
align 4
.new_line:
mov ecx, [putimg.real_sx]
; push ebp edx
;--------------------------------------
align 4
.new_x:
push [putimg.edi]
215,10 → 258,24
call eax
cmp [ebp], bl
jne .skip
; mov eax, [esi] ; eax = RRBBGGRR
;--------------------------------------
push ecx
 
neg ecx
add ecx, [putimg.real_sx_and_abs_cx + 4]
shl ecx, 16
add ecx, [putimg.real_sy_and_abs_cy + 4]
sub ecx, edi
 
; check mouse area for putpixel
call [_display.check_mouse]
pop ecx
; store to real LFB
mov [LFB_BASE+edx], ax
shr eax, 16
mov [LFB_BASE+edx+2], al
;--------------------------------------
align 4
.skip:
; add esi, 3 ;[putimg.source_bpp]
add edx, 3
236,23 → 293,32
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
;--------------------------------------
align 4
.finish:
add esp, putimg.stack_data
popad
ret
 
;------------------------------------------------------------------------------
align 4
put_image_end_32:
mov edi, [putimg.real_sy]
;--------------------------------------
align 4
.new_line:
mov ecx, [putimg.real_sx]
; push ebp edx
;--------------------------------------
align 4
.new_x:
push [putimg.edi]
260,8 → 326,22
call eax
cmp [ebp], bl
jne .skip
; mov eax, [esi] ; ecx = RRBBGGRR
;--------------------------------------
push ecx
 
neg ecx
add ecx, [putimg.real_sx_and_abs_cx + 4]
shl ecx, 16
add ecx, [putimg.real_sy_and_abs_cy + 4]
sub ecx, edi
 
; check mouse area for putpixel
call [_display.check_mouse]
pop ecx
; store to real LFB
mov [LFB_BASE+edx], eax
;--------------------------------------
align 4
.skip:
; add esi, [putimg.source_bpp]
add edx, 4
279,12 → 359,18
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
;--------------------------------------
align 4
.finish:
add esp, putimg.stack_data
popad
291,9 → 377,7
call VGA__putimage
mov [EGA_counter], 1
ret
 
 
;*************************************************
;------------------------------------------------------------------------------
align 4
__sys_putpixel:
 
323,47 → 407,83
cmp edx, [CURRENT_TASK]
pop eax
jne .exit
 
;--------------------------------------
align 4
.forced:
; check if negation
test ecx, 0x01000000
jz .noneg
 
call getpixel
not ecx
 
rol ecx, 8
mov cl, [esp+32-8+3]
ror ecx, 8
mov [esp+32-8], ecx
;--------------------------------------
align 4
.noneg:
; OK to set pixel
call dword [PUTPIXEL]; call the real put_pixel function
;--------------------------------------
align 4
.exit:
popad
ret
 
;-----------------------------------------------------------------------------
align 4
Vesa20_putpixel24:
; eax = x
; ebx = y
mov ecx, eax
shl ecx, 16
mov cx, bx
 
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [eax+eax*2]; edi = x*3
mov eax, [esp+32-8+4]
;--------------------------------------
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
call [_display.check_mouse]
;--------------------------------------
align 4
@@:
; store to real LFB
mov [LFB_BASE+ebx+edi], ax
shr eax, 16
mov [LFB_BASE+ebx+edi+2], al
;--------------------------------------
ret
 
 
;-----------------------------------------------------------------------------
align 4
Vesa20_putpixel32:
; eax = x
; ebx = y
mov ecx, eax
shl ecx, 16
mov cx, bx
 
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4]; eax = color
;--------------------------------------
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
call [_display.check_mouse]
;--------------------------------------
align 4
@@:
and eax, 0xffffff
; store to real LFB
mov [LFB_BASE+edi], eax
;--------------------------------------
ret
 
;*************************************************
 
;align 4
;-----------------------------------------------------------------------------
align 4
calculate_edi:
mov edi, ebx
imul edi, [Screen_Max_X]
370,16 → 490,11
add edi, ebx
add edi, eax
ret
 
;*************************************************
 
;-----------------------------------------------------------------------------
; DRAWLINE
 
;-----------------------------------------------------------------------------
align 4
__sys_draw_line:
; inc [mouse_pause]
call [_display.disable_mouse]
 
; draw a line
; eax = HIWORD = x1
; LOWORD = x2
416,8 → 531,12
call vline
push edx ; necessary to rightly restore stack frame at .exit
jmp .exit
;--------------------------------------
align 4
.x2lx1:
neg esi ; get esi absolute value
;--------------------------------------
align 4
.no_vline:
; checking y-axis...
sub ebp, ebx ; ebp = y2-y1
427,9 → 546,12
mov edx, [dl_x2]; else (if y1=y2)
call hline
jmp .exit
 
;--------------------------------------
align 4
.y2ly1:
neg ebp ; get ebp absolute value
;--------------------------------------
align 4
.no_hline:
cmp ebp, esi
jle .x_rules ; |y2-y1| < |x2-x1| ?
442,6 → 564,8
mov edx, [dl_y2]
mov [dl_y2], ebx
mov [dl_y1], edx
;--------------------------------------
align 4
.no_reverse1:
mov eax, [dl_dx]
cdq ; extend eax sing to edx
453,6 → 577,8
cmp ebp, edx
jb @f
inc eax
;--------------------------------------
align 4
@@:
;--------------------------------------
mov edx, ebp ; edx = counter (number of pixels to draw)
459,7 → 585,8
mov ebp, 1 *65536; <<16 ; ebp = dy = 1.0
mov esi, eax ; esi = dx
jmp .y_rules
 
;--------------------------------------
align 4
.x_rules:
cmp [dl_x2], eax ; make sure x1 is at the begining
jge .no_reverse2
470,6 → 597,8
mov edx, [dl_y2]
mov [dl_y2], ebx
mov [dl_y1], edx
;--------------------------------------
align 4
.no_reverse2:
xor edx, edx
mov eax, [dl_dy]
482,11 → 611,15
cmp esi, edx
jb @f
inc eax
;--------------------------------------
align 4
@@:
;--------------------------------------
mov edx, esi ; edx = counter (number of pixels to draw)
mov esi, 1 *65536;<< 16 ; esi = dx = 1.0
mov ebp, eax ; ebp = dy
;--------------------------------------
align 4
.y_rules:
mov eax, [dl_x1]
mov ebx, [dl_y1]
501,6 → 634,8
test ah, 0x80
jz @f
add eax, 1 shl 16
;--------------------------------------
align 4
@@:
;--------------------------------------
shr eax, 16
509,9 → 644,12
test bh, 0x80
jz @f
add ebx, 1 shl 16
;--------------------------------------
align 4
@@:
;--------------------------------------
shr ebx, 16
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
pop ebx eax
add ebx, ebp ; y = y+dy
521,15 → 659,17
; force last drawn pixel to be at (x2,y2)
mov eax, [dl_x2]
mov ebx, [dl_y2]
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
;--------------------------------------
align 4
.exit:
add esp, 6*4
popa
; dec [mouse_pause]
call [draw_pointer]
; call [draw_pointer]
ret
 
 
;------------------------------------------------------------------------------
align 4
hline:
; draw an horizontal line
; eax = x1
541,8 → 681,10
cmp edx, eax ; make sure x2 is above x1
jge @f
xchg eax, edx
;--------------------------------------
align 4
@@:
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
inc eax
cmp eax, edx
549,8 → 691,8
jle @b
pop edx eax
ret
 
 
;------------------------------------------------------------------------------
align 4
vline:
; draw a vertical line
; eax = x
562,8 → 704,10
cmp edx, ebx ; make sure y2 is above y1
jge @f
xchg ebx, edx
;--------------------------------------
align 4
@@:
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
inc ebx
cmp ebx, edx
570,11 → 714,8
jle @b
pop edx ebx
ret
 
 
;*************************************************
 
 
;------------------------------------------------------------------------------
align 4
virtual at esp
drbar:
.bar_sx dd ?
588,9 → 729,11
.color dd ?
.line_inc_scr dd ?
.line_inc_map dd ?
.stack_data = 4*11
.real_sx_and_abs_cx dd ?
.real_sy_and_abs_cy dd ?
.stack_data = 4*13
end virtual
 
;--------------------------------------
align 4
; eax cx
; ebx cy
599,7 → 742,6
; edi color
vesa20_drawbar:
pushad
call [_display.disable_mouse]
sub esp, drbar.stack_data
mov [drbar.color], edi
sub edx, ebx
623,6 → 765,8
; \end{diamond}[20.08.2006]
sub ebx, [drbar.bar_cx]
ja @f
;--------------------------------------
align 4
.exit: ;// mike.dld, 2005-01-29
add esp, drbar.stack_data
popad
629,10 → 773,14
xor eax, eax
inc eax
ret
;--------------------------------------
align 4
@@:
cmp ebx, [drbar.bar_sx]
jbe .end_x
mov ebx, [drbar.bar_sx]
;--------------------------------------
align 4
.end_x:
mov [drbar.real_sx], ebx
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
647,10 → 795,14
xor eax, eax
inc eax
ret
;--------------------------------------
align 4
@@:
cmp ebx, [drbar.bar_sy]
jbe .end_y
mov ebx, [drbar.bar_sy]
;--------------------------------------
align 4
.end_y:
mov [drbar.real_sy], ebx
; line_inc_map
681,10 → 833,22
add eax, [drbar.abs_cx]
add eax, [_WinMapAddress]
xchg eax, ebp
;--------------------------------------
mov ebx, [drbar.real_sx]
add ebx, [drbar.abs_cx]
mov [drbar.real_sx_and_abs_cx], ebx
mov ebx, [drbar.real_sy]
add ebx, [drbar.abs_cy]
mov [drbar.real_sy_and_abs_cy], ebx
 
add edx, LFB_BASE
;--------------------------------------
; get process number
mov ebx, [CURRENT_TASK]
cmp byte [ScreenBPP], 24
jne draw_bar_end_32
;--------------------------------------
align 4
draw_bar_end_24:
mov eax, [drbar.color] ;; BBGGRR00
mov bh, al ;; bh = BB
697,16 → 861,37
; esi - counter
; edi - counter
mov esi, [drbar.real_sy]
cmp [_display.select_cursor], 0
jne draw_bar_end_24_new
;--------------------------------------
align 4
.new_y:
mov edi, [drbar.real_sx]
;--------------------------------------
align 4
.new_x:
cmp byte [ebp], bl
jne .skip
;--------------------------------------
push eax
 
mov [LFB_BASE+edx], bh
mov [LFB_BASE+edx + 1], ax
mov ecx, [drbar.real_sx_and_abs_cx + 4]
sub ecx, edi
shl ecx, 16
add ecx, [drbar.real_sy_and_abs_cy + 4]
sub ecx, esi
 
shl eax, 8
mov al, bh
; check mouse area for putpixel
call check_mouse_area_for_putpixel
; store to real LFB
mov [edx], ax
shr eax, 16
mov [edx + 2], al
pop eax
;--------------------------------------
align 4
.skip:
; add pixel
add edx, 3
722,27 → 907,128
test bh, bh
jz @f
dec bh
;--------------------------------------
align 4
@@:
; </Ivan 15.10.04>
dec esi
jnz .new_y
;--------------------------------------
align 4
.end:
add esp, drbar.stack_data
popad
xor eax, eax
ret
;--------------------------------------
align 4
draw_bar_end_24_new:
;--------------------------------------
align 4
.new_y:
mov edi, [drbar.real_sx]
;--------------------------------------
align 4
.new_x:
cmp byte [ebp], bl
jne .skip
;--------------------------------------
mov ecx, [drbar.real_sy_and_abs_cy]
sub ecx, esi
;--------------------------------------
; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
 
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area
 
rol ecx, 16
add ecx, [drbar.real_sx_and_abs_cx]
sub ecx, edi
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
 
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
;--------------------------------------
; check mouse area for putpixel
push eax
 
shl eax, 8
mov al, bh
 
call check_mouse_area_for_putpixel_new.1
; store to real LFB
mov [edx], ax
shr eax, 16
mov [edx + 2], al
pop eax
jmp .skip
; store to real LFB
;--------------------------------------
align 4
.no_mouse_area:
mov [edx], bh
mov [edx + 1], ax
;--------------------------------------
align 4
.skip:
; add pixel
add edx, 3
inc ebp
dec edi
jnz .new_x
; add line
add edx, [drbar.line_inc_scr]
add ebp, [drbar.line_inc_map]
; <Ivan 15.10.04> drawing gradient bars
test eax, 0x00800000
jz @f
test bh, bh
jz @f
dec bh
;--------------------------------------
align 4
@@:
; </Ivan 15.10.04>
dec esi
jnz .new_y
jmp draw_bar_end_24.end
;--------------------------------------
align 4
draw_bar_end_32:
mov eax, [drbar.color] ;; BBGGRR00
mov esi, [drbar.real_sy]
cmp [_display.select_cursor], 0
jne draw_bar_end_32_new
;--------------------------------------
align 4
.new_y:
mov edi, [drbar.real_sx]
;--------------------------------------
align 4
.new_x:
cmp byte [ebp], bl
jne .skip
;--------------------------------------
push eax
 
mov [LFB_BASE+edx], eax
mov ecx, [drbar.real_sx_and_abs_cx + 4]
sub ecx, edi
shl ecx, 16
add ecx, [drbar.real_sy_and_abs_cy + 4]
sub ecx, esi
 
; check mouse area for putpixel
call check_mouse_area_for_putpixel
; store to real LFB
mov [edx], eax
pop eax
;--------------------------------------
align 4
.skip:
; add pixel
add edx, 4
758,10 → 1044,15
test al, al
jz @f
dec al
;--------------------------------------
align 4
@@:
; </Ivan 15.10.04>
dec esi
jnz .new_y
;--------------------------------------
align 4
.end:
add esp, drbar.stack_data
popad
call VGA_draw_bar
768,13 → 1059,83
xor eax, eax
mov [EGA_counter], 1
ret
;--------------------------------------
align 4
draw_bar_end_32_new:
;--------------------------------------
align 4
.new_y:
mov edi, [drbar.real_sx]
;--------------------------------------
align 4
.new_x:
cmp byte [ebp], bl
jne .skip
;--------------------------------------
mov ecx, [drbar.real_sy_and_abs_cy]
sub ecx, esi
;--------------------------------------
; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
 
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area
 
rol ecx, 16
add ecx, [drbar.real_sx_and_abs_cx]
sub ecx, edi
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
 
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
;--------------------------------------
; check mouse area for putpixel
push eax
call check_mouse_area_for_putpixel_new.1
mov [edx], eax
pop eax
jmp .skip
; store to real LFB
;--------------------------------------
align 4
.no_mouse_area:
mov [edx], eax
;--------------------------------------
align 4
.skip:
; add pixel
add edx, 4
inc ebp
dec edi
jnz .new_x
; add line
add edx, [drbar.line_inc_scr]
add ebp, [drbar.line_inc_map]
; <Ivan 15.10.04> drawing gradient bars
test eax, 0x80000000
jz @f
test al, al
jz @f
dec al
;--------------------------------------
align 4
@@:
; </Ivan 15.10.04>
dec esi
jnz .new_y
jmp draw_bar_end_32.end
;------------------------------------------------------------------------------
align 4
vesa20_drawbackground_tiled:
call [_display.disable_mouse]
pushad
; External loop for all y from start to end
mov ebx, [draw_data+32+RECT.top] ; y start
;--------------------------------------
align 4
dp2:
mov ebp, [draw_data+32+RECT.left] ; x start
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
788,6 → 1149,8
cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size
jz @f
add ebp, eax
;--------------------------------------
align 4
@@:
add ebp, LFB_BASE
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
821,16 → 1184,35
; edx = 1
; esi -> bgr memory, edi -> output
; ebp = offset in WinMapAddress
;--------------------------------------
align 4
dp3:
cmp [ebp], dl
jnz nbgp
movsb
movsb
movsb
jmp @f
;--------------------------------------
push eax ecx
 
mov ecx, eax
shl ecx, 16
add ecx, ebx
 
mov eax, [esi]
and eax, 0xffffff
; check mouse area for putpixel
call [_display.check_mouse]
; store to real LFB
mov [edi], ax
shr eax, 16
mov [edi+2], al
 
pop ecx eax
;--------------------------------------
align 4
nbgp:
add esi, 3
add edi, 3
;--------------------------------------
align 4
@@:
cmp [ScreenBPP], byte 25 ; 24 or 32 bpp?
sbb edi, -1 ; +1 for 32 bpp
847,6 → 1229,8
sub esi, ecx
sub esi, ecx
jmp dp3
;--------------------------------------
align 4
dp4:
; next scan line
inc ebx
856,12 → 1240,9
mov [EGA_counter], 1
call VGA_drawbackground
ret
 
; ----------
 
 
;------------------------------------------------------------------------------
align 4
vesa20_drawbackground_stretch:
call [_display.disable_mouse]
pushad
; Helper variables
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
896,6 → 1277,8
cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size
jz @f
add ebp, eax
;--------------------------------------
align 4
@@:
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi
926,6 → 1309,8
push edx
push esi
; 3) Smooth horizontal
;--------------------------------------
align 4
bgr_resmooth0:
mov ecx, [esp+8]
mov edx, [esp+4]
933,6 → 1318,8
push edi
mov edi, bgr_cur_line
call smooth_line
;--------------------------------------
align 4
bgr_resmooth1:
mov eax, [esp+16+4]
inc eax
946,8 → 1333,12
add esi, [BgrDataWidth]
mov edi, bgr_next_line
call smooth_line
;--------------------------------------
align 4
bgr.no2nd:
pop edi
;--------------------------------------
align 4
sdp3:
xor esi, esi
mov ecx, [esp+12]
963,6 → 1354,8
; precalculated constants:
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
;--------------------------------------
align 4
sdp3a:
mov eax, [_WinMapAddress]
cmp [ebp+eax], byte 1
972,12 → 1365,22
jz .novert
mov ebx, [bgr_next_line+esi]
call [overlapping_of_points_ptr]
;--------------------------------------
align 4
.novert:
 
push ecx
mov ecx, [esp+20+4] ;x
shl ecx, 16
add ecx, [esp+24+4] ;y
; check mouse area for putpixel
call [_display.check_mouse]
; store to real LFB
mov [LFB_BASE+edi], ax
shr eax, 16
 
mov [LFB_BASE+edi+2], al
pop ecx
;--------------------------------------
align 4
snbgp:
cmp [ScreenBPP], byte 25
sbb edi, -4
988,6 → 1391,8
add esi, 4
cmp eax, [draw_data+32+RECT.right]
jbe sdp3a
;--------------------------------------
align 4
sdp4:
; next y
mov ebx, [esp+24]
1006,6 → 1411,8
cmp [ScreenBPP], byte 24
jz @f
sub edi, eax
;--------------------------------------
align 4
@@:
add edi, [BytesPerScanLine]
; restore ecx,edx; advance esi to next background line
1032,6 → 1439,8
inc ecx
rep movsd
jmp bgr_resmooth1
;--------------------------------------
align 4
sdpdone:
add esp, 44
popad
1040,11 → 1449,14
ret
 
uglobal
;--------------------------------------
align 4
bgr_cur_line rd 1920 ; maximum width of screen
bgr_next_line rd 1920
;--------------------------------------
endg
 
;--------------------------------------
align 4
smooth_line:
mov al, [esi+2]
shl eax, 16
1054,6 → 1466,8
mov ebx, [esi+2]
shr ebx, 8
call [overlapping_of_points_ptr]
;--------------------------------------
align 4
@@:
stosd
mov eax, [esp+20+8]
1068,11 → 1482,13
lea eax, [eax*3]
sub esi, eax
jmp smooth_line
;--------------------------------------
align 4
@@:
mov eax, [draw_data+32+RECT.left]
mov [esp+20+8], eax
ret
 
;------------------------------------------------------------------------------
align 16
overlapping_of_points:
if 0
1137,18 → 1553,25
end if
 
iglobal
;--------------------------------------
align 4
overlapping_of_points_ptr dd overlapping_of_points
;--------------------------------------
endg
 
;------------------------------------------------------------------------------
align 4
init_background:
mov edi, BgrAuxTable
xor edx, edx
;--------------------------------------
align 4
.loop2:
mov eax, edx
shl eax, 8
neg eax
mov ecx, 0x200
;--------------------------------------
align 4
.loop1:
mov byte [edi], ah
inc edi
1159,9 → 1582,11
test byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
jz @f
mov [overlapping_of_points_ptr], overlapping_of_points_mmx
;--------------------------------------
align 4
@@:
ret
 
;------------------------------------------------------------------------------
align 16
overlapping_of_points_mmx:
movd mm0, eax
1181,3 → 1606,4
paddb mm4, mm1
movd eax, mm4
ret
;------------------------------------------------------------------------------