Merge pull request #502 from negativeExponent/mappers

Mappers
This commit is contained in:
Autechre
2022-02-26 22:37:58 +01:00
committed by GitHub
59 changed files with 467 additions and 63 deletions

View File

@@ -2,7 +2,7 @@
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -3,7 +3,7 @@
* Copyright notice for this file:
* Copyright (C) 2011 CaH4e3
* Copyright (C) 2019 Libretro Team
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -2,7 +2,7 @@
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

98
src/boards/326.c Normal file
View File

@@ -0,0 +1,98 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022
*
* 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 326 is used for a bootleg version of Contra/Gryzor.
* as implemented from
* http://forums.nesdev.org/viewtopic.php?f=9&t=17352&p=218722#p218722
*/
#include "mapinc.h"
static uint8 PRG[3], CHR[8], NTAPage[4];
static SFORMAT StateRegs[] =
{
{ PRG, 3, "PRG" },
{ CHR, 8, "CHR" },
{ NTAPage, 4, "NT" },
{ 0 }
};
static void SyncPRG(void) {
setprg8(0x8000, PRG[0]);
setprg8(0xA000, PRG[1]);
setprg8(0xC000, PRG[2]);
setprg8(0xE000, ~0);
}
static void DoCHR(int x, uint8 V) {
CHR[x] = V;
setchr1(x << 10, V);
}
static void FixCHR(void) {
int x;
for (x = 0; x < 8; x++)
DoCHR(x, CHR[x]);
}
static void FASTAPASS(2) DoNTARAM(int w, uint8 V) {
NTAPage[w] = V;
setntamem(NTARAM + ((V & 1) << 10), 1, w);
}
static void FixNTAR(void) {
int x;
for (x = 0; x < 4; x++)
DoNTARAM(x, NTAPage[x]);
}
static DECLFW(M326Write) {
switch (A & 0xE010) {
case 0x8000: PRG[0] = V; SyncPRG(); break;
case 0xA000: PRG[1] = V; SyncPRG(); break;
case 0xC000: PRG[2] = V; SyncPRG(); break;
}
A &= 0x801F;
if ((A >= 0x8010) && (A <= 0x8017))
DoCHR(A - 0x8010, V);
else if ((A >= 0x8018) && (A <= 0x801B))
DoNTARAM(A - 0x8018, V);
}
static void M326Power(void) {
SyncPRG();
FixCHR();
FixNTAR();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M326Write);
}
static void StateRestore(int version) {
SyncPRG();
FixCHR();
FixNTAR();
}
void Mapper326_Init(CartInfo *info) {
info->Power = M326Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

137
src/boards/330.c Normal file
View File

@@ -0,0 +1,137 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022
*
* 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 330 is used for a bootleg version of Contra/Gryzor.
* as implemented from
* http://forums.nesdev.org/viewtopic.php?f=9&t=17352&p=218722#p218722
*/
#include "mapinc.h"
static uint8 *WRAM;
static uint8 PRG[3], CHR[8], NTAPage[4];
static uint8 IRQa;
static uint16 IRQCount;
static SFORMAT StateRegs[] =
{
{ PRG, 3, "PRG" },
{ CHR, 8, "CHR" },
{ NTAPage, 4, "NT" },
{ &IRQa, 1, "IRQA" },
{ &IRQCount, 2, "IRQC" },
{ 0 }
};
static void SyncPRG(void) {
setprg8(0x8000, PRG[0]);
setprg8(0xA000, PRG[1]);
setprg8(0xC000, PRG[2]);
setprg8(0xE000, ~0);
}
static void DoCHR(int x, uint8 V) {
CHR[x] = V;
setchr1(x << 10, V);
}
static void FixCHR(void) {
int x;
for (x = 0; x < 8; x++)
DoCHR(x, CHR[x]);
}
static void FASTAPASS(2) DoNTARAM(int w, uint8 V) {
NTAPage[w] = V;
setntamem(NTARAM + ((V & 1) << 10), 1, w);
}
static void FixNTAR(void) {
int x;
for (x = 0; x < 4; x++)
DoNTARAM(x, NTAPage[x]);
}
static DECLFW(M330Write) {
if (!(A & 0x400)) {
if (A >= 0x8000 && A <= 0xB800)
DoCHR((A - 0x8000) >> 11, V);
else if (A >= 0xC000 && A <= 0xD800)
DoNTARAM((A - 0xC000) >> 11, V);
else if (A >= 0xE000 && A <= 0xF000) {
PRG[(A - 0xE000) >> 11] = V;
SyncPRG();
}
} else if ((A < 0xC000) && !(A & 0x4000)) {
if (A & 0x2000) {
IRQCount &= 0x00FF;
IRQCount |= (V & 0x7F) << 8;
IRQa = V & 0x80;
X6502_IRQEnd(FCEU_IQEXT);
} else {
IRQCount &= 0xFF00;
IRQCount |= V;
}
}
}
static void M330Power(void) {
int i;
for (i = 0; i < 4; i++)
PRG[i] = i;
for (i = 0; i < 8; i++)
CHR[i] = i;
for (i = 0; i < 4; i++)
NTAPage[i] = ~0;
IRQa = 0;
IRQCount = 0;
SyncPRG();
FixCHR();
FixNTAR();
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M330Write);
}
static void FP_FASTAPASS(1) M330IRQHook(int a) {
if (IRQa) {
IRQCount += a;
if (IRQCount > 0x7FFF) {
X6502_IRQBegin(FCEU_IQEXT);
IRQa = 0;
IRQCount = 0;
}
}
}
static void StateRestore(int version) {
SyncPRG();
FixCHR();
FixNTAR();
}
void Mapper330_Init(CartInfo *info) {
info->Power = M330Power;
MapIRQHook = M330IRQHook;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
WRAM = (uint8 *)FCEU_gmalloc(8192);
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
AddExState(WRAM, 8192, 0, "WRAM");
}

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* added 2020-1-28 - negativeExponent */
/* added 2020-1-28 - */
/* NES 2.0 Mapper 372 is used for a revision of the Rockman I-VI multicart (PCB ID SFC-12).
* It is INES Mapper 045 but with one bit of outer bank register #2 working as a CHR-ROM/RAM switch.
*/

125
src/boards/375.c Normal file
View File

@@ -0,0 +1,125 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022
*
* 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"
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static uint16 addrlatch;
static uint8 datalatch;
static void Sync(void) {
uint32 S = addrlatch & 1;
uint32 p = ((addrlatch >> 2) & 0x1F) + ((addrlatch & 0x100) >> 3) + ((addrlatch & 0x400) >> 4);
uint32 L = (addrlatch >> 9) & 1;
uint32 p_8000 = p;
if ((addrlatch >> 11) & 1)
p_8000 = (p & 0x7E) | (datalatch & 7);
if ((addrlatch >> 7) & 1) {
if (S) {
setprg32(0x8000, p >> 1);
} else {
setprg16(0x8000, p_8000);
setprg16(0xC000, p);
}
} else {
if (S) {
if (L) {
setprg16(0x8000, p_8000 & 0x7E);
setprg16(0xC000, p | 7);
} else {
setprg16(0x8000, p_8000 & 0x7E);
setprg16(0xC000, p & 0x78);
}
} else {
if (L) {
setprg16(0x8000, p_8000);
setprg16(0xC000, p | 7);
} else {
setprg16(0x8000, p_8000);
setprg16(0xC000, p & 0x78);
}
}
}
if ((addrlatch & 0x80) == 0x80)
/* CHR-RAM write protect hack, needed for some multicarts */
SetupCartCHRMapping(0, CHRptr[0], 0x2000, 0);
else
SetupCartCHRMapping(0, CHRptr[0], 0x2000, 1);
setmirror(((addrlatch >> 1) & 1) ^ 1);
setchr8(0);
setprg8r(0x10, 0x6000, 0);
}
static DECLFR(M375Read) {
return CartBR(A);
}
static DECLFW(M375Write) {
if (addrlatch & 0x800)
datalatch = V;
else {
addrlatch = A;
datalatch = V;
}
Sync();
}
static void M375Reset(void) {
addrlatch = 0;
datalatch = 0;
Sync();
}
static void M375Power(void) {
addrlatch = 0;
datalatch = 0;
Sync();
setchr8(0);
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M375Write);
if (WRAMSIZE) {
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
}
}
static void StateRestore(int version) {
Sync();
}
void Mapper375_Init(CartInfo *info) {
info->Power = M375Power;
info->Reset = M375Reset;
GameStateRestore = StateRestore;
AddExState(&addrlatch, 2, 0, "ADDR");
AddExState(&datalatch, 1, 0, "DATA");
WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
}

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* 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
@@ -51,7 +51,7 @@ static void M396Reset(void) {
Sync();
}
static void StateRestore(void) {
static void StateRestore(int version) {
Sync();
}

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 negativeExponent
* Copyright (C) 2022
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -1,7 +1,7 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@@ -2,7 +2,7 @@
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -544,6 +544,21 @@ void Mapper288_Init(CartInfo *info) {
AddExState(&dipswitch, 1, 0, "DIPSW");
}
/*------------------ Map 385 ---------------------------*/
static void M385Sync(void) {
int32 mirror = latche & 1;
int32 bank = (latche >> 1) & 0x7;
setprg16(0x8000, bank);
setprg16(0xc000, bank);
setmirror(mirror ^ 1);
setchr8(0);
}
void Mapper385_Init(CartInfo *info) {
Latch_Init(info, M385Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
}
/*------------------ Map 541 ---------------------------*/
/* LittleCom 160-in-1 multicart */
static void M541Sync(void) {

View File

@@ -460,6 +460,18 @@ void Mapper241_Init(CartInfo *info) {
Latch_Init(info, M241Sync, 0, 0x8000, 0xFFFF, 1, 0);
}
/*------------------ Map 271 ---------------------------*/
static void M271Sync(void) {
setchr8(latche & 0x0F);
setprg32(0x8000, latche >> 4);
setmirror((latche >> 5) & 1);
}
void Mapper271_Init(CartInfo *info) {
Latch_Init(info, M271Sync, 0, 0x8000, 0xFFFF, 0, 0);
}
/*------------------ Map 381 ---------------------------*/
/* 2-in-1 High Standard Game (BC-019), reset-based */
static uint8 reset = 0;
@@ -512,33 +524,34 @@ void Mapper538_Init(CartInfo *info) {
* mode (one screen) and 32K bankswitching, second one have only
* 16 bankswitching mode and normal mirroring... But there is no any
* correlations between modes and they can be used in one mapper code.
*
* Submapper 0 - 3-in-1 (N068)
* Submapper 0 - 3-in-1 (N080)
* Submapper 1 - 4-in-1 (JY-066)
*/
static int A65ASsubmapper;
static void BMCA65ASSync(void) {
if (latche & 0x40)
setprg32(0x8000, (latche >> 1) & 0x0F);
else {
if (A65ASsubmapper == 1) {
setprg16(0x8000, ((latche & 0x38) >> 0) | (latche & 7));
setprg16(0xC000, ((latche & 0x38) >> 0) | 7);
} else {
setprg16(0x8000, ((latche & 0x30) >> 1) | (latche & 7));
setprg16(0xC000, ((latche & 0x30) >> 1) | 7);
} else {
setprg16(0x8000, latche & 0x0F);
setprg16(0xC000, latche & 0x0F | 7);
}
}
setchr8(0);
if (latche & 0x80)
setmirror(MI_0 + (((latche >> 5) & 1)));
else {
if (A65ASsubmapper == 1) /* added as workaround since games for this cart uses vertical mirroring */
setmirror(MI_V);
else
setmirror(((latche >> 3) & 1) ^ 1);
}
else
setmirror(((latche >> 3) & 1) ^ 1);
}
void BMCA65AS_Init(CartInfo *info) {
A65ASsubmapper = info->submapper; /* not a real submapper */
A65ASsubmapper = info->submapper;
Latch_Init(info, BMCA65ASSync, 0, 0x8000, 0xFFFF, 0, 0);
}

View File

@@ -2,7 +2,7 @@
*
* Copyright notice for this file:
* Copyright (C) 2006 CaH4e3
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -549,11 +549,16 @@ static void M297Power(void) {
SetWriteHandler(0x8000, 0xFFFF, M297Latch);
}
static void M297StateRestore(int version) {
Sync();
}
void Mapper297_Init(CartInfo *info) {
GenMMC1Init(info, 256, 256, 0, 0);
info->Power = M297Power;
MMC1CHRHook4 = M297CHR;
MMC1PRGHook16 = M297PRG;
GameStateRestore = M297StateRestore;
AddExState(&latch, 1, 0, "LATC");
AddExState(&mode, 1, 0, "MODE");
}

View File

@@ -2,7 +2,7 @@
*
* Copyright notice for this file:
* Copyright (C) 2019 Libretro Team
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -2,7 +2,7 @@
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -3,7 +3,7 @@
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
* Copyright (C) 2019 Libretro Team
* Copyright (C) 2020 negativeExponent
* Copyright (C) 2020
*
* 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

View File

@@ -387,7 +387,7 @@ int FCEUI_DecodePAR(const char *str, uint16 *a, uint8 *v, int *c, int *type) {
*c = -1;
/* 2020-08-31 - negativeExponent
/* 2020-08-31
* Why is the top code set as default on non-debug runtime when
* bottom code is what works for PAR?
*/

View File

@@ -691,6 +691,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "8-in-1 JY-119", 267, Mapper267_Init )
INES_BOARD( "COOLBOY/MINDKIDS", 268, Mapper268_Init ) /* Submapper distinguishes between COOLBOY and MINDKIDS */
INES_BOARD( "Games Xplosion 121-in-1", 269, Mapper269_Init )
INES_BOARD( "MGC-026", 271, Mapper271_Init )
INES_BOARD( "Akumajō Special: Boku Dracula-kun", 272, Mapper272_Init )
INES_BOARD( "80013-B", 274, BMC80013B_Init )
INES_BOARD( "YY860417C", 281, Mapper281_Init )
@@ -730,9 +731,11 @@ INES_BOARD_BEGIN()
INES_BOARD( "FARID_SLROM_8-IN-1", 323, FARIDSLROM8IN1_Init )
INES_BOARD( "FARID_UNROM_8-IN-1", 324, FARIDUNROM_Init )
INES_BOARD( "MALISB", 325, UNLMaliSB_Init )
INES_BOARD( "Contra/Gryzor", 326, Mapper326_Init )
INES_BOARD( "10-24-C-A1", 327, BMC1024CA1_Init )
INES_BOARD( "RT-01", 328, UNLRT01_Init )
INES_BOARD( "EDU2000", 329, UNLEDU2000_Init )
INES_BOARD( "Sangokushi II: Haō no Tairiku", 330, Mapper330_Init )
INES_BOARD( "12-IN-1", 331, BMC12IN1_Init )
INES_BOARD( "WS", 332, BMCWS_Init )
INES_BOARD( "NEWSTAR-GRM070-8IN1", 333, BMC8IN1_Init )
@@ -766,12 +769,14 @@ INES_BOARD_BEGIN()
INES_BOARD( "Golden Mario Party II - Around the World 6-in-1", 370, Mapper370_Init )
INES_BOARD( "MMC3 PIRATE SFC-12", 372, Mapper372_Init )
INES_BOARD( "95/96 Super HiK 4-in-1", 374, Mapper374_Init )
INES_BOARD( "135-in-1", 375, Mapper375_Init )
INES_BOARD( "YY841155C", 376, Mapper376_Init )
INES_BOARD( "JY-111/JY-112", 377, Mapper377_Init )
INES_BOARD( "42 to 80,000 (970630C)", 380, Mapper380_Init )
INES_BOARD( "KN-42", 381, Mapper381_Init )
INES_BOARD( "830928C", 382, Mapper382_Init )
INES_BOARD( "YY840708C", 383, Mapper383_Init )
INES_BOARD( "NTDEC 2779", 385, Mapper385_Init )
INES_BOARD( "YY860729C", 386, Mapper386_Init )
INES_BOARD( "YY850735C", 387, Mapper387_Init )
INES_BOARD( "YY850835C", 388, Mapper388_Init )

View File

@@ -259,10 +259,13 @@ void J2282_Init(CartInfo *);
void Mapper267_Init(CartInfo *);
void Mapper268_Init(CartInfo *);
void Mapper269_Init(CartInfo *);
void Mapper271_Init(CartInfo *);
void Mapper288_Init(CartInfo *);
void Mapper293_Init(CartInfo *);
void Mapper297_Init(CartInfo *);
void Mapper319_Init(CartInfo *);
void Mapper326_Init(CartInfo *);
void Mapper330_Init(CartInfo *);
void Mapper334_Init(CartInfo *);
void Mapper353_Init(CartInfo *);
void Mapper356_Init(CartInfo *);
@@ -276,12 +279,14 @@ void Mapper369_Init(CartInfo *);
void Mapper370_Init(CartInfo *);
void Mapper372_Init(CartInfo *);
void Mapper374_Init(CartInfo *);
void Mapper375_Init(CartInfo *);
void Mapper376_Init(CartInfo *);
void Mapper377_Init(CartInfo *);
void Mapper380_Init(CartInfo *);
void Mapper381_Init(CartInfo *);
void Mapper382_Init(CartInfo *);
void Mapper383_Init(CartInfo *);
void Mapper385_Init(CartInfo *);
void Mapper386_Init(CartInfo *);
void Mapper387_Init(CartInfo *);
void Mapper388_Init(CartInfo *);

View File

@@ -364,7 +364,7 @@ struct _unif_db {
};
static struct _unif_db unif_db[] = {
{ 0x8ebad077d08e6c78ULL, "A65AS", 1, -1, -1 }, /* 3-in-1 (N080) [p1][U][!], not a real submapper */
{ 0x03ed6963ca50e1d8ULL, "A65AS", 1, -1, -1 },
{ 0x616851e56946893bULL, "RESETNROM-XIN1", 0, MI_V, -1 }, /* Sheng Tian 2-in-1(Unl,ResetBase)[p1].unf */
{ 0x4cd729b5ae23a3cfULL, "RESETNROM-XIN1", 0, MI_H, -1 }, /* Sheng Tian 2-in-1(Unl,ResetBase)[p2].unf */
@@ -620,6 +620,7 @@ static BMAPPING bmap[] = {
{ "BS-400R", 422, Mapper422_Init, 0 },
{ "BS-4040R", 422, Mapper422_Init, 0 },
{ "22026", 271, Mapper271_Init, 0 },
#ifdef COPYFAMI
{ "COPYFAMI_MMC3", NO_INES, MapperCopyFamiMMC3_Init, 0 },