dsp.cpp
 1  /*****************************************************************************\
 2       Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
 3                  This file is licensed under the Snes9x License.
 4     For further information, consult the LICENSE file in the root directory.
 5  \*****************************************************************************/
 6  
 7  #include "snes9x.h"
 8  #include "memory.h"
 9  #ifdef DEBUGGER
10  #include "debug.h"
11  #endif
12  
13  uint8	(*GetDSP) (uint16)        = NULL;
14  void	(*SetDSP) (uint8, uint16) = NULL;
15  
16  struct SDSP0	DSP0;
17  struct SDSP1	DSP1;
18  struct SDSP2	DSP2;
19  
20  
21  void S9xResetDSP (void)
22  {
23  	memset(&DSP1, 0, sizeof(DSP1));
24  	DSP1.waiting4command = TRUE;
25  	DSP1.first_parameter = TRUE;
26  
27  	memset(&DSP2, 0, sizeof(DSP2));
28  	DSP2.waiting4command = TRUE;
29  }
30  
31  uint8 S9xGetDSP (uint16 address)
32  {
33  #ifdef DEBUGGER
34  	if (Settings.TraceDSP)
35  	{
36  		sprintf(String, "DSP read: 0x%04X", address);
37  		S9xMessage(S9X_TRACE, S9X_TRACE_DSP1, String);
38  	}
39  #endif
40  
41  	return ((*GetDSP)(address));
42  }
43  
44  void S9xSetDSP (uint8 byte, uint16 address)
45  {
46  #ifdef DEBUGGER
47  	if (Settings.TraceDSP)
48  	{
49  		sprintf(String, "DSP write: 0x%04X=0x%02X", address, byte);
50  		S9xMessage(S9X_TRACE, S9X_TRACE_DSP1, String);
51  	}
52  #endif
53  
54  	(*SetDSP)(byte, address);
55  }