Subversion Repositories Kolibri OS

Rev

Rev 374 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 374 Rev 376
1
format MS COFF
1
format MS COFF
2
 
2
 
3
include "snd.inc"
3
include "snd.inc"
4
include "proc32.inc"
4
include "proc32.inc"
5
 
5
 
6
section '.text' align 16 code readable executable
6
section '.text' align 16 code readable executable
7
 
7
 
8
public _InitSound@0
8
public _InitSound@4
9
public _CreateBuffer@8
9
public _CreateBuffer@12
10
public _DestroyBuffer@4
10
public _DestroyBuffer@4
11
 
11
 
12
align 4
12
align 4
13
proc _InitSound@0
-
 
14
           locals
-
 
15
             handle     dd ?
-
 
16
             io_code    dd ?
-
 
17
             input      dd ?
-
 
18
             inp_size   dd ?
13
_InitSound@4:       ;p_ver:dword
19
             output     dd ?
-
 
20
             out_size   dd ?
-
 
21
           endl
-
 
22
 
14
 
23
           push ebx
15
           push ebx
24
           push ecx
16
           push ecx
-
 
17
 
25
           mov eax, 68
18
           mov eax, 68
26
           mov ebx, 16
19
           mov ebx, 16
27
           mov ecx, szInfinity
20
           mov ecx, szInfinity
28
           int 0x40
21
           int 0x40
29
           mov [hSound], eax
22
           mov [hSound], eax
30
           test eax, eax
23
           test eax, eax
31
           jz .fail
24
           jz .fail
32
           
25
 
33
           mov eax, 68
26
           mov eax, 68
34
           mov ebx, 16
27
           mov ebx, 16
35
           mov ecx, szSound
28
           mov ecx, szSound
36
           int 0x40
29
           int 0x40
37
           mov [hrdwSound], eax
30
           mov [hrdwSound], eax
38
           
31
 
39
           mov eax, [hSound]
32
           lea eax, [esp+12]   ;p_ver
40
           xor ebx, ebx
33
           xor ebx, ebx
41
 
34
 
42
           mov [handle], eax
35
           push 4              ;.out_size
43
           mov [io_code], SRV_GETVERSION
36
           push eax            ;.output
44
           mov [input], ebx
37
           push ebx            ;.inp_size
45
           mov [inp_size], ebx
38
           push ebx            ;.input
46
           mov [output], ebx
39
           push SRV_GETVERSION ;.code
47
           mov [out_size], ebx
40
           push [hSound]       ;.handle
48
           
41
 
49
           mov eax, 68
42
           mov eax, 68
50
           mov ebx, 17
43
           mov ebx, 17
51
           lea ecx, [handle]
44
           mov ecx, esp        ;[handle]
52
           int 0x40
45
           int 0x40
-
 
46
           add esp, 24
-
 
47
           pop ecx  
-
 
48
           pop ebx
-
 
49
           ret 4
53
.fail:     
50
.fail:
54
 
-
 
55
.done:
51
           or eax, -1 
56
           pop ecx  
52
           pop ecx  
57
           pop ebx
53
           pop ebx
58
           ret
54
           ret 4
59
endp
-
 
60
 
55
 
61
 
56
 
62
align 4
57
align 4
63
proc _CreateBuffer@8 stdcall, format:dword, size:dword
58
_CreateBuffer@12:   ;format:dword,size:dword,p_str:dword
64
           locals
-
 
65
             handle     dd ?
-
 
66
             io_code    dd ?
-
 
67
             input      dd ?
-
 
68
             inp_size   dd ?
-
 
69
             output     dd ?
-
 
70
             out_size   dd ?
-
 
71
           endl
-
 
72
 
59
 
73
           push ebx
60
           push ebx
74
           push ecx
61
           push ecx
75
           mov eax, [hSound]
62
           lea eax, [esp+20]   ;p_str
76
           lea ebx, [format]
63
           lea ebx, [esp+12]   ;format
77
           xor ecx, ecx
-
 
78
 
64
 
79
           mov [handle], eax
65
           push 4              ;.out_size
80
           mov [io_code], SND_CREATE_BUFF
66
           push eax            ;.output
81
           mov [input], ebx
67
           push 8              ;.inp_size
82
           mov [inp_size], 4
68
           push ebx            ;.input
83
           mov [output], ecx
69
           push SND_CREATE_BUFF;.code
84
           mov [out_size], ecx
70
           push [hSound]       ;.handle
85
           
71
 
86
           mov eax, 68
72
           mov eax, 68
87
           mov ebx, 17
73
           mov ebx, 17
88
           lea ecx, [handle]
74
           mov ecx, esp
89
           int 0x40
75
           int 0x40
-
 
76
           add esp, 24       ;io_cintrol 
90
           pop ecx
77
           pop ecx
91
           pop ebx
78
           pop ebx
92
           ret
79
           ret 12
93
endp
-
 
94
 
80
 
95
align 4
81
align 4
96
proc _DestroyBuffer@4 stdcall, str:dword
-
 
97
           locals
-
 
98
             handle     dd ?
-
 
99
             io_code    dd ?
-
 
100
             input      dd ?
-
 
101
             inp_size   dd ?
-
 
102
             output     dd ?
-
 
103
             out_size   dd ?
-
 
104
           endl
82
_DestroyBuffer@4:     ;str:dword
105
 
83
 
106
           push ebx
84
           push ebx
107
           push ecx
85
           push ecx
108
           
86
 
109
           mov eax, [hSound]
87
           xor eax, eax
110
           lea ebx, [str]
-
 
111
           xor ecx, ecx
88
           lea ebx, [esp+12]   ;[stream]
112
 
89
 
113
           mov [handle], eax
90
           push eax            ;.out_size
114
           mov [io_code], SND_DESTROY_BUFF
91
           push eax            ;.output
115
           mov [input], ebx
92
           push 4              ;.inp_size
116
           mov [inp_size], 4
93
           push ebx            ;.input
117
           mov [output], ecx
94
           push SND_DESTROY_BUFF;.code
118
           mov [out_size], ecx
95
           push [hSound]       ;.handle
119
 
96
 
120
           mov eax, 68
97
           mov eax, 68
121
           mov ebx, 17
98
           mov ebx, 17
122
           lea ecx, [handle]
99
           mov ecx, esp        ;[handle]
123
           int 0x40
100
           int 0x40
-
 
101
           add esp, 24
124
           pop ecx 
102
           pop ecx 
125
           pop ebx
103
           pop ebx
126
           ret
104
           ret 4
127
endp
105
 
128
 
106
 
129
section '.data' align 16 data readable writable
107
section '.data' align 16 data readable writable
130
 
108
 
131
public hSound
109
public hSound
132
public hrdwSound
110
public hrdwSound
133
 
111
 
134
hSound      dd ?
112
hSound      dd ?
135
hrdwSound   dd ? 
113
hrdwSound   dd ? 
136
 
114
 
137
szInfinity  db 'INFINITY',0
115
szInfinity  db 'INFINITY',0
138
szSound     db 'SOUND',0
116
szSound     db 'SOUND',0