Rev 802 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 802 | Rev 850 | ||
---|---|---|---|
Line 35... | Line 35... | ||
35 | 35 | ||
Line 36... | Line 36... | ||
36 | include 'sb16.inc' |
36 | include 'sb16.inc' |
37 | 37 | ||
38 | ;------------------------------------------------------------------------------- |
- | |
39 | proc START stdcall, state:dword |
38 | ;------------------------------------------------------------------------------- |
40 | 39 | proc START stdcall, state:dword |
|
41 | cmp [state], 1 |
40 | cmp [state], 1 |
Line 42... | Line 41... | ||
42 | jne .stop |
41 | jne .stop |
Line 51... | Line 50... | ||
51 | test eax,eax ;SB card not found |
50 | test eax,eax ;SB card not found |
52 | jz .exit |
51 | jz .exit |
Line 53... | Line 52... | ||
53 | 52 | ||
54 | if DEBUG |
53 | if DEBUG |
- | 54 | movzx eax,al ;major version |
|
55 | movzx eax,al ;major version |
55 | mov esi,sb_DSP_description |
56 | dec eax |
56 | dec eax |
57 | jz .sb_say_about_found_dsp |
57 | jz .sb_say_about_found_dsp |
58 | mov dword[sb_DSP_description],'2.x ' |
58 | mov dword[esi],'2.x ' |
59 | dec eax |
59 | dec eax |
60 | jz .sb_say_about_found_dsp |
60 | jz .sb_say_about_found_dsp |
61 | mov dword[sb_DSP_description],'Pro ' |
61 | mov dword[esi],'Pro ' |
62 | dec eax |
62 | dec eax |
63 | jz .sb_say_about_found_dsp |
63 | jz .sb_say_about_found_dsp |
64 | mov dword[sb_DSP_description],'16 ' |
64 | mov dword[esi],'16 ' |
65 | .sb_say_about_found_dsp: |
65 | .sb_say_about_found_dsp: |
66 | mov esi,msgDSPFound |
66 | mov esi,msgDSPFound |
67 | call SysMsgBoardStr |
67 | call SysMsgBoardStr |
68 | end if |
68 | end if |
69 | xor eax,eax |
69 | xor eax,eax |
70 | mov ebx,[sb_base_port] |
70 | mov ebx,[sb_base_port] |
71 | lea ecx,[ebx+0xF] |
71 | lea ecx,[ebx+0xF] |
72 | call ReservePortArea ;these ports must be mine! |
72 | call ReservePortArea ;these ports must be my! |
73 | if DEBUG |
73 | if DEBUG |
74 | dec eax |
74 | dec eax |
75 | jnz @f |
75 | jnz @f |
76 | mov esi,msgErrRsrvPorts |
76 | mov esi,msgErrRsrvPorts |
Line 145... | Line 145... | ||
145 | call pre_fill_data ;fill first and second half of the buffer |
145 | call pre_fill_data ;fill first and second half of the buffer |
146 | call pre_fill_data ; |
146 | call pre_fill_data ; |
Line 147... | Line 147... | ||
147 | 147 | ||
148 | call sb_set_dma ;is it really needed here? Paranoia. |
148 | call sb_set_dma ;is it really needed here? Paranoia. |
- | 149 | call sb_play |
|
- | 150 | xor eax,eax ;set maximum volume |
|
149 | call sb_play |
151 | call sb_set_master_vol |
150 | xor eax,eax |
152 | xor eax,eax |
151 | ret |
153 | ret |
152 | ;@@: ;all this commented stuff in service proc |
154 | ;@@: ;all this commented stuff in service proc |
153 | ; cmp eax,DEV_STOP ;is never used. Mixer do this virtually, |
155 | ; cmp eax,DEV_STOP ;is never used. Mixer do this virtually, |
Line 170... | Line 172... | ||
170 | mov eax,[edi] |
172 | mov eax,[edi] |
171 | mov [callback],eax |
173 | mov [callback],eax |
172 | if DEBUG |
174 | if DEBUG |
173 | call SysMsgBoardNum |
175 | call SysMsgBoardNum |
174 | end if |
176 | end if |
- | 177 | xor eax,eax |
|
175 | ret |
178 | ret |
176 | @@: |
179 | @@: |
177 | ; cmp eax,DEV_SET_MASTERVOL |
180 | cmp eax,DEV_SET_MASTERVOL ;Serge asked me to unlock |
- | 181 | jne @F ;DEV_SET(GET)_MASTERVOL, although mixer doesn't use it. |
|
178 | ; jne @F |
182 | ;It doesn't use it _in current version_ - but in the future... |
- | 183 | ||
179 | ;if DEBUG |
184 | if DEBUG |
180 | ; mov esi,msgSetVol |
185 | mov esi,msgSetVol |
181 | ; call SysMsgBoardStr |
186 | call SysMsgBoardStr |
182 | ;end if |
187 | end if |
183 | ; mov eax,[edi+input] |
188 | mov eax,[edi+input] |
184 | ; mov eax,[eax] |
189 | mov eax,[eax] |
185 | ; mov [sb_master_vol],eax |
190 | call sb_set_master_vol |
- | 191 | xor eax,eax |
|
186 | ; ret |
192 | ret |
187 | ;@@: |
193 | @@: |
188 | ; cmp eax,DEV_GET_MASTERVOL |
194 | cmp eax,DEV_GET_MASTERVOL |
189 | ; jne @F |
195 | jne @F |
190 | ;if DEBUG |
196 | if DEBUG |
191 | ; mov esi,msgGetVol |
197 | mov esi,msgGetVol |
192 | ; call SysMsgBoardStr |
198 | call SysMsgBoardStr |
193 | ;end if |
199 | end if |
194 | ; mov eax,[edi+output] |
200 | mov eax,[edi+output] |
195 | ; mov edx,[sb_master_vol] |
201 | mov edx,[sb_master_vol] |
196 | ; mov [eax],edx |
202 | mov [eax],edx |
- | 203 | xor eax,eax |
|
197 | ; ret |
204 | ret |
Line 198... | Line 205... | ||
198 | 205 | ||
199 | .fail: |
206 | .fail: |
200 | or eax, -1 |
207 | or eax, -1 |
201 | ret |
208 | ret |
Line 220... | Line 227... | ||
220 | not dword[eax] |
227 | not dword[eax] |
221 | mov eax,[eax] |
228 | mov eax,[eax] |
222 | test eax,eax |
229 | test eax,eax |
223 | jns .fill_second_half |
230 | jns .fill_second_half |
Line -... | Line 231... | ||
- | 231 | ||
224 | 232 | if sb_buffer_size eq small_buffer |
|
- | 233 | stdcall [callback],SB16Buffer0 ;for 32k buffer |
|
225 | stdcall [callback],SB16Buffer0 ;for 32k buffer |
234 | else if sb_buffer_size eq full_buffer |
226 | ; stdcall [callback],SB16Buffer0 ;for 64k buffer |
235 | stdcall [callback],SB16Buffer0 ;for 64k buffer |
227 | ; stdcall [callback],SB16Buffer1 ;for 64k buffer |
236 | stdcall [callback],SB16Buffer1 ;for 64k buffer |
228 | 237 | end if |
|
229 | xor eax,eax |
238 | xor eax,eax |
Line 230... | Line 239... | ||
230 | ret |
239 | ret |
- | 240 | ||
231 | 241 | .fill_second_half: |
|
- | 242 | if sb_buffer_size eq small_buffer |
|
232 | .fill_second_half: |
243 | stdcall [callback],SB16Buffer1 ;for 32k buffer |
233 | stdcall [callback],SB16Buffer1 ;for 32k buffer |
244 | else if sb_buffer_size eq full_buffer |
234 | ; stdcall [callback],SB16Buffer2 ;for 64k buffer |
245 | stdcall [callback],SB16Buffer2 ;for 64k buffer |
235 | ; stdcall [callback],SB16Buffer3 ;for 64k buffer |
246 | stdcall [callback],SB16Buffer3 ;for 64k buffer |
236 | 247 | end if |
|
237 | xor eax,eax |
248 | xor eax,eax |
238 | ret |
249 | ret |
239 | endp |
250 | endp |
Line 289... | Line 300... | ||
289 | xor edx,edx |
300 | xor edx,edx |
290 | mov dl,10 |
301 | mov dl,10 |
291 | div dl |
302 | div dl |
292 | ror eax,16 |
303 | ror eax,16 |
293 | xor ah,ah |
304 | xor ah,ah |
- | 305 | mov [sb_DSP_version_int],eax ;for internal usage |
|
294 | if DEBUG |
306 | if DEBUG |
295 | add [sb_DSP_version],eax |
307 | add [sb_DSP_version],eax |
296 | end if |
308 | end if |
297 | ret |
309 | ret |
Line 300... | Line 312... | ||
300 | loop .sb_check_port ;100 retries (~100 microsec.) |
312 | loop .sb_check_port ;100 retries (~100 microsec.) |
301 | jmp .sb_detect_next_port |
313 | jmp .sb_detect_next_port |
302 | endp |
314 | endp |
303 | ;------------------------------------------------------------------------------- |
315 | ;------------------------------------------------------------------------------- |
304 | if DEBUG |
316 | if DEBUG |
305 | proc SysMsgBoardNum |
317 | proc SysMsgBoardNum ;warning: destroys eax,ebx,ecx,esi |
306 | mov ebx,eax |
318 | mov ebx,eax |
307 | mov ecx,8 |
319 | mov ecx,8 |
308 | mov esi,(number_to_out+1) |
320 | mov esi,(number_to_out+1) |
309 | .1: |
321 | .1: |
310 | mov eax,ebx |
322 | mov eax,ebx |
Line 321... | Line 333... | ||
321 | call SysMsgBoardStr |
333 | call SysMsgBoardStr |
322 | ret |
334 | ret |
323 | endp |
335 | endp |
324 | end if |
336 | end if |
325 | ;all initialized data place here |
337 | ;all initialized data place here |
326 | - | ||
327 | align 4 |
338 | align 4 |
328 | version dd (5 shl 16) or (API_VERSION and 0xFFFF) |
339 | version dd (5 shl 16) or (API_VERSION and 0xFFFF) |
Line 329... | Line 340... | ||
329 | 340 | ||
330 | sb_base_port: dd 200h |
- | |
331 | - | ||
332 | ;pTempBuf dd 0 |
- | |
333 | - | ||
334 | callback dd 0 |
- | |
335 | - | ||
Line 336... | Line 341... | ||
336 | int_flip_flop dd 0 |
341 | sb_base_port: dd 200h ;don't ask me why - see the code&docs |
Line 337... | Line 342... | ||
337 | 342 | ||
338 | sound_dma dd sb_dma_num |
343 | sound_dma dd sb_dma_num |
339 | 344 | ||
Line 340... | Line -... | ||
340 | ;note that 4th DMA channel doesn't exist, it is used for cascade |
- | |
341 | ;plugging the first DMA controler to the second |
- | |
342 | dma_table db 0x87,0x83,0x81,0x82,0xFF,0x8B,0x89,0x8A |
345 | ;note that 4th DMA channel doesn't exist, it is used for cascade |
Line 343... | Line 346... | ||
343 | 346 | ;plugging the first DMA controler to the second |
|
344 | ;sb_master_vol dd 0 |
347 | dma_table db 0x87,0x83,0x81,0x82,0xFF,0x8B,0x89,0x8A |
Line 358... | Line 361... | ||
358 | db 'owner',39,'s handler: ',0 |
361 | db 'owner',39,'s handler: ',0 |
359 | msgSucAtchIRQ db 'succesfully attached IRQ',(sb_irq_num+'0') |
362 | msgSucAtchIRQ db 'succesfully attached IRQ',(sb_irq_num+'0') |
360 | db ' as hardcoded',13,10,0 |
363 | db ' as hardcoded',13,10,0 |
361 | msgErrRsrvPorts db 'failed to reserve needed ports.',13,10 |
364 | msgErrRsrvPorts db 'failed to reserve needed ports.',13,10 |
362 | db 'Driver may work unstable',13,10,0 |
365 | db 'Driver may work unstable',13,10,0 |
363 | ;msgSetVol db 'DEV_SET_MASTERVOL call came',13,10,0 |
366 | msgSetVol db 'DEV_SET_MASTERVOL call came',13,10,0 |
364 | ;msgGetVol db 'DEV_GET_MASTERVOL call came',13,10,0 |
367 | msgGetVol db 'DEV_GET_MASTERVOL call came',13,10,0 |
365 | msgErrDMAsetup db 'failed to setup DMA - bad channel',13,10,0 |
368 | msgErrDMAsetup db 'failed to setup DMA - bad channel',13,10,0 |
366 | ;------------------------------------------------------------------------------- |
369 | ;------------------------------------------------------------------------------- |
367 | msgDSPFound db 'DSP found at port 2' |
370 | msgDSPFound db 'DSP found at port 2' |
368 | label port_second_digit_num dword at $ |
371 | label port_second_digit_num dword at $ |
369 | db '00h',13,10,'DSP version ' |
372 | db '00h',13,10,'DSP version ' |
370 | sb_DSP_version: db '0.00 - SB' |
373 | sb_DSP_version: db '0.00 - SB' |
371 | sb_DSP_description: db 32,32,32,32,13,10,0 |
374 | sb_DSP_description: db 32,32,32,32,13,10,0 |
372 | ;------------------------------------------------------------------------------- |
375 | ;------------------------------------------------------------------------------- |
373 | end if |
376 | end if |
- | 377 | ||
374 | ;section '.data' data readable writable align 16 |
378 | section '.data' data readable writable align 16 |
375 | ;all uninitialized data place here |
379 | ;all uninitialized data place here |
- | 380 | ||
- | 381 | ;pTempBuf rd 1 |
|
- | 382 | ||
- | 383 | callback rd 1 |
|
- | 384 | ||
- | 385 | int_flip_flop rd 1 |
|
- | 386 | ||
- | 387 | sb_master_vol rd 1 |
|
- | 388 | ||
- | 389 | sb_DSP_version_int rd 1 |