Creative SB0350 Hardware Programming Guide - Page 25

Creative SB0350 Manual

Page 25 highlights

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 add mov out sub Delay: dec jnz out sub Empty: mov add in or jns sub in cmp je dx,wSBCBaseAddx dl,6 al,1 dx,al al,al al Delay dx,al cx,cx dx,wSBCBaseAddx dl,0Eh al,dx al,al NextAttempt dl,4 al,dx al,0AAh ResetOK ; SBC base I/O address 2x0h ; Reset port, 2x6h ; Write a 1 to the DSP reset port ; ; Delay loop ; Write a 0 to the DSP reset port ; Maximum of 65536 tries ; SBC base I/O address 2x0h ; Read-Buffer Status port, 2xEh ; Read Read-Buffer Status port ; Data available? ; Bit 7 clear, try again ; ; ; ; Read Data port, 2xAh Read in-bound DSP data Receive success code, 0AAh? 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 add Busy: in or jns sub in al,dx al,al Busy dl,4 al,dx ; Check for in-bound data ; Data available? ; Bit 7 clear, try again ; Read Data port, 2xAh ; Read in-bound DSP data dx,wSBCBaseAddx dl,0Eh ; SBC base I/O address 2x0h ; Read-Buffer Status port, 2xEh

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141

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