From 902b3b01c696b873d3fce24f4eb96e74c4d0dcb3 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Sat, 25 May 2024 09:23:37 +0200 Subject: [PATCH] Add mapper 500 --- src/boards/500.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ src/ines.c | 1 + src/ines.h | 1 + src/unif.c | 1 + 4 files changed, 61 insertions(+) create mode 100644 src/boards/500.c diff --git a/src/boards/500.c b/src/boards/500.c new file mode 100644 index 0000000..ef3e8d4 --- /dev/null +++ b/src/boards/500.c @@ -0,0 +1,58 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2023 + * + * 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 "latch.h" + +static uint8 reg[2]; + +static SFORMAT StateRegs[] = { + { reg, 2, "REGS" }, + { 0 } +}; + +static void Sync(void) { + setprg4(0x7000, 0); + setprg16(0x8000, (reg[0] << 3) | (latch.data & 7)); + setprg16(0xC000, (reg[0] << 3) | 7); + setchr8(0); + setmirror(reg[1] & 1); +} + +static DECLFW(M500WriteReg) { + if (~reg[1] & 0x80) { + reg[A & 1] = V; + Sync(); + } +} + +static void M500Power() { + reg[0] = reg[1] = 0; + LatchPower(); + SetReadHandler(0x7000, 0x7FFF, CartBR); + SetWriteHandler(0x6000, 0x6FFF, M500WriteReg); +} + +void Mapper500_Init(CartInfo *info) { + Latch_Init(info, Sync, NULL, 0, 0); + info->Power = M500Power; + AddExState(StateRegs, ~0, 0, NULL); +} diff --git a/src/ines.c b/src/ines.c index dd2ea86..484c85f 100644 --- a/src/ines.c +++ b/src/ines.c @@ -834,6 +834,7 @@ INES_BOARD_BEGIN() INES_BOARD( "Keybyte Computer", 466, Mapper466_Init ) INES_BOARD( "47-2", 467, Mapper467_Init ) INES_BOARD( "BlazePro CPLD", 468, Mapper468_Init ) + INES_BOARD( "Yhc-000", 500, Mapper500_Init ) INES_BOARD( "SA-9602B", 513, SA9602B_Init ) INES_BOARD( "Brilliant Com Cocoma Pack", 516, Mapper516_Init ) INES_BOARD( "DANCE2000", 518, UNLD2000_Init ) diff --git a/src/ines.h b/src/ines.h index 6f61a7d..54a9840 100644 --- a/src/ines.h +++ b/src/ines.h @@ -343,6 +343,7 @@ void Mapper465_Init(CartInfo *); void Mapper466_Init(CartInfo *); void Mapper467_Init(CartInfo *); void Mapper468_Init(CartInfo *); +void Mapper500_Init(CartInfo *); void Mapper516_Init(CartInfo *); void Mapper523_Init(CartInfo *); void Mapper533_Init(CartInfo *); diff --git a/src/unif.c b/src/unif.c index d566631..d2d964f 100644 --- a/src/unif.c +++ b/src/unif.c @@ -624,6 +624,7 @@ static BMAPPING bmap[] = { { "DS-07", 439, Mapper439_Init, 0 }, { "K86B", 439, Mapper439_Init, 0 }, { "COOLGIRL", 342, COOLGIRL_Init, BMCFLAG_256KCHRR }, + { "S-2009", 434, Mapper434_Init, 0 }, { NULL, NO_INES, NULL, 0 } };