Version 4.7d which now enables Intellivoice for the DS-Lite/Phat on World Series Major League Baseball.

This commit is contained in:
Dave Bernazzani 2024-01-22 11:53:27 -05:00
parent 8efcf9d6f0
commit 35e6fa69f4
5 changed files with 39 additions and 44 deletions

Binary file not shown.

View File

@ -50,9 +50,9 @@ public:
return ((UINT8*)image)[(location) - this->location];
}
inline UINT8 peek8a(UINT16 location) // For when you know this can't be disabled (e.g. iVoice ROM)
inline UINT8 peek8_fast(UINT16 location) // For when you know this can't be disabled and can mask the ROM easily (e.g. iVoice ROM)
{
return ((UINT8*)image)[(location) - this->location];
return ((UINT8*)image)[location];
}
// This is now optimized for 16-bit access... GROM and iVOICE ROM should always call the peek8() version above...

View File

@ -110,6 +110,7 @@ void SP0256::resetProcessor()
fifoSize = 0;
speaking = FALSE;
sp_idle = 1;
cleared = true;
amplitude = 0;
period = 0;
@ -119,7 +120,7 @@ void SP0256::resetProcessor()
y[i][0] = 0;
y[i][1] = 0;
}
memset(fifoBytes, 0x00, sizeof(fifoBytes));
}
@ -222,7 +223,7 @@ ITCM_CODE INT32 SP0256::readBitsReverse(INT32 numBits)
{
while (bitsLeft < numBits) {
if (pc < 0x1800) {
currentBits |= (ivoiceROM.peek8a((UINT16)pc) << bitsLeft);
currentBits |= (ivoiceROM.peek8_fast(pc & 0x7FF) << bitsLeft);
bitsLeft += 8;
pc++;
}
@ -251,7 +252,7 @@ ITCM_CODE INT32 SP0256::readBits(INT32 numBits)
{
while (bitsLeft < numBits) {
if (pc < 0x1800) {
currentBits |= (ivoiceROM.peek8a((UINT16)pc) << bitsLeft);
currentBits |= (ivoiceROM.peek8_fast(pc & 0x7FF) << bitsLeft);
bitsLeft += 8;
pc++;
}
@ -797,8 +798,8 @@ void SP0256::PAUSE(INT32 immed4) {
}
ITCM_CODE void SP0256::decode() {
INT32 immed4 = readBits(4);
INT32 nextInstruction = readBitsReverse(4);
UINT8 immed4 = readBits(4);
UINT8 nextInstruction = readBitsReverse(4);
switch (nextInstruction) {
case 0x0:
if (immed4 == 0)

View File

@ -118,14 +118,14 @@ class SP0256 : public Processor, public AudioProducer
void decode();
static INT32 flipEndian(INT32 value, INT32 bits);
UINT8 idle;
UINT8 lrqHigh;
UINT8 speaking;
INT16 fifoHead;
INT16 fifoSize;
INT32 command;
INT32 random;
INT32 page;
UINT8 idle;
UINT8 lrqHigh;
UINT8 speaking;
INT16 fifoHead;
INT16 fifoSize;
INT32 command;
INT32 random;
INT32 page;
};
#endif

View File

@ -24,39 +24,33 @@ void SP0256_Registers::init(SP0256* ms)
ITCM_CODE void SP0256_Registers::poke(UINT16 location, UINT16 value)
{
switch(location) {
//a poke of any value into $80 means that the SP0256 should
//start speaking
case 0x0080:
if (ms->lrqHigh) {
ms->lrqHigh = FALSE;
//$81 will reset the SP0256 or push an 16-bit value into the queue
if (location & 1)
{
if (value & 0x0400) {
ms->resetProcessor();
}
else if (ms->fifoSize < FIFO_MAX_SIZE) {
fifoBytes[(ms->fifoHead+ms->fifoSize) & 0x3F] = value;
ms->fifoSize++;
}
}
else //Any poke of any value into $80 means that the SP0256 should start speaking
{
if (ms->lrqHigh) {
ms->lrqHigh = FALSE;
ms->command = value & 0xFF;
ms->command = value & 0xFF;
if (!ms->speaking)
ms->idle = FALSE;
}
break;
//$81 will reset the SP0256 or push an 8-bit value into the queue
case 0x0081:
if (value & 0x0400) {
ms->resetProcessor();
}
else if (ms->fifoSize < FIFO_MAX_SIZE) {
fifoBytes[(ms->fifoHead+ms->fifoSize) & 0x3F] = value;
ms->fifoSize++;
}
break;
if (!ms->speaking)
ms->idle = FALSE;
}
}
}
ITCM_CODE UINT16 SP0256_Registers::peek(UINT16 location) {
switch(location) {
case 0x0080:
return (ms->lrqHigh ? 0x8000 : 0);
case 0x0081:
default:
return (ms->fifoSize == FIFO_MAX_SIZE ? 0x8000 : 0);
}
ITCM_CODE UINT16 SP0256_Registers::peek(UINT16 location)
{
if (location & 1) return (ms->fifoSize == FIFO_MAX_SIZE ? 0x8000 : 0);
return (ms->lrqHigh ? 0x8000 : 0);
}