Add mapper 396

This commit is contained in:
negativeExponent
2022-02-06 18:05:36 +08:00
parent 17ad461e7d
commit bc8767ef26
4 changed files with 76 additions and 0 deletions

73
src/boards/396.c Normal file
View File

@@ -0,0 +1,73 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 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 396 - BMC-830752C
* 1995 Super 8-in-1 (JY-050 rev0)
* Super 8-in-1 Gold Card Series (JY-085)
* Super 8-in-1 Gold Card Series (JY-086)
* 2-in-1 (GN-51)
*/
#include "mapinc.h"
static uint8 reg[2];
static void Sync (void) {
setprg16(0x8000, reg[1] << 3 | reg[0] & 7);
setprg16(0xC000, reg[1] << 3 | 7);
setchr8(0);
setmirror(((reg[0] >> 6) & 1) ^ 1);
}
static DECLFW(M396WriteInnerBank) {
reg[0] = V;
Sync();
}
static DECLFW(M396WriteOuterBank) {
reg[1] = V;
Sync();
}
static void M396Reset(void) {
reg[0] = 0x00;
reg[1] = 0x00;
Sync();
}
static void StateRestore(void) {
Sync();
}
static void M396Power(void) {
reg[0] = 0x00;
reg[1] = 0x00;
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0x9FFF, M396WriteInnerBank);
SetWriteHandler(0xA000, 0xBFFF, M396WriteOuterBank);
SetWriteHandler(0xC000, 0xFFFF, M396WriteInnerBank);
}
void Mapper396_Init(CartInfo *info) {
info->Power = M396Power;
info->Reset = M396Reset;
GameStateRestore = StateRestore;
AddExState(reg, 2, 0, "REGS");
}

View File

@@ -792,6 +792,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "YY850735C", 387, Mapper387_Init )
INES_BOARD( "YY850835C", 388, Mapper388_Init )
INES_BOARD( "BS-110", 391, Mapper391_Init )
INES_BOARD( "YY850437C", 396, Mapper396_Init )
INES_BOARD( "YY850439C", 397, Mapper397_Init )
INES_BOARD( "831019C J-2282", 402, J2282_Init )
INES_BOARD( "SC871115C", 421, Mapper421_Init )

View File

@@ -284,6 +284,7 @@ void Mapper389_Init(CartInfo *);
void Mapper390_Init(CartInfo *);
void Mapper391_Init(CartInfo *);
void Mapper395_Init(CartInfo *);
void Mapper396_Init(CartInfo *);
void Mapper397_Init(CartInfo *);
void Mapper401_Init(CartInfo *);
void Mapper403_Init(CartInfo *);

View File

@@ -616,6 +616,7 @@ static BMAPPING bmap[] = {
{ "SB-5013", 359, Mapper359_Init, 0 },
{ "82112C", 540, Mapper540_Init, 0 },
{ "N49C-300", 369, Mapper369_Init, 0 },
{ "830752C", 396, Mapper396_Init, 0 },
{ "BS-400R", 422, Mapper422_Init, 0 },
{ "BS-4040R", 422, Mapper422_Init, 0 },