Exponential notation of NES 2.0 ROM sizes; mappers (#480)

* Support 2 MIB mapper 314 (Y2K 76-in-1)

* Mapper 57: Forgot one Sync() statement

* Mapper 83: Correction for 256 KiB PRG+512 KiB CHR games

* Mapper 114: Use NES 2.0 submapper field if available to differentiate between scrambling patterns

* NES 2.0: Support exponential notation of PRG/CHR sizes, thus adding support for 4 KiB and 8 KiB ROM files.

* Add mapper 553.

* Correct the database regarding the Nanjing game Pegasus Senya

* Add submapper 5 (HST-162) to mapper 176

* Add mapper 436

* Mapper 176.5 has a CNROM latch as well, though it works a bit differently than submapper 1's

* Added mapper 429

* Added mapper 380 submapper 1

* Added mapper 437

* Added mapper 456

* Forgot to include math.h for pow

* Added mapper 434

* Added mapper 452

* Added mapper 438

* Added mappers 391 and 444, corrected the mixup with BS-110 and NC7000M

* Added mapper 443. Added menu-switching funcionality to mapper 444

Co-authored-by: NewRisingSun <8vytz1+dhp372pv94ebg@sharklasers.com>
This commit is contained in:
NRS-NewRisingSun
2022-01-06 08:22:18 +01:00
committed by GitHub
parent c291ceeb13
commit d72c64e5d9
24 changed files with 767 additions and 457 deletions

View File

@@ -25,6 +25,7 @@
static uint16 latche;
static uint8 dipswitch;
static uint8 isKN35A;
static SFORMAT StateRegs[] = {
{ &latche, 2 | FCEUSTATE_RLSB, "LATC" },
@@ -47,14 +48,14 @@ static void Sync(void)
else /* UxROM */
{
setprg16(0x8000, latche >> 2);
setprg16(0xC000, (latche >> 2) | 7);
setprg16(0xC000, (latche >> 2) | 7 | (isKN35A && latche &0x100? 8: 0));
}
setmirror(((latche >> 1) & 1) ^ 1);
}
static DECLFR(M380Read)
{
if (latche & 0x100)
if (latche & 0x100 && !isKN35A)
return dipswitch;
return CartBR(A);
}
@@ -89,6 +90,7 @@ static void StateRestore(int version)
void Mapper380_Init(CartInfo *info)
{
isKN35A = info->iNES2 && info->submapper == 1;
info->Power = M380Power;
info->Reset = M380Reset;
GameStateRestore = StateRestore;

71
src/boards/391.c Normal file
View File

@@ -0,0 +1,71 @@
/* 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
*/
/* BS-110 PCB, previously called NC7000M due to a mix-up. */
#include "mapinc.h"
#include "mmc3.h"
static void Mapper391_PRGWrap(uint32 A, uint8 V) {
int prgAND =EXPREGS[0] &0x08? 0x0F: 0x1F;
int prgOR =EXPREGS[0] <<4 &0x30;
if (EXPREGS[0] &0x20) {
if (~A &0x4000) {
setprg8(A, (EXPREGS[0] &0x04? ~2: ~0) &V &prgAND | prgOR &~prgAND);
setprg8(A |0x4000, (EXPREGS[0] &0x04? 2: 0) |V &prgAND | prgOR &~prgAND);
}
} else
setprg8(A, V &prgAND | prgOR &~prgAND);
}
static void Mapper391_CHRWrap(uint32 A, uint8 V) {
int chrAND =EXPREGS[0] &0x40? 0x7F: 0xFF;
int chrOR =EXPREGS[0] <<3 &0x80 | EXPREGS[1] <<8 &0x100;
setchr1(A, V &chrAND | chrOR &~chrAND);
}
static DECLFW(Mapper391_Write) {
if (~EXPREGS[0] &0x80) {
EXPREGS[0] =V;
EXPREGS[1] =A >>8 &0xFF;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
}
static void Mapper391_Reset(void) {
EXPREGS[0] =EXPREGS[1] =0;
MMC3RegReset();
}
static void Mapper391_Power(void) {
EXPREGS[0] =EXPREGS[1] =0;
GenMMC3Power();
SetWriteHandler(0x6000, 0x7FFF, Mapper391_Write);
}
void Mapper391_Init(CartInfo *info) {
GenMMC3_Init(info, 256, 256, 0, 0);
cwrap = Mapper391_CHRWrap;
pwrap = Mapper391_PRGWrap;
info->Power = Mapper391_Power;
info->Reset = Mapper391_Reset;
AddExState(EXPREGS, 2, 0, "EXPR");
}

62
src/boards/434.c Normal file
View File

@@ -0,0 +1,62 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
* Copyright (C) 2002 Xodnizel
*
* 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
*/
/* S-009. UNROM plus outer bank register at $6000-$7FFF. */
#include "mapinc.h"
static uint16 latch;
static void Mapper434_Sync(void) {
setprg16(0x8000, latch);
setprg16(0xC000, latch |7);
setchr8(0);
setmirror(latch >>8 &1);
}
static DECLFW(Mapper434_WriteOuterBank) {
latch =latch &7 | V <<3;
Mapper434_Sync();
}
static DECLFW(Mapper434_WriteInnerBank) {
latch =latch &~7 | V &CartBR(A) &7;
Mapper434_Sync();
}
static void Mapper434_Reset(void) {
latch =0;
Mapper434_Sync();
}
static void Mapper434_Power(void) {
latch =0;
Mapper434_Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, Mapper434_WriteOuterBank);
SetWriteHandler(0x8000, 0xFFFF, Mapper434_WriteInnerBank);
}
void Mapper434_Init(CartInfo *info) {
info->Reset = Mapper434_Reset;
info->Power = Mapper434_Power;
AddExState(&latch, 2, 0, "LATC");
}

63
src/boards/436.c Normal file
View File

@@ -0,0 +1,63 @@
/* 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");
}

62
src/boards/437.c Normal file
View File

@@ -0,0 +1,62 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
* Copyright (C) 2002 Xodnizel
*
* 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
*/
/* NTDEC TH2348 circuit board. UNROM plus outer bank register at $5FFx. */
#include "mapinc.h"
static uint8 latch;
static void Mapper437_Sync(void) {
setprg16(0x8000, latch);
setprg16(0xC000, latch |7);
setchr8(0);
setmirror(latch >>6 &1 ^1);
}
static DECLFW(Mapper437_WriteOuterBank) {
latch =latch &7 | A <<3;
Mapper437_Sync();
}
static DECLFW(Mapper437_WriteInnerBank) {
latch =latch &~7 | V &CartBR(A) &7;
Mapper437_Sync();
}
static void Mapper437_Reset(void) {
latch =0;
Mapper437_Sync();
}
static void Mapper437_Power(void) {
latch =0;
Mapper437_Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x5000, 0x5FFF, Mapper437_WriteOuterBank);
SetWriteHandler(0x8000, 0xFFFF, Mapper437_WriteInnerBank);
}
void Mapper437_Init(CartInfo *info) {
info->Reset = Mapper437_Reset;
info->Power = Mapper437_Power;
AddExState(&latch, 1, 0, "LATC");
}

62
src/boards/438.c Normal file
View File

@@ -0,0 +1,62 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
* Copyright (C) 2002 Xodnizel
*
* 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
*/
/* K-3071 */
#include "mapinc.h"
static uint8 latch[2];
static void Mapper438_Sync(void) {
if (latch[0] &1)
setprg32(0x8000, latch[0] >>2);
else {
setprg16(0x8000, latch[0] >>1);
setprg16(0xC000, latch[0] >>1);
}
setchr8(latch[1] >>1);
setmirror(latch[1] &1 ^1);
}
static DECLFW(Mapper438_WriteLatch) {
latch[0] =A &0xFF;
latch[1] =V;
Mapper438_Sync();
}
static void Mapper438_Reset(void) {
latch[0] =latch[1] =0;
Mapper438_Sync();
}
static void Mapper438_Power(void) {
latch[0] =latch[1] =0;
Mapper438_Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, Mapper438_WriteLatch);
}
void Mapper438_Init(CartInfo *info) {
info->Reset = Mapper438_Reset;
info->Power = Mapper438_Power;
AddExState(&latch, 2, 0, "LATC");
}

