Subversion Repositories Kolibri OS

Rev

Rev 485 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
134 diamond 1
new_thread:
2
    mov  ecx,ipcarea2
3
    call init_ipc
4
    mcall 40,1000000b
5
  tstill:
6
    mov  dword[ipcarea2],0
7
    mov  dword[ipcarea2+4],8
8
    mcall 10
9
  .prc:
10
    cmp  eax,7
11
    jne  tstill
12
    and  [flag],not FL_PLAY
13
    mov  eax,dword[ipcarea2+8]
14
    cmp  eax,[parentPID]
15
    jne  tstill
16
    cmp  byte[ipcarea2+16],IPC_PLAY
17
    je   .play_next
18
    cmp  byte[ipcarea2+16],IPC_TRIG
19
    jne  tstill
20
  .play_next:
21
    or   [flag],FL_PLAY
22
    mov  edi,[cur_ptr]
23
    movzx eax,word[edi]
24
    mov  [play_area],ax
25
    add  [cur_ptr],2
26
  if SOUND eq ON
27
    test [flag],FL_MUTE
28
    jnz   .nosound
29
    mov  esi,play_area
30
    mov  eax,55
31
    mov  ebx,eax
485 heavyiron 32
    mcall
134 diamond 33
  .nosound:
34
  end if
35
    movzx ebx,byte[play_area]
36
    and  ebx,0x7f
37
    add  [cur_tick],ebx
38
    mov  eax,23
485 heavyiron 39
    mcall
134 diamond 40
    cmp  word[edi],0
41
    jne  .checkevt
42
    mov  eax,IPC_NEXT
43
    call ipc_send
44
    jmp  tstill
45
  .checkevt:
46
    test eax,eax
47
    jz   .upd
48
    cmp  eax,7
49
    jne  tstill
50
    cmp  byte[ipcarea2+16],IPC_PLAY
51
    jne  tstill
52
  .upd:
53
    mov  eax,IPC_UPDT
54
    call ipc_send
55
    jmp  .play_next
56
 
57
respawn:
58
    mcall 9,prcinfo,-1
59
    mov  ecx,eax
60
    xor  edx,edx
61
    xor  esi,esi
62
  .nxt:
63
    mcall 9
64
    cmp  dx,[ebx+4]
65
    jae  .less
66
    mov  dx,[ebx+4]
67
    mov  esi,[ebx+30]
68
  .less:
69
    loop .nxt
70
    push esi
1493 mario79 71
    mcall 51,1,new_thread,thread_stack ;APP_MEM
134 diamond 72
    pop  edx
73
    cmp  edx,[childPID]
74
    jne  .nochild
75
    mov  edx,[parentPID]
76
  .nochild:
77
    mov  [childPID],eax
78
    call prc_find
79
    mcall 18,3
80
    ret
81
 
82
kill:
83
    mov  edx,[childPID]
84
    call prc_find
85
    mcall 18,2
86
  .nothread:
87
    ret
88
 
89
prc_find: ;in: edx-PID, out: ecx-number
90
    mcall 9,prcinfo,-1
91
    mov  ecx,eax
92
  .nxt:
93
    mcall 9
94
    cmp  edx,[ebx+30]
95
    je   .found
96
    loop .nxt
97
  .found:
98
    ret
99
 
100
init_ipc:
101
    mcall 60,1,,20
102
    ret
103
 
104
ipc_send: ;eax-msg
105
   test [flag],FL_LOCK
106
   jnz  .noipc
107
   pusha
108
   mov  [ipcmsg],al
109
   mov  ebx,ipcarea2
110
   mov  ecx,childPID
111
   cmp  eax,0xb0
112
   jb   .noparent
113
   add  ecx,4
114
   sub  ebx,20
115
 .noparent:
116
   mov  dword[ebx],0
117
   mov  dword[ebx+4],8
118
   mcall 60,2,[ecx],ipcmsg,1
119
   popa
120
  .noipc:
121
   ret