From d362485d088f99d1de5df889668777ceeb448dbb Mon Sep 17 00:00:00 2001 From: NewRisingSun <8vytz1+dhp372pv94ebg@sharklasers.com> Date: Sat, 5 Apr 2025 21:13:59 +0200 Subject: [PATCH] Replaced mapper 436. The previous mapper 436 was a duplicate of 49. --- src/boards/436.c | 63 --------------------------------------------- src/boards/onebus.c | 29 +++++++++++++++++++++ src/ines.c | 2 +- 3 files changed, 30 insertions(+), 64 deletions(-) delete mode 100644 src/boards/436.c diff --git a/src/boards/436.c b/src/boards/436.c deleted file mode 100644 index b7be076..0000000 --- a/src/boards/436.c +++ /dev/null @@ -1,63 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2008 CaH4e3 - * 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 - */ - -/* NES 2.0 Mapper 436: 820401/T-217 */ - -#include "mapinc.h" -#include "mmc3.h" - -static void Mapper436_PWrap(uint32 A, uint8 V) { - if (EXPREGS[0] &0x01) - setprg8(A, V &0x0F | EXPREGS[0] >>2 &0x30); - else - if (A == 0x8000) - setprg32(A, (EXPREGS[0] >>4)); -} - -static void Mapper436_CWrap(uint32 A, uint8 V) { - setchr1(A, V &0x7F | EXPREGS[0] <<1 &~0x7F); -} - -static DECLFW(Mapper436_Write) { - EXPREGS[0] = A &0xFF; - FixMMC3PRG(MMC3_cmd); - FixMMC3CHR(MMC3_cmd); -} - -static void Mapper436_Reset(void) { - EXPREGS[0] = 0; - MMC3RegReset(); -} - -static void Mapper436_Power(void) { - EXPREGS[0] = 0; - GenMMC3Power(); - SetWriteHandler(0x6000, 0x7FFF, Mapper436_Write); -} - -void Mapper436_Init(CartInfo *info) { - GenMMC3_Init(info, 128, 128, 8, 0); - pwrap = Mapper436_PWrap; - cwrap = Mapper436_CWrap; - info->Power = Mapper436_Power; - info->Reset = Mapper436_Reset; - AddExState(EXPREGS, 1, 0, "EXPR"); -} diff --git a/src/boards/onebus.c b/src/boards/onebus.c index bf40b00..e70f013 100644 --- a/src/boards/onebus.c +++ b/src/boards/onebus.c @@ -323,6 +323,7 @@ static void UNLOneBusPower(void) { memset(cpu410x, 0x00, sizeof(cpu410x)); memset(ppu201x, 0x00, sizeof(ppu201x)); memset(apu40xx, 0x00, sizeof(apu40xx)); + cpu410x[0x0F] =0xFF; cpu410x[0x1C] =submapper ==14? 0x40: 0x00; SetupCartCHRMapping(0, PRGptr[0], PRGsize[0], 0); @@ -354,6 +355,7 @@ static void UNLOneBusReset(void) { memset(cpu410x, 0x00, sizeof(cpu410x)); memset(ppu201x, 0x00, sizeof(ppu201x)); memset(apu40xx, 0x00, sizeof(apu40xx)); + cpu410x[0x0F] =0xFF; cpu410x[0x1C] =submapper ==14? 0x40: 0x00; reg4242 =0; dipswitch ^=8; @@ -430,3 +432,30 @@ void Mapper270_Init(CartInfo *info) { Sync =Sync270; } + +static void Sync436(void) { + int AND =0xFFFF, OR =0; + switch(submapper) { + case 1: OR = cpu410x[0x1C] &0x01 && ~cpu410x[0x1C] &0x04? 0x0800: 0x0000; + PSync(0xF7FF, OR); + CSync(0xBFFF, OR <<3); + break; + default: PSync(0xF3FF, (cpu410x[0x0F] &0x20? 0x0400: 0x0000) | (cpu410x[0x00] &0x40? 0x0800: 0x0000)); + CSync(0x9FFF, (cpu410x[0x0F] &0x20? 0x2000: 0x0000) | (cpu410x[0x00] &0x04? 0x4000: 0x0000)); + break; + } +} + +void Mapper436_Init(CartInfo *info) { + UNLOneBus_Init(info); + cpuMangle =cpuMangles[0]; + ppuMangle =ppuMangles[0]; + mmc3Mangle =mmc3Mangles[0]; + + CHRRAMSIZE = 8192; + CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); + AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); + + Sync =Sync436; +} diff --git a/src/ines.c b/src/ines.c index 305f9a6..841a8ed 100644 --- a/src/ines.c +++ b/src/ines.c @@ -825,7 +825,7 @@ INES_BOARD_BEGIN() INES_BOARD( "NC-20MB", 433, Mapper433_Init ) INES_BOARD( "S-009", 434, Mapper434_Init ) INES_BOARD( "F-1002", 435, Mapper435_Init ) - INES_BOARD( "820401/T-217", 436, Mapper436_Init ) + INES_BOARD( "ZLX-08", 436, Mapper436_Init ) INES_BOARD( "NTDEC TH2348", 437, Mapper437_Init ) INES_BOARD( "K-3071", 438, Mapper438_Init ) INES_BOARD( "YS2309", 439, Mapper439_Init )