diff --git a/Src/Model3/DSB.cpp b/Src/Model3/DSB.cpp index 36a84d5..30a42ad 100644 --- a/Src/Model3/DSB.cpp +++ b/Src/Model3/DSB.cpp @@ -376,7 +376,7 @@ UINT8 CDSB1::IORead8(UINT32 addr) if (fifoIdxR != fifoIdxW) // if these are equal, nothing has been written yet (don't advance) { fifoIdxR++; - fifoIdxR &= 127; + fifoIdxR &= FIFO_STACK_SIZE_MASK; } if (fifoIdxR == fifoIdxW) // FIFO empty? @@ -415,7 +415,7 @@ void CDSB1::SendCommand(UINT8 data) * over the course of a frame at once. */ fifo[fifoIdxW++] = data; - fifoIdxW &= 127; + fifoIdxW &= FIFO_STACK_SIZE_MASK; //printf("Write FIFO: %02X\n", data); // Have we caught up to the read pointer? @@ -983,7 +983,7 @@ void CDSB2::SendCommand(UINT8 data) * over the course of a frame at once. */ fifo[fifoIdxW++] = data; - fifoIdxW &= 255; + fifoIdxW &= FIFO_STACK_SIZE_MASK; //printf("Write FIFO: %02X\n", data); // Have we caught up to the read pointer? @@ -1013,7 +1013,7 @@ void CDSB2::RunFrame(INT16 *audioL, INT16 *audioR) { cmdLatch = fifo[fifoIdxR]; // retrieve next command byte fifoIdxR++; - fifoIdxR &= 255; + fifoIdxR &= FIFO_STACK_SIZE_MASK; M68KSetIRQ(1); // indicate pending command //printf("68K INT fired\n"); diff --git a/Src/Model3/DSB.h b/Src/Model3/DSB.h index 6fc391c..f39789b 100644 --- a/Src/Model3/DSB.h +++ b/Src/Model3/DSB.h @@ -38,6 +38,8 @@ #include "CPU/Z80/Z80.h" #include "Util/NewConfig.h" +#define FIFO_STACK_SIZE 0x100 +#define FIFO_STACK_SIZE_MASK (FIFO_STACK_SIZE - 1) /****************************************************************************** Resampling @@ -213,7 +215,7 @@ private: UINT8 *ram; // Z80 RAM // Command FIFO - UINT8 fifo[128]; + UINT8 fifo[FIFO_STACK_SIZE]; int fifoIdxR; // read position int fifoIdxW; // write position @@ -301,7 +303,7 @@ private: UINT8 *ram; // 68K RAM // Command FIFO - UINT8 fifo[256]; + UINT8 fifo[FIFO_STACK_SIZE]; int fifoIdxR; // read position int fifoIdxW; // write position diff --git a/Src/Sound/SCSP.cpp b/Src/Sound/SCSP.cpp index d10bfd7..8b3e68a 100644 --- a/Src/Sound/SCSP.cpp +++ b/Src/Sound/SCSP.cpp @@ -134,7 +134,7 @@ static DWORD IrqMidi; unsigned short MCIEB; unsigned short MCIPD; -#define MIDI_STACK_SIZE 128 +#define MIDI_STACK_SIZE 0x100 #define MIDI_STACK_SIZE_MASK (MIDI_STACK_SIZE-1) static BYTE MidiOutStack[16];