diff --git a/src/boards/122.c b/src/boards/122.c new file mode 100644 index 0000000..9021045 --- /dev/null +++ b/src/boards/122.c @@ -0,0 +1,56 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2025 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" + +static uint8 reg[2]; + +static void sync () { + setprg32(0x8000, 0); + setchr4(0x0000, reg[0]); + setchr4(0x1000, reg[1]); +} + +static DECLFW (writeReg) { + reg[A &1] = V; + sync(); +} + +static void reset () { + reg[0] = reg[1] = 0; + sync(); +} + +static void power () { + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, writeReg); + reset(); +} + +static void stateRestore (int version) { + sync(); +} + +void Mapper122_Init (CartInfo *info) { + info->Reset = reset; + info->Power = power; + GameStateRestore = stateRestore; + AddExState(reg, 2, 0, "REGS"); +} diff --git a/src/ines.c b/src/ines.c index 0825ede..f1fceb1 100644 --- a/src/ines.c +++ b/src/ines.c @@ -575,7 +575,7 @@ INES_BOARD_BEGIN() INES_BOARD( "NES-TQROM", 119, Mapper119_Init ) INES_BOARD( "FDS TOBIDASE", 120, Mapper120_Init ) INES_BOARD( "MMC3 PIRATE PROT. A", 121, Mapper121_Init ) -/* INES_BOARD( "", 122, Mapper122_Init ) */ + INES_BOARD( "JY043", 122, Mapper122_Init ) INES_BOARD( "MMC3 PIRATE H2288", 123, UNLH2288_Init ) /* INES_BOARD( "", 124, Mapper124_Init ) */ INES_BOARD( "FDS LH32", 125, LH32_Init ) diff --git a/src/ines.h b/src/ines.h index 37695a7..6258ca9 100644 --- a/src/ines.h +++ b/src/ines.h @@ -150,6 +150,7 @@ void Mapper117_Init(CartInfo *); void Mapper119_Init(CartInfo *); void Mapper120_Init(CartInfo *); void Mapper121_Init(CartInfo *); +void Mapper122_Init(CartInfo *); void Mapper125_Init(CartInfo *); void Mapper126_Init(CartInfo *); void Mapper128_Init(CartInfo *);