Subversion Repositories Kolibri OS

Rev

Rev 485 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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