79
src/boards/443.c Normal file
View File

@@ -0,0 +1,79 @@
/* 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
*/
/* NC3000M PCB */
#include "mapinc.h"
#include "mmc3.h"
static uint8 dip;
static void Mapper443_PRGWrap(uint32 A, uint8 V) {
int prgAND =0x0F;
int prgOR =EXPREGS[0] <<4 &0x20 | EXPREGS[0] &0x10;
if (EXPREGS[0] &0x04) {
if (~A &0x4000) {
setprg8(A, (~EXPREGS[0] &0x08? ~2: ~0) &V &prgAND | prgOR &~prgAND);
setprg8(A |0x4000, (~EXPREGS[0] &0x08? 2: 0) |V &prgAND | prgOR &~prgAND);
}
} else
setprg8(A, V &prgAND | prgOR &~prgAND);
}
static void Mapper443_CHRWrap(uint32 A, uint8 V) {
int chrAND =0xFF;
int chrOR =EXPREGS[0] <<8;
setchr1(A, V &chrAND | chrOR &~chrAND);
}
static DECLFR(Mapper443_Read) {
return (EXPREGS[0] &0x0C) ==0x08? dip: CartBR(A);
}
static DECLFW(Mapper443_Write) {
EXPREGS[0] =A &0xFF;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void Mapper443_Reset(void) {
dip++;
dip &= 15;
EXPREGS[0] =0;
MMC3RegReset();
}
static void Mapper443_Power(void) {
dip =0;
EXPREGS[0] =0;
GenMMC3Power();
SetWriteHandler(0x6000, 0x7FFF, Mapper443_Write);
SetReadHandler(0x8000, 0xFFFF, Mapper443_Read);
}
void Mapper443_Init(CartInfo *info) {
GenMMC3_Init(info, 256, 256, 0, 0);
cwrap = Mapper443_CHRWrap;
pwrap = Mapper443_PRGWrap;
info->Power = Mapper443_Power;
info->Reset = Mapper443_Reset;
AddExState(EXPREGS, 1, 0, "EXPR");
AddExState(&dip, 1, 0, "DIPS");
}

81
src/boards/444.c Normal file
View File

@@ -0,0 +1,81 @@
/* 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
*/
/* NC7000M PCB, with incorrect UNIF MAPR BS-110 due to a mix-up. Submappers denote the setting of two solder pads that configure CHR banking. */
#include "mapinc.h"
#include "mmc3.h"
static uint8 pads;
static uint8 dip;
static void Mapper444_PRGWrap(uint32 A, uint8 V) {
int prgAND =0x0F;
int prgOR =EXPREGS[0] <<4;
if (EXPREGS[0] &0x04) {
if (~A &0x4000) {
setprg8(A, (~EXPREGS[0] &0x08? ~2: ~0) &V &prgAND | prgOR &~prgAND);
setprg8(A |0x4000, (~EXPREGS[0] &0x08? 2: 0) |V &prgAND | prgOR &~prgAND);
}
} else
setprg8(A, V &prgAND | prgOR &~prgAND);
}
static void Mapper444_CHRWrap(uint32 A, uint8 V) {
int chrAND =pads &1? 0xFF: 0x7F;
int chrOR =EXPREGS[0] <<7 &(pads &1? 0x00: 0x80) | EXPREGS[0] <<(pads &2? 4: 7) &0x100;
setchr1(A, V &chrAND | chrOR &~chrAND);
}
static DECLFR(Mapper444_Read) {
return (EXPREGS[0] &0x0C) ==0x08? dip: CartBR(A);
}
static DECLFW(Mapper444_Write) {
EXPREGS[0] =A &0xFF;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void Mapper444_Reset(void) {
dip++;
dip &= 3;
EXPREGS[0] =0;
MMC3RegReset();
}
static void Mapper444_Power(void) {
dip =0;
EXPREGS[0] =0;
GenMMC3Power();
SetWriteHandler(0x6000, 0x7FFF, Mapper444_Write);
SetReadHandler(0x8000, 0xFFFF, Mapper444_Read);
}
void Mapper444_Init(CartInfo *info) {
pads = info->submapper; /* UNIF represents submapper 0 */
GenMMC3_Init(info, 256, 256, 0, 0);
cwrap = Mapper444_CHRWrap;
pwrap = Mapper444_PRGWrap;
info->Power = Mapper444_Power;
info->Reset = Mapper444_Reset;
AddExState(EXPREGS, 1, 0, "EXPR");
AddExState(&dip, 1, 0, "DIPS");
}

79
src/boards/452.c Normal file
View File

@@ -0,0 +1,79 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
* Copyright (C) 2002 Xodnizel
*
* 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
*/
/* DS-9-27. Absolutely insane PCB that overlays 8 KiB of WRAM into a selectable position between $8000 and $E000. */
#include "mapinc.h"
static uint8 latch[2];
static void Mapper452_Sync(void) {
uint8 wramBank = latch[1] >>3 &6 |8;
if (latch[1] &2) {
setprg8(0x8000, latch[0] >>1);
setprg8(0xA000, latch[0] >>1);
setprg8(0xC000, latch[0] >>1);
setprg8(0xE000, latch[0] >>1);
setprg8r(0x10, (wramBank ^4) <<12, 0);
} else
if (latch[1] &8) {
setprg8(0x8000, latch[0] >>1 |0);
setprg8(0xA000, latch[0] >>1 |1);
setprg8(0xC000, latch[0] >>1 |2);
setprg8(0xE000, latch[0] >>1 |3 | latch[1] &4);
} else {
setprg16(0x8000, latch[0] >>2);
setprg16(0xC000, 0);
}
setprg8r(0x10, wramBank <<12, 0);
setchr8(0);
setmirror(latch [1] &1 ^1);
}
static DECLFW(Mapper452_WriteLatch) {
latch[0] =A &0xFF;
latch[1] =V;
Mapper452_Sync();
/* Do not relay to CartBW, as RAM mapped to locations other than $8000-$DFFF are not write-enabled. */
}
static void Mapper452_Reset(void) {
latch[0] =latch[1] =0;
Mapper452_Sync();
}
static void Mapper452_Power(void) {
latch[0] =latch[1] =0;
Mapper452_Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xDFFF, Mapper452_WriteLatch);
SetWriteHandler(0xE000, 0xFFFF, CartBW);
uint8* WRAM = (uint8*) FCEU_gmalloc(8192);
SetupCartPRGMapping(0x10, (uint8*) FCEU_gmalloc(8192), 8192, 1);
}
void Mapper452_Init(CartInfo *info) {
info->Reset = Mapper452_Reset;
info->Power = Mapper452_Power;
AddExState(&latch, 2, 0, "LATC");
}

58
src/boards/456.c Normal file
View File

@@ -0,0 +1,58 @@
/* 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
*/
#include "mapinc.h"
#include "mmc3.h"
static void Mapper456_PRGWrap(uint32 A, uint8 V) {
setprg8(A, V &0x0F | EXPREGS[0] <<4);
}
static void Mapper456_CHRWrap(uint32 A, uint8 V) {
setchr1(A, V &0x7F | EXPREGS[0] <<7);
}
static DECLFW(Mapper456_Write) {
if (A &0x100) {
EXPREGS[0] =V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
}
static void Mapper456_Reset(void) {
EXPREGS[0] =0;
MMC3RegReset();
}
static void Mapper456_Power(void) {
EXPREGS[0] =0;
GenMMC3Power();
SetWriteHandler(0x4020, 0x5FFF, Mapper456_Write);
}
void Mapper456_Init(CartInfo *info) {
GenMMC3_Init(info, 128, 128, 8, 0);
cwrap = Mapper456_CHRWrap;
pwrap = Mapper456_PRGWrap;
info->Power = Mapper456_Power;
info->Reset = Mapper456_Reset;
AddExState(EXPREGS, 1, 0, "EXPR");
}

View File

@@ -67,6 +67,7 @@ static void M57Reset(void) {
hrd_flag++;
hrd_flag &= 3;
FCEU_printf("Select Register = %02x\n", hrd_flag);
Sync();
}
static void StateRestore(int version) {

View File

@@ -1,199 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2008 -2020 dragon2snow,loong2snow from www.nesbbs.com
*
* 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 "mmc3.h"
static uint8 *WRAM;
static uint32 WRAMSIZE;
static uint8 mmc3_reg[8];
static uint8 exRegs[8];
static uint8 pointer;
static uint8 readDIP;
static uint16 prgAND;
static uint16 chrAND;
static uint16 prgOR;
static uint16 chrOR;
static uint8 nrom;
static uint8 nrom128;
static uint8 dipswitch;
static SFORMAT BS110_StateRegs[] =
{
{ exRegs, 8, "REGS" },
{ mmc3_reg, 8, "MREG" },
{ &pointer, 1, "PNT0" },
{ &readDIP, 1, "RDIP" },
{ &prgAND, 2 | FCEUSTATE_RLSB, "PAND" },
{ &chrAND, 2 | FCEUSTATE_RLSB, "CAND" },
{ &prgOR, 2 | FCEUSTATE_RLSB, "PROR" },
{ &chrOR, 2 | FCEUSTATE_RLSB, "CHOR" },
{ &nrom, 1, "NROM" },
{ &nrom128, 1, "N128" },
{ &dipswitch, 1, "DIP0" },
{ 0 }
};
int BS110GetPRGBank(int bank)
{
if ((~bank & 1) && (pointer & 0x40)) bank ^= 2;
return (bank & 2) ? 0xFE | (bank & 1) : mmc3_reg[6 | (bank & 1)];
}
void BS110SyncPRG_GNROM(int A14, int AND, int OR) {
setprg8(0x8000, ((BS110GetPRGBank(0) &~A14) &AND) | OR);
setprg8(0xA000, ((BS110GetPRGBank(1) &~A14) &AND) | OR);
setprg8(0xC000, ((BS110GetPRGBank(0) | A14) &AND) | OR);
setprg8(0xE000, ((BS110GetPRGBank(1) | A14) &AND) | OR);
}
static void BS110CW(uint32 A, uint8 V) {
uint8 block = ((exRegs[1]) & 0x03);
uint8 mask = 0x7F;
setchr1(A, (block << 7) | (V & mask));
}
static void BS110PW(uint32 A, uint8 V) {
if ((exRegs[1] >> 2) & 0x01)
{
uint8 mask = 0x0F;
uint8 block = (exRegs[1] & 3) << 4;
if ((exRegs[1] >> 3) & 0x01)
{
setprg8(0x8000, ((BS110GetPRGBank(0)) & mask) | block);
setprg8(0xA000, ((BS110GetPRGBank(1)) & mask) | block);
setprg8(0xC000, ((BS110GetPRGBank(0)) & mask) | block);
setprg8(0xE000, ((BS110GetPRGBank(1)) & mask) | block);
}
else
{
setprg8(0x8000, ((BS110GetPRGBank(0)) & mask) | block);
setprg8(0xA000, ((BS110GetPRGBank(1)) & mask) | block);
setprg8(0xC000, ((BS110GetPRGBank(0) | 2) & mask) | block);
setprg8(0xE000, ((BS110GetPRGBank(1) | 2) & mask) | block);
}
}
else
{
uint8 mask = 0x0F;
uint8 block = (exRegs[1] & 3) << 4;
setprg8(A, block | (V & mask));
}
}
static DECLFW(BS110WriteHi) {
A = A & 0xE001;
if (A < 0xC000)
{
if (A == 0x8000)
pointer = MMC3_cmd ^ V;
if (A == 0x8001)
mmc3_reg[MMC3_cmd & 0x07] = V;
MMC3_CMDWrite(A, V);
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
else
{
MMC3_IRQWrite(A, V);
}
}
static DECLFW(BS110WriteLo) {
exRegs[1] = A;
exRegs[0] = V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static DECLFR(BS110ReadHi)
{
if ((A == 0xCB00) && ((exRegs[1] & 0x0F) == 0x08))
return dipswitch;
else
return CartBR(A);
}
static void BS110Power(void)
{
int i = 0;
dipswitch = 0;
mmc3_reg[0] = 0x00; mmc3_reg[1] = 0x02;
mmc3_reg[2] = 0x04; mmc3_reg[3] = 0x05; mmc3_reg[4] = 0x06; mmc3_reg[5] = 0x07;
mmc3_reg[6] = 0x00; mmc3_reg[7] = 0x01;
for (i = 0;i<4;i++)
exRegs[i] = 0;
GenMMC3Power();
SetWriteHandler(0x6000, 0x7FFF, BS110WriteLo);
SetWriteHandler(0x8000, 0xFFFF, BS110WriteHi);
SetReadHandler(0x8000, 0xFFFF, BS110ReadHi);
}
static void BS110Reset(void)
{
int i = 0;
dipswitch++;
mmc3_reg[0] = 0x00; mmc3_reg[1] = 0x02;
mmc3_reg[2] = 0x04; mmc3_reg[3] = 0x05; mmc3_reg[4] = 0x06; mmc3_reg[5] = 0x07;
mmc3_reg[6] = 0x00; mmc3_reg[7] = 0x01;
for (i = 0;i<4;i++)
exRegs[i] = 0;
MMC3RegReset();
}
static void BS110Close(void) {
GenMMC3Close();
if (WRAM)
FCEU_free(WRAM);
WRAM = NULL;
}
void BS110_Init(CartInfo *info) {
GenMMC3_Init(info, 512, 512, 0, 0);
pwrap = BS110PW;
cwrap = BS110CW;
info->Power = BS110Power;
info->Reset = BS110Reset;
info->Close = BS110Close;
WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(EXPREGS, 3, 0, "EXPR");
AddExState(BS110_StateRegs, ~0, 0, 0);
}

View File

@@ -1,186 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2008 -2020 dragon2snow,loong2snow from www.nesbbs.com
*
* 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 "mmc3.h"
static uint8 *WRAM;
static uint32 WRAMSIZE;
static uint8 mmc3_reg[8];
static uint8 exRegs[8];
static uint8 pointer;
static uint8 locked;
static uint8 readDIP;
static uint16 prgAND;
static uint16 chrAND;
static uint16 prgOR;
static uint16 chrOR;
static uint8 nrom;
static uint8 nrom256;
static uint16 reg;
static SFORMAT NC7000M_StateRegs[] =
{
{ exRegs, 8, "REGS" },
{ mmc3_reg, 8, "MREG" },
{ &pointer, 1, "PNT0" },
{ &readDIP, 1, "RDIP" },
{ &prgAND, 2 | FCEUSTATE_RLSB, "PAND" },
{ &chrAND, 2 | FCEUSTATE_RLSB, "CAND" },
{ &prgOR, 2 | FCEUSTATE_RLSB, "PROR" },
{ &chrOR, 2 | FCEUSTATE_RLSB, "CHOR" },
{ &nrom, 1, "NROM" },
{ &nrom256, 1, "N256" },
{ &reg, 2 | FCEUSTATE_RLSB, "REG0" },
{ 0 }
};
void NC7000MAnalyzeReg()
{
locked = (reg & 0x80);
prgAND = (reg & 0x08 ? 0x0F : 0x1F);
chrAND = (reg & 0x40 ? 0x7F : 0xFF);
prgOR = (reg << 4 & 0x30);
chrOR = ((reg << 3) & 0x080) | (reg & 0x100);
nrom = (reg & 0x20);
nrom256 = (reg & 0x04);
}
int NC7000MGetPRGBank(int bank)
{
if ((~bank & 1) && (pointer & 0x40)) bank ^= 2;
return (bank & 2) ? 0xFE | (bank & 1) : mmc3_reg[6 | (bank & 1)];
}
void NC7000MSyncPRG_GNROM(int A14, int AND, int OR) {
setprg8(0x8000, ((NC7000MGetPRGBank(0) &~A14) &AND) | OR);
setprg8(0xA000, ((NC7000MGetPRGBank(1) &~A14) &AND) | OR);
setprg8(0xC000, ((NC7000MGetPRGBank(0) | A14) &AND) | OR);
setprg8(0xE000, ((NC7000MGetPRGBank(1) | A14) &AND) | OR);
}
static void NC7000MCW(uint32 A, uint8 V) {
setchr1(A, (V & chrAND) | (chrOR &~chrAND));
}
static void NC7000MPW(uint32 A, uint8 V) {
if (nrom)
{
NC7000MSyncPRG_GNROM(nrom256 ? 2 : 0, prgAND, prgOR &~prgAND);
}
else
{
setprg8(A, (prgOR &~prgAND) | (V & prgAND));
}
}
static DECLFW(NC7000MWriteHi) {
A = A & 0xE001;
if (A < 0xC000)
{
if(A==0x8000)
pointer = MMC3_cmd ^ V;
if(A==0x8001)
mmc3_reg[MMC3_cmd & 0x07] = V;
MMC3_CMDWrite(A, V);
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
else
{
MMC3_IRQWrite(A, V);
}
}
static DECLFW(NC7000MWriteLo) {
if (!(reg & 0x80)) {
reg = V | (A & 0x100);
NC7000MAnalyzeReg();
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
else
{
WRAM[A - 0x6000] = V;
}
}
static void NC7000MPower(void) {
mmc3_reg[0] = 0x00; mmc3_reg[1] = 0x02;
mmc3_reg[2] = 0x04; mmc3_reg[3] = 0x05; mmc3_reg[4] = 0x06; mmc3_reg[5] = 0x07;
mmc3_reg[6] = 0x00; mmc3_reg[7] = 0x01;
reg = 0x0000;
NC7000MAnalyzeReg();
GenMMC3Power();
SetWriteHandler(0x6000, 0x7FFF, NC7000MWriteLo);
SetWriteHandler(0x8000, 0xFFFF, NC7000MWriteHi);
}
static void NC7000MReset(void) {
mmc3_reg[0] = 0x00; mmc3_reg[1] = 0x02;
mmc3_reg[2] = 0x04; mmc3_reg[3] = 0x05; mmc3_reg[4] = 0x06; mmc3_reg[5] = 0x07;
mmc3_reg[6] = 0x00; mmc3_reg[7] = 0x01;
reg = 0x0000;
NC7000MAnalyzeReg();
MMC3RegReset();
}
static void NC7000MClose(void) {
GenMMC3Close();
if (WRAM)
FCEU_gfree(WRAM);
WRAM = NULL;
}
void NC7000M_Init(CartInfo *info) {
GenMMC3_Init(info, 512, 512, 0, 0);
pwrap = NC7000MPW;
cwrap = NC7000MCW;
info->Power = NC7000MPower;
info->Reset = NC7000MReset;
info->Close = NC7000MClose;
WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(EXPREGS, 3, 0, "EXPR");
AddExState(NC7000M_StateRegs, ~0, 0, 0);
}

View File

@@ -33,9 +33,9 @@ static SFORMAT StateRegs[] =
static void Sync(void) {
if (regs[0] & 0x80) { /* NROM mode */
if (regs[1] & 0x80)
setprg32(0x8000, regs[1] & 0x1F);
setprg32(0x8000, regs[1] & 0x3F);
else {
int bank = ((regs[1] & 0x1f) << 1) | ((regs[1] >> 6) & 1);
int bank = ((regs[1] & 0x3F) << 1) | ((regs[1] >> 6) & 1);
setprg16(0x8000, bank);
setprg16(0xC000, bank);
}

View File

@@ -570,3 +570,20 @@ static void BMCK3046Sync(void) {
void BMCK3046_Init(CartInfo *info) {
Latch_Init(info, BMCK3046Sync, 0, 0x8000, 0xFFFF, 0, 0);
}
/* Mapper 429: LIKO BBG-235-8-1B/Milowork FCFC1 */
static void Mapper429_Sync(void) {
setprg32(0x8000, latche >>2);
setchr8(latche &3);
}
static void Mapper429_Reset(void) {
latche = 4; /* Initial CHR bank 0, initial PRG bank 1 */
Mapper429_Sync();
}
void Mapper429_Init(CartInfo *info) {
info->Reset = Mapper429_Reset;
Latch_Init(info, Mapper429_Sync, 0, 0x8000, 0xFFFF, 0, 0);
}

View File

@@ -29,6 +29,7 @@
2 - 外星 FS005/FS006
3 - JX9003B
4 - GameStar Smart Genius Deluxe
5 - HST-162
Verified on real hardware:
"Legend of Kage" sets CNROM latch 1 and switches between CHR bank 0 and 1 using 5FF2, causing the wrong bank (1 instead of 0) during gameplay.
@@ -87,7 +88,7 @@ static SFORMAT StateRegs[] = {
#define PRG_MODE ( fk23_regs[0] & 0x07)
#define MMC3_EXTENDED !!( fk23_regs[3] & 0x02) /* Extended MMC3 mode, adding extra registers for switching the normally-fixed PRG banks C and E and for eight independent 1 KiB CHR banks. Only available on FK- and FS005 PCBs. */
#define CHR_8K_MODE !!( fk23_regs[0] & 0x40) /* MMC3 CHR registers are ignored, apply outer bank only, and CNROM latch if it exists */
#define CHR_CNROM_MODE (~fk23_regs[0] & 0x20 && subType == 1) /* Only subtype 1 has a CNROM latch, which can be disabled */
#define CHR_CNROM_MODE (~fk23_regs[0] & 0x20 && (subType == 1 || subType == 5)) /* Only subtypes 1 and 5 have a CNROM latch, which can be disabled */
#define CHR_OUTER_BANK_SIZE !!( fk23_regs[0] & 0x10) /* Switch between 256 and 128 KiB CHR, or 32 and 16 KiB CHR in CNROM mode */
#define CHR_MIXED !!(WRAM_EXTENDED && mmc3_wram &0x04) /* First 8 KiB of CHR address space are RAM, then ROM */
@@ -119,7 +120,8 @@ static void SyncCHR(void)
if (CHR_8K_MODE)
{
uint32 mask = (CHR_CNROM_MODE? (CHR_OUTER_BANK_SIZE? 0x01: 0x03): 0x00);
uint32 bank = ((outer & ~mask) | (latch & mask)) << 3; /* Address bits are never OR'd; they either come from the outer bank or from the CNROM latch. */
/* In Submapper 1, address bits come either from outer bank or from latch. In Submapper 5, they are OR'd. Both verified on original hardware. */
uint32 bank = ((subType ==5? outer: (outer & ~mask)) | (latch & mask)) << 3;
cwrap(0x0000, bank + 0);
cwrap(0x0400, bank + 1);
@@ -183,6 +185,9 @@ static void SyncPRG(void)
case 4: /* GameStar Smart Genius Deluxe */
prg_base |= fk23_regs[2] & 0x80;
break;
case 5: /* HST-162 */
prg_base = prg_base &0x1F | fk23_regs[5] <<5;
break;
}
switch (PRG_MODE)
@@ -262,6 +267,11 @@ static void Sync(void)
SyncMIR();
}
static DECLFW(Write4800) /* Only used by submapper 5 (HST-162) */
{
fk23_regs[5] = V; /* Register 4800 is a separate register, but we use one of the ASIC registers that is otherwise unused in submapper 5 */
SyncPRG();
}
static DECLFW(Write5000)
{
if (after_power && A > 0x5010 && A != 0x5FF3) /* Ignore writes from $5000-$500F, in particular to $5008, but not $5FF3 */
@@ -381,7 +391,7 @@ static void Reset(void)
FCEU_printf("BMCFK23C dipswitch set to $%04x\n",0x5000|0x10 << dipswitch);
}
fk23_regs[0] = fk23_regs[1] = fk23_regs[2] = fk23_regs[3] = 0;
fk23_regs[0] = fk23_regs[1] = fk23_regs[2] = fk23_regs[3] = fk23_regs[4] = fk23_regs[5] = fk23_regs[6] = fk23_regs[7] = 0;
mmc3_regs[0] = 0;
mmc3_regs[1] = 2;
mmc3_regs[2] = 4;
@@ -402,7 +412,7 @@ static void Reset(void)
static void Power(void)
{
fk23_regs[0] = fk23_regs[1] = fk23_regs[2] = fk23_regs[3] = 0;
fk23_regs[0] = fk23_regs[1] = fk23_regs[2] = fk23_regs[3] = fk23_regs[4] = fk23_regs[5] = fk23_regs[6] = fk23_regs[7] = 0;
mmc3_regs[0] = 0;
mmc3_regs[1] = 2;
mmc3_regs[2] = 4;
@@ -424,6 +434,9 @@ static void Power(void)
SetWriteHandler(0x5000, 0x5FFF, Write5000);
SetWriteHandler(0x8000, 0xFFFF, Write8000);
if (subType == 5)
SetWriteHandler(0x4800, 0x4FFF, Write4800);
if (WRAMSIZE)
{
SetReadHandler(0x6000, 0x7FFF, CartBR);

View File

@@ -792,10 +792,8 @@ static void M114Reset(void) {
void Mapper114_Init(CartInfo *info) {
isRevB = 0;
type_Boogerman = 0;
if (info->CRC32 == 0x80eb1839 || /* Boogerman (Sugar Softec) (Unl) [!] - submapper 1 */
info->CRC32 == 0x071e4ee8) /* 114 test-rom https://forums.nesdev.com/viewtopic.php?f=3&t=17391 */
type_Boogerman = 1;
/* Use NES 2.0 submapper to identify scrambling pattern, otherwise CRC32 for Boogerman and test rom */
type_Boogerman = info->iNES2? (info->submapper ==1): (info->CRC32 ==0x80eb1839 || info->CRC32 ==0x071e4ee8);
GenMMC3_Init(info, 256, 256, 0, 0);
pwrap = M114PWRAP;

View File

@@ -327,3 +327,18 @@ void S74LS374N_Init(CartInfo *info) {
AddExState(latch, 8, 0, "LATC");
AddExState(&cmd, 1, 0, "CMD");
}
static DECLFR(Mapper553Read) {
return 0x3A;
}
static void Mapper553Power(void) {
setprg16(0xC000, 0);
setchr8(0);
SetReadHandler(0x8000, 0xBFFF, Mapper553Read);
SetReadHandler(0xC000, 0xFFFF, CartBR);
}
void Mapper553_Init(CartInfo *info) {
info->Power = Mapper553Power;
}

View File

@@ -33,7 +33,7 @@ static int32 IRQCount;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static uint8 is2kbank, isnot2kbank;
static uint8 is2kbank, dbzParty, isYoko;
static SFORMAT StateRegs[] =
{
@@ -44,7 +44,6 @@ static SFORMAT StateRegs[] =
{ reg, 11, "REGS" },
{ low, 4, "LOWR" },
{ &is2kbank, 1, "IS2K" },
{ &isnot2kbank, 1, "NT2K" },
{ 0 }
};
@@ -77,7 +76,7 @@ static void M83Sync(void) {
case 2: setmirror(MI_0); break;
case 3: setmirror(MI_1); break;
}
if (is2kbank && !isnot2kbank) {
if (is2kbank) {
setchr2(0x0000, reg[0]);
setchr2(0x0800, reg[1]);
setchr2(0x1000, reg[6]);
@@ -88,14 +87,21 @@ static void M83Sync(void) {
setchr1(x << 10, reg[x] | ((bank & 0x30) << 4));
}
setprg8r(0x10, 0x6000, 0);
if (mode & 0x40) {
setprg16(0x8000, (bank & 0x3F)); /* DBZ Party [p1] */
setprg16(0xC000, (bank & 0x30) | 0xF);
} else {
setprg8(0x8000, reg[8]);
setprg8(0xA000, reg[9]);
setprg8(0xC000, reg[10]);
setprg8(0xE000, ~0);
switch (mode >>3 &3) {
case 0:
setprg16(0x8000, bank);
setprg16(0xC000, bank |0x0F);
break;
case 1:
setprg32(0x8000, bank >>1);
break;
case 2:
case 3:
setprg8(0x8000, bank <<1 &~0x1F | reg[8] &0x1F);
setprg8(0xA000, bank <<1 &~0x1F | reg[9] &0x1F);
setprg8(0xC000, bank <<1 &~0x1F | reg[10]&0x1F);
setprg8(0xE000, bank <<1 &~0x1F | 0x1F);
break;
}
}
@@ -116,25 +122,22 @@ static DECLFW(UNLYOKOWrite) {
}
static DECLFW(M83Write) {
switch (A) {
case 0x8000: is2kbank = 1; M83Sync(); break;
case 0xB000: /* Dragon Ball Z Party [p1] BMC */
case 0xB0FF: /* Dragon Ball Z Party [p1] BMC */
case 0xB1FF: bank = V; mode |= 0x40; M83Sync(); break; /* Dragon Ball Z Party [p1] BMC */
case 0x8100: mode = V | (mode & 0x40); M83Sync(); break;
case 0x8200: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break;
case 0x8201: IRQa = mode & 0x80; IRQCount &= 0xFF; IRQCount |= V << 8; break;
case 0x8300: reg[8] = V; mode &= 0xBF; M83Sync(); break;
case 0x8301: reg[9] = V; mode &= 0xBF; M83Sync(); break;
case 0x8302: reg[10] = V; mode &= 0xBF; M83Sync(); break;
case 0x8310: reg[0] = V; M83Sync(); break;
case 0x8311: reg[1] = V; M83Sync(); break;
case 0x8312: reg[2] = V; isnot2kbank = 1; M83Sync(); break;
case 0x8313: reg[3] = V; isnot2kbank = 1; M83Sync(); break;
case 0x8314: reg[4] = V; isnot2kbank = 1; M83Sync(); break;
case 0x8315: reg[5] = V; isnot2kbank = 1; M83Sync(); break;
case 0x8316: reg[6] = V; M83Sync(); break;
case 0x8317: reg[7] = V; M83Sync(); break;
switch (A &0x31F) {
case 0x000: bank = V; M83Sync(); break;
case 0x100: mode = V; M83Sync(); break;
case 0x200: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break;
case 0x201: IRQa = mode & 0x80; IRQCount &= 0xFF; IRQCount |= V << 8; break;
case 0x300: reg[8] = V; mode &= 0xBF; M83Sync(); break;
case 0x301: reg[9] = V; mode &= 0xBF; M83Sync(); break;
case 0x302: reg[10] = V; mode &= 0xBF; M83Sync(); break;
case 0x310: reg[0] = V; M83Sync(); break;
case 0x311: reg[1] = V; M83Sync(); break;
case 0x312: reg[2] = V; M83Sync(); break;
case 0x313: reg[3] = V; M83Sync(); break;
case 0x314: reg[4] = V; M83Sync(); break;
case 0x315: reg[5] = V; M83Sync(); break;
case 0x316: reg[6] = V; M83Sync(); break;
case 0x317: reg[7] = V; M83Sync(); break;
}
}
@@ -162,8 +165,6 @@ static void UNLYOKOPower(void) {
}
static void M83Power(void) {
is2kbank = 0;
isnot2kbank = 0;
mode = bank = 0;
dip = 0;
M83Sync();
@@ -171,7 +172,7 @@ static void M83Power(void) {
SetReadHandler(0x5100, 0x5103, UNLYOKOReadLow);
SetWriteHandler(0x5100, 0x5103, UNLYOKOWriteLow);
SetReadHandler(0x6000, 0x7fff, CartBR);
SetWriteHandler(0x6000, 0x7fff, CartBW);/* Pirate Dragon Ball Z Party [p1] used if for saves instead of seraial EEPROM */
SetWriteHandler(0x6000, 0x7fff, CartBW);
SetReadHandler(0x8000, 0xffff, CartBR);
SetWriteHandler(0x8000, 0xffff, M83Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
@@ -185,6 +186,7 @@ static void UNLYOKOReset(void) {
static void M83Reset(void) {
dip ^= 1;
mode = bank = 0;
M83Sync();
}
@@ -228,10 +230,19 @@ void Mapper83_Init(CartInfo *info) {
MapIRQHook = UNLYOKOIRQHook;
GameStateRestore = M83StateRestore;
WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if (info->iNES2) {
is2kbank =info->submapper ==1;
dbzParty =info->submapper ==2;
} else {
is2kbank = info->CHRRomSize ==512*1024;
dbzParty = info->PRGRomSize ==1024*1024;
}
if (dbzParty) {
WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
}
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@@ -363,6 +363,7 @@
{ 0x1C098942, 162, 0, MI_H, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 西游记后传 */
/* Mapper 162: Nanjing games that use an FS304 feature as a protection check */
{ 0x8589652D, 162, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 农场小精灵 */
{ 0x99FE9AB5, 162, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 时空斗士 - Pegasus Senya */
{ 0x82F204AE, 162, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 梁山英雄 */
/* Mapper 163: Nanjing, running with $5300=$04 */
@@ -430,7 +431,7 @@
{ 0xB35BE92F, 163, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 圣斗士星矢: 北欧突击篇 */
{ 0x15E50ECD, 163, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 宠物高达战记 */
{ 0xBBAB3A61, 163, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 拳皇R-1: 最强格斗王 */
{ 0x2DA3A49C, 163, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 时空斗士 - Pegasus Senya */
{ 0x2DA3A49C, 163, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 时空斗士 - Pegasus Senya, turns out to be wrong after all, and the mapper 162 one is the correct one */
{ 0x222A136A, 163, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 武侠天地 */
{ 0xEBC6E2E2, 163, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 毁灭之神 */
{ 0xE08AB52E, 163, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 魔兽世界: 恶魔猎人 */
@@ -453,7 +454,6 @@
{ 0x054444A0, 162, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 圣斗士星矢: 北欧突击篇 */
{ 0x9BA518BA, 162, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 宠物高达战记 */
{ 0x4CE082F8, 162, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 拳皇R-1: 最强格斗王 */
{ 0x99FE9AB5, 162, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 时空斗士 - Pegasus Senya */
{ 0x57414FB6, 162, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 武侠天地 */
{ 0x979239DE, 162, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 毁灭之神 */
{ 0xEFF96E8A, 162, 0, MI_V, 1, 0x70, 0x07, DENDY, NOEXTRA }, /* 魔兽世界: 恶魔猎人 */

View File

@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "fceu-types.h"
#include "x6502.h"
@@ -790,11 +791,20 @@ INES_BOARD_BEGIN()
INES_BOARD( "YY860729C", 386, Mapper386_Init )
INES_BOARD( "YY850735C", 387, Mapper387_Init )
INES_BOARD( "YY850835C", 388, Mapper388_Init )
INES_BOARD( "NC7000M", 391, NC7000M_Init )
INES_BOARD( "BS-110", 391, Mapper391_Init )
INES_BOARD( "YY850439C", 397, Mapper397_Init )
INES_BOARD( "831019C J-2282", 402, J2282_Init )
INES_BOARD( "SC871115C", 421, Mapper421_Init )
INES_BOARD( "AB-G1L/WELL-NO-DG450", 428, Mapper428_Init )
INES_BOARD( "LIKO BBG-235-8-1B", 429, Mapper429_Init )
INES_BOARD( "S-009", 434, Mapper434_Init )
INES_BOARD( "820401/T-217", 436, Mapper436_Init )
INES_BOARD( "NTDEC TH2348", 437, Mapper437_Init )
INES_BOARD( "K-3071", 438, Mapper438_Init )
INES_BOARD( "NC-3000M", 443, Mapper443_Init )
INES_BOARD( "NC-7000M", 444, Mapper444_Init )
INES_BOARD( "DS-9-27", 452, Mapper452_Init )
INES_BOARD( "K6C3001A", 456, Mapper456_Init )
INES_BOARD( "SA-9602B", 513, SA9602B_Init )
INES_BOARD( "DANCE2000", 518, UNLD2000_Init )
INES_BOARD( "EH8813A", 519, UNLEH8813A_Init )
@@ -808,6 +818,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "T-230", 529, UNLT230_Init )
INES_BOARD( "AX5705", 530, UNLAX5705_Init )
INES_BOARD( "LH53", 535, LH53_Init )
INES_BOARD( "SACHEN 3013", 553, Mapper553_Init )
INES_BOARD( "YC-03-09", 558, Mapper558_Init )
INES_BOARD_END()
@@ -917,7 +928,10 @@ int iNESLoad(const char *name, FCEUFILE *fp)
filesize -= 512;
}
romSize = (ROM_size * 0x4000) + (VROM_size * 0x2000);
iNESCart.PRGRomSize = ROM_size >=0xF00? (pow(2, head.ROM_size >>2)*((head.ROM_size &3)*2+1)): (ROM_size*0x4000);
iNESCart.CHRRomSize =VROM_size >=0xF00? (pow(2, head.VROM_size>>2)*((head.VROM_size&3)*2+1)): (VROM_size*0x2000);;
romSize = iNESCart.PRGRomSize + iNESCart.CHRRomSize;
if (romSize > filesize)
{
@@ -926,17 +940,17 @@ int iNESLoad(const char *name, FCEUFILE *fp)
else if (romSize < filesize)
FCEU_PrintError(" File contains %llu bytes of unused data\n", filesize - romSize);
rom_size_pow2 = uppow2(ROM_size) * 0x4000;
rom_size_pow2 = uppow2(iNESCart.PRGRomSize);
if ((ROM = (uint8*)FCEU_malloc(rom_size_pow2)) == NULL)
return 0;
memset(ROM, 0xFF, rom_size_pow2);
FCEU_fread(ROM, 0x4000, ROM_size, fp);
FCEU_fread(ROM, 1, iNESCart.PRGRomSize, fp);
if (VROM_size)
if (iNESCart.CHRRomSize)
{
vrom_size_pow2 = uppow2(VROM_size) * 0x2000;
vrom_size_pow2 = uppow2(iNESCart.CHRRomSize);
if ((VROM = (uint8*)FCEU_malloc(vrom_size_pow2)) == NULL)
{
@@ -946,20 +960,17 @@ int iNESLoad(const char *name, FCEUFILE *fp)
}
memset(VROM, 0xFF, vrom_size_pow2);
FCEU_fread(VROM, 0x2000, VROM_size, fp);
FCEU_fread(VROM, 1, iNESCart.CHRRomSize, fp);
}
iNESCart.PRGRomSize = ROM_size * 0x4000;
iNESCart.CHRRomSize = VROM_size * 0x2000;
iNESCart.PRGCRC32 = CalcCRC32(0, ROM, ROM_size * 0x4000);
iNESCart.CHRCRC32 = CalcCRC32(0, VROM, VROM_size * 0x2000);
iNESCart.CRC32 = CalcCRC32(iNESCart.PRGCRC32, VROM, VROM_size * 0x2000);
iNESCart.PRGCRC32 = CalcCRC32(0, ROM, iNESCart.PRGRomSize);
iNESCart.CHRCRC32 = CalcCRC32(0, VROM, iNESCart.CHRRomSize);
iNESCart.CRC32 = CalcCRC32(iNESCart.PRGCRC32, VROM, iNESCart.CHRRomSize);
md5_starts(&md5);
md5_update(&md5, ROM, ROM_size * 0x4000);
if (VROM_size)
md5_update(&md5, VROM, VROM_size * 0x2000);
md5_update(&md5, ROM, iNESCart.PRGRomSize);
if (iNESCart.CHRRomSize)
md5_update(&md5, VROM, iNESCart.CHRRomSize);
md5_finish(&md5, iNESCart.MD5);
memcpy(&GameInfo->MD5, &iNESCart.MD5, sizeof(iNESCart.MD5));
@@ -997,8 +1008,8 @@ int iNESLoad(const char *name, FCEUFILE *fp)
FCEU_printf(" PRG-ROM CRC32: 0x%08X\n", iNESCart.PRGCRC32);
FCEU_printf(" PRG+CHR CRC32: 0x%08X\n", iNESCart.CRC32);
FCEU_printf(" PRG+CHR MD5: 0x%s\n", md5_asciistr(iNESCart.MD5));
FCEU_printf(" PRG-ROM: %3d x 16KiB\n", ROM_size);
FCEU_printf(" CHR-ROM: %3d x 8KiB\n", VROM_size);
FCEU_printf(" PRG-ROM: %6d KiB\n", iNESCart.PRGRomSize >> 10);
FCEU_printf(" CHR-ROM: %36 KiB\n", iNESCart.CHRRomSize >> 10);
FCEU_printf(" Mapper #: %3d\n", iNESCart.mapper);
FCEU_printf(" Mapper name: %s\n", mappername);
FCEU_printf(" Mirroring: %s\n", iNESCart.mirror == 2 ? "None (Four-screen)" : iNESCart.mirror ? "Vertical" : "Horizontal");

View File

@@ -251,7 +251,6 @@ void Mapper282_Init(CartInfo *);
void Mapper295_Init(CartInfo *);
void Bs5652_Init(CartInfo *);
void NC7000M_Init(CartInfo *);
void J2282_Init(CartInfo *);
void Mapper267_Init(CartInfo *);
@@ -281,6 +280,7 @@ void Mapper387_Init(CartInfo *);
void Mapper388_Init(CartInfo *);
void Mapper389_Init(CartInfo *);
void Mapper390_Init(CartInfo *);
void Mapper391_Init(CartInfo *);
void Mapper395_Init(CartInfo *);
void Mapper397_Init(CartInfo *);
void Mapper401_Init(CartInfo *);
@@ -288,6 +288,15 @@ void Mapper411_Init(CartInfo *);
void Mapper421_Init(CartInfo *);
void Mapper422_Init(CartInfo *);
void Mapper428_Init(CartInfo *);
void Mapper429_Init(CartInfo *);
void Mapper434_Init(CartInfo *);
void Mapper436_Init(CartInfo *);
void Mapper437_Init(CartInfo *);
void Mapper438_Init(CartInfo *);
void Mapper443_Init(CartInfo *);
void Mapper444_Init(CartInfo *);
void Mapper452_Init(CartInfo *);
void Mapper456_Init(CartInfo *);
void Mapper516_Init(CartInfo *);
void Mapper523_Init(CartInfo *);
void Mapper533_Init(CartInfo *);
@@ -298,6 +307,7 @@ void Mapper540_Init(CartInfo *);
void Mapper541_Init(CartInfo *);
void Mapper543_Init(CartInfo *);
void Mapper550_Init(CartInfo *);
void Mapper553_Init(CartInfo *);
void Mapper554_Init(CartInfo *);
void Mapper558_Init(CartInfo *);

View File

@@ -443,7 +443,7 @@ static BMAPPING bmap[] = {
{ "ANROM", 7, ANROM_Init, 0 },
{ "AX5705", 530, UNLAX5705_Init, 0 },
{ "BB", 108, UNLBB_Init, 0 },
{ "BS-110", NO_INES, BS110_Init, 0 },
{ "BS-110", 444, Mapper444_Init, 0 }, /* Due to a mix-up, UNIF MAPR BMC-BS-110 is actually the NC7000M PCB and refers to NES 2.0 Mapper 444 instead. */
{ "BS-5", 286, BMCBS5_Init, 0 },
{ "CC-21", 27, UNLCC21_Init, 0 },
{ "CITYFIGHT", 266, UNLCITYFIGHT_Init, 0 },

View File

@@ -187,11 +187,11 @@ void BMCK3033_Init(CartInfo *info); /* mm22 */
void BMC830134C_Init(CartInfo *info); /* m315 */
void BMCGN26_Init(CartInfo *info); /* m344 */
void BS110_Init(CartInfo *info);
void KG256_Init(CartInfo *info);
void WAIXINGFS005_Init(CartInfo *info);
void Mapper422_Init(CartInfo *info);
void Mapper444_Init(CartInfo *info);
#ifdef COPYFAMI
void MapperCopyFamiMMC3_Init(CartInfo *info);