diff --git a/zsnes/src/chips/dsp4emu.c b/zsnes/src/chips/dsp4emu.c index 3b40f8e0..1946d481 100644 --- a/zsnes/src/chips/dsp4emu.c +++ b/zsnes/src/chips/dsp4emu.c @@ -20,6 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include + typedef unsigned char bool8; typedef unsigned char uint8; typedef unsigned short uint16; @@ -30,19 +32,6 @@ typedef long int32; #define FALSE 0 #define TRUE 1 -struct -{ - bool8 waiting4command; - bool8 half_command; - uint16 command; - uint32 in_count; - uint32 in_index; - uint32 out_count; - uint32 out_index; - uint8 parameters[512]; - uint8 output[512]; -} DSP4; - /* Due recognition and credit are given on Overload's DSP website. Thank those contributors for their hard work on this chip. @@ -61,6 +50,19 @@ Fixed-point math reminder: #define WRITE_WORD(s, d) (*(uint16 *) (s)) = (d) #define WRITE_DWORD(s, d) (*(uint32 *) (s)) = (d) +struct +{ + bool8 waiting4command; + bool8 half_command; + uint16 command; + uint32 in_count; + uint32 in_index; + uint32 out_count; + uint32 out_index; + uint8 parameters[512]; + uint8 output[512]; +} DSP4; + // op control int8 DSP4_Logic; // controls op flow @@ -2043,14 +2045,12 @@ void DSP4_OP11(int16 A, int16 B, int16 C, int16 D, int16 *M) //Processing Code ///////////////////////////////////////////////////////////// - - - uint8 dsp4_byte; uint16 dsp4_address; void InitDSP4() { + memset(&DSP4, 0, sizeof(DSP4)); DSP4.waiting4command = TRUE; } diff --git a/zsnes/src/chips/dsp4proc.asm b/zsnes/src/chips/dsp4proc.asm index e1bdfdf7..ea773688 100644 --- a/zsnes/src/chips/dsp4proc.asm +++ b/zsnes/src/chips/dsp4proc.asm @@ -49,7 +49,7 @@ NEWSYM DSP4Read16b popad mov ah,byte[dsp4_byte] ret -; + NEWSYM DSP4Write16b mov word[dsp4_address],cx mov byte[dsp4_byte],al diff --git a/zsnes/src/init.asm b/zsnes/src/init.asm index 28ff79d2..652e619f 100644 --- a/zsnes/src/init.asm +++ b/zsnes/src/init.asm @@ -3085,6 +3085,7 @@ NEWSYM CheckROMType cmp byte[DSP3Enable],1 je .initdsp cmp byte[DSP4Enable],1 + jne .notDSP1Hi pushad call InitDSP4 popad