From c73cf9eb63616a4958597a073366830e854929f0 Mon Sep 17 00:00:00 2001 From: CaH4e3 Date: Thu, 10 Dec 2015 20:49:54 +0000 Subject: [PATCH] unif F-15 - new mapper for "150-in-1 Unchained FIGHT ver" --- trunk/src/boards/F-15.cpp | 62 +++++++++++++++++++++++++++++ trunk/src/boards/mmc3.cpp | 4 +- trunk/src/ines-correct.h | 1 + trunk/src/ines.cpp | 1 + trunk/src/unif.cpp | 1 + trunk/src/unif.h | 1 + trunk/vc/vc10_fceux.vcxproj | 1 + trunk/vc/vc10_fceux.vcxproj.filters | 3 ++ 8 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 trunk/src/boards/F-15.cpp diff --git a/trunk/src/boards/F-15.cpp b/trunk/src/boards/F-15.cpp new file mode 100644 index 00000000..7e18c7be --- /dev/null +++ b/trunk/src/boards/F-15.cpp @@ -0,0 +1,62 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2015 CaH4e3 + * + * 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 + * + * BMC F-15 PCB (256+266 MMC3 based, with 16/32Kb banking discrete logic) + * 150-in-1 Unchaied Melody FIGHT version with system test (START+SELECT) + * + * CHR - MMC3 stock regs + * PRG - MMC3 regs disabled, area 6000-7FFF used instead + * 011xxxxxxxxxxxxx addr mask, + * ----APPp reg bits mask + * A - higher 128K PRG bank select/32K bank mode override + * PP - bank number in 32K mode + * PPp - bank number in 16K mode + * initial state of extra regs is undefined, A001 enables/disables the 6000 area + */ + +#include "mapinc.h" +#include "mmc3.h" + +static void BMCF15PW(uint32 A, uint8 V) { + uint32 bank = EXPREGS[0] & 0xF; + uint32 mode = (EXPREGS[0] & 8) >> 3; + uint32 mask = ~(mode); + setprg16(0x8000, (bank & mask)); + setprg16(0xC000, (bank & mask) | mode); +} + +static DECLFW(BMCF15Write) { + if (A001B & 0x80) { + EXPREGS[0] = V & 0xF; + FixMMC3PRG(MMC3_cmd); + } +} + +static void BMCF15Power(void) { + GenMMC3Power(); + SetWriteHandler(0x6000, 0x7FFF, BMCF15Write); + SetWriteHandler(0x6000, 0x7FFF, BMCF15Write); +} + +void BMCF15_Init(CartInfo *info) { + GenMMC3_Init(info, 256, 256, 0, 0); + pwrap = BMCF15PW; + info->Power = BMCF15Power; + AddExState(EXPREGS, 1, 0, "EXPR"); +} diff --git a/trunk/src/boards/mmc3.cpp b/trunk/src/boards/mmc3.cpp index ebd2db4c..855af203 100644 --- a/trunk/src/boards/mmc3.cpp +++ b/trunk/src/boards/mmc3.cpp @@ -1039,8 +1039,8 @@ static DECLFW(Mapper196Write) { } static DECLFW(Mapper196WriteLo) { - EXPREGS[0] = 1; - EXPREGS[1] = (V & 0xf) | (V >> 4); + EXPREGS[0] = 1; // hacky + EXPREGS[1] = (V & 0xf) | (V >> 4); // this is the same as 189 mapper, but with addr permutations FixMMC3PRG(MMC3_cmd); } diff --git a/trunk/src/ines-correct.h b/trunk/src/ines-correct.h index 1fe067c9..2ab50872 100644 --- a/trunk/src/ines-correct.h +++ b/trunk/src/ines-correct.h @@ -266,5 +266,6 @@ {0x8d51a23b, 257|0x1000,-1}, /* [KeWang] Chao Ji Wu Bi Han Ka (C) V1 */ {0x25c76773, 257|0x1000,-1}, /* [KeWang] Chao Ji Wu Bi Han Ka (C) V2 */ {0x1ca9c322, 258|0x1000,-1}, /* Blood Of Jurassic (GD-98)(Unl) */ + {0x2469c1ae, 259|0x1000,-1}, /* 150-in-1 Unchained FIGHT version */ {0x00000000, -1, -1} diff --git a/trunk/src/ines.cpp b/trunk/src/ines.cpp index 69a635b6..8a51a4f5 100644 --- a/trunk/src/ines.cpp +++ b/trunk/src/ines.cpp @@ -719,6 +719,7 @@ static BMAPPINGLocal bmap[] = { {"ONE-BUS Systems", 256, UNLOneBus_Init}, {"PEC-586 Computer", 257, UNLPEC586Init}, {"158B Prot Board", 258, UNL158B_Init}, + {"F-15 MMC3 Based", 259, BMCF15_Init}, {"", 0, NULL} }; diff --git a/trunk/src/unif.cpp b/trunk/src/unif.cpp index 0231a4dd..46db143d 100644 --- a/trunk/src/unif.cpp +++ b/trunk/src/unif.cpp @@ -463,6 +463,7 @@ static BMAPPING bmap[] = { { "DRAGONFIGHTER", UNLBMW8544_Init, 0 }, { "EH8813A", UNLEH8813A_Init, 0 }, { "HP898F", BMCHP898F_Init, 0 }, + { "F-15", BMCF15_Init, 0 }, { 0, 0, 0 } }; diff --git a/trunk/src/unif.h b/trunk/src/unif.h index c9b2a9c2..6f9aaee9 100644 --- a/trunk/src/unif.h +++ b/trunk/src/unif.h @@ -151,6 +151,7 @@ void UNL158B_Init(CartInfo *info); void UNLBMW8544_Init(CartInfo *info); void UNLEH8813A_Init(CartInfo *info); void BMCHP898F_Init(CartInfo *info); +void BMCF15_Init(CartInfo *info); extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM // bank switcherooing with certain boards... diff --git a/trunk/vc/vc10_fceux.vcxproj b/trunk/vc/vc10_fceux.vcxproj index 45781e16..cbe24ac5 100644 --- a/trunk/vc/vc10_fceux.vcxproj +++ b/trunk/vc/vc10_fceux.vcxproj @@ -319,6 +319,7 @@ + diff --git a/trunk/vc/vc10_fceux.vcxproj.filters b/trunk/vc/vc10_fceux.vcxproj.filters index 9289e467..2fff849b 100644 --- a/trunk/vc/vc10_fceux.vcxproj.filters +++ b/trunk/vc/vc10_fceux.vcxproj.filters @@ -1063,6 +1063,9 @@ boards + + boards +