Function 15.8 - Get coordinates of last draw the background

git-svn-id: svn://kolibrios.org@2515 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-03-28 16:32:08 +00:00
parent 370072a7fd
commit 6cf03dd98c
3 changed files with 155 additions and 34 deletions

View File

@ -608,6 +608,23 @@
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 1 ¯à¨ ãᯥå¥, 0 ¯à¨ ®è¨¡ª¥ * eax = 1 ¯à¨ ãᯥå¥, 0 ¯à¨ ®è¨¡ª¥
======================================================================
====================== ”ã­ªæ¨ï 15, ¯®¤äã­ªæ¨ï 8 ======================
=========== <20>®«ãç¨âì ª®®à¤¨­ âë ¯®á«¥¤­¥© ®âà¨á®¢ª¨ ä®­ . ============
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 15 - ­®¬¥à ä㭪樨
* ebx = 8 - ­®¬¥à ¯®¤ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = [left]*65536 + [right]
* ebx = [top]*65536 + [bottom]
‡ ¬¥ç ­¨ï:
* (left,top) - ª®®à¤¨­ âë «¥¢®£® ¢¥àå­¥£® 㣫 ,
(right,bottom) - ª®®à¤¨­ âë ¯à ¢®£® ­¨¦­¥£®.
* „«ï ¯®«ã祭¨ï ¡®«¥¥ ¤®á⮢¥à­ëå ᢥ¤¥­¨©, ­¥®¡å®¤¨¬® ¢ë§¢ âì
äã­ªæ¨î áࠧ㠯®á«¥ ¯®«ã祭¨ï ᮡëâ¨ï:
5 = § ¢¥à訫 áì ¯¥à¥à¨á®¢ª  ä®­  à ¡®ç¥£® á⮫ 
====================================================================== ======================================================================
============= ”ã­ªæ¨ï 16 - á®åà ­¨âì à ¬¤¨áª ­  ¤¨áª¥âã. ============= ============= ”ã­ªæ¨ï 16 - á®åà ­¨âì à ¬¤¨áª ­  ¤¨áª¥âã. =============
====================================================================== ======================================================================

View File

@ -600,6 +600,23 @@ Parameters:
Returned value: Returned value:
* eax = 1 - success, 0 - error * eax = 1 - success, 0 - error
======================================================================
===================== Function 15, subfunction 8 =====================
============= Get coordinates of last draw the background ============
======================================================================
Parameters:
* eax = 15 - function number
* ebx = 8 - subfunction number
Returned value:
* eax = [left]*65536 + [right]
* ebx = [top]*65536 + [bottom]
Remarks:
* (left,top) are coordinates of the left upper corner,
(right,bottom) are coordinates of the right lower one.
* For receiving more reliable information, call the function
immediately after the event:
5 = kernel finished redrawing of the desktop background
====================================================================== ======================================================================
=============== Function 16 - save ramdisk on a floppy. ============== =============== Function 16 - save ramdisk on a floppy. ==============
====================================================================== ======================================================================

View File

@ -2384,35 +2384,44 @@ version_inf:
dd __REV__ dd __REV__
version_end: version_end:
endg endg
;------------------------------------------------------------------------------
align 4
sys_cachetodiskette: sys_cachetodiskette:
cmp ebx, 1 cmp ebx, 1
jne .no_floppy_a_save jne .no_floppy_a_save
mov [flp_number], 1 mov [flp_number], 1
jmp .save_image_on_floppy jmp .save_image_on_floppy
;--------------------------------------
align 4
.no_floppy_a_save: .no_floppy_a_save:
cmp ebx, 2 cmp ebx, 2
jne .no_floppy_b_save jne .no_floppy_b_save
mov [flp_number], 2 mov [flp_number], 2
;--------------------------------------
align 4
.save_image_on_floppy: .save_image_on_floppy:
call save_image call save_image
mov [esp + 32], dword 0 mov [esp + 32], dword 0
cmp [FDC_Status], 0 cmp [FDC_Status], 0
je .yes_floppy_save je .yes_floppy_save
;--------------------------------------
align 4
.no_floppy_b_save: .no_floppy_b_save:
mov [esp + 32], dword 1 mov [esp + 32], dword 1
;--------------------------------------
align 4
.yes_floppy_save: .yes_floppy_save:
ret ret
;------------------------------------------------------------------------------
uglobal uglobal
; bgrchanged dd 0x0 ; bgrchanged dd 0x0
align 4 align 4
bgrlockpid dd 0 bgrlockpid dd 0
bgrlock db 0 bgrlock db 0
endg endg
;------------------------------------------------------------------------------
align 4
sys_background: sys_background:
cmp ebx, 1 ; BACKGROUND SIZE cmp ebx, 1 ; BACKGROUND SIZE
jnz nosb1 jnz nosb1
test ecx, ecx test ecx, ecx
@ -2421,12 +2430,16 @@ sys_background:
test edx, edx test edx, edx
; cmp edx,0 ; cmp edx,0
jz sbgrr jz sbgrr
;--------------------------------------
align 4
@@: @@:
;;Maxis use atomic bts for mutexes 4.4.2009 ;;Maxis use atomic bts for mutexes 4.4.2009
bts dword [bgrlock], 0 bts dword [bgrlock], 0
jnc @f jnc @f
call change_task call change_task
jmp @b jmp @b
;--------------------------------------
align 4
@@: @@:
mov [BgrDataWidth], ecx mov [BgrDataWidth], ecx
mov [BgrDataHeight], edx mov [BgrDataHeight], edx
@ -2438,6 +2451,8 @@ sys_background:
cmp eax, static_background_data cmp eax, static_background_data
jz @f jz @f
stdcall kernel_free, eax stdcall kernel_free, eax
;--------------------------------------
align 4
@@: @@:
; calculate RAW size ; calculate RAW size
xor eax, eax xor eax, eax
@ -2445,10 +2460,14 @@ sys_background:
cmp [BgrDataWidth], eax cmp [BgrDataWidth], eax
jae @f jae @f
mov [BgrDataWidth], eax mov [BgrDataWidth], eax
;--------------------------------------
align 4
@@: @@:
cmp [BgrDataHeight], eax cmp [BgrDataHeight], eax
jae @f jae @f
mov [BgrDataHeight], eax mov [BgrDataHeight], eax
;--------------------------------------
align 4
@@: @@:
mov eax, [BgrDataWidth] mov eax, [BgrDataWidth]
imul eax, [BgrDataHeight] imul eax, [BgrDataHeight]
@ -2466,6 +2485,8 @@ sys_background:
jz .memfailed jz .memfailed
mov [img_background], eax mov [img_background], eax
jmp .exit jmp .exit
;--------------------------------------
align 4
.memfailed: .memfailed:
; revert to static monotone data ; revert to static monotone data
mov [img_background], static_background_data mov [img_background], static_background_data
@ -2474,15 +2495,18 @@ sys_background:
mov [BgrDataWidth], eax mov [BgrDataWidth], eax
mov [BgrDataHeight], eax mov [BgrDataHeight], eax
mov [mem_BACKGROUND], 4 mov [mem_BACKGROUND], 4
;--------------------------------------
align 4
.exit: .exit:
popad popad
mov [bgrlock], 0 mov [bgrlock], 0
;--------------------------------------
sbgrr: align 4
sbgrr:
ret ret
;------------------------------------------------------------------------------
align 4
nosb1: nosb1:
cmp ebx, 2 ; SET PIXEL cmp ebx, 2 ; SET PIXEL
jnz nosb2 jnz nosb2
@ -2491,6 +2515,8 @@ nosb1:
jz @f jz @f
cmp eax, static_background_data cmp eax, static_background_data
jz .ret jz .ret
;--------------------------------------
align 4
@@: @@:
mov ebx, [mem_BACKGROUND] mov ebx, [mem_BACKGROUND]
add ebx, 4095 add ebx, 4095
@ -2504,28 +2530,39 @@ nosb1:
and edx, 0x00FFFFFF;255*256*256+255*256+255 and edx, 0x00FFFFFF;255*256*256+255*256+255
add edx, ebx add edx, ebx
mov [eax+ecx], edx mov [eax+ecx], edx
;--------------------------------------
align 4
.ret: .ret:
ret ret
;------------------------------------------------------------------------------
align 4
nosb2: nosb2:
cmp ebx, 3 ; DRAW BACKGROUND cmp ebx, 3 ; DRAW BACKGROUND
jnz nosb3 jnz nosb3
;--------------------------------------
align 4
draw_background_temp: draw_background_temp:
mov [background_defined], 1 mov [background_defined], 1
call force_redraw_background call force_redraw_background
nosb31: ;--------------------------------------
align 4
nosb31:
ret ret
nosb3: ;------------------------------------------------------------------------------
align 4
nosb3:
cmp ebx, 4 ; TILED / STRETCHED cmp ebx, 4 ; TILED / STRETCHED
jnz nosb4 jnz nosb4
cmp ecx, [BgrDrawMode] cmp ecx, [BgrDrawMode]
je nosb41 je nosb41
mov [BgrDrawMode], ecx mov [BgrDrawMode], ecx
nosb41: ;--------------------------------------
align 4
nosb41:
ret ret
nosb4: ;------------------------------------------------------------------------------
align 4
nosb4:
cmp ebx, 5 ; BLOCK MOVE TO BGR cmp ebx, 5 ; BLOCK MOVE TO BGR
jnz nosb5 jnz nosb5
cmp [img_background], static_background_data cmp [img_background], static_background_data
@ -2534,25 +2571,34 @@ draw_background_temp:
jnz .fin jnz .fin
cmp esi, 4 cmp esi, 4
ja .fin ja .fin
@@: ;--------------------------------------
align 4
@@:
; bughere ; bughere
mov eax, ecx mov eax, ecx
mov ebx, edx mov ebx, edx
add ebx, [img_background];IMG_BACKGROUND add ebx, [img_background];IMG_BACKGROUND
mov ecx, esi mov ecx, esi
call memmove call memmove
.fin: ;--------------------------------------
align 4
.fin:
ret ret
nosb5: ;------------------------------------------------------------------------------
align 4
nosb5:
cmp ebx, 6 cmp ebx, 6
jnz nosb6 jnz nosb6
;--------------------------------------
align 4
;;Maxis use atomic bts for mutex 4.4.2009 ;;Maxis use atomic bts for mutex 4.4.2009
@@: @@:
bts dword [bgrlock], 0 bts dword [bgrlock], 0
jnc @f jnc @f
call change_task call change_task
jmp @b jmp @b
;--------------------------------------
align 4
@@: @@:
mov eax, [CURRENT_TASK] mov eax, [CURRENT_TASK]
mov [bgrlockpid], eax mov [bgrlockpid], eax
@ -2570,11 +2616,15 @@ draw_background_temp:
mov ecx, [mem_BACKGROUND] mov ecx, [mem_BACKGROUND]
add ecx, 0xFFF add ecx, 0xFFF
shr ecx, 12 shr ecx, 12
;--------------------------------------
align 4
.z: .z:
mov eax, [page_tabs+ebx*4] mov eax, [page_tabs+ebx*4]
test al, 1 test al, 1
jz @f jz @f
call free_page call free_page
;--------------------------------------
align 4
@@: @@:
mov eax, [page_tabs+esi*4] mov eax, [page_tabs+esi*4]
or al, PG_UW or al, PG_UW
@ -2586,9 +2636,13 @@ draw_background_temp:
inc esi inc esi
loop .z loop .z
ret ret
;--------------------------------------
align 4
.nomem: .nomem:
and [bgrlockpid], 0 and [bgrlockpid], 0
mov [bgrlock], 0 mov [bgrlock], 0
;------------------------------------------------------------------------------
align 4
nosb6: nosb6:
cmp ebx, 7 cmp ebx, 7
jnz nosb7 jnz nosb7
@ -2607,6 +2661,8 @@ nosb6:
push eax push eax
shr ecx, 12 shr ecx, 12
dec ecx dec ecx
;--------------------------------------
align 4
@@: @@:
and dword [page_tabs+eax*4], 0 and dword [page_tabs+eax*4], 0
mov edx, eax mov edx, eax
@ -2623,13 +2679,31 @@ nosb6:
and [bgrlockpid], 0 and [bgrlockpid], 0
mov [bgrlock], 0 mov [bgrlock], 0
ret ret
;--------------------------------------
align 4
.err: .err:
and dword [esp+32], 0 and dword [esp+32], 0
ret ret
;------------------------------------------------------------------------------
align 4
nosb7: nosb7:
cmp ebx, 8
jnz nosb8
mov eax, [draw_data+32 + RECT.left]
shl eax, 16
add eax, [draw_data+32 + RECT.right]
mov [esp + 32], eax ; eax = [left]*65536 + [right]
mov eax, [draw_data+32 + RECT.top]
shl eax, 16
add eax, [draw_data+32 + RECT.bottom]
mov [esp + 20], eax ; ebx = [top]*65536 + [bottom]
ret ret
;------------------------------------------------------------------------------
align 4
nosb8:
ret
;------------------------------------------------------------------------------
align 4
force_redraw_background: force_redraw_background:
and [draw_data+32 + RECT.left], 0 and [draw_data+32 + RECT.left], 0
and [draw_data+32 + RECT.top], 0 and [draw_data+32 + RECT.top], 0
@ -2641,9 +2715,8 @@ force_redraw_background:
pop ebx eax pop ebx eax
inc byte[REDRAW_BACKGROUND] inc byte[REDRAW_BACKGROUND]
ret ret
;------------------------------------------------------------------------------
align 4 align 4
sys_getbackground: sys_getbackground:
; cmp eax,1 ; SIZE ; cmp eax,1 ; SIZE
dec ebx dec ebx
@ -2653,7 +2726,8 @@ sys_getbackground:
mov ax, [BgrDataHeight] mov ax, [BgrDataHeight]
mov [esp+32], eax mov [esp+32], eax
ret ret
;------------------------------------------------------------------------------
align 4
nogb1: nogb1:
; cmp eax,2 ; PIXEL ; cmp eax,2 ; PIXEL
dec ebx dec ebx
@ -2664,6 +2738,8 @@ nogb1:
jz @f jz @f
cmp eax, static_background_data cmp eax, static_background_data
jz .ret jz .ret
;--------------------------------------
align 4
@@: @@:
mov ebx, [mem_BACKGROUND] mov ebx, [mem_BACKGROUND]
add ebx, 4095 add ebx, 4095
@ -2676,21 +2752,26 @@ nogb1:
and eax, 0xFFFFFF and eax, 0xFFFFFF
mov [esp+32], eax mov [esp+32], eax
;--------------------------------------
align 4
.ret: .ret:
ret ret
nogb2: ;------------------------------------------------------------------------------
align 4
nogb2:
; cmp eax,4 ; TILED / STRETCHED ; cmp eax,4 ; TILED / STRETCHED
dec ebx dec ebx
dec ebx dec ebx
jnz nogb4 jnz nogb4
mov eax, [BgrDrawMode] mov eax, [BgrDrawMode]
nogb4: ;--------------------------------------
align 4
nogb4:
mov [esp+32], eax mov [esp+32], eax
ret ret
;------------------------------------------------------------------------------
align 4 align 4
sys_getkey: sys_getkey:
mov [esp + 32], dword 1 mov [esp + 32], dword 1
; test main buffer ; test main buffer
@ -2712,12 +2793,18 @@ sys_getkey:
mov ebx, KEY_BUFF mov ebx, KEY_BUFF
call memmove call memmove
pop eax pop eax
;--------------------------------------
align 4
.ret_eax: .ret_eax:
mov [esp + 32], eax mov [esp + 32], eax
ret ret
;--------------------------------------
align 4
.finish: .finish:
; test hotkeys buffer ; test hotkeys buffer
mov ecx, hotkey_buffer mov ecx, hotkey_buffer
;--------------------------------------
align 4
@@: @@:
cmp [ecx], ebx cmp [ecx], ebx
jz .found jz .found
@ -2725,6 +2812,8 @@ sys_getkey:
cmp ecx, hotkey_buffer + 120 * 8 cmp ecx, hotkey_buffer + 120 * 8
jb @b jb @b
ret ret
;--------------------------------------
align 4
.found: .found:
mov ax, [ecx + 6] mov ax, [ecx + 6]
shl eax, 16 shl eax, 16
@ -2733,11 +2822,9 @@ sys_getkey:
and dword [ecx + 4], 0 and dword [ecx + 4], 0
and dword [ecx], 0 and dword [ecx], 0
jmp .ret_eax jmp .ret_eax
;------------------------------------------------------------------------------
align 4 align 4
sys_getbutton: sys_getbutton:
mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK
mov [esp + 32], dword 1 mov [esp + 32], dword 1
movzx ecx, word [WIN_STACK + ebx * 2] movzx ecx, word [WIN_STACK + ebx * 2]
@ -2751,12 +2838,12 @@ sys_getbutton:
and al, 0xFE ; delete left button bit and al, 0xFE ; delete left button bit
mov [BTN_COUNT], byte 0 mov [BTN_COUNT], byte 0
mov [esp + 32], eax mov [esp + 32], eax
;--------------------------------------
align 4
.exit: .exit:
ret ret
;------------------------------------------------------------------------------
align 4 align 4
sys_cpuusage: sys_cpuusage:
; RETURN: ; RETURN: