Specifications
Introduction to DSP Programming 2-3
Sound Blaster card may not be installed or an incorrect I/O address is being used.
You should exit the reset process and declare an error.
The following assembly code fragment shows the process of resetting the DSP:
mov dx,wSBCBaseAddx ; SBC base I/O address 2
x
0h
add dl,6 ; Reset port, 2
x
6h
mov al,1 ; Write a 1 to the DSP reset port
out dx,al ;
sub al,al ; Delay loop
Delay:
dec al
jnz Delay
out dx,al ; Write a 0 to the DSP reset port
sub cx,cx ; Maximum of 65536 tries
Empty:
mov dx,wSBCBaseAddx ; SBC base I/O address 2
x
0h
add dl,0Eh ; Read-Buffer Status port, 2
x
Eh
in al,dx ; Read Read-Buffer Status port
or al,al ; Data available?
jns NextAttempt ; Bit 7 clear, try again
sub dl,4 ; Read Data port, 2
x
Ah
in al,dx ; Read in-bound DSP data
cmp al,0AAh ; Receive success code, 0AAh?
je ResetOK ; SUCCESS!
NextAttempt:
loop Empty ; Try again
;***
;*** Failed to reset DSP: Sound Blaster not detected!
Reading from DSP
When DSP data is available, it can be read in from the Read Data port.
Before the data is read in, bit-7 of the Read-Buffer Status port must be checked to
ensure that there is data to read. If bit-7 is 1, then there is data to read. Otherwise,
no data is available.
The following assembly code fragment shows the process of reading data from the
DSP:
mov dx,wSBCBaseAddx ; SBC base I/O address 2
x
0h
add dl,0Eh ; Read-Buffer Status port, 2
x
Eh
Busy:
in al,dx ; Check for in-bound data
or al,al ; Data available?
jns Busy ; Bit 7 clear, try again
sub dl,4 ; Read Data port, 2
x
Ah
in al,dx ; Read in-bound DSP data