More mapper 45 fixes

This commit is contained in:
Alexey 'Cluster' Avdyukhin 2023-10-26 23:33:49 +04:00
parent 764e1ebd76
commit 5a5faa7372
1 changed files with 16 additions and 8 deletions

View File

@ -514,6 +514,9 @@ static void M45PW(uint32 A, uint8 V) {
} }
static DECLFW(M45Write) { static DECLFW(M45Write) {
WRAM[A - 0x6000] = V;
if (!(A & 1))
{
if (EXPREGS[3] & 0x40) { if (EXPREGS[3] & 0x40) {
WRAM[A - 0x6000] = V; WRAM[A - 0x6000] = V;
return; return;
@ -523,6 +526,11 @@ static DECLFW(M45Write) {
FixMMC3PRG(MMC3_cmd); FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd); FixMMC3CHR(MMC3_cmd);
} }
else {
// lock reset
EXPREGS[3] &= ~0x40;
}
}
static DECLFR(M45Read) { static DECLFR(M45Read) {
uint32 addr = 1 << (EXPREGS[5] + 4); uint32 addr = 1 << (EXPREGS[5] + 4);
@ -542,7 +550,7 @@ static void M45Reset(void) {
static void M45Power(void) { static void M45Power(void) {
GenMMC3Power(); GenMMC3Power();
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = EXPREGS[4] = EXPREGS[5] = 0; EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = EXPREGS[4] = EXPREGS[5] = 0;
SetWriteHandler(0x5000, 0x7FFF, M45Write); SetWriteHandler(0x6000, 0x7FFF, M45Write);
SetReadHandler(0x5000, 0x5FFF, M45Read); SetReadHandler(0x5000, 0x5FFF, M45Read);
} }