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