From 0657d2136631e48030e994bfed4632d862bc0370 Mon Sep 17 00:00:00 2001 From: NewRisingSun <8vytz1+dhp372pv94ebg@sharklasers.com> Date: Sat, 10 Apr 2021 14:38:49 +0200 Subject: [PATCH] MINDKIDS accessible as NES 2.0 m268.1; mapper 224 is MINDKIDS; remove KT-008 remnants from mmc3.c --- src/boards/224.c | 50 -------------------------------------------- src/boards/coolboy.c | 9 ++++++++ src/boards/mmc3.c | 21 +------------------ src/ines-correct.h | 38 ++++++++++++++++++++++++++++++--- src/ines.c | 5 ++--- src/ines.h | 1 + 6 files changed, 48 insertions(+), 76 deletions(-) delete mode 100644 src/boards/224.c diff --git a/src/boards/224.c b/src/boards/224.c deleted file mode 100644 index 7c885b7..0000000 --- a/src/boards/224.c +++ /dev/null @@ -1,50 +0,0 @@ -/* FCEUmm - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2019 Libretro Team - * - * 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 - */ - -/* 2019-05-29 - Mapper 224, KT-008 - * iNES Mapper 224 is used for the 晶科泰 (Jncota) KT-008 PCB. - * It's an MMC3 clone that supports 1024 KiB of PRG-ROM through an additional - * outer bank register at $5000. - * http://wiki.nesdev.com/w/index.php/INES_Mapper_224 */ - -#include "mapinc.h" -#include "mmc3.h" - -static void M224PW(uint32 A, uint8 V) { - setprg8(A, (V & 0x3f) | ((EXPREGS[0] << 4) & 0x40)); -} - -static DECLFW(Mapper224Write) { - EXPREGS[0] = V; - FixMMC3PRG(MMC3_cmd); -} - -static void M224Power(void) { - EXPREGS[0] = 0; - GenMMC3Power(); - SetWriteHandler(0x5000, 0x5000, Mapper224Write); -} - -void Mapper224_Init(CartInfo *info) { - GenMMC3_Init(info, 1024, 0, 8, 0); - pwrap = M224PW; - info->Power = M224Power; - AddExState(EXPREGS, 1, 0, "EXPR"); -} diff --git a/src/boards/coolboy.c b/src/boards/coolboy.c index 5482550..357cd2a 100644 --- a/src/boards/coolboy.c +++ b/src/boards/coolboy.c @@ -174,3 +174,12 @@ void MINDKIDS_Init(CartInfo *info) { info->Reset = COOLBOYReset; AddExState(EXPREGS, 4, 0, "EXPR"); } + +void Mapper268_Init(CartInfo *info) { + /* Technically, the distinction between COOLBOY ($6000-$7FFF) and MINDKIDS ($5000-$5FFF) is based on a solder pad setting. */ + /* In NES 2.0, the submapper field is used to distinguish between the two settings. */ + if (info->submapper == 1) + MINDKIDS_Init(info); + else + COOLBOY_Init(info); +} diff --git a/src/boards/mmc3.c b/src/boards/mmc3.c index 1618bea..0698d85 100644 --- a/src/boards/mmc3.c +++ b/src/boards/mmc3.c @@ -184,17 +184,6 @@ DECLFW(MMC3_IRQWrite) { } } -/* KT-008 boards hack 2-in-1, TODO assign to new ines mapper, most dump of KT-boards on the net are mapper 4, so need database or goodnes fix support */ -DECLFW(KT008HackWrite) { -/* FCEU_printf("%04x:%04x\n",A,V); */ - switch (A & 3) { - case 0: kt_extra = V; FixMMC3PRG(MMC3_cmd); break; - case 1: break; /* unk */ - case 2: break; /* unk */ - case 3: break; /* unk */ - } -} - static void ClockMMC3Counter(void) { int count = IRQCount; if (!count || IRQReload) { @@ -236,9 +225,7 @@ static void GENPWRAP(uint32 A, uint8 V) { /* [NJ102] Mo Dao Jie (C) has 1024Mb MMC3 BOARD, maybe something other will be broken * also HengGe BBC-2x boards enables this mode as default board mode at boot up */ - setprg8(A, (V & 0x7F)/* | ((kt_extra & 4) << 4)*/); - /* KT-008 boards hack 2-in-1, TODO assign to new ines mapper, most dump of KT-boards on the net are mapper 4, so need database or goodnes fix support */ - /* KT-008 boards should be assigned to mapper 224 */ + setprg8(A, (V & 0x7F)); } static void GENMWRAP(uint8 V) { @@ -265,9 +252,6 @@ void GenMMC3Power(void) { SetWriteHandler(0xC000, 0xFFFF, MMC3_IRQWrite); SetReadHandler(0x8000, 0xFFFF, CartBR); - /* KT-008 boards hack 2-in-1, TODO assign to new ines mapper, most dump of KT-boards on the net are mapper 4, so need database or goodnes fix support */ - /* SetWriteHandler(0x5000,0x5FFF, KT008HackWrite); */ /* KT-008 boards should be assigned to mapper 224 */ - A001B = A000B = 0; setmirror(1); if (mmc3opts & 1) { @@ -321,9 +305,6 @@ void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery) { info->SaveGameLen[0] = WRAMSIZE; } - /* KT-008 boards hack 2-in-1, TODO assign to new ines mapper, most dump of KT-boards on the net are mapper 4, so need database or goodnes fix support */ - /* KT-008 boards should be assigned to mapper 224 */ - AddExState(&kt_extra, 1, 0, "KTEX"); AddExState(MMC3_StateRegs, ~0, 0, 0); info->Power = GenMMC3Power; diff --git a/src/ines-correct.h b/src/ines-correct.h index 4c4185d..5096d75 100644 --- a/src/ines-correct.h +++ b/src/ines-correct.h @@ -619,10 +619,42 @@ { 0x345ee51a, 245, DEFAULT, DEFAULT, 1, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Yong Zhe Dou E Long - Dragon Quest VII (Ch).nes */ { 0x57514c6c, 245, DEFAULT, DEFAULT, 1, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Yong Zhe Dou E Long - Dragon Quest VI (Ch).nes */ { 0xdb9d71b7, 114, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Super Donkey Kong (Unl) [o1].nes */ + + /* KT-008 PCB. These require mapper 224 for having an outer bank register at $5xxx, but are usually found set to mapper 4. */ { 0x61fc4d20, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* (KT-1062) 口袋怪兽꞉ 水晶版.nes */ - { 0x4d735cb1, 224, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Pokemon Platinum (KT-008 PCB)(Ch)[!].nes */ - { 0x4f427110, 224, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Pokemon Platinum Alt title 1 (KT-008 PCB)(Ch)[!].nes */ - { 0xe001de16, 224, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Pokemon Platinum Alt title 2 (KT-008 PCB)(Ch)[!].nes */ + { 0xaa666c19, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* Ys Origin: Hugo.nes */ + { 0xb0d011d3, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* Ys Origin: Yunica.nes */ + { 0x16143319, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* Ys VI: 纳比斯汀的方舟.nes */ + { 0xe05fc21f, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* Ys: 菲尔盖纳之誓约.nes */ + { 0xf8b58b59, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 三国志 - 蜀魏争霸.nes */ + { 0xcb1bab3d, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 三国志꞉ 蜀汉风云.nes */ + { 0xddc122ed, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 亡灵崛起.nes */ + { 0x4d2811c7, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 伏魔英雄传.nes */ + { 0x24750e5d, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 傲视天地.nes */ + { 0xc658b6a8, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 刀剑英雄传.nes */ + { 0xea831217, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 剑侠情缘.nes */ + { 0x92ebad5b, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 勇者斗恶龙 III꞉ 罪恶渊源.nes */ + { 0x48210324, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 勇者斗恶龙꞉ 勇者的试炼.nes */ + { 0x3439d140, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 勇者斗恶龙꞉ 天空的新娘.nes */ + { 0x9a0a531a, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 勇者斗恶龙꞉ 天空篇.nes */ + { 0xb5fdb3cb, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 勇者黑暗世界 - 混沌世界.nes */ + { 0x4f427110, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 口袋怪兽꞉ 珍珠版.nes */ + { 0xa46d6f4c, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 口袋怪兽꞉ 琥珀版.nes */ + { 0xe001de16, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 口袋怪兽꞉ 白金版.nes */ + { 0x5464d7f8, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 口袋怪兽꞉ 翡翠版.nes */ + { 0x4d735cb1, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 口袋怪兽꞉ 钻石版.nes */ + { 0x5d04547c, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 失落的神器.nes */ + { 0xcb524b42, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 征战天下.nes */ + { 0x5f362198, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 战神世界.nes */ + { 0x36de88e7, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 新魔界.nes */ + { 0xf8e9c9cf, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 无双乱舞.nes */ + { 0xa4c39535, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 神魔大陆.nes */ + { 0x76bbe916, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 落日征战.nes */ + { 0x9b518d54, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 轩辕剑꞉ 云的彼端.nes */ + { 0x91396b3f, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 轩辕剑꞉ 天之痕.nes */ + { 0xaa621fa0, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 轩辕剑꞉ 枫之舞.nes */ + { 0x48d1f54a, 224, DEFAULT, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 轩辕剑꞉ 王者归来.nes */ + { 0xbdbe3c96, 238, DEFAULT, MI_V, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Contra Fighter (Unl).nes */ { 0xcb53c523, 11, DEFAULT, MI_V, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* King Neptune's Adventure (USA) (Unl).nes */ { 0x6e149729, 189, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Master Fighter II (Unl) [a1].nes */ diff --git a/src/ines.c b/src/ines.c index 316fa5d..33cbed2 100644 --- a/src/ines.c +++ b/src/ines.c @@ -639,7 +639,7 @@ INES_BOARD_BEGIN() INES_BOARD( "UNLN625092", 221, UNLN625092_Init ) INES_BOARD( "", 222, Mapper222_Init ) /* INES_BOARD( "", 223, Mapper223_Init ) */ - INES_BOARD( "KT-008", 224, Mapper224_Init ) + INES_BOARD( "KT-008", 224, MINDKIDS_Init ) /* The KT-008 board contains the MINDKIDS chipset */ INES_BOARD( "", 225, Mapper225_Init ) INES_BOARD( "BMC 22+20-in-1", 226, Mapper226_Init ) INES_BOARD( "", 227, Mapper227_Init ) @@ -724,8 +724,7 @@ INES_BOARD_BEGIN() INES_BOARD( "YOKO", 264, UNLYOKO_Init ) INES_BOARD( "T-262", 265, BMCT262_Init ) INES_BOARD( "CITYFIGHT", 266, UNLCITYFIGHT_Init ) - INES_BOARD( "COOLBOY", 268, COOLBOY_Init ) -/* INES_BOARD( "MINDKIDS", 268, MINDKIDS_Init ) */ + INES_BOARD( "COOLBOY/MINDKIDS", 268, Mapper268_Init ) /* Submapper distinguishes between COOLBOY and MINDKIDS */ INES_BOARD( "80013-B", 274, BMC80013B_Init ) INES_BOARD( "GS-2004", 283, BMCGS2004_Init ) /* INES_BOARD( "GS-2013", 283, BMCGS2013_Init ) */ diff --git a/src/ines.h b/src/ines.h index 574a0de..cbeaf42 100644 --- a/src/ines.h +++ b/src/ines.h @@ -253,6 +253,7 @@ void NC7000M_Init(CartInfo *); void J2282_Init(CartInfo *); void Mapper267_Init(CartInfo *); +void Mapper268_Init(CartInfo *); void Mapper269_Init(CartInfo *); void Mapper288_Init(CartInfo *); void Mapper293_Init(CartInfo *);