From a5df7359bc861131853259175373555a6feb1db3 Mon Sep 17 00:00:00 2001 From: NewRisingSun <8vytz1+dhp372pv94ebg@sharklasers.com> Date: Tue, 10 Mar 2026 19:37:22 +0100 Subject: [PATCH] Add mapper 615. --- src/boards/615.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ src/ines.c | 1 + src/ines.h | 1 + 3 files changed, 72 insertions(+) create mode 100644 src/boards/615.c diff --git a/src/boards/615.c b/src/boards/615.c new file mode 100644 index 0000000..da373d1 --- /dev/null +++ b/src/boards/615.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" + +static uint8 reg[3]; + +static void sync () { + int prg = reg[0] &0x34 | reg[1] <<3 &0x08; + if (reg[0] &0x08) { + if (reg[0] &0x20 && reg[1] &0x01) { + setprg16(0x8000, prg &0x3C | reg[2] &0x03); + setprg16(0xC000, prg &0x3C | 0x03); + } else { + setprg16(0x8000, prg &0x38 | reg[2] &0x07); + setprg16(0xC000, prg &0x38 | 0x07); + } + } else + setprg32(0x8000, prg >>1 &0x1C | reg[0] >>1 &0x03); + setchr8(0); + setmirror(reg[0] &0x80? MI_H: MI_V); +} + +static DECLFW (writeReg) { + if (A < 0x8000) { + reg[0] = V; + reg[1] = A &0xFF; + } else + reg[2] = V; + sync(); +} + +static void reset () { + reg[0] = reg[1] = reg[2] = 0; + sync(); +} + +static void power () { + SetReadHandler(0x6000, 0xFFFF, CartBR); + SetWriteHandler(0x6000, 0xFFFF, writeReg); + reset(); +} + +static void stateRestore (int version) { + sync(); +} + +void Mapper615_Init (CartInfo *info) { + info->Power = power; + info->Reset = reset; + GameStateRestore = stateRestore; + AddExState(reg, 3, 0, "REGS"); +} diff --git a/src/ines.c b/src/ines.c index beeb6e0..dd417a0 100644 --- a/src/ines.c +++ b/src/ines.c @@ -1032,6 +1032,7 @@ INES_BOARD_BEGIN() INES_BOARD( "K-3004", 612, Mapper612_Init ) INES_BOARD( "S5668 3366", 613, Mapper613_Init ) INES_BOARD( "New Star 9135", 614, Mapper614_Init ) + INES_BOARD( "LB12in1", 615, Mapper615_Init ) INES_BOARD( "K-3044", 616, Mapper616_Init ) INES_BOARD_END() diff --git a/src/ines.h b/src/ines.h index 9b7fafa..d1fe952 100644 --- a/src/ines.h +++ b/src/ines.h @@ -501,6 +501,7 @@ void Mapper611_Init(CartInfo *); void Mapper612_Init(CartInfo *); void Mapper613_Init(CartInfo *); void Mapper614_Init(CartInfo *); +void Mapper615_Init(CartInfo *); void Mapper616_Init(CartInfo *); void FFE_Init(CartInfo *);