From 5538bbedd9455380bf04c56223775c6bc6f414d1 Mon Sep 17 00:00:00 2001 From: negativeExponent Date: Thu, 22 Oct 2020 05:32:16 +0800 Subject: [PATCH] Update mapper 059/060 Excerpt from nesdev: NESten's Mapper DLL v1.0 contained an incorrect implementation of T3H53 as iNES mapper 059 and UNIF mapper BMC-T3H53. The UNIF implementation was improved in NESten's Mapper DLL v1.2 while the iNES implementation was not, causing confusion about what kind of cartridge the unimproved mapper 59 was supposed to be. As Nintendulator's mapper DLL is based on NESten's mapper DLL, this was carried over to Nintendulator. Presumably as a result of this confusion, FCEUX and others put the correct implementation of T3H53 at INES Mapper 060, displacing the "Reset-based NROM-128 4-in-1" in the process. With that said above, im following nesdev's notes and change the following: - Reassign Mapper 60 as Mapper 59. - Add BMC-T3H53, a UNIF cart using the same UNIF-board D1038 which is assigned as iNES Mapper 59 - Add the Reset-Based NRON-128 mapper, Mapper 60 --- src/boards/60.c | 56 ++++++++++++++++++++++++++++++++++++++++++ src/boards/addrlatch.c | 5 ++-- src/ines.c | 5 ++-- src/ines.h | 1 + src/unif.c | 1 + 5 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 src/boards/60.c diff --git a/src/boards/60.c b/src/boards/60.c new file mode 100644 index 0000000..01e4ccf --- /dev/null +++ b/src/boards/60.c @@ -0,0 +1,56 @@ +/* FCEUmm - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2020 negativeExponent + * + * 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 game = 0; + +static void Sync(void) +{ + setchr8(game); + setprg16(0x8000, game); + setprg16(0xC000, game); +} + +static void M60Reset(void) +{ + game = (game + 1) & 3; + Sync(); +} + +static void M60Power(void) +{ + game = 0; + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, CartBW); +} + +static void StateRestore(int version) { + Sync(); +} + +void Mapper60_Init(CartInfo *info) +{ + info->Power = M60Power; + info->Reset = M60Reset; + GameStateRestore = StateRestore; + AddExState(&game, 1, 0, "GAME"); +} \ No newline at end of file diff --git a/src/boards/addrlatch.c b/src/boards/addrlatch.c index b2e193a..415d574 100644 --- a/src/boards/addrlatch.c +++ b/src/boards/addrlatch.c @@ -166,7 +166,8 @@ void BMCGK192_Init(CartInfo *info) { /*------------------ Map 059 ---------------------------*/ /* One more forgotten mapper */ -static void M59Sync(void) { +/* Formerly, an incorrect implementation of BMC-T3H53 */ +/*static void M59Sync(void) { setprg32(0x8000, (latche >> 4) & 7); setchr8(latche & 0x7); setmirror((latche >> 3) & 1); @@ -181,7 +182,7 @@ static DECLFR(M59Read) { void Mapper59_Init(CartInfo *info) { Latch_Init(info, M59Sync, M59Read, 0x0000, 0x8000, 0xFFFF, 0); -} +}*/ /*------------------ Map 061 ---------------------------*/ static void M61Sync(void) { diff --git a/src/ines.c b/src/ines.c index 8b8c621..ab839b7 100644 --- a/src/ines.c +++ b/src/ines.c @@ -479,8 +479,9 @@ INES_BOARD_BEGIN() INES_BOARD( "UNLKS202", 56, UNLKS202_Init ) INES_BOARD( "SIMBPLE BMC PIRATE A", 57, Mapper57_Init ) INES_BOARD( "SIMBPLE BMC PIRATE B", 58, BMCGK192_Init ) - INES_BOARD( "", 59, Mapper59_Init ) /* Check this out */ - INES_BOARD( "SIMBPLE BMC PIRATE C", 60, BMCD1038_Init ) +/* INES_BOARD( "", 59, Mapper59_Init ) */ /* Check this out, update 2020-10-21 - formerly an incorrect implementation of T3H53 */ + INES_BOARD( "BMC T3H53/D1038", 59, BMCD1038_Init ) + INES_BOARD( "Reset-based NROM-128 ", 60, Mapper60_Init ) INES_BOARD( "20-in-1 KAISER Rev. A", 61, Mapper61_Init ) INES_BOARD( "700-in-1", 62, Mapper62_Init ) INES_BOARD( "", 63, Mapper63_Init ) diff --git a/src/ines.h b/src/ines.h index 3ad9898..bc119f2 100644 --- a/src/ines.h +++ b/src/ines.h @@ -94,6 +94,7 @@ void Mapper51_Init(CartInfo *); void Mapper52_Init(CartInfo *); void Mapper57_Init(CartInfo *); void Mapper59_Init(CartInfo *); +void Mapper60_Init(CartInfo *); void Mapper61_Init(CartInfo *); void Mapper62_Init(CartInfo *); void Mapper63_Init(CartInfo *); diff --git a/src/unif.c b/src/unif.c index 736dcb3..cc81a11 100644 --- a/src/unif.c +++ b/src/unif.c @@ -446,6 +446,7 @@ static BMAPPING bmap[] = { { "CNROM", 3, CNROM_Init, 0 }, { "CPROM", 13, CPROM_Init, BMCFLAG_16KCHRR }, { "D1038", 59, BMCD1038_Init, 0 }, + { "T3H53", 59, BMCD1038_Init, 0 }, { "DANCE", 256, UNLOneBus_Init, 0 }, { "DANCE2000", 518, UNLD2000_Init, 0 }, { "DREAMTECH01", 521, DreamTech01_Init, 0 },