Add mapper 413 support
This commit is contained in:
parent
647c08e1e6
commit
aace08d0b6
|
@ -375,6 +375,7 @@ set(SRC_CORE
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/boards/33.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/34.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/354.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/413.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/36.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/3d-block.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/40.cpp
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
/* FCEUmm - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2024
|
||||
*
|
||||
* 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"
|
||||
#include "../ines.h"
|
||||
|
||||
static uint8 reg[4];
|
||||
static uint8 IRQCount;
|
||||
static uint8 IRQReload;
|
||||
static uint8 IRQa;
|
||||
static uint8 serialControl;
|
||||
static uint32 serialAddress;
|
||||
|
||||
static SFORMAT StateRegs[] = {
|
||||
{ reg, 4, "REGS" },
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ &IRQReload, 1, "IRQR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &serialAddress, 4, "ADDR" },
|
||||
{ &serialControl, 1, "CTRL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg4(0x5000, 0x01);
|
||||
setprg8(0x6000, reg[0]);
|
||||
|
||||
setprg8(0x8000, reg[1]);
|
||||
setprg8(0xA000, reg[2]);
|
||||
setprg4(0xD000, 0x07);
|
||||
setprg8(0xE000, 0x04);
|
||||
|
||||
setchr4(0x0000, reg[3]);
|
||||
setchr4(0x1000, ~0x02);
|
||||
}
|
||||
|
||||
static uint64 lreset;
|
||||
static uint32 laddr;
|
||||
static DECLFR(M413ReadPCM) {
|
||||
uint8 ret = X.DB;
|
||||
if ((A == laddr) && ((timestampbase + timestamp) < (lreset + 4))) {
|
||||
return ret;
|
||||
}
|
||||
if (serialControl & 0x02) {
|
||||
ret = MiscROM[serialAddress++ & (MiscROM_size - 1)];
|
||||
} else {
|
||||
ret = MiscROM[serialAddress & (MiscROM_size - 1)];
|
||||
}
|
||||
laddr = A;
|
||||
lreset = timestampbase + timestamp;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DECLFW(M413Write) {
|
||||
switch (A & 0xF000) {
|
||||
case 0x8000:
|
||||
IRQReload = V;
|
||||
break;
|
||||
case 0x9000:
|
||||
IRQCount = 0;
|
||||
break;
|
||||
case 0xA000:
|
||||
case 0xB000:
|
||||
IRQa = (A & 0x1000) != 0;
|
||||
if (!IRQa) {
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
}
|
||||
break;
|
||||
case 0xC000:
|
||||
serialAddress = (serialAddress << 1) | (V >> 7);
|
||||
break;
|
||||
case 0xD000:
|
||||
serialControl = V;
|
||||
break;
|
||||
case 0xE000:
|
||||
case 0xF000:
|
||||
reg[V >> 6] = V & 0x3F;
|
||||
Sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M413Power(void) {
|
||||
serialAddress = 0;
|
||||
serialControl = 0;
|
||||
|
||||
IRQCount = 0;
|
||||
IRQReload = 0;
|
||||
IRQa = 0;
|
||||
|
||||
reg[0] = 0;
|
||||
reg[1] = 0;
|
||||
reg[2] = 0;
|
||||
reg[3] = 0;
|
||||
|
||||
laddr = 0;
|
||||
lreset = 0;
|
||||
|
||||
Sync();
|
||||
|
||||
SetReadHandler(0x4800, 0x4FFF, M413ReadPCM);
|
||||
SetReadHandler(0x5000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xBFFF, CartBR);
|
||||
SetReadHandler(0xC000, 0xCFFF, M413ReadPCM);
|
||||
SetReadHandler(0xD000, 0xFFFF, CartBR);
|
||||
|
||||
SetWriteHandler(0x8000, 0xFFFF, M413Write);
|
||||
}
|
||||
|
||||
static void M413IRQHook(void) {
|
||||
if (IRQCount == 0) {
|
||||
IRQCount = IRQReload;
|
||||
} else {
|
||||
IRQCount--;
|
||||
}
|
||||
if ((IRQCount == 0) && IRQa) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper413_Init(CartInfo *info) {
|
||||
info->Power = M413Power;
|
||||
GameHBIRQHook = M413IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -796,6 +796,7 @@ BMAPPINGLocal bmap[] = {
|
|||
{"FAM250/81-01-39-C/SCHI-24", 354, Mapper354_Init },
|
||||
|
||||
{"Impact Soft MMC3 Flash Board", 406, Mapper406_Init },
|
||||
{"Super Russian Roulette", 413, Mapper413_Init },
|
||||
{"INX_007T_V01", 470, INX_007T_Init },
|
||||
|
||||
{"KONAMI QTAi Board", 547, QTAi_Init },
|
||||
|
|
|
@ -280,6 +280,7 @@ void Mapper254_Init(CartInfo *);
|
|||
void Mapper255_Init(CartInfo *);
|
||||
void Mapper354_Init(CartInfo *);
|
||||
void Mapper406_Init(CartInfo *);
|
||||
void Mapper413_Init(CartInfo *);
|
||||
|
||||
void INX_007T_Init(CartInfo* info);
|
||||
void GN45_Init(CartInfo *info); /* previously mapper 205 */
|
||||
|
|
|
@ -437,6 +437,7 @@ xcopy /y /d "$(ProjectDir)\..\src\drivers\win\7z_64.dll" "$(OutDir)"</Command>
|
|||
<ClCompile Include="..\src\boards\33.cpp" />
|
||||
<ClCompile Include="..\src\boards\34.cpp" />
|
||||
<ClCompile Include="..\src\boards\354.cpp" />
|
||||
<ClCompile Include="..\src\boards\413.cpp" />
|
||||
<ClCompile Include="..\src\boards\36.cpp" />
|
||||
<ClCompile Include="..\src\boards\3d-block.cpp" />
|
||||
<ClCompile Include="..\src\boards\40.cpp" />
|
||||
|
|
|
@ -1120,6 +1120,9 @@
|
|||
<ClCompile Include="..\src\boards\354.cpp">
|
||||
<Filter>boards</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\boards\413.cpp">
|
||||
<Filter>boards</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\debugsymboltable.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue