Merge pull request #389 from negativeExponent/mapper554

Add mapper 554
This commit is contained in:
Autechre
2020-10-11 16:50:25 +02:00
committed by GitHub
3 changed files with 79 additions and 0 deletions

77
src/boards/554.c Normal file
View File

@@ -0,0 +1,77 @@
/* 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 554 - Kaiser KS-7010
* used for one of several cartridge conversions of the FDS version of
* 悪魔城 Dracula, the Japanese version of Castlevania
*/
#include "mapinc.h"
static uint8 reg;
static SFORMAT StateRegs[] =
{
{ &reg, 1, "REG" },
{ 0 }
};
static void Sync(void) {
setprg8(0x6000, reg);
setprg8(0x8000, 10);
setprg8(0xA000, 11);
setprg8(0xC000, 6);
setprg8(0xE000, 7);
setchr8(reg);
}
static DECLFR(M554Read) {
if ((A >= 0xCAB6) && (A < 0xCAD7))
{
reg = (A >> 2) & 0x0F;
Sync();
}
else if ((A == 0xEBE2) || (A == 0xEE32))
{
reg = (A >> 2) & 0x0F;
Sync();
}
else if (A == 0xFFFC)
{
reg = (A >> 2) & 0x0F;
Sync();
}
return CartBR(A);
}
static void M554Power(void) {
Sync();
SetReadHandler(0x6000, 0xFFFF, M554Read);
}
static void StateRestore(int version) {
Sync();
}
void Mapper554_Init(CartInfo *info) {
info->Power = M554Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@@ -706,6 +706,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "82112C", 540, Mapper540_Init )
INES_BOARD( "LittleCom 160-in-1", 541, Mapper541_Init )
INES_BOARD( "5-in-1 (CH-501)", 543, Mapper543_Init )
INES_BOARD( "KS-7010", 554, Mapper554_Init )
INES_BOARD( "", 550, Mapper550_Init )
/* UNIF to NES 2.0 BOARDS */

View File

@@ -274,5 +274,6 @@ void Mapper540_Init(CartInfo *);
void Mapper541_Init(CartInfo *);
void Mapper543_Init(CartInfo *);
void Mapper550_Init(CartInfo *);
void Mapper554_Init(CartInfo *);
#endif