Increase MIDI FIFO buffer size for SCSP; should prevent FIFO overflows

Also use similar macro for DSB FIFO buffer
This commit is contained in:
Matthew Daniels 2021-11-30 23:01:37 +00:00
parent e93c5d710f
commit 0c47ac831a
3 changed files with 9 additions and 7 deletions

View file

@ -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");

View file

@ -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

View file

@ -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];