Add mapper 369 (BMC-N49C-300)
This commit is contained in:
153
src/boards/369.c
Normal file
153
src/boards/369.c
Normal file
@@ -0,0 +1,153 @@
|
||||
/* 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
|
||||
*/
|
||||
|
||||
/* Mapper 369 (BMC-N49C-300) - Super Mario Bros. Party multicart */
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 M40IRQa;
|
||||
static uint16 M40IRQCount;
|
||||
|
||||
static void M369PW(uint32 A, uint8 V) {
|
||||
switch (EXPREGS[0]) {
|
||||
case 0x00:
|
||||
setprg32(0x8000, 0);
|
||||
break;
|
||||
case 0x01:
|
||||
setprg32(0x8000, 1);
|
||||
break;
|
||||
case 0x13:
|
||||
setprg8(0x6000, 0x0E);
|
||||
setprg8(0x8000, 0x0C);
|
||||
setprg8(0xa000, 0x0D);
|
||||
setprg8(0xc000, EXPREGS[1] | 0x08);
|
||||
setprg8(0xe000, 0x0F);
|
||||
break;
|
||||
case 0x37:
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(A, (V & 0x0F) | 0x10);
|
||||
break;
|
||||
case 0xFF:
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(A, (V & 0x1F) | 0x20);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M369CW(uint32 A, uint8 V) {
|
||||
switch (EXPREGS[0]) {
|
||||
case 0x00:
|
||||
setchr8(0);
|
||||
break;
|
||||
case 0x01:
|
||||
setchr8(1);
|
||||
break;
|
||||
case 0x13:
|
||||
setprg8(0xE000, 0xF);
|
||||
setchr8(3);
|
||||
break;
|
||||
case 0x37:
|
||||
setchr1(A, (V & 0x7F) | 0x80);
|
||||
break;
|
||||
case 0xFF:
|
||||
setchr1(A, V | 0x100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M369WriteCMD) {
|
||||
EXPREGS[0] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static DECLFW(M369Write) {
|
||||
if (EXPREGS[0] == 0x13) {
|
||||
switch (A & 0xE000) {
|
||||
case 0x8000:
|
||||
M40IRQa = 0;
|
||||
M40IRQCount = 0;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
break;
|
||||
case 0xA000:
|
||||
M40IRQa = 1;
|
||||
break;
|
||||
case 0xE000:
|
||||
EXPREGS[1] = V & 7;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (A < 0xC000) {
|
||||
MMC3_CMDWrite(A, V);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
} else
|
||||
MMC3_IRQWrite(A, V);
|
||||
}
|
||||
}
|
||||
|
||||
static void M369Power(void) {
|
||||
EXPREGS[0] = 0x00;
|
||||
EXPREGS[1] = 0x00;
|
||||
M40IRQa = 0x00;
|
||||
M40IRQCount = 0x00;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4120, 0x4120, M369WriteCMD);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M369Write);
|
||||
}
|
||||
|
||||
static void M369Reset(void) {
|
||||
EXPREGS[0] = 0x00;
|
||||
EXPREGS[1] = 0x00;
|
||||
M40IRQa = 0x00;
|
||||
M40IRQCount = 0x00;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M40IRQHook(int a) {
|
||||
if (EXPREGS[0] == 0x13)
|
||||
{
|
||||
if (M40IRQa)
|
||||
{
|
||||
if (M40IRQCount < 4096)
|
||||
M40IRQCount += a;
|
||||
else
|
||||
{
|
||||
M40IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mapper369_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 384, 8, 0);
|
||||
pwrap = M369PW;
|
||||
cwrap = M369CW;
|
||||
MapIRQHook = M40IRQHook;
|
||||
info->Power = M369Power;
|
||||
info->Reset = M369Reset;
|
||||
AddExState(EXPREGS, 4, 0, "EXPR");
|
||||
AddExState(&M40IRQa, 1, 0, "M2a");
|
||||
AddExState(&M40IRQCount, 2 | FCEUSTATE_RLSB, 0, "M2CN");
|
||||
}
|
||||
@@ -390,6 +390,8 @@
|
||||
{0x5aa23a15, 361, 0}, /* 4-in-1 (OK-411)[p1][!] */
|
||||
{0xf6b9d088, 366, 0}, /* 4-in-1 (K-3131GS, GN-45) [p1][!] */
|
||||
{0x503566b2, 366, 0}, /* 4-in-1 (K-3131SS, GN-45) [p1][!] */
|
||||
{0xDB2D2D88, 369, -1}, /* Super Mario Bros. Party.nes */
|
||||
|
||||
|
||||
/* ines mappers that uses unif boards */
|
||||
|
||||
|
||||
@@ -753,6 +753,7 @@ static BMAPPINGLocal bmap[] = {
|
||||
{(uint8_t*)"G-146", 349, BMCG146_Init },
|
||||
{(uint8_t*)"891227", 350, BMC891227_Init },
|
||||
{(uint8_t*)"3D-BLOCK", 355, UNL3DBlock_Init },
|
||||
{(uint8_t*)"Super Mario Bros. Party (N49C-300)", 369, Mapper369_Init },
|
||||
{(uint8_t*)"NC7000M", 391, NC7000M_Init },
|
||||
{(uint8_t*)"831019C J-2282", 402, J2282_Init },
|
||||
{(uint8_t*)"SA-9602B", 513, SA9602B_Init },
|
||||
|
||||
@@ -257,6 +257,7 @@ void Mapper356_Init(CartInfo *);
|
||||
void Mapper357_Init(CartInfo *);
|
||||
void Mapper359_Init(CartInfo *);
|
||||
void Mapper360_Init(CartInfo *);
|
||||
void Mapper369_Init(CartInfo *);
|
||||
void Mapper372_Init(CartInfo *);
|
||||
void Mapper374_Init(CartInfo *);
|
||||
void Mapper382_Init(CartInfo *);
|
||||
|
||||
@@ -608,6 +608,7 @@ static BMAPPING bmap[] = {
|
||||
{ "WX-KB4K", 134, Bs5652_Init, 0 },
|
||||
{ "SB-5013", 359, Mapper359_Init, 0 },
|
||||
{ "82112C", 540, Mapper540_Init, 0 },
|
||||
{ "N49C-300", 369, Mapper369_Init },
|
||||
|
||||
#ifdef COPYFAMI
|
||||
{ "COPYFAMI_MMC3", NO_INES, MapperCopyFamiMMC3_Init, 0 },
|
||||
|
||||
Reference in New Issue
Block a user