diff --git a/zsnes/src/chips/dsp4emu.c b/zsnes/src/chips/dsp4emu.c index 31b2f405..138f9415 100644 --- a/zsnes/src/chips/dsp4emu.c +++ b/zsnes/src/chips/dsp4emu.c @@ -1175,11 +1175,13 @@ void DSP4_OP09() int16 sp_dx, sp_dy; int16 pixels; - bool8 draw = TRUE; + bool8 draw; DSP4.in_count = 2; DSP4_WAIT(5) resume5 : + draw = TRUE; + // opcode termination raster = DSP4_READ_WORD(); if (raster == -0x8000) @@ -1211,6 +1213,8 @@ void DSP4_OP09() DSP4.in_count = 4; DSP4_WAIT(6) resume6 : + draw = TRUE; + ///////////////////////////////////// // process tile data @@ -2047,7 +2051,6 @@ void DSP4_OP11(int16 A, int16 B, int16 C, int16 D, int16 *M) ///////////////////////////////////////////////////////////// //Processing Code ///////////////////////////////////////////////////////////// - uint8 dsp4_byte; uint16 dsp4_address; @@ -2060,7 +2063,7 @@ void InitDSP4() void DSP4SetByte() { if ((dsp4_address & 0xf000) == 0x6000 || (dsp4_address >= 0x8000 && dsp4_address < 0xc000)) - { + { // clear pending read if (DSP4.out_index < DSP4.out_count) { @@ -2138,7 +2141,6 @@ void DSP4SetByte() DSP4.out_index = 0; DSP4.in_index = 0; - printf("DSP4 Command: %u\n", DSP4.command); switch (DSP4.command) { // 16-bit multiplication @@ -2147,12 +2149,11 @@ void DSP4SetByte() int16 multiplier, multiplicand; int32 product; - multiplier = DSP4_READ_WORD(); multiplicand = DSP4_READ_WORD(); DSP4_Multiply(multiplicand, multiplier, &product); - + DSP4_CLEAR_OUT(); DSP4_WRITE_WORD(product); DSP4_WRITE_WORD(product >> 16); @@ -2195,8 +2196,7 @@ void DSP4SetByte() int16 in3a = DSP4_READ_WORD(); int16 out1a, out2a, out3a, out4a; - //DSP4_OP0A(in2a, &out2a, &out1a, &out4a, &out3a); - DSP4_OP0A(in2a, &out1a, &out2a, &out3a, &out4a); + DSP4_OP0A(in2a, &out2a, &out1a, &out4a, &out3a); DSP4_CLEAR_OUT(); DSP4_WRITE_WORD(out1a); diff --git a/zsnes/src/chips/dsp4proc.asm b/zsnes/src/chips/dsp4proc.asm index ed821472..1ce58192 100644 --- a/zsnes/src/chips/dsp4proc.asm +++ b/zsnes/src/chips/dsp4proc.asm @@ -21,10 +21,15 @@ %include "macros.mac" EXTSYM dsp4_address,dsp4_byte,DSP4GetByte,DSP4SetByte +EXTSYM regaccessbankr16,regaccessbankr8,regaccessbankw16,regaccessbankw8 SECTION .text NEWSYM DSP4Read8b + test ecx,8000h + jnz .dsp4area + jmp regaccessbankr8 +.dsp4area mov word[dsp4_address],cx pushad call DSP4GetByte @@ -33,6 +38,10 @@ NEWSYM DSP4Read8b ret NEWSYM DSP4Write8b + test ecx,8000h + jnz .dsp4area + jmp regaccessbankw8 +.dsp4area mov word[dsp4_address],cx mov byte[dsp4_byte],al pushad @@ -41,11 +50,15 @@ NEWSYM DSP4Write8b ret NEWSYM DSP4Read16b + test ecx,8000h + jnz .dsp4area + jmp regaccessbankr16 +.dsp4area mov word[dsp4_address],cx pushad call DSP4GetByte popad - mov al,byte[dsp4_byte] + mov al,byte[dsp4_byte] inc word[dsp4_address] pushad call DSP4GetByte @@ -54,6 +67,10 @@ NEWSYM DSP4Read16b ret NEWSYM DSP4Write16b + test ecx,8000h + jnz .dsp4area + jmp regaccessbankw16 +.dsp4area mov word[dsp4_address],cx mov byte[dsp4_byte],al mov byte[dsp4temp],ah