Revise mapper 455.

This commit is contained in:
NewRisingSun
2025-09-12 14:05:59 +02:00
parent 2731fdc56b
commit 7e774f4f5a

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator /* FCEUmm - NES/Famicom Emulator
* *
* Copyright notice for this file: * Copyright notice for this file:
* Copyright (C) 2022 * Copyright (C) 2020
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -16,62 +16,57 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*
*/ */
/* N625836 PCB */
#include "mapinc.h" #include "mapinc.h"
#include "mmc3.h" #include "asic_mmc3.h"
static void Mapper455_PRGWrap(uint32 A, uint8 V) { static uint8 reg[2];
int prgAND =EXPREGS[1] &0x01? 0x1F: 0x0F;
int prgOR =EXPREGS[0] >>2 &0x07 | EXPREGS[1] <<1 &0x08 | EXPREGS[0] >>2 &0x10; static void sync () {
if (EXPREGS[0] &0x01) { if (reg[0] &0x01) {
if (EXPREGS[0] &0x02) { if (reg[0] &0x02)
setprg32(0x8000, prgOR >>1); setprg32(0x8000, reg[0] >>3);
} else { else {
setprg16(0x8000, prgOR); setprg16(0x8000, reg[0] >>2);
setprg16(0xC000, prgOR); setprg16(0xC000, reg[0] >>2);
} }
MMC3_syncCHR(0xFF, 0x00);
} else { } else {
prgOR <<=1; int prgAND = 0x1F;
setprg8(A, V &prgAND | prgOR &~prgAND); int chrAND = reg[1] &0x02? 0x7F: 0xFF;
int prgOR = reg[0] >>1;
int chrOR = reg[1] <<6;
MMC3_syncPRG(prgAND, prgOR &~prgAND);
MMC3_syncCHR(chrAND, chrOR &~chrAND);
} }
MMC3_syncMirror();
} }
static void Mapper455_CHRWrap(uint32 A, uint8 V) { static DECLFW (writeReg) {
int chrAND =EXPREGS[1] &0x02? 0xFF: 0x7F;
int chrOR =(EXPREGS[0] >>2 &0x07 | EXPREGS[1] <<1 &0x08 | EXPREGS[0] >>2 &0x10) <<4;
setchr1(A, V &chrAND | chrOR &~chrAND);
}
static DECLFW(Mapper455_Write) {
if (A &0x100) { if (A &0x100) {
EXPREGS[0] =V; reg[0] = V;
EXPREGS[1] =A &0xFF; reg[1] = A &0xFF;
FixMMC3PRG(MMC3_cmd); sync();
FixMMC3CHR(MMC3_cmd);
} }
} }
static void Mapper455_Reset(void) { static void reset () {
EXPREGS[0] =1; reg[0] = reg[1] = 0;
EXPREGS[1] =0; MMC3_clear();
MMC3RegReset();
} }
static void Mapper455_Power(void) { static void power () {
EXPREGS[0] =1; reg[0] = reg[1] = 0;
EXPREGS[1] =0; MMC3_power();
GenMMC3Power(); SetWriteHandler(0x4020, 0x5FFF, writeReg);
SetWriteHandler(0x4100, 0x5FFF, Mapper455_Write);
} }
void Mapper455_Init(CartInfo *info) { void Mapper455_Init (CartInfo *info) {
GenMMC3_Init(info, 256, 256, 0, 0); MMC3_init(info, sync, MMC3_TYPE_AX5202P, NULL, NULL, NULL, NULL);
cwrap = Mapper455_CHRWrap; info->Power = power;
pwrap = Mapper455_PRGWrap; info->Reset = reset;
info->Power = Mapper455_Power; AddExState(reg, 2, 0, "EXPR");
info->Reset = Mapper455_Reset;
AddExState(EXPREGS, 2, 0, "EXPR");
} }