Merge pull request #318 from negativeExponent/add_new_mappers
Add new mappers
This commit is contained in:
60
src/boards/267.c
Normal file
60
src/boards/267.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/* NES 2.0 Mapper 267 - 8-in-1 JY-119 */
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
#define OUTER_BANK (((EXPREGS[0] & 0x20) >> 2) | (EXPREGS[0] & 0x06))
|
||||
|
||||
static void M267CW(uint32 A, uint8 V) {
|
||||
setchr1(A, (V & 0x7F) | (OUTER_BANK << 6));
|
||||
}
|
||||
|
||||
static void M267PW(uint32 A, uint8 V) {
|
||||
setprg8(A, (V & 0x1F) | (OUTER_BANK << 4));
|
||||
}
|
||||
|
||||
static DECLFW(M267Write) {
|
||||
EXPREGS[0] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void M267Reset(void) {
|
||||
EXPREGS[0] = 0;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void M267Power(void) {
|
||||
EXPREGS[0] = 0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x6000, 0x6FFF, M267Write);
|
||||
}
|
||||
|
||||
void Mapper267_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 128, 0, 0);
|
||||
cwrap = M267CW;
|
||||
pwrap = M267PW;
|
||||
info->Reset = M267Reset;
|
||||
info->Power = M267Power;
|
||||
AddExState(EXPREGS, 4, 0, "EXPR");
|
||||
}
|
||||
124
src/boards/357.c
Normal file
124
src/boards/357.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/* NES 2.0 Mapper 357 is used for a 4-in-1 multicart (cartridge ID 4602) from Bit Corp.
|
||||
* The first game is Bit Corp's hack of the YUNG-08 conversion of Super Mario Brothers 2 (J) named Mr. Mary 2,
|
||||
* the other three games are UNROM games.
|
||||
*
|
||||
* Implementation is modified so reset actually sets the correct dipswitch (or outer banks) for each of the 4 games
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 preg[4];
|
||||
static uint8 dipswitch;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static uint8 banks[8] = { 4, 3, 5, 3, 6, 3, 7, 3 };
|
||||
static uint8 outer_bank[4] = { 0x00, 0x08, 0x10, 0x18 };
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 4 | FCEUSTATE_RLSB, "IRQC" },
|
||||
{ &IRQa, 4 | FCEUSTATE_RLSB, "IRQA" },
|
||||
{ &dipswitch, 1, "DPSW" },
|
||||
{ &preg, 4, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (dipswitch == 0) {
|
||||
/* SMB2J Mode */
|
||||
setprg4(0x5000, 16);
|
||||
setprg8(0x6000, preg[1] ? 0 : 2);
|
||||
setprg8(0x8000, 1);
|
||||
setprg8(0xa000, 0);
|
||||
setprg8(0xc000, banks[preg[0]]);
|
||||
setprg8(0xe000, preg[1] ? 8 : 10);
|
||||
} else {
|
||||
/* UNROM Mode */
|
||||
setprg16(0x8000, outer_bank[dipswitch] | preg[2]);
|
||||
setprg16(0xc000, outer_bank[dipswitch] | 7);
|
||||
}
|
||||
setchr8(0);
|
||||
setmirror(dipswitch == 3 ? MI_H : MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(M357WriteLo) {
|
||||
switch (A & 0x71ff) {
|
||||
case 0x4022: preg[0] = V & 7; Sync(); break;
|
||||
case 0x4120: preg[1] = V & 1; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M357WriteIRQ) {
|
||||
IRQa = V & 1;
|
||||
if (!IRQa) {
|
||||
IRQCount = 0;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M357WriteUNROM) {
|
||||
preg[2] = V & 7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M357Power(void) {
|
||||
preg[0] = 0;
|
||||
preg[1] = 0;
|
||||
IRQa = IRQCount = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x5000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x4022, 0x4022, M357WriteLo);
|
||||
SetWriteHandler(0x4120, 0x4120, M357WriteLo);
|
||||
SetWriteHandler(0x4122, 0x4122, M357WriteIRQ);
|
||||
SetWriteHandler(0x8000, 0xffff, M357WriteUNROM);
|
||||
}
|
||||
|
||||
static void M357Reset(void) {
|
||||
IRQa = IRQCount = 0;
|
||||
dipswitch++;
|
||||
dipswitch &= 3;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M357IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
if (IRQCount < 4096)
|
||||
IRQCount += a;
|
||||
else {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper357_Init(CartInfo *info) {
|
||||
info->Reset = M357Reset;
|
||||
info->Power = M357Power;
|
||||
MapIRQHook = M357IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
110
src/boards/372.c
Normal file
110
src/boards/372.c
Normal file
@@ -0,0 +1,110 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/* added 2020-1-28 - negativeExponent */
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 WRAM[0x2000];
|
||||
static uint32 CHRRAMSIZE;
|
||||
static uint8 *CHRRAM;
|
||||
|
||||
static void M372CW(uint32 A, uint8 V) {
|
||||
if (!UNIFchrrama) {
|
||||
uint32 NV = V;
|
||||
if (EXPREGS[2] & 8)
|
||||
NV &= (1 << ((EXPREGS[2] & 7) + 1)) - 1;
|
||||
else if (EXPREGS[2])
|
||||
NV &= 0; /* hack ;( don't know exactly how it should be */
|
||||
NV |= EXPREGS[0] | ((EXPREGS[2] & 0xF0) << 4);
|
||||
if (EXPREGS[2] & 0x20)
|
||||
setchr1r(0x10, A, V);
|
||||
else
|
||||
setchr1(A, NV);
|
||||
} else
|
||||
/* setchr8(0); */ /* i don't know what cart need this, but a new one need other lol */
|
||||
setchr1(A, V);
|
||||
}
|
||||
|
||||
static void M372PW(uint32 A, uint8 V) {
|
||||
uint32 MV = V & ((EXPREGS[3] & 0x3F) ^ 0x3F);
|
||||
MV |= EXPREGS[1];
|
||||
if(UNIFchrrama)
|
||||
MV |= ((EXPREGS[2] & 0x40) << 2);
|
||||
setprg8(A, MV);
|
||||
/* FCEU_printf("1:%02x 2:%02x 3:%02x A=%04x V=%03x\n",EXPREGS[1],EXPREGS[2],EXPREGS[3],A,MV); */
|
||||
}
|
||||
|
||||
static DECLFW(M372Write) {
|
||||
if (EXPREGS[3] & 0x40) {
|
||||
WRAM[A - 0x6000] = V;
|
||||
return;
|
||||
}
|
||||
EXPREGS[EXPREGS[4]] = V;
|
||||
EXPREGS[4] = (EXPREGS[4] + 1) & 3;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static DECLFR(M372Read) {
|
||||
uint32 addr = 1 << (EXPREGS[5] + 4);
|
||||
if (A & (addr | (addr - 1)))
|
||||
return X.DB | 1;
|
||||
else
|
||||
return X.DB;
|
||||
}
|
||||
|
||||
static void M372Reset(void) {
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = EXPREGS[4] = 0;
|
||||
EXPREGS[5]++;
|
||||
EXPREGS[5] &= 7;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void M372Power(void) {
|
||||
GenMMC3Power();
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = EXPREGS[4] = EXPREGS[5] = 0;
|
||||
SetWriteHandler(0x5000, 0x7FFF, M372Write);
|
||||
SetReadHandler(0x5000, 0x5FFF, M372Read);
|
||||
}
|
||||
|
||||
static void M372Close(void) {
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM = NULL;
|
||||
}
|
||||
|
||||
void Mapper372_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 256, 8, info->battery);
|
||||
cwrap = M372CW;
|
||||
pwrap = M372PW;
|
||||
info->Reset = M372Reset;
|
||||
info->Power = M372Power;
|
||||
info->Close = M372Close;
|
||||
CHRRAMSIZE = 8192;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
|
||||
AddExState(EXPREGS, 5, 0, "EXPR");
|
||||
}
|
||||
92
src/boards/390.c
Normal file
92
src/boards/390.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/* NES 2.0 Mapper 390 - Realtec 8031 */
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[2];
|
||||
static uint8 dipswitch;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®s, 2, "REG" },
|
||||
{ &dipswitch, 1, "DPSW" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
switch ((regs[1] >> 4) & 3) {
|
||||
case 0:
|
||||
case 1:
|
||||
/* UNROM */
|
||||
setprg16(0x8000, regs[1]);
|
||||
setprg16(0xC000, regs[1] | 7);
|
||||
break;
|
||||
case 2:
|
||||
/* Maybe unused, NROM-256? */
|
||||
setprg32(0x8000, regs[1] >> 1);
|
||||
break;
|
||||
case 3:
|
||||
/* NROM-128 */
|
||||
setprg16(0x8000, regs[1]);
|
||||
setprg16(0xC000, regs[1]);
|
||||
break;
|
||||
}
|
||||
setchr8(regs[0]);
|
||||
setmirror(((regs[0] & 0x20) >> 5) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFR(M390Read) {
|
||||
uint8 ret = CartBR(A);
|
||||
if ((regs[1] & 0x30) == 0x10)
|
||||
ret |= dipswitch;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DECLFW(M390Write) {
|
||||
regs[(A >> 14) & 1] = A & 0x3F;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M390Power(void) {
|
||||
regs[0] = 0;
|
||||
regs[1] = 0;
|
||||
dipswitch = 11; /* hard-coded 150-in-1 menu */
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xffff, M390Read);
|
||||
SetWriteHandler(0x8000, 0xffff, M390Write);
|
||||
}
|
||||
|
||||
static void M390Reset(void) {
|
||||
dipswitch = 11; /* hard-coded 150-in-1 menu */
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper390_Init(CartInfo *info) {
|
||||
info->Reset = M390Reset;
|
||||
info->Power = M390Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -472,6 +472,55 @@ void Mapper242_Init(CartInfo *info) {
|
||||
Latch_Init(info, M242Sync, NULL, 0x0000, 0x8000, 0xFFFF, 1);
|
||||
}
|
||||
|
||||
/*------------------ Map 288 ---------------------------*/
|
||||
/* NES 2.0 Mapper 288 is used for two GKCX1 21-in-1 multicarts
|
||||
* - 21-in-1 (GA-003)
|
||||
* - 64-in-1 (CF-015)
|
||||
*/
|
||||
static void M288Sync(void) {
|
||||
setchr8(latche & 7);
|
||||
setprg32(0x8000, (latche >> 3) & 3);
|
||||
}
|
||||
|
||||
static DECLFR(M288Read) {
|
||||
uint8 ret = CartBR(A);
|
||||
if (latche & 0x20)
|
||||
ret |= (dipswitch << 2);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void M288Reset(void) {
|
||||
dipswitch++;
|
||||
dipswitch &= 3;
|
||||
M288Sync();
|
||||
}
|
||||
|
||||
void Mapper288_Init(CartInfo *info) {
|
||||
dipswitch = 0;
|
||||
Latch_Init(info, M288Sync, M288Read, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
info->Reset = M288Reset;
|
||||
AddExState(&dipswitch, 1, 0, "DIPSW");
|
||||
}
|
||||
|
||||
/*------------------ Map 541 ---------------------------*/
|
||||
/* LittleCom 160-in-1 multicart */
|
||||
static void M541Sync(void) {
|
||||
if (latche & 2) {
|
||||
/* NROM-128 */
|
||||
setprg16(0x8000, latche >> 2);
|
||||
setprg16(0xC000, latche >> 2);
|
||||
} else {
|
||||
/* NROM=256 */
|
||||
setprg32(0x8000, latche >> 3);
|
||||
}
|
||||
setchr8(0);
|
||||
setmirror(latche & 1);
|
||||
}
|
||||
|
||||
void Mapper541_Init(CartInfo *info) {
|
||||
Latch_Init(info, M541Sync, NULL, 0x0000, 0xC000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
/*------------------ 190in1 ---------------------------*/
|
||||
|
||||
static void BMC190in1Sync(void) {
|
||||
|
||||
@@ -490,6 +490,46 @@ void Mapper241_Init(CartInfo *info) {
|
||||
Latch_Init(info, M241Sync, 0, 0x8000, 0xFFFF, 1, 0);
|
||||
}
|
||||
|
||||
/*------------------ Map 381 ---------------------------*/
|
||||
/* 2-in-1 High Standard Game (BC-019), reset-based */
|
||||
static uint8 reset = 0;
|
||||
static void M381Sync(void) {
|
||||
setprg16(0x8000, ((latche & 0x10) >> 4) | ((latche & 7) << 1) | (reset << 4));
|
||||
setprg16(0xC000, 15 | (reset << 4));
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static void M381Reset(void) {
|
||||
reset ^= 1;
|
||||
M381Sync();
|
||||
}
|
||||
|
||||
void Mapper381_Init(CartInfo *info) {
|
||||
info->Reset = M381Reset;
|
||||
Latch_Init(info, M381Sync, 0, 0x8000, 0xFFFF, 1, 0);
|
||||
AddExState(&reset, 1, 0, "RST0");
|
||||
}
|
||||
|
||||
/*------------------ Map 538 ---------------------------*/
|
||||
/* NES 2.0 Mapper 538 denotes the 60-1064-16L PCB, used for a
|
||||
* bootleg cartridge conversion named Super Soccer Champion
|
||||
* of the Konami FDS game Exciting Soccer.
|
||||
*/
|
||||
static uint8 M538Banks[16] = { 0, 1, 2, 1, 3, 1, 4, 1, 5, 5, 1, 1, 6, 6, 7, 7 };
|
||||
static void M538Sync(void) {
|
||||
setprg8(0x6000, (latche >> 1) | 8);
|
||||
setprg8(0x8000, M538Banks[latche & 15]);
|
||||
setprg8(0xA000, 14);
|
||||
setprg8(0xC000, 7);
|
||||
setprg8(0xE000, 15);
|
||||
setchr8(0);
|
||||
setmirror(1);
|
||||
}
|
||||
|
||||
void Mapper538_Init(CartInfo *info) {
|
||||
Latch_Init(info, M538Sync, 0, 0xC000, 0xCFFF, 1, 0);
|
||||
}
|
||||
|
||||
/* ------------------ A65AS --------------------------- */
|
||||
|
||||
/* actually, there is two cart in one... First have extra mirroring
|
||||
|
||||
@@ -443,3 +443,92 @@ void FARIDSLROM8IN1_Init(CartInfo *info) {
|
||||
AddExState(&lock, 1, 0, "LOCK");
|
||||
AddExState(®, 1, 0, "REG6");
|
||||
}
|
||||
|
||||
/* ---------------------------- Mapper 374 -------------------------------- */
|
||||
/* 1995 Super HiK 4-in-1 - 新系列機器戰警组合卡 (JY-022)
|
||||
* 1996 Super HiK 4-in-1 - 新系列超級飛狼組合卡 (JY-051)
|
||||
*/
|
||||
static uint8 game = 0;
|
||||
static void M374PRG(uint32 A, uint8 V) {
|
||||
setprg16(A, (V & 0x07) | (game << 3));
|
||||
}
|
||||
|
||||
static void M374CHR(uint32 A, uint8 V) {
|
||||
setchr4(A, (V & 0x1F) | (game << 5));
|
||||
}
|
||||
|
||||
static void M374Reset(void) {
|
||||
game = (game + 1) & 3;
|
||||
MMC1CMReset();
|
||||
}
|
||||
|
||||
void Mapper374_Init(CartInfo *info) {
|
||||
GenMMC1Init(info, 128, 128, 0, 0);
|
||||
MMC1CHRHook4 = M374CHR;
|
||||
MMC1PRGHook16 = M374PRG;
|
||||
info->Reset = M374Reset;
|
||||
AddExState(&game, 1, 0, "GAME");
|
||||
}
|
||||
|
||||
/* ---------------------------- Mapper 297 -------------------------------- */
|
||||
/* NES 2.0 Mapper 297 - 2-in-1 Uzi Lightgun (MGC-002) */
|
||||
|
||||
static uint8 mode;
|
||||
static uint8 latch;
|
||||
|
||||
static void M297PRG(uint32 A, uint8 V) {
|
||||
setprg16(A, (V & 0x07) | ((mode & 1) << 3));
|
||||
}
|
||||
|
||||
static void M297CHR(uint32 A, uint8 V) {
|
||||
setchr4(A, (V & 0x1F) | ((mode & 1) << 5));
|
||||
}
|
||||
|
||||
static void Sync(void) {
|
||||
if (mode & 1) {
|
||||
/* MMC1 */
|
||||
MMC1PRG();
|
||||
MMC1CHR();
|
||||
MMC1MIRROR();
|
||||
} else {
|
||||
/* Mapper 70 */
|
||||
setprg16(0x8000, ((mode & 2) << 1) | ((latch >> 4) & 3));
|
||||
setprg16(0xC000, ((mode & 2) << 1) | 3);
|
||||
setchr8(latch & 0xF);
|
||||
setmirror(1);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M297Mode) {
|
||||
if (A & 0x100) {
|
||||
mode = V;
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M297Latch) {
|
||||
if (mode & 1) {
|
||||
MMC1_write(A, V);
|
||||
} else {
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void M297Power(void) {
|
||||
latch = 0;
|
||||
mode = 0;
|
||||
Sync();
|
||||
GenMMC1Power();
|
||||
SetWriteHandler(0x4120, 0x4120, M297Mode);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M297Latch);
|
||||
}
|
||||
|
||||
void Mapper297_Init(CartInfo *info) {
|
||||
GenMMC1Init(info, 256, 256, 0, 0);
|
||||
info->Power = M297Power;
|
||||
MMC1CHRHook4 = M297CHR;
|
||||
MMC1PRGHook16 = M297PRG;
|
||||
AddExState(&latch, 1, 0, "LATC");
|
||||
AddExState(&mode, 1, 0, "MODE");
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2019 Libretro Team
|
||||
* 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
|
||||
@@ -27,12 +28,37 @@
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 submapper;
|
||||
|
||||
static void M313CW(uint32 A, uint8 V) {
|
||||
setchr1(A, (EXPREGS[0] << 7) | (V & 0x7F));
|
||||
/*FCEU_printf("CHR: A:%04x V:%02x 0:%02x\n", A, V, EXPREGS[0]);*/
|
||||
uint32_t bank;
|
||||
switch (submapper) {
|
||||
default: bank = (EXPREGS[0] << 7) | (V & 0x7F); break;
|
||||
case 1: bank = (EXPREGS[0] << 7) | (V & 0x7F); break;
|
||||
case 2: bank = (EXPREGS[0] << 8) | (V & 0xFF); break;
|
||||
case 3: bank = (EXPREGS[0] << 8) | (V & 0xFF); break;
|
||||
case 4: bank = (EXPREGS[0] << 7) | (V & 0x7F); break;
|
||||
}
|
||||
setchr1(A, bank);
|
||||
}
|
||||
|
||||
static void M313PW(uint32 A, uint8 V) {
|
||||
setprg8(A, (EXPREGS[0] << 4) | (V & 0x0F));
|
||||
/*FCEU_printf("PRG: A:%04x V:%02x 0:%02x\n", A, V, EXPREGS[0]);*/
|
||||
uint32_t bank;
|
||||
switch (submapper) {
|
||||
default: bank = (EXPREGS[0] << 4) | (V & 0x0F); break;
|
||||
case 1: bank = (EXPREGS[0] << 5) | (V & 0x1F); break;
|
||||
case 2: bank = (EXPREGS[0] << 4) | (V & 0x0F); break;
|
||||
case 3: bank = (EXPREGS[0] << 5) | (V & 0x1F); break;
|
||||
case 4:
|
||||
if (EXPREGS[0] == 0)
|
||||
bank = (EXPREGS[0] << 5) | (V & 0x1F);
|
||||
else
|
||||
bank = (EXPREGS[0] << 4) | (V & 0x0F);
|
||||
break;
|
||||
}
|
||||
setprg8(A, bank);
|
||||
}
|
||||
|
||||
static void M313Reset(void) {
|
||||
@@ -48,10 +74,12 @@ static void M313Power(void) {
|
||||
|
||||
/* NES 2.0 313, UNIF BMC-RESET-TXROM */
|
||||
void BMCRESETTXROM_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 128, 0, 0);
|
||||
GenMMC3_Init(info, 256, 256, 8, 0);
|
||||
cwrap = M313CW;
|
||||
pwrap = M313PW;
|
||||
submapper = info->submapper;
|
||||
info->Power = M313Power;
|
||||
info->Reset = M313Reset;
|
||||
AddExState(EXPREGS, 1, 0, "EXPR");
|
||||
AddExState(&EXPREGS[0], 1, 0, "EXPR");
|
||||
AddExState(&submapper, 1, 0, "SUBM");
|
||||
}
|
||||
|
||||
14
src/ines.c
14
src/ines.c
@@ -198,6 +198,8 @@ static void SetInput(void) {
|
||||
{0xb8b9aca3, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Wild Gunman */
|
||||
{0x5112dc21, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Wild Gunman */
|
||||
{0xaf4010ea, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, /* World Class Track Meet */
|
||||
{0xb3cc4d26, SI_GAMEPAD, SI_UNSET, SIFC_SHADOW }, /* 2-in-1 Uzi Lightgun (MGC-002) */
|
||||
|
||||
{0x00000000, SI_UNSET, SI_UNSET, SIFC_UNSET }
|
||||
};
|
||||
int x = 0;
|
||||
@@ -659,6 +661,18 @@ static BMAPPINGLocal bmap[] = {
|
||||
{(uint8_t*)"OK-411", 361, GN45_Init}, /* OK-411 is emulated together with GN-45 */
|
||||
{(uint8_t*)"HUMMER/JY-052", 281, Mapper281_Init},
|
||||
{(uint8_t*)"GN-45", 366, GN45_Init},
|
||||
|
||||
{(uint8_t*)"GKCX1", 288, Mapper288_Init },
|
||||
{(uint8_t*)"Bit Corp 4-in-1", 357, Mapper357_Init },
|
||||
{(uint8_t*)"MMC3 PIRATE SFC-12", 372, Mapper372_Init },
|
||||
{(uint8_t*)"95/96 Super HiK 4-in-1", 374, Mapper374_Init },
|
||||
{(uint8_t*)"KN-42", 381, Mapper381_Init },
|
||||
{(uint8_t*)"Realtec 8031", 390, Mapper390_Init },
|
||||
{(uint8_t*)"60-1064-16L (FDS)", 538, Mapper538_Init },
|
||||
{(uint8_t*)"LittleCom 160-in-1", 541, Mapper541_Init },
|
||||
{(uint8_t*)"8-in-1 JY-119", 267, Mapper267_Init },
|
||||
{(uint8_t*)"MMC3 BMC PIRATE", 294, Bs5652_Init}, /* nesdev redirects this as mapper 134 */
|
||||
{(uint8_t*)"TXC 01-22110-000", 297, Mapper297_Init},
|
||||
|
||||
/* UNIF to NES 2.0 BOARDS */
|
||||
|
||||
|
||||
11
src/ines.h
11
src/ines.h
@@ -243,4 +243,15 @@ void Bs5652_Init(CartInfo *);
|
||||
void NC7000M_Init(CartInfo *);
|
||||
void J2282_Init(CartInfo *);
|
||||
|
||||
void Mapper267_Init(CartInfo *);
|
||||
void Mapper288_Init(CartInfo *);
|
||||
void Mapper297_Init(CartInfo *);
|
||||
void Mapper357_Init(CartInfo *);
|
||||
void Mapper372_Init(CartInfo *);
|
||||
void Mapper374_Init(CartInfo *);
|
||||
void Mapper381_Init(CartInfo *);
|
||||
void Mapper390_Init(CartInfo *);
|
||||
void Mapper538_Init(CartInfo *);
|
||||
void Mapper541_Init(CartInfo *);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -604,7 +604,7 @@ static BMAPPING bmap[] = {
|
||||
{ "830134C", 315, BMC830134C_Init, 0 },
|
||||
{ "GN-26", 344, BMCGN26_Init, 0 },
|
||||
{ "KG256", NO_INES,KG256_Init, 0 },
|
||||
{ "T4A54A", 134, Mapper134_Init, 0 },
|
||||
{ "T4A54A", 134, Bs5652_Init, 0 },
|
||||
|
||||
#ifdef COPYFAMI
|
||||
{ "COPYFAMI_MMC3", NO_INES, MapperCopyFamiMMC3_Init, 0 },
|
||||
|
||||
Reference in New Issue
Block a user