From 7b4f0848308c313745c409cc2830cf551bc05c87 Mon Sep 17 00:00:00 2001 From: NewRisingSun <8vytz1+dhp372pv94ebg@sharklasers.com> Date: Tue, 9 Sep 2025 00:51:25 +0200 Subject: [PATCH] Add mapper 578. --- src/boards/432.c | 8 +++---- src/boards/578.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ src/ines.c | 1 + src/ines.h | 1 + 4 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 src/boards/578.c diff --git a/src/boards/432.c b/src/boards/432.c index 002718d..c17c897 100644 --- a/src/boards/432.c +++ b/src/boards/432.c @@ -32,10 +32,10 @@ static DECLFR(readPad) { } static void sync() { - int prgAND =reg[1] &0x02? 0x0F: 0x1F; - int chrAND =reg[1] &0x20 && submapper == 3? 0x1FF: reg[1] &0x04? 0x7F: 0xFF; - int prgOR =reg[1] <<4 &0x10 | reg[1] <<1 &0x60; - int chrOR =reg[1] <<7 &0x80 | reg[1] <<5 &0x100 | reg[1] <<4 &0x200; + int prgAND = reg[1] &0x02? 0x0F: 0x1F; + int chrAND = reg[1] &0x20 && submapper == 3? 0x1FF: reg[1] &0x04? 0x7F: 0xFF; + int prgOR = reg[1] <<4 &0x10 | reg[1] <<1 &0x60; + int chrOR = reg[1] <<7 &0x80 | reg[1] <<5 &0x100 | reg[1] <<4 &0x200; MMC3_syncPRG(prgAND, prgOR &~prgAND); MMC3_syncCHR(chrAND, chrOR &~chrAND); MMC3_syncMirror(); diff --git a/src/boards/578.c b/src/boards/578.c new file mode 100644 index 0000000..c70a936 --- /dev/null +++ b/src/boards/578.c @@ -0,0 +1,60 @@ +/* FCEUmm - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2020 + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * + */ + +#include "mapinc.h" +#include "asic_mmc3.h" + +static uint8 reg; + +static void sync() { + int prgAND = reg &0x02 && reg &0x04? 0x1F: 0x0F; + int chrAND = reg &0x02 && reg &0x04? 0xFF: 0x7F; + int prgOR = reg <<4; + int chrOR = reg <<7; + MMC3_syncPRG(prgAND, prgOR &~prgAND); + MMC3_syncCHR(chrAND, chrOR &~chrAND); + MMC3_syncMirror(); +} + +static DECLFW(writeReg) { + reg = V; + sync(); +} + +static void reset() { + reg = 0; + sync(); +} + +static void power() { + int i; + reg = 0; + MMC3_power(); + for (int i = 0x8000; i < 0xFFFF; i +=4) SetWriteHandler(i |2, i |3, writeReg); +} + +void Mapper578_Init(CartInfo *info) { + MMC3_init(info, sync, MMC3_TYPE_AX5202P, NULL, NULL, NULL, writeReg); + info->Power = power; + info->Reset = reset; + AddExState(®, 1, 0, "EXPR"); +} diff --git a/src/ines.c b/src/ines.c index 93cf2f2..39716d5 100644 --- a/src/ines.c +++ b/src/ines.c @@ -952,6 +952,7 @@ INES_BOARD_BEGIN() INES_BOARD( "J-2020", 563, Mapper563_Init ) INES_BOARD( "Top Ten Variety (SF III)", 567, Mapper567_Init ) INES_BOARD( "5068", 573, Mapper573_Init ) + INES_BOARD( "910610", 578, Mapper578_Init ) INES_BOARD( "T-215", 579, Mapper579_Init ) INES_BOARD( "ET-82", 581, Mapper581_Init ) INES_BOARD( "8203", 583, Mapper583_Init ) diff --git a/src/ines.h b/src/ines.h index 5ba4eb1..d262f3f 100644 --- a/src/ines.h +++ b/src/ines.h @@ -417,6 +417,7 @@ void Mapper561_562_Init(CartInfo *); void Mapper563_Init(CartInfo *); void Mapper567_Init(CartInfo *); void Mapper573_Init(CartInfo *); +void Mapper578_Init(CartInfo *); void Mapper579_Init(CartInfo *); void Mapper581_Init(CartInfo *); void Mapper583_Init(CartInfo *);