Add mapper 411

This commit is contained in:
negativeExponent
2020-10-11 22:47:48 +08:00
parent e03f7adc85
commit 8073cfba7e
3 changed files with 87 additions and 0 deletions

85
src/boards/411.c Normal file
View File

@@ -0,0 +1,85 @@
/* 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
*
*/
/* Mapper 411 - A88S-1
* 1997 Super 7-in-1 (JY-201)
* 1997 Super 6-in-1 (JY-202)
* 1997 Super 7-in-1 (JY-203)
* 1997 龍珠武鬥會 7-in-1 (JY-204)
* 1997 Super 7-in-1 (JY-205)
* 1997 Super 7-in-1 (JY-206)
*/
#include "mapinc.h"
#include "mmc3.h"
static void M411CW(uint32 A, uint8 V) {
uint32 mask = (EXPREGS[1] & 2) ? 0xFF : 0x7F;
V &= mask;
setchr1(A, V | ((EXPREGS[1] << 5) & 0x80) | ((EXPREGS[0] << 4) & 0x100));
}
static void M411PW(uint32 A, uint8 V) {
/* NROM Mode */
if (EXPREGS[0] & 0x40)
{
uint32 bank = (EXPREGS[0] & 1) | ((EXPREGS[0] >> 2) & 2) | (EXPREGS[0] & 4) | (EXPREGS[1] & 8) | ((EXPREGS[1] >> 2) & 0x10);
/* NROM-256 */
if (EXPREGS[0] & 0x02) {
setprg32(0x8000, bank >> 1);
/* NROM-128 */
} else {
setprg16(0x8000, bank);
setprg16(0xC000, bank);
}
}
/* MMC3 Mode */
else
{
uint32 mask = (EXPREGS[1] & 2) ? 0x1F : 0x0F;
V &= mask;
setprg8(A, V | ((EXPREGS[1] << 1) & 0x10) | ((EXPREGS[1] >> 1) & 0x20));
}
}
static DECLFW(M411Write5000) {
EXPREGS[A & 1] = V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void M411Power(void) {
EXPREGS[0] = 0x80;
EXPREGS[1] = 0x82;
GenMMC3Power();
SetWriteHandler(0x5000, 0x5FFF, M411Write5000);
}
void Mapper411_Init(CartInfo *info) {
GenMMC3_Init(info, 256, 256, 0, 0);
pwrap = M411PW;
cwrap = M411CW;
info->Power = M411Power;
AddExState(EXPREGS, 2, 0, "EXPR");
}

View File

@@ -698,6 +698,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "830928C", 382, Mapper382_Init )
INES_BOARD( "Caltron 9-in-1", 389, Mapper389_Init )
INES_BOARD( "Realtec 8031", 390, Mapper390_Init )
INES_BOARD( "A88S-1", 411, Mapper411_Init )
INES_BOARD( "Brilliant Com Cocoma Pack", 516, Mapper516_Init )
INES_BOARD( "Sachen 3014", 533, Mapper533_Init )
INES_BOARD( "NJ064", 534, Mapper534_Init )

View File

@@ -265,6 +265,7 @@ void Mapper381_Init(CartInfo *);
void Mapper382_Init(CartInfo *);
void Mapper389_Init(CartInfo *);
void Mapper390_Init(CartInfo *);
void Mapper411_Init(CartInfo *);
void Mapper516_Init(CartInfo *);
void Mapper533_Init(CartInfo *);
void Mapper534_Init(CartInfo *);