From 726d7157f859c118ecd8d08b0b387d955225d999 Mon Sep 17 00:00:00 2001 From: NewRisingSun <8vytz1+dhp372pv94ebg@sharklasers.com> Date: Tue, 10 Mar 2026 17:46:33 +0100 Subject: [PATCH] Add mapper 613. --- src/boards/613.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ src/ines.c | 1 + src/ines.h | 1 + 3 files changed, 72 insertions(+) create mode 100644 src/boards/613.c diff --git a/src/boards/613.c b/src/boards/613.c new file mode 100644 index 0000000..c501647 --- /dev/null +++ b/src/boards/613.c @@ -0,0 +1,70 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2026 NewRisingSun + * + * 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_mmc1.h" +#include "asic_mmc3.h" + +static uint8 reg; + +static void sync (void) { + if (reg &0x01) { + MMC3_syncPRG(0x0F, reg <<4); + MMC3_syncCHR(0x7F, reg <<7); + MMC3_syncMirror(); + } else { + MMC1_syncPRG(0x07, reg <<3); + MMC1_syncCHR(0x1F, reg <<5); + MMC1_syncMirror(); + } +} + +static void applyMode (uint8 clear) { + PPU_hook = NULL; + MapIRQHook = NULL; + GameHBIRQHook = NULL; + if (reg &0x01) + MMC3_activate(clear, sync, MMC3_TYPE_AX5202P, NULL, NULL, NULL, NULL); + else + MMC1_activate(clear, sync, MMC1_TYPE_MMC1B, NULL, NULL, NULL, NULL); +} + +static void reset (void) { + reg++; + applyMode(1); +} + +static void power (void) { + reg = 0; + applyMode(1); +} + +static void restore (int version) { + applyMode(0); +} + +void Mapper613_Init (CartInfo *info) { + MMC1_addExState(); + MMC3_addExState(); + info->Reset = reset; + info->Power = power; + GameStateRestore = restore; + AddExState(®, 1, 0, "EXPR"); +} diff --git a/src/ines.c b/src/ines.c index 596c200..8fe523c 100644 --- a/src/ines.c +++ b/src/ines.c @@ -1029,6 +1029,7 @@ INES_BOARD_BEGIN() INES_BOARD( "63-100", 609, Mapper609_Init ) INES_BOARD( "J-2042", 610, Mapper610_Init ) INES_BOARD( "T-124/43-117/831049", 611, Mapper611_Init ) + INES_BOARD( "S5668 3366", 613, Mapper613_Init ) INES_BOARD( "K-3044", 616, Mapper616_Init ) INES_BOARD_END() diff --git a/src/ines.h b/src/ines.h index 1e0570d..e22a48f 100644 --- a/src/ines.h +++ b/src/ines.h @@ -498,6 +498,7 @@ void Mapper608_Init(CartInfo *); void Mapper609_Init(CartInfo *); void Mapper610_Init(CartInfo *); void Mapper611_Init(CartInfo *); +void Mapper613_Init(CartInfo *); void Mapper616_Init(CartInfo *); void FFE_Init(CartInfo *);