Add mappers 341.1 and 343.

This commit is contained in:
NewRisingSun
2026-04-05 11:05:29 +02:00
parent 37e23ac075
commit 147eb59b6b
7 changed files with 98 additions and 20 deletions

40
src/boards/341.c Normal file
View File

@@ -0,0 +1,40 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2026 NewRisingSun
*
* 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 "asic_latch.h"
uint8 submapper;
static void sync () {
setprg32(0x8000, Latch_address >>8);
setchr8(Latch_address >>8);
setmirror(Latch_address &(submapper == 1? 0x800: 0x200)? MI_H: MI_V);
}
static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) {
if (!((*newAddress &0xF0) == 0xA0)) *newAddress = Latch_address; /* Update address only if new A7..A4 = $A */
}
void Mapper341_Init (CartInfo *info) {
submapper = info->submapper;
Latch_init(info, sync, 0x8000, 0xFFFF, submapper == 1? trapLatchWrite: NULL);
info->Reset = Latch_clear;
}

53
src/boards/343.c Normal file
View File

@@ -0,0 +1,53 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2026 NewRisingSun
*
* 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 "asic_latch.h"
static uint8 reg;
static void sync () {
setprg32(0x8000, Latch_data);
setchr8(0);
setmirror(reg &0x08? MI_H: MI_V);
}
static DECLFW (writeReg) {
reg = V;
sync();
}
static void reset () {
reg = 0;
Latch_clear();
}
static void power () {
reg = 0;
Latch_power();
SetWriteHandler(0x5000, 0x5FFF, writeReg);
}
void Mapper343_Init (CartInfo *info) {
Latch_init(info, sync, 0x8000, 0xFFFF, NULL);
info->Power = power;
info->Reset = reset;
AddExState(&reg, 1, 0, "REGS");
}

View File

@@ -696,23 +696,6 @@ void BMCG146_Init(CartInfo *info) {
Latch_Init(info, BMCG146Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
}
/*-------------- BMC-TJ-03 ------------------------*/
/* NES 2.0 mapper 341 is used for a simple 4-in-1 multicart */
static void BMCTJ03Sync(void) {
uint8 mirr = latche &(PRGsize[0] &0x40000? 0x800: 0x200)? MI_H: MI_V;
uint8 bank = latche >> 8;
setprg32(0x8000, bank);
setchr8(bank);
setmirror(mirr);
}
void BMCTJ03_Init(CartInfo *info) {
Latch_Init(info, BMCTJ03Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
}
/*-------------- BMC-SA005-A ------------------------*/
/* NES 2.0 mapper 338 is used for a 16-in-1 and a 200/300/600/1000-in-1 multicart.
* http://wiki.nesdev.com/w/index.php/NES_2.0_Mapper_338 */

View File

@@ -786,8 +786,9 @@ INES_BOARD_BEGIN()
INES_BOARD( "SA005-A", 338, BMCSA005A_Init )
INES_BOARD( "K-3006", 339, BMCK3006_Init )
INES_BOARD( "K-3036", 340, Mapper340_Init )
INES_BOARD( "TJ-03", 341, BMCTJ03_Init )
INES_BOARD( "TJ-03", 341, Mapper341_Init )
INES_BOARD( "COOLGIRL", 342, COOLGIRL_Init )
INES_BOARD( "I030", 343, Mapper343_Init )
INES_BOARD( "GN-26", 344, BMCGN26_Init )
INES_BOARD( "L6IN1", 345, BMCL6IN1_Init )
INES_BOARD( "KS7012", 346, UNLKS7012_Init )

View File

@@ -281,6 +281,8 @@ void Mapper326_Init(CartInfo *);
void Mapper330_Init(CartInfo *);
void Mapper334_Init(CartInfo *);
void Mapper340_Init(CartInfo *);
void Mapper341_Init(CartInfo *);
void Mapper343_Init(CartInfo *);
void Mapper351_Init(CartInfo *);
void Mapper352_Init(CartInfo *);
void Mapper353_Init(CartInfo *);

View File

@@ -590,7 +590,7 @@ static BMAPPING bmap[] = {
{ "K-3088", 287, BMCK3088_Init, 0 },
{ "FARID_SLROM_8-IN-1", 323, FARIDSLROM8IN1_Init, 0 },
{ "830425C-4391T", 320, BMC830425C4391T_Init, 0 },
{ "TJ-03", 341, BMCTJ03_Init, 0 },
{ "TJ-03", 341, Mapper341_Init, 0 },
{ "CTC-09", 335, BMCCTC09_Init, 0 },
{ "K-3046", 336, BMCK3046_Init, 0 },
{ "SA005-A", 338, BMCSA005A_Init, 0 },

View File

@@ -158,7 +158,6 @@ void LH51_Init(CartInfo *info); /* m309 */
void BMCRESETTXROM_Init(CartInfo *info); /* m313 */
void FARIDSLROM8IN1_Init(CartInfo *info); /* m323 */
void BMC830425C4391T_Init(CartInfo *info); /* m320 */
void BMCTJ03_Init(CartInfo *info); /* m341 */
void BMCCTC09_Init(CartInfo *info); /* m335 */
void BMCK3046_Init(CartInfo *info); /* m336 */
void BMCSA005A_Init(CartInfo *info); /* m338 */