Fk23c: Fix chr issues for some games

- Affects mostly waixing using mixed chr rom/ram modes (bit 2 of ram config register $A001)
This commit is contained in:
negativeExponent
2020-04-26 08:19:45 +08:00
parent 40ff23d0df
commit e6fcff5e99
2 changed files with 34 additions and 33 deletions

View File

@@ -84,15 +84,20 @@ static SFORMAT StateRegs[] = {
static void cwrap(uint16 A, uint16 V)
{
/* some workaround for chr rom / ram access */
if (!UNIFchrrama && !CHRRAMSIZE)
fk23_regs[0] &= ~0x20; /* chr rom with no chr ram always write to bank 0 */
else if (UNIFchrrama && WRAM_EXTENDED && (mmc3_wram & 0x04))
fk23_regs[0] &= ~0x20;
else if (UNIFchrrama)
fk23_regs[0] &= ~0x20; /* no chr rom, then chr ram is in bank 0 through UNIFchrrama */
int bank = 0;
setchr1r((fk23_regs[0] & 0x20) >> 1, A, V);
/* some workaround for chr rom / ram access */
if (!VROM_size)
bank = 0;
else if (CHRRAMSIZE && fk23_regs[0] & 0x20)
bank = 0x10;
if (WRAM_EXTENDED) {
if ((mmc3_wram & 0x04) && V < 8) bank = 0x10; /* first 8K of chr bank is ram */
else bank = 0;
}
setchr1r(bank, A, V);
}
static void SyncCHR(void)