Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5022 | Serge | 1 | format MS COFF |
2 | |||
3 | include "snd.inc" |
||
4 | include "proc32.inc" |
||
5 | |||
6 | section '.text' align 16 code readable executable |
||
7 | |||
8 | public _test_wav@4 |
||
9 | |||
10 | ; convert WAVEHEADER into PCM_x_xx_xx constant |
||
11 | |||
12 | align 4 |
||
13 | proc _test_wav@4 stdcall, hdr:dword |
||
14 | |||
15 | mov eax, [hdr] |
||
16 | cmp dword [eax], 0x46464952 |
||
17 | jne .fail |
||
18 | |||
19 | cmp dword [eax+8], 0x45564157 |
||
20 | jne .fail |
||
21 | |||
22 | cmp word [eax+20], 1 |
||
23 | jne .fail |
||
24 | |||
25 | mov ecx, dword [eax+24] |
||
26 | mov edx, 22050 |
||
27 | cmp ecx, edx |
||
28 | ja .high |
||
29 | je .l_22 |
||
30 | |||
31 | cmp ecx, 8000 |
||
32 | je .l_8 |
||
33 | |||
34 | cmp ecx, 11025 |
||
35 | je .l_11 |
||
36 | |||
37 | cmp ecx, 12000 |
||
38 | je .l_12 |
||
39 | |||
40 | cmp ecx, 16000 |
||
41 | je .l_16 |
||
42 | .fail: |
||
43 | xor eax, eax |
||
44 | ret |
||
45 | .high: |
||
46 | cmp ecx, 24000 |
||
47 | je .LN56 |
||
48 | cmp ecx, 32000 |
||
49 | je .LN65 |
||
50 | cmp ecx, 44100 |
||
51 | je .LN74 |
||
52 | cmp ecx, 48000 |
||
53 | jne .fail |
||
54 | |||
55 | movzx ecx, word [eax+22] |
||
56 | dec ecx |
||
57 | je .LN79 |
||
58 | dec ecx |
||
59 | jne .LN74 |
||
60 | |||
61 | mov edx, 19 |
||
62 | jmp .done |
||
63 | .LN79: |
||
64 | mov edx, 20 |
||
65 | jmp .done |
||
66 | .LN74: |
||
67 | movzx ecx, word [eax+22] |
||
68 | dec ecx |
||
69 | je .LN70 |
||
70 | dec ecx |
||
71 | jne .LN65 |
||
72 | |||
73 | mov edx, 21 |
||
74 | jmp .done |
||
75 | .LN70: |
||
76 | mov edx, 22 |
||
77 | jmp .done |
||
78 | .LN65: |
||
79 | movzx ecx, word [eax+22] |
||
80 | dec ecx |
||
81 | je .LN61 |
||
82 | dec ecx |
||
83 | jne .LN56 |
||
84 | |||
85 | mov edx, 23 |
||
86 | jmp .done |
||
87 | .LN61: |
||
88 | mov edx, 24 |
||
89 | jmp .done |
||
90 | .LN56: |
||
91 | movzx ecx, word [eax+22] |
||
92 | dec ecx |
||
93 | je .LN52 |
||
94 | dec ecx |
||
95 | je .LN50 |
||
96 | .l_22: |
||
97 | movzx ecx, word [eax+22] |
||
98 | dec ecx |
||
99 | je .LN43 |
||
100 | dec ecx |
||
101 | je .LN41 |
||
102 | .l_16: |
||
103 | movzx ecx, word [eax+22] |
||
104 | dec ecx |
||
105 | je .LN34 |
||
106 | dec ecx |
||
107 | je .LN32 |
||
108 | .l_12: |
||
109 | movzx ecx, word [eax+22] |
||
110 | dec ecx |
||
111 | je .LN25 |
||
112 | dec ecx |
||
113 | je .LN23 |
||
114 | .l_11: |
||
115 | movzx ecx, word [eax+22] |
||
116 | dec ecx |
||
117 | je .LN16 |
||
118 | dec ecx |
||
119 | je .LN14 |
||
120 | .l_8: |
||
121 | movzx ecx, word [eax+22] |
||
122 | dec ecx |
||
123 | je .LN7 |
||
124 | dec ecx |
||
125 | jne .fail |
||
126 | |||
127 | mov edx, 35 |
||
128 | jmp .done |
||
129 | .LN7: |
||
130 | mov edx, 36 |
||
131 | jmp .done |
||
132 | .LN14: |
||
133 | mov edx, 33 |
||
134 | jmp .done |
||
135 | .LN16: |
||
136 | mov edx, 34 |
||
137 | jmp .done |
||
138 | .LN23: |
||
139 | mov edx, 31 |
||
140 | jmp .done |
||
141 | .LN25: |
||
142 | mov edx, 32 |
||
143 | jmp .done |
||
144 | .LN32: |
||
145 | mov edx, 29 |
||
146 | jmp .done |
||
147 | .LN34: |
||
148 | mov edx, 30 |
||
149 | jmp .done |
||
150 | .LN41: |
||
151 | mov edx, 27 |
||
152 | jmp .done |
||
153 | .LN43: |
||
154 | mov edx, 28 |
||
155 | jmp .done |
||
156 | .LN50: |
||
157 | mov edx, 25 |
||
158 | jmp .done |
||
159 | .LN52: |
||
160 | mov edx, 26 |
||
161 | .done: |
||
162 | xor ecx, ecx |
||
163 | cmp word [eax+34], 16 |
||
164 | setne cl |
||
165 | dec ecx |
||
166 | and ecx, -18 |
||
167 | add ecx, edx |
||
168 | mov eax, ecx |
||
169 | ret |
||
170 | endp |