'Event 5' is changed now. Event returns after redrawing the background.

git-svn-id: svn://kolibrios.org@2513 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-03-27 20:02:50 +00:00
parent 8a05d855b7
commit 659824c952
6 changed files with 212 additions and 139 deletions

View File

@ -255,7 +255,7 @@ SYS_SHUTDOWN equ (OS_BASE+0x000FF00)
TASK_ACTIVATE equ (OS_BASE+0x000FF01) TASK_ACTIVATE equ (OS_BASE+0x000FF01)
REDRAW_BACKGROUND equ (OS_BASE+0x000FFF0) REDRAW_BACKGROUND equ (OS_BASE+0x000FFF0)
BACKGROUND_CHANGED equ (OS_BASE+0x000FFF1)
BANK_RW equ (OS_BASE+0x000FFF2) BANK_RW equ (OS_BASE+0x000FFF2)
MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4) MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4)
DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5) DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5)

View File

@ -4497,10 +4497,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
ª­®¯ª¨ ¨§ ¡ãä¥à  áç¨â ­ë ä㭪樥© 17) ª­®¯ª¨ ¨§ ¡ãä¥à  áç¨â ­ë ä㭪樥© 17)
* 4 = § à¥§¥à¢¨à®¢ ­® (¢ ⥪ã饩 ॠ«¨§ æ¨¨ ­¨ª®£¤  ­¥ ¯à¨å®¤¨â ¤ ¦¥ * 4 = § à¥§¥à¢¨à®¢ ­® (¢ ⥪ã饩 ॠ«¨§ æ¨¨ ­¨ª®£¤  ­¥ ¯à¨å®¤¨â ¤ ¦¥
¯à¨ à §¬ áª¨à®¢ª¥ ä㭪樥© 40) ¯à¨ à §¬ áª¨à®¢ª¥ ä㭪樥© 40)
* 5 = ¯¥à¥à¨á®¢ë¢ ¥âáï ä®­ à ¡®ç¥£® á⮫  (á¡à á뢠¥âáï * 5 = § ¢¥à訫 áì ¯¥à¥à¨á®¢ª  ä®­  à ¡®ç¥£® á⮫ 
 ¢â®¬ â¨ç¥áª¨ ¯®á«¥ ¯¥à¥à¨á®¢ª¨, â ª çâ® ¥á«¨ ¢® ¢à¥¬ï ¯¥à¥à¨á®¢ª¨
ä®­  ¯à®£à ¬¬  ­¥ ¦¤ñâ ¨ ­¥ ¯à®¢¥àï¥â ᮡëâ¨ï, â® í⮣® ᮡëâ¨ï
®­  ­¥ § ¬¥â¨â)
* 6 = ᮡë⨥ ®â ¬ëè¨ (çâ®-â® á«ã稫®áì - ­ ¦ â¨¥ ­  ª­®¯ªã ¬ëè¨ * 6 = ᮡë⨥ ®â ¬ëè¨ (çâ®-â® á«ã稫®áì - ­ ¦ â¨¥ ­  ª­®¯ªã ¬ëè¨
¨«¨ ¯¥à¥¬¥é¥­¨¥; á¡à á뢠¥âáï ¯à¨ ¯à®ç⥭¨¨) ¨«¨ ¯¥à¥¬¥é¥­¨¥; á¡à á뢠¥âáï ¯à¨ ¯à®ç⥭¨¨)
* 7 = ¯à®¨§®è«® ᮡë⨥ IPC (ᬮâਠäã­ªæ¨î 60 - Inter Process * 7 = ¯à®¨§®è«® ᮡë⨥ IPC (ᬮâਠäã­ªæ¨î 60 - Inter Process

View File

@ -4463,9 +4463,7 @@ Codes of events:
are read out by function 17) are read out by function 17)
* 4 = reserved (in current implementation never comes even after * 4 = reserved (in current implementation never comes even after
unmasking by function 40) unmasking by function 40)
* 5 = the desktop background is redrawed (is reset automatically * 5 = kernel finished redrawing of the desktop background
after redraw, so if in redraw time program does not wait and
does not check events, it will not remark this event)
* 6 = mouse event (something happened - button pressing or moving; * 6 = mouse event (something happened - button pressing or moving;
is reset at reading) is reset at reading)
* 7 = IPC event (see function 60 - * 7 = IPC event (see function 60 -

View File

@ -23,6 +23,7 @@ endg
EV_SPACE = 512 EV_SPACE = 512
FreeEvents = event_start-EVENT.fd ; "âèðòóàëüíûé" event, èñïîëüçóþòñÿ òîëüêî ïîëÿ: FreeEvents = event_start-EVENT.fd ; "âèðòóàëüíûé" event, èñïîëüçóþòñÿ òîëüêî ïîëÿ:
; FreeEvents.fd=event_start è FreeEvents.bk=event_end ; FreeEvents.fd=event_start è FreeEvents.bk=event_end
;-----------------------------------------------------------------------------
align 4 align 4
init_events: ;; used from kernel.asm init_events: ;; used from kernel.asm
stdcall kernel_alloc, EV_SPACE*sizeof.EVENT stdcall kernel_alloc, EV_SPACE*sizeof.EVENT
@ -32,7 +33,9 @@ init_events: ;; used from kernel.asm
mov ecx, EV_SPACE ; current - in allocated space mov ecx, EV_SPACE ; current - in allocated space
mov ebx, FreeEvents ; previos - íà÷àëî ñïèñêà mov ebx, FreeEvents ; previos - íà÷àëî ñïèñêà
push ebx ; îíî æå è êîíåö ïîòîì áóäåò push ebx ; îíî æå è êîíåö ïîòîì áóäåò
@@: ;--------------------------------------
align 4
@@:
mov [ebx+EVENT.fd], eax mov [ebx+EVENT.fd], eax
mov [eax+EVENT.bk], ebx mov [eax+EVENT.bk], ebx
mov ebx, eax ; previos <- current mov ebx, eax ; previos <- current
@ -41,14 +44,16 @@ init_events: ;; used from kernel.asm
pop eax ; âîò îíî êîíöîì è ñòàëî pop eax ; âîò îíî êîíöîì è ñòàëî
mov [ebx+EVENT.fd], eax mov [ebx+EVENT.fd], eax
mov [eax+EVENT.bk], ebx mov [eax+EVENT.bk], ebx
;--------------------------------------
align 4
.fail: .fail:
ret ret
;-----------------------------------------------------------------------------
EVENT_WATCHED equ 0x10000000 ;áèò 28 EVENT_WATCHED equ 0x10000000 ;áèò 28
EVENT_SIGNALED equ 0x20000000 ;áèò 29 EVENT_SIGNALED equ 0x20000000 ;áèò 29
MANUAL_RESET equ 0x40000000 ;áèò 30 MANUAL_RESET equ 0x40000000 ;áèò 30
MANUAL_DESTROY equ 0x80000000 ;áèò 31 MANUAL_DESTROY equ 0x80000000 ;áèò 31
;-----------------------------------------------------------------------------
align 4 align 4
create_event: ;; EXPORT use create_event: ;; EXPORT use
;info: ;info:
@ -67,7 +72,8 @@ create_event: ;; EXPORT use
mov edx, [edx+TASKDATA.pid] mov edx, [edx+TASKDATA.pid]
pushfd pushfd
cli cli
;--------------------------------------
align 4
set_event: ;; INTERNAL use !!! don't use for Call set_event: ;; INTERNAL use !!! don't use for Call
;info: ;info:
; Áåðåì íîâûé event èç FreeEvents, çàïîëíÿåì åãî ïîëÿ, êàê óêàçàíî â ecx,edx,esi ; Áåðåì íîâûé event èç FreeEvents, çàïîëíÿåì åãî ïîëÿ, êàê óêàçàíî â ecx,edx,esi
@ -89,7 +95,9 @@ set_event: ;; INTERNAL use !!! don't use
call init_events call init_events
popad popad
jz RemoveEventTo.break ; POPF+RET jz RemoveEventTo.break ; POPF+RET
@@: ;--------------------------------------
align 4
@@:
mov eax, [eax+EVENT.fd] mov eax, [eax+EVENT.fd]
mov [eax+EVENT.magic], 'EVNT' mov [eax+EVENT.magic], 'EVNT'
mov [eax+EVENT.destroy], destroy_event.internal mov [eax+EVENT.destroy], destroy_event.internal
@ -103,7 +111,8 @@ set_event: ;; INTERNAL use !!! don't use
mov ecx, (sizeof.EVENT -EVENT.code)/4 mov ecx, (sizeof.EVENT -EVENT.code)/4
cld cld
rep movsd rep movsd
;--------------------------------------
align 4
RemoveEventTo: ;; INTERNAL use !!! don't use for Call RemoveEventTo: ;; INTERNAL use !!! don't use for Call
;param: ;param:
; eax - óêàçàòåëü íà event, ÊÎÒÎÐÛÉ âñòàâëÿåì ; eax - óêàçàòåëü íà event, ÊÎÒÎÐÛÉ âñòàâëÿåì
@ -118,10 +127,12 @@ RemoveEventTo: ;; INTERNAL use !!! don't use
xchg ecx, [eax+EVENT.fd] ; Self.fd=NewRight, ecx=OldRight xchg ecx, [eax+EVENT.fd] ; Self.fd=NewRight, ecx=OldRight
mov [ebx+EVENT.fd], ecx ; OldLeft.fd=OldRight mov [ebx+EVENT.fd], ecx ; OldLeft.fd=OldRight
mov [ecx+EVENT.bk], ebx ; OldRight.bk=OldLeft mov [ecx+EVENT.bk], ebx ; OldRight.bk=OldLeft
;--------------------------------------
align 4
.break: .break:
popfd popfd
ret ret
;-----------------------------------------------------------------------------
align 4 align 4
NotDummyTest: ;; INTERNAL use (not returned for fail !!!) NotDummyTest: ;; INTERNAL use (not returned for fail !!!)
pop edi pop edi
@ -129,6 +140,8 @@ NotDummyTest: ;; INTERNAL use (not returned
mov ebx, eax mov ebx, eax
mov eax, [ebx+EVENT.pid] mov eax, [ebx+EVENT.pid]
push edi push edi
;--------------------------------------
align 4
.small: ; êðèâî êàê-òî... .small: ; êðèâî êàê-òî...
pop edi pop edi
pushfd pushfd
@ -137,7 +150,7 @@ NotDummyTest: ;; INTERNAL use (not returned
shl eax, 8 shl eax, 8
jz RemoveEventTo.break ; POPF+RET jz RemoveEventTo.break ; POPF+RET
jmp edi ; øòàòíûé âîçâðàò jmp edi ; øòàòíûé âîçâðàò
;-----------------------------------------------------------------------------
align 4 align 4
raise_event: ;; EXPORT use raise_event: ;; EXPORT use
;info: ;info:
@ -158,19 +171,23 @@ raise_event: ;; EXPORT use
mov ecx, (sizeof.EVENT -EVENT.code)/4 mov ecx, (sizeof.EVENT -EVENT.code)/4
cld cld
rep movsd rep movsd
@@: ;--------------------------------------
align 4
@@:
test byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24 test byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24
jnz RemoveEventTo.break ; POPF+RET jnz RemoveEventTo.break ; POPF+RET
bt edx, 28 ;EVENT_WATCHED bt edx, 28 ;EVENT_WATCHED
jnc @f jnc @f
test byte[ebx+EVENT.state+3], EVENT_WATCHED shr 24 test byte[ebx+EVENT.state+3], EVENT_WATCHED shr 24
jz RemoveEventTo.break ; POPF+RET jz RemoveEventTo.break ; POPF+RET
@@: ;--------------------------------------
align 4
@@:
or byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24 or byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24
add eax, SLOT_BASE+APP_EV_OFFSET add eax, SLOT_BASE+APP_EV_OFFSET
xchg eax, ebx xchg eax, ebx
jmp RemoveEventTo jmp RemoveEventTo
;-----------------------------------------------------------------------------
align 4 align 4
clear_event: ;; EXPORT use clear_event: ;; EXPORT use
;info: ;info:
@ -184,7 +201,7 @@ clear_event: ;; EXPORT use
and byte[ebx+EVENT.state+3], not((EVENT_SIGNALED+EVENT_WATCHED)shr 24) and byte[ebx+EVENT.state+3], not((EVENT_SIGNALED+EVENT_WATCHED)shr 24)
xchg eax, ebx xchg eax, ebx
jmp RemoveEventTo jmp RemoveEventTo
;-----------------------------------------------------------------------------
align 4 align 4
send_event: ;; EXPORT use send_event: ;; EXPORT use
;info: ;info:
@ -207,7 +224,7 @@ send_event: ;; EXPORT use
lea ebx, [eax+SLOT_BASE+APP_EV_OFFSET] lea ebx, [eax+SLOT_BASE+APP_EV_OFFSET]
mov ecx, EVENT_SIGNALED mov ecx, EVENT_SIGNALED
jmp set_event jmp set_event
;-----------------------------------------------------------------------------
align 4 align 4
DummyTest: ;; INTERNAL use (not returned for fail !!!) DummyTest: ;; INTERNAL use (not returned for fail !!!)
;param: ;param:
@ -217,16 +234,21 @@ DummyTest: ;; INTERNAL use (not returned
jne @f jne @f
cmp [eax+EVENT.id], ebx cmp [eax+EVENT.id], ebx
je .ret je .ret
@@: ;--------------------------------------
align 4
@@:
pop eax pop eax
xor eax, eax xor eax, eax
;--------------------------------------
align 4
.ret: .ret:
ret ret
;-----------------------------------------------------------------------------
align 4 align 4
Wait_events: Wait_events:
or ebx, -1; infinite timeout or ebx, -1; infinite timeout
;--------------------------------------
align 4
Wait_events_ex: Wait_events_ex:
;info: ;info:
; Îæèäàíèå "àáñòðàêòíîãî" ñîáûòèÿ ÷åðåç ïåðåâîä ñëîòà â 5-þ ïîçèöèþ. ; Îæèäàíèå "àáñòðàêòíîãî" ñîáûòèÿ ÷åðåç ïåðåâîä ñëîòà â 5-þ ïîçèöèþ.
@ -260,9 +282,11 @@ Wait_events_ex:
mov [eax+TASKDATA.state], 5 mov [eax+TASKDATA.state], 5
call change_task call change_task
mov eax, [esi+APPDATA.wait_param] mov eax, [esi+APPDATA.wait_param]
@@: ;--------------------------------------
align 4
@@:
ret ret
;-----------------------------------------------------------------------------
align 4 align 4
wait_event: ;; EXPORT use wait_event: ;; EXPORT use
;info: ;info:
@ -281,7 +305,7 @@ wait_event: ;; EXPORT use
mov edx, get_event_alone ; wait_test mov edx, get_event_alone ; wait_test
call Wait_events ; timeout ignored call Wait_events ; timeout ignored
jmp wait_finish jmp wait_finish
;-----------------------------------------------------------------------------
align 4 align 4
get_event_ex: ;; f68:14 get_event_ex: ;; f68:14
;info: ;info:
@ -303,6 +327,8 @@ get_event_ex: ;; f68:14
cld cld
rep movsd rep movsd
mov byte[edi-(sizeof.EVENT-EVENT.code)+2], cl;clear priority field mov byte[edi-(sizeof.EVENT-EVENT.code)+2], cl;clear priority field
;--------------------------------------
align 4
wait_finish: wait_finish:
test byte[eax+EVENT.state+3], MANUAL_RESET shr 24 test byte[eax+EVENT.state+3], MANUAL_RESET shr 24
jnz get_event_queue.ret ; RET jnz get_event_queue.ret ; RET
@ -314,7 +340,7 @@ wait_finish:
pushfd pushfd
cli cli
jmp RemoveEventTo jmp RemoveEventTo
;-----------------------------------------------------------------------------
align 4 align 4
destroy_event: ;; EXPORT use destroy_event: ;; EXPORT use
;info: ;info:
@ -326,6 +352,8 @@ destroy_event: ;; EXPORT use
; eax - àäðåñ îáúåêòà EVENT (=0 => fail) ; eax - àäðåñ îáúåêòà EVENT (=0 => fail)
;scratched: ebx,ecx ;scratched: ebx,ecx
call DummyTest ; not returned for fail !!! call DummyTest ; not returned for fail !!!
;--------------------------------------
align 4
.internal: .internal:
xor ecx, ecx ; clear common header xor ecx, ecx ; clear common header
pushfd pushfd
@ -336,7 +364,7 @@ destroy_event: ;; EXPORT use
mov [eax+EVENT.id], ecx mov [eax+EVENT.id], ecx
mov ebx, FreeEvents mov ebx, FreeEvents
jmp RemoveEventTo jmp RemoveEventTo
;-----------------------------------------------------------------------------
align 4 align 4
get_event_queue: get_event_queue:
;info: ;info:
@ -353,9 +381,11 @@ get_event_queue:
mov eax, [ebx+APPOBJ.bk] ; âûáèðàåì ñ êîíöà, ïî ïðèíöèïó FIFO mov eax, [ebx+APPOBJ.bk] ; âûáèðàåì ñ êîíöà, ïî ïðèíöèïó FIFO
cmp eax, ebx ; empty ??? cmp eax, ebx ; empty ???
je get_event_alone.ret0 je get_event_alone.ret0
;--------------------------------------
align 4
.ret: .ret:
ret ret
;-----------------------------------------------------------------------------
align 4 align 4
get_event_alone: get_event_alone:
;info: ;info:
@ -372,11 +402,15 @@ get_event_alone:
test byte[eax+EVENT.state+3], EVENT_SIGNALED shr 24 test byte[eax+EVENT.state+3], EVENT_SIGNALED shr 24
jnz .ret jnz .ret
or byte[eax+EVENT.state+3], EVENT_WATCHED shr 24 or byte[eax+EVENT.state+3], EVENT_WATCHED shr 24
;--------------------------------------
align 4
.ret0: .ret0:
xor eax, eax; NO event!!! xor eax, eax; NO event!!!
;--------------------------------------
align 4
.ret: .ret:
ret ret
;-----------------------------------------------------------------------------
align 4 align 4
sys_sendwindowmsg: ;; f72 sys_sendwindowmsg: ;; f72
dec ebx dec ebx
@ -387,6 +421,8 @@ sys_sendwindowmsg: ;; f72
je .sendkey je .sendkey
dec ecx dec ecx
jnz .retf jnz .retf
;--------------------------------------
align 4
.sendbtn: .sendbtn:
cmp byte[BTN_COUNT], 1 cmp byte[BTN_COUNT], 1
jae .result ;overflow jae .result ;overflow
@ -394,19 +430,27 @@ sys_sendwindowmsg: ;; f72
shl edx, 8 shl edx, 8
mov [BTN_BUFF], edx mov [BTN_BUFF], edx
jmp .result jmp .result
;--------------------------------------
align 4
.sendkey: .sendkey:
movzx eax, byte[KEY_COUNT] movzx eax, byte[KEY_COUNT]
cmp al, 120 cmp al, 120
jae .result ;overflow jae .result ;overflow
inc byte[KEY_COUNT] inc byte[KEY_COUNT]
mov [KEY_COUNT+1+eax], dl mov [KEY_COUNT+1+eax], dl
;--------------------------------------
align 4
.result: .result:
setae byte[esp+32] ;ñ÷èòàåì, ÷òî èñõîäíî: dword[esp+32]==72 setae byte[esp+32] ;ñ÷èòàåì, ÷òî èñõîäíî: dword[esp+32]==72
;--------------------------------------
align 4
.retf: .retf:
popfd popfd
;--------------------------------------
align 4
.ret: .ret:
ret ret
;-----------------------------------------------------------------------------
align 4 align 4
sys_getevent: ;; f11 sys_getevent: ;; f11
mov ebx, [current_slot];ïîêà ýòî âîïðîñ, ÷åãî êóäû ñóâàòü.......... mov ebx, [current_slot];ïîêà ýòî âîïðîñ, ÷åãî êóäû ñóâàòü..........
@ -416,16 +460,18 @@ sys_getevent: ;; f11
popfd popfd
mov [esp+32], eax mov [esp+32], eax
ret ret
;-----------------------------------------------------------------------------
align 4 align 4
sys_waitforevent: ;; f10 sys_waitforevent: ;; f10
or ebx, -1; infinite timeout or ebx, -1; infinite timeout
;--------------------------------------
align 4
sys_wait_event_timeout: ;; f23 sys_wait_event_timeout: ;; f23
mov edx, get_event_for_app; wait_test mov edx, get_event_for_app; wait_test
call Wait_events_ex ; ebx - timeout call Wait_events_ex ; ebx - timeout
mov [esp+32], eax mov [esp+32], eax
ret ret
;-----------------------------------------------------------------------------
align 4 align 4
get_event_for_app: ;; used from f10,f11,f23 get_event_for_app: ;; used from f10,f11,f23
;info: ;info:
@ -443,6 +489,8 @@ get_event_for_app: ;; used from f10,f11,f23
add edi, CURRENT_TASK ; edi is assumed as [TASK_BASE] add edi, CURRENT_TASK ; edi is assumed as [TASK_BASE]
mov ecx, [edi+TASKDATA.event_mask] mov ecx, [edi+TASKDATA.event_mask]
and ecx, 0x7FFFFFFF and ecx, 0x7FFFFFFF
;--------------------------------------
align 4
.loop: ; ïîêà íå èñ÷åðïàåì âñå áèòû ìàñêè .loop: ; ïîêà íå èñ÷åðïàåì âñå áèòû ìàñêè
bsr eax, ecx ; íàõîäèì íåíóëåâîé áèò ìàñêè (31 -> 0) bsr eax, ecx ; íàõîäèì íåíóëåâîé áèò ìàñêè (31 -> 0)
jz .no_events ; èñ÷åðïàëè âñå áèòû ìàñêè, íî íè÷åãî íå íàøëè ??? jz .no_events ; èñ÷åðïàëè âñå áèòû ìàñêè, íî íè÷åãî íå íàøëè ???
@ -455,14 +503,19 @@ get_event_for_app: ;; used from f10,f11,f23
ja .FlagAutoReset ; eax=[4..8], retvals=eax+1 ja .FlagAutoReset ; eax=[4..8], retvals=eax+1
cmp eax, 1 cmp eax, 1
jae .BtKy ; eax=[1,2], retvals=eax+1 jae .BtKy ; eax=[1,2], retvals=eax+1
;--------------------------------------
align 4
.WndRedraw: ; eax=0, retval WndRedraw=1 .WndRedraw: ; eax=0, retval WndRedraw=1
cmp [edi-twdw+WDATA.fl_redraw], al;al==0 cmp [edi-twdw+WDATA.fl_redraw], al;al==0
jne .result jne .result
jmp .loop jmp .loop
.no_events: ;--------------------------------------
align 4
.no_events:
xor eax, eax xor eax, eax
ret ret
;--------------------------------------
align 4
.FlagAutoReset: ; retvals: BgrRedraw=5, Mouse=6, IPC=7, Stack=8, Debug=9 .FlagAutoReset: ; retvals: BgrRedraw=5, Mouse=6, IPC=7, Stack=8, Debug=9
cmp eax, 5; Mouse 5+1=6 cmp eax, 5; Mouse 5+1=6
jne .no_mouse_check jne .no_mouse_check
@ -473,6 +526,8 @@ get_event_for_app: ;; used from f10,f11,f23
jz @f jz @f
pop eax pop eax
jmp .no_mouse_check jmp .no_mouse_check
;--------------------------------------
align 4
@@: @@:
; If the window is captured and moved by the user, then no mouse events!!! ; If the window is captured and moved by the user, then no mouse events!!!
mov al, [mouse.active_sys_window.action] mov al, [mouse.active_sys_window.action]
@ -480,16 +535,24 @@ get_event_for_app: ;; used from f10,f11,f23
test al, al test al, al
pop eax pop eax
jnz .loop jnz .loop
;--------------------------------------
align 4
.no_mouse_check: .no_mouse_check:
btr [ebx+APPDATA.event_mask], eax btr [ebx+APPDATA.event_mask], eax
jnc .loop jnc .loop
.result: ; retval = eax+1 ;--------------------------------------
align 4
.result: ; retval = eax+1
inc eax inc eax
ret ret
.BtKy: ;--------------------------------------
align 4
.BtKy:
movzx edx, bh movzx edx, bh
movzx edx, word[WIN_STACK+edx*2] movzx edx, word[WIN_STACK+edx*2]
je .Keys ; eax=1, retval Keys=2 je .Keys ; eax=1, retval Keys=2
;--------------------------------------
align 4
.Buttons: ; eax=2, retval Buttons=3 .Buttons: ; eax=2, retval Buttons=3
cmp byte[BTN_COUNT], 0 cmp byte[BTN_COUNT], 0
je .loop ; empty ??? je .loop ; empty ???
@ -502,14 +565,20 @@ get_event_for_app: ;; used from f10,f11,f23
mov [window_minimize], 1 mov [window_minimize], 1
dec byte[BTN_COUNT] dec byte[BTN_COUNT]
jmp .loop jmp .loop
;--------------------------------------
align 4
.Keys: ; eax==1 .Keys: ; eax==1
cmp edx, [TASK_COUNT] cmp edx, [TASK_COUNT]
jne @f ; not Top ??? jne @f ; not Top ???
cmp [KEY_COUNT], al; al==1 cmp [KEY_COUNT], al; al==1
jae .result ; not empty ??? jae .result ; not empty ???
@@: ;--------------------------------------
align 4
@@:
mov edx, hotkey_buffer mov edx, hotkey_buffer
@@: ;--------------------------------------
align 4
@@:
cmp [edx], bh ; bh - slot for testing cmp [edx], bh ; bh - slot for testing
je .result je .result
add edx, 8 add edx, 8
@ -517,3 +586,4 @@ get_event_for_app: ;; used from f10,f11,f23
jb @b jb @b
jmp .loop jmp .loop
;end. ;end.
;-----------------------------------------------------------------------------

View File

@ -2511,12 +2511,7 @@ nosb2:
cmp ebx, 3 ; DRAW BACKGROUND cmp ebx, 3 ; DRAW BACKGROUND
jnz nosb3 jnz nosb3
draw_background_temp: draw_background_temp:
; cmp [bgrchanged],1 ;0
; je nosb31
;draw_background_temp:
; mov [bgrchanged],1 ;0
mov [background_defined], 1 mov [background_defined], 1
mov byte[BACKGROUND_CHANGED], 1
call force_redraw_background call force_redraw_background
nosb31: nosb31:
ret ret
@ -2527,7 +2522,6 @@ draw_background_temp:
cmp ecx, [BgrDrawMode] cmp ecx, [BgrDrawMode]
je nosb41 je nosb41
mov [BgrDrawMode], ecx mov [BgrDrawMode], ecx
; mov [bgrchanged],1
nosb41: nosb41:
ret ret
nosb4: nosb4:
@ -3139,12 +3133,9 @@ endg
uglobal uglobal
background_defined db 0 ; diamond, 11.04.2006 background_defined db 0 ; diamond, 11.04.2006
endg endg
;-----------------------------------------------------------------------------
align 4 align 4
; check misc
checkmisc: checkmisc:
cmp [ctrl_alt_del], 1 cmp [ctrl_alt_del], 1
jne nocpustart jne nocpustart
@ -3152,7 +3143,8 @@ checkmisc:
call fs_execute_from_sysdir call fs_execute_from_sysdir
mov [ctrl_alt_del], 0 mov [ctrl_alt_del], 0
;--------------------------------------
align 4
nocpustart: nocpustart:
cmp [mouse_active], 1 cmp [mouse_active], 1
jne mouse_not_active jne mouse_not_active
@ -3168,7 +3160,7 @@ nocpustart:
movzx eax, word [MOUSE_X] movzx eax, word [MOUSE_X]
movzx edx, word [MOUSE_Y] movzx edx, word [MOUSE_Y]
;--------------------------------------
align 4 align 4
.set_mouse_event: .set_mouse_event:
add edi, 256 add edi, 256
@ -3178,7 +3170,8 @@ align 4
cmp edi, [esp] ; skip if filtration active cmp edi, [esp] ; skip if filtration active
jne .skip jne .skip
;--------------------------------------
align 4
.pos_filter: .pos_filter:
test [ebx+TASKDATA.event_mask], 0x40000000 test [ebx+TASKDATA.event_mask], 0x40000000
jz .set jz .set
@ -3196,50 +3189,53 @@ align 4
add esi, [ebx-twdw+WDATA.box.height] add esi, [ebx-twdw+WDATA.box.height]
cmp edx, esi cmp edx, esi
ja .skip ja .skip
;--------------------------------------
align 4
.set: .set:
or [edi+SLOT_BASE+APPDATA.event_mask], 100000b or [edi+SLOT_BASE+APPDATA.event_mask], 100000b ; set event 6
;--------------------------------------
align 4
.skip: .skip:
loop .set_mouse_event loop .set_mouse_event
pop eax pop eax
;--------------------------------------
align 4
mouse_not_active: mouse_not_active:
cmp byte[BACKGROUND_CHANGED], 0
jz no_set_bgr_event
xor edi, edi
mov ecx, [TASK_COUNT]
set_bgr_event:
add edi, 256
or [edi+SLOT_BASE+APPDATA.event_mask], 16
loop set_bgr_event
mov byte[BACKGROUND_CHANGED], 0
no_set_bgr_event:
cmp byte[REDRAW_BACKGROUND], 0 ; background update ? cmp byte[REDRAW_BACKGROUND], 0 ; background update ?
jz nobackgr jz nobackgr
cmp [background_defined], 0 cmp [background_defined], 0
jz nobackgr jz nobackgr
; mov [draw_data+32 + RECT.left],dword 0 ;--------------------------------------
; mov [draw_data+32 + RECT.top],dword 0 align 4
; mov eax,[Screen_Max_X]
; mov ebx,[Screen_Max_Y]
; mov [draw_data+32 + RECT.right],eax
; mov [draw_data+32 + RECT.bottom],ebx
@@: @@:
call drawbackground call drawbackground
;--------- set event 5 start ----------
push ecx edi
xor edi, edi
mov ecx, [TASK_COUNT]
;--------------------------------------
align 4
set_bgr_event:
add edi, 256
or [edi+SLOT_BASE+APPDATA.event_mask], 10000b ; set event 5
loop set_bgr_event
pop edi ecx
;--------- set event 5 stop -----------
xor eax, eax xor eax, eax
xchg al, [REDRAW_BACKGROUND] xchg al, [REDRAW_BACKGROUND]
test al, al ; got new update request? test al, al ; got new update request?
jnz @b jnz @b
mov [draw_data+32 + RECT.left], eax mov [draw_data+32 + RECT.left], eax
mov [draw_data+32 + RECT.top], eax mov [draw_data+32 + RECT.top], eax
mov [draw_data+32 + RECT.right], eax mov [draw_data+32 + RECT.right], eax
mov [draw_data+32 + RECT.bottom], eax mov [draw_data+32 + RECT.bottom], eax
mov [MOUSE_BACKGROUND], byte 0 mov [MOUSE_BACKGROUND], byte 0
;--------------------------------------
align 4
nobackgr: nobackgr:
; system shutdown request
; system shutdown request
cmp [SYS_SHUTDOWN], byte 0 cmp [SYS_SHUTDOWN], byte 0
je noshutdown je noshutdown
@ -3251,28 +3247,31 @@ nobackgr:
lea ecx, [edx-1] lea ecx, [edx-1]
mov edx, OS_BASE+0x3040 mov edx, OS_BASE+0x3040
jecxz @f jecxz @f
;--------------------------------------
align 4
markz: markz:
mov [edx+TASKDATA.state], byte 3 mov [edx+TASKDATA.state], byte 3
add edx, 0x20 add edx, 0x20
loop markz loop markz
;--------------------------------------
align 4
@@: @@:
no_mark_system_shutdown:
no_mark_system_shutdown:
dec byte [SYS_SHUTDOWN] dec byte [SYS_SHUTDOWN]
je system_shutdown je system_shutdown
;--------------------------------------
align 4
noshutdown: noshutdown:
mov eax, [TASK_COUNT] ; termination mov eax, [TASK_COUNT] ; termination
mov ebx, TASK_DATA+TASKDATA.state mov ebx, TASK_DATA+TASKDATA.state
mov esi, 1 mov esi, 1
;--------------------------------------
align 4
newct: newct:
mov cl, [ebx] mov cl, [ebx]
cmp cl, byte 3 cmp cl, byte 3
jz terminate jz terminate
cmp cl, byte 4 cmp cl, byte 4
jz terminate jz terminate
@ -3281,11 +3280,9 @@ newct:
dec eax dec eax
jnz newct jnz newct
ret ret
;-----------------------------------------------------------------------------
; redraw screen align 4
redrawscreen: redrawscreen:
; eax , if process window_data base is eax, do not set flag/limits ; eax , if process window_data base is eax, do not set flag/limits
pushad pushad
@ -3296,8 +3293,9 @@ redrawscreen:
;mov ecx,0 ; redraw flags for apps ;mov ecx,0 ; redraw flags for apps
xor ecx, ecx xor ecx, ecx
newdw2: ;--------------------------------------
align 4
newdw2:
inc ecx inc ecx
push ecx push ecx
@ -3342,45 +3340,58 @@ redrawscreen:
mov eax, [draw_limits.left] ; eax = area x start ecx = window x end mov eax, [draw_limits.left] ; eax = area x start ecx = window x end
cmp ecx, eax cmp ecx, eax
jb ricino jb ricino
;--------------------------------------
bgli: align 4
bgli:
cmp dword[esp], 1 cmp dword[esp], 1
jnz .az jnz .az
; cmp byte[BACKGROUND_CHANGED], 0
; jnz newdw8
cmp byte[REDRAW_BACKGROUND], 0 cmp byte[REDRAW_BACKGROUND], 0
jz .az jz .az
mov dl, 0 mov dl, 0
lea eax, [edi+draw_data-window_data] lea eax, [edi+draw_data-window_data]
mov ebx, [draw_limits.left] mov ebx, [draw_limits.left]
cmp ebx, [eax+RECT.left] cmp ebx, [eax+RECT.left]
jae @f jae @f
mov [eax+RECT.left], ebx mov [eax+RECT.left], ebx
mov dl, 1 mov dl, 1
@@: ;--------------------------------------
align 4
@@:
mov ebx, [draw_limits.top] mov ebx, [draw_limits.top]
cmp ebx, [eax+RECT.top] cmp ebx, [eax+RECT.top]
jae @f jae @f
mov [eax+RECT.top], ebx mov [eax+RECT.top], ebx
mov dl, 1 mov dl, 1
@@: ;--------------------------------------
align 4
@@:
mov ebx, [draw_limits.right] mov ebx, [draw_limits.right]
cmp ebx, [eax+RECT.right] cmp ebx, [eax+RECT.right]
jbe @f jbe @f
mov [eax+RECT.right], ebx mov [eax+RECT.right], ebx
mov dl, 1 mov dl, 1
@@: ;--------------------------------------
align 4
@@:
mov ebx, [draw_limits.bottom] mov ebx, [draw_limits.bottom]
cmp ebx, [eax+RECT.bottom] cmp ebx, [eax+RECT.bottom]
jbe @f jbe @f
mov [eax+RECT.bottom], ebx mov [eax+RECT.bottom], ebx
mov dl, 1 mov dl, 1
@@: ;--------------------------------------
align 4
@@:
add byte[REDRAW_BACKGROUND], dl add byte[REDRAW_BACKGROUND], dl
jmp newdw8 jmp newdw8
.az: ;--------------------------------------
align 4
.az:
mov eax, edi mov eax, edi
add eax, draw_data-window_data add eax, draw_data-window_data
@ -3398,16 +3409,16 @@ redrawscreen:
cmp dword [esp], 1 cmp dword [esp], 1
jne nobgrd jne nobgrd
inc byte[REDRAW_BACKGROUND] inc byte[REDRAW_BACKGROUND]
;--------------------------------------
newdw8: align 4
nobgrd: newdw8:
nobgrd:
mov [eax + WDATA.fl_redraw], byte 1 ; mark as redraw mov [eax + WDATA.fl_redraw], byte 1 ; mark as redraw
;--------------------------------------
ricino: align 4
ricino:
not_this_task: not_this_task:
pop ecx pop ecx
cmp ecx, [TASK_COUNT] cmp ecx, [TASK_COUNT]
@ -3415,11 +3426,10 @@ redrawscreen:
pop eax pop eax
popad popad
ret ret
;-----------------------------------------------------------------------------
align 4
calculatebackground: ; background calculatebackground: ; background
mov edi, [_WinMapAddress] ; set os to use all pixels mov edi, [_WinMapAddress] ; set os to use all pixels
mov eax, 0x01010101 mov eax, 0x01010101
mov ecx, [_WinMapSize] mov ecx, [_WinMapSize]
@ -3427,19 +3437,14 @@ calculatebackground: ; background
rep stosd rep stosd
mov byte[REDRAW_BACKGROUND], 0 ; do not draw background! mov byte[REDRAW_BACKGROUND], 0 ; do not draw background!
mov byte[BACKGROUND_CHANGED], 0
ret ret
;-----------------------------------------------------------------------------
uglobal uglobal
imax dd 0x0 imax dd 0x0
endg endg
;-----------------------------------------------------------------------------
align 4
delay_ms: ; delay in 1/1000 sec delay_ms: ; delay in 1/1000 sec
push eax push eax
push ecx push ecx
@ -3453,8 +3458,9 @@ delay_ms: ; delay in 1/1000 sec
and al, 0x10 and al, 0x10
mov ah, al mov ah, al
cld cld
;--------------------------------------
cnt1: align 4
cnt1:
in al, 0x61 in al, 0x61
and al, 0x10 and al, 0x10
cmp al, ah cmp al, ah
@ -3465,9 +3471,8 @@ delay_ms: ; delay in 1/1000 sec
pop ecx pop ecx
pop eax pop eax
ret ret
;-----------------------------------------------------------------------------
align 4 align 4
set_app_param: set_app_param:
mov edi, [TASK_BASE] mov edi, [TASK_BASE]
@ -3478,17 +3483,17 @@ set_app_param:
xchg eax, [edi + TASKDATA.event_mask] ; set new event mask xchg eax, [edi + TASKDATA.event_mask] ; set new event mask
mov [esp+32], eax ; return old mask value mov [esp+32], eax ; return old mask value
ret ret
;-----------------------------------------------------------------------------
align 4
delay_hs: ; delay in 1/100 secs delay_hs: ; delay in 1/100 secs
; ebx = delay time ; ebx = delay time
push ecx push ecx
push edx push edx
mov edx, [timer_ticks] mov edx, [timer_ticks]
;--------------------------------------
newtic: align 4
newtic:
mov ecx, [timer_ticks] mov ecx, [timer_ticks]
sub ecx, edx sub ecx, edx
cmp ecx, ebx cmp ecx, ebx
@ -3497,16 +3502,15 @@ delay_hs: ; delay in 1/100 secs
call change_task call change_task
jmp newtic jmp newtic
;--------------------------------------
zerodelay: align 4
zerodelay:
pop edx pop edx
pop ecx pop ecx
ret ret
;-----------------------------------------------------------------------------
align 16 ;very often call this subrutine align 16 ;very often call this subrutine
memmove: ; memory move in bytes memmove: ; memory move in bytes
; eax = from ; eax = from
; ebx = to ; ebx = to
; ecx = no of bytes ; ecx = no of bytes
@ -3527,15 +3531,19 @@ memmove: ; memory move in bytes
pop ecx pop ecx
and ecx, 11b and ecx, 11b
jz .finish jz .finish
@@: ;--------------------------------------
align 4
@@:
rep movsb rep movsb
;--------------------------------------
.finish: align 4
.finish:
pop ecx edi esi pop ecx edi esi
.ret: ;--------------------------------------
align 4
.ret:
ret ret
;-----------------------------------------------------------------------------
; <diamond> Sysfunction 34, read_floppy_file, is obsolete. Use 58 or 70 function instead. ; <diamond> Sysfunction 34, read_floppy_file, is obsolete. Use 58 or 70 function instead.
;align 4 ;align 4
; ;

View File

@ -137,7 +137,7 @@
; FF00 byte 1 = system shutdown request ; FF00 byte 1 = system shutdown request
; FF01 byte task activation request? ; FF01 byte task activation request?
; FFF0 byte >0 if redraw background request from app ; FFF0 byte >0 if redraw background request from app
; FFF1 byte >0 if background changed ; FFF1 byte free
; FFF2 write and read bank in screen ; FFF2 write and read bank in screen
; FFF4 byte 0 if first mouse draw & do not return picture under ; FFF4 byte 0 if first mouse draw & do not return picture under
; FFF5 byte 1 do not draw pointer ; FFF5 byte 1 do not draw pointer