Merge pull request #336 from negativeExponent/updates_and_fixes

mapper updates and fixes
This commit is contained in:
hizzlekizzle
2020-03-06 17:34:43 -06:00
committed by GitHub
7 changed files with 189 additions and 10 deletions

153
src/boards/369.c Normal file
View 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");
}

View File

@@ -25,6 +25,17 @@
*
*/
/* 2020-3-6 - update mirroring (negativeExponent)
/* PRG-ROM Bank Select #1/Mirroring Select ($8000-$8FFF, write)
* A~FEDC BA98 7654 3210
* -------------------
* 1000 .... .... MBBB
* |+++- Select 4 KiB PRG-ROM bank at CPU $7000-$7FFF
* +---- Select nametable mirroring type
* 0: Vertical
* 1: Horizontal
*/
#include "mapinc.h"
#include "../fds_apu.h"
@@ -42,8 +53,9 @@ static SFORMAT StateRegs[] =
static void Sync(void) {
setchr8(0);
setprg32(0x8000, ~0);
setprg4(0xb800, reg0);
setprg4(0xb800, reg0 & 0x07);
setprg4(0xc800, 8 + reg1);
setmirror(((reg0 >> 3) & 1) ^ 1);
}
/* 6000 - 6BFF - RAM
@@ -99,12 +111,12 @@ static DECLFR(UNLKS7030RamRead1) {
}
static DECLFW(UNLKS7030Write0) {
reg0 = A & 7;
reg0 = A & 0xF;
Sync();
}
static DECLFW(UNLKS7030Write1) {
reg1 = A & 15;
reg1 = A & 0xF;
Sync();
}

View File

@@ -266,7 +266,7 @@ static void M200Sync(void) {
setprg16(0x8000, latche & 7);
setprg16(0xC000, latche & 7);
setchr8(latche & 7);
setmirror((latche & 8) >> 3);
setmirror(((latche >> 3) & 1) ^ 1);
}
void Mapper200_Init(CartInfo *info) {
@@ -274,18 +274,25 @@ void Mapper200_Init(CartInfo *info) {
}
/*------------------ Map 201 ---------------------------*/
/* 2020-3-6 - Support for 21-in-1 (CF-043) (2006-V) (Unl) [p1].nes which has mixed mirroring
* found at the time labeled as submapper 15 (negativeExponent)
* 0x05658DED 128K PRG, 32K CHR */
static uint32 submapper = 0;
static void M201Sync(void) {
if (latche & 8) {
if (latche & 8 || submapper == 15) {
setprg32(0x8000, latche & 3);
setchr8(latche & 3);
} else {
setprg32(0x8000, 0);
setchr8(0);
}
if (submapper == 15)
setmirror(((latche & 0x07) == 0x07) ? MI_V : MI_H);
}
void Mapper201_Init(CartInfo *info) {
if (info->CRC32 == 0x05658DED)
submapper = 15;
Latch_Init(info, M201Sync, NULL, 0xFFFF, 0x8000, 0xFFFF, 0);
}
@@ -377,8 +384,8 @@ void Mapper214_Init(CartInfo *info) {
/*------------------ Map 217 ---------------------------*/
static void M217Sync(void) {
setprg32(0x8000, (latche >> 2) & 3);
setchr8(latche & 7);
setprg32(0x8000, (latche >> 2) & 0x03);
setchr8(latche & 0x0F);
}
void Mapper217_Init(CartInfo *info) {

View File

@@ -294,7 +294,8 @@
{0xd871d3e6, 199, -1}, /* Dragon Ball Z 2 - Gekishin Freeza! (C) */
{0xed481b7c, 199, -1}, /* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C) */
{0x44c20420, 199, -1}, /* San Guo Zhi 2 (C) */
{0x4e1c1e3c, 206, 0}, /* Karnov */
{0x44c20420, 199, -1}, /* San Guo Zhi 2 (C) */
{0x05658DED, 201, -1}, /* 21-in-1 (CF-043) (2006-V) (Unl) [p1].nes, submapper 15 */
{0x276237b3, 206, 0}, /* Karnov */
{0xa5e6baf9, 206, 1}, /* Dragon Slayer 4 - Drasle Family (Japan) */
{0x4f2f1846, 206, 1}, /* Famista '89 - Kaimaku Han!! (J) */
@@ -389,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 */
@@ -398,6 +401,7 @@
{0xa1dc16c0, 262, -1}, /* Street Heroes (Asia) (Ja) (Unl */
{0x1df10182, 263, -1}, /* Boogerman II (Rex-Soft) [!].nes */
{0xf956fcea, 521, -1}, /* Korean Igo (Korea) (Unl) */
{0x2EED2E34, 289, -1}, /* 76-in-1 [p1][a1].nes 2048 PRG, 0 CHR */
{0x00000000, -1, -1}

View File

@@ -596,7 +596,7 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"TW MMC3+VRAM Rev. E", 198, Mapper198_Init},
{(uint8_t*)"", 199, Mapper199_Init},
{(uint8_t*)"", 200, Mapper200_Init},
{(uint8_t*)"", 201, Mapper201_Init},
{(uint8_t*)"21-in-1", 201, Mapper201_Init},
{(uint8_t*)"", 202, Mapper202_Init},
{(uint8_t*)"", 203, Mapper203_Init},
{(uint8_t*)"", 204, Mapper204_Init},
@@ -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 },

View File

@@ -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 *);

View File

@@ -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 },