Fixed ROM banking -- appears to fix the sounds in Daytona 2 PE and VON2 but otherwise has not been extensively tested. The high 8MB of the 68K address is treated as a single window into the 16MB sample ROM, and can point either to the low or high 8MB bank.

This commit is contained in:
Bart Trzynadlowski 2011-12-23 21:06:45 +00:00
parent 4c3d6e1abf
commit a71af94edb
2 changed files with 21 additions and 44 deletions

View file

@ -70,15 +70,9 @@ static FILE *soundFP;
void CSoundBoard::UpdateROMBanks(void) void CSoundBoard::UpdateROMBanks(void)
{ {
if ((ctrlReg&0x10)) if ((ctrlReg&0x10))
{ sampleBank = &sampleROM[0x800000];
sampleBankLo = &sampleROM[0xA00000];
sampleBankHi = &sampleROM[0xE00000];
}
else else
{ sampleBank = &sampleROM[0x000000];
sampleBankLo = &sampleROM[0x200000];
sampleBankHi = &sampleROM[0x600000];
}
} }
UINT8 CSoundBoard::Read8(UINT32 a) UINT8 CSoundBoard::Read8(UINT32 a)
@ -100,19 +94,15 @@ UINT8 CSoundBoard::Read8(UINT32 a)
case 0x6: // Program ROM: 600000-67FFFF (unlike real hardware, we mirror up to 6FFFFF here) case 0x6: // Program ROM: 600000-67FFFF (unlike real hardware, we mirror up to 6FFFFF here)
return soundROM[(a&0x07FFFF)^1]; return soundROM[(a&0x07FFFF)^1];
case 0x8: // Sample ROM (low 2MB, fixed): 800000-9FFFFF case 0x8: // Sample ROM bank: 800000-FFFFFF
case 0x9: case 0x9:
return sampleROM[(a&0x1FFFFF)^1]; case 0xA:
case 0xA: // Sample ROM (bank): A00000-DFFFFF
case 0xB: case 0xB:
case 0xC: case 0xC:
case 0xD: case 0xD:
return sampleBankLo[(a-0xA00000)^1]; case 0xE:
case 0xE: // Sample ROM (bank): E00000-FFFFFF
case 0xF: case 0xF:
return sampleBankHi[(a&0x1FFFFF)^1]; return sampleBank[(a&0x7FFFFF)^1];
default: default:
//printf("68K: Unknown read8 %06X\n", a); //printf("68K: Unknown read8 %06X\n", a);
@ -123,7 +113,7 @@ UINT8 CSoundBoard::Read8(UINT32 a)
} }
UINT16 CSoundBoard::Read16(UINT32 a) UINT16 CSoundBoard::Read16(UINT32 a)
{ {
switch ((a>>20)&0xF) switch ((a>>20)&0xF)
{ {
case 0x0: // SCSP RAM 1 (master): 000000-0FFFFF case 0x0: // SCSP RAM 1 (master): 000000-0FFFFF
@ -141,19 +131,15 @@ UINT16 CSoundBoard::Read16(UINT32 a)
case 0x6: // Program ROM: 600000-67FFFF case 0x6: // Program ROM: 600000-67FFFF
return *(UINT16 *) &soundROM[a&0x07FFFF]; return *(UINT16 *) &soundROM[a&0x07FFFF];
case 0x8: // Sample ROM (low 2MB, fixed): 800000-9FFFFF case 0x8: // Sample ROM bank: 800000-FFFFFF
case 0x9: case 0x9:
return *(UINT16 *) &sampleROM[a&0x1FFFFF]; case 0xA:
case 0xA: // Sample ROM (bank): A00000-DFFFFF
case 0xB: case 0xB:
case 0xC: case 0xC:
case 0xD: case 0xD:
return *(UINT16 *) &sampleBankLo[a-0xA00000]; case 0xE:
case 0xE: // Sample ROM (bank): E00000-FFFFFF
case 0xF: case 0xF:
return *(UINT16 *) &sampleBankHi[a&0x1FFFFF]; return *(UINT16 *) sampleBank[a&0x7FFFFF];
default: default:
//printf("68K: Unknown read16 %06X\n", a); //printf("68K: Unknown read16 %06X\n", a);
@ -189,25 +175,17 @@ UINT32 CSoundBoard::Read32(UINT32 a)
hi = *(UINT16 *) &soundROM[a&0x07FFFF]; hi = *(UINT16 *) &soundROM[a&0x07FFFF];
lo = *(UINT16 *) &soundROM[(a+2)&0x07FFFF]; lo = *(UINT16 *) &soundROM[(a+2)&0x07FFFF];
return (hi<<16)|lo; return (hi<<16)|lo;
case 0x8: // Sample ROM (low 2MB, fixed): 800000-9FFFFF case 0x8: // Sample ROM bank: 800000-FFFFFF
case 0x9: case 0x9:
hi = *(UINT16 *) &sampleROM[a&0x1FFFFF]; case 0xA:
lo = *(UINT16 *) &sampleROM[(a+2)&0x1FFFFF];
return (hi<<16)|lo;
case 0xA: // Sample ROM (bank): A00000-DFFFFF
case 0xB: case 0xB:
case 0xC: case 0xC:
case 0xD: case 0xD:
hi = *(UINT16 *) &sampleBankLo[a-0xA00000]; case 0xE:
lo = *(UINT16 *) &sampleBankLo[a+2-0xA00000];
return (hi<<16)|lo;
case 0xE: // Sample ROM (bank): E00000-FFFFFF
case 0xF: case 0xF:
hi = *(UINT16 *) &sampleBankHi[a&0x1FFFFF]; hi = *(UINT16 *) &sampleBank[a&0x7FFFFF];
lo = *(UINT16 *) &sampleBankHi[(a+2)&0x1FFFFF]; lo = *(UINT16 *) &sampleBank[(a+2)&0x7FFFFF];
return (hi<<16)|lo; return (hi<<16)|lo;
default: default:

View file

@ -205,8 +205,7 @@ private:
// Sound board memory // Sound board memory
const UINT8 *soundROM; // 68K program ROM (passed in from parent object) const UINT8 *soundROM; // 68K program ROM (passed in from parent object)
const UINT8 *sampleROM; // 68K sample ROM (passed in from parent object) const UINT8 *sampleROM; // 68K sample ROM (passed in from parent object)
const UINT8 *sampleBankLo; // sample ROM bank switching const UINT8 *sampleBank; // sample ROM bank switching (points to high or low 8MB)
const UINT8 *sampleBankHi;
UINT8 *memoryPool; // single allocated region for all sound board RAM UINT8 *memoryPool; // single allocated region for all sound board RAM
UINT8 *ram1, *ram2; // SCSP1 and SCSP2 RAM UINT8 *ram1, *ram2; // SCSP1 and SCSP2 RAM