Allow FDS conversion mappers to use FDS APU

This commit is contained in:
negativeExponent
2020-03-05 23:54:34 +08:00
parent 80b002a04e
commit 722154b93f
22 changed files with 381 additions and 288 deletions

View File

@@ -17,11 +17,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* FDS Conversion
* FDS Conversion - Doki Doki Panic
*
*/
#include "mapinc.h"
#include "../fds_apu.h"
static uint8 reg0, reg1, reg2;
static uint8 *WRAM = NULL;
@@ -80,6 +81,7 @@ static DECLFW(M103Write2) {
}
static void M103Power(void) {
FDSSoundPower();
reg0 = reg1 = 0; reg2 = 0;
Sync();
SetReadHandler(0x6000, 0x7FFF, CartBR);

View File

@@ -25,6 +25,7 @@
#include "mapinc.h"
#include "mmc3.h"
#include "../fds_apu.h"
static uint8* CHRRAM = NULL;
static uint32 CHRRAMSIZE;
@@ -96,6 +97,7 @@ static DECLFW(M353Write) {
}
static void M353Power(void) {
FDSSoundPower();
EXPREGS[0] = 0;
GenMMC3Power();
SetWriteHandler(0x8000, 0xFFFF, M353Write);
@@ -104,6 +106,7 @@ static void M353Power(void) {
static void M353Reset(void) {
EXPREGS[0] = 0;
MMC3RegReset();
FDSSoundReset();
}
static void M353Close(void) {

View File

@@ -23,6 +23,7 @@
*/
#include "mapinc.h"
#include "../fds_apu.h"
static uint32 mapperNum;
static uint8 preg[4];
@@ -140,6 +141,7 @@ static DECLFW(M359WriteEx) {
}
static void M359Power(void) {
FDSSoundPower();
Sync();
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0x8FFF, M359WritePRG);
@@ -148,6 +150,11 @@ static void M359Power(void) {
SetWriteHandler(0xC000, 0xCFFF, M359WriteIRQ);
}
static void M359Reset(void) {
FDSSoundReset();
Sync();
}
static void FP_FASTAPASS(1) M359CPUHook(int a) {
if (!irqPA12) {
if (IRQa && IRQCount16) {
@@ -177,6 +184,7 @@ static void StateRestore(int version) {
void Mapper359_Init(CartInfo* info) {
mapperNum = 359;
info->Power = M359Power;
info->Reset = M359Reset;
MapIRQHook = M359CPUHook;
GameHBIRQHook = M359IRQHook;
GameStateRestore = StateRestore;

View File

@@ -23,6 +23,7 @@
*/
#include "mapinc.h"
#include "../fds_apu.h"
static uint8 preg, creg, mirr;
static uint32 IRQCount, IRQa;
@@ -54,6 +55,7 @@ static DECLFW(M42Write) {
}
static void M42Power(void) {
FDSSoundPower();
preg = 0;
mirr = 1; /* Ai Senshi Nicol actually has fixed mirroring, but mapper forcing it's default value now */
Sync();

View File

@@ -18,7 +18,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* FDS Conversion - Kid Icarus (パルテナの鏡) (Parthena) */
#include "mapinc.h"
#include "../fds_apu.h"
static uint8 preg;
static uint8 mirr;
@@ -82,6 +85,7 @@ static DECLFW(M539Write) {
}
static void M539Power(void) {
FDSSoundPower();
preg = 0;
mirr = 0;
Sync();

View File

@@ -25,6 +25,7 @@
*/
#include "mapinc.h"
#include "../fds_apu.h"
static uint8 preg;
@@ -68,6 +69,7 @@ static DECLFW(UNLKS7016Write) {
}
static void UNLKS7016Power(void) {
FDSSoundPower();
preg = 8;
Sync();
SetReadHandler(0x6000, 0xffff, CartBR);

View File

@@ -17,11 +17,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* FDS Conversion
* FDS Conversion - Almana No Kiseki
*
*/
#include "mapinc.h"
#include "../fds_apu.h"
static uint8 latche, reg, mirr;
static int32 IRQa, IRQCount, IRQLatch;
@@ -52,19 +53,23 @@ static DECLFW(UNLKS7017Write) {
} else if ((A & 0xFF00) == 0x5100) {
reg = latche;
Sync();
} else if (A == 0x4020) {
X6502_IRQEnd(FCEU_IQEXT);
IRQCount &= 0xFF00;
IRQCount |= V;
} else if (A == 0x4021) {
X6502_IRQEnd(FCEU_IQEXT);
IRQCount &= 0xFF;
IRQCount |= V << 8;
IRQa = 1;
} else if (A == 0x4025) {
mirr = ((V & 8) >> 3) ^ 1;
} else {
if (A == 0x4020) {
X6502_IRQEnd(FCEU_IQEXT);
IRQCount &= 0xFF00;
IRQCount |= V;
} else if (A == 0x4021) {
X6502_IRQEnd(FCEU_IQEXT);
IRQCount &= 0xFF;
IRQCount |= V << 8;
IRQa = 1;
} else if (A == 0x4025) {
mirr = ((V & 8) >> 3) ^ 1;
}
FDSSoundWrite(A, V);
}
}
static DECLFR(FDSRead4030) {
X6502_IRQEnd(FCEU_IQEXT);
return X.IRQlow & FCEU_IQEXT ? 1 : 0;
@@ -81,6 +86,7 @@ static void FP_FASTAPASS(1) UNL7017IRQ(int a) {
}
static void UNLKS7017Power(void) {
FDSSoundPower();
Sync();
setchr8(0);
setprg8r(0x10, 0x6000, 0);

View File

@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* FDS Conversion
* FDS Conversion - Yume Koujou: Doki Doki Panic
*
* Logical bank layot 32 K BANK 0, 64K BANK 1, 32K ~0 hardwired, 8K is missing
* need redump from MASKROM!
@@ -26,6 +26,7 @@
*/
#include "mapinc.h"
#include "../fds_apu.h"
static uint8 reg0, reg1;
static uint8 *WRAM = NULL;
@@ -108,6 +109,7 @@ static DECLFW(UNLKS7030Write1) {
}
static void UNLKS7030Power(void) {
FDSSoundPower();
reg0 = reg1 = ~0;
Sync();
SetReadHandler(0x6000, 0x7FFF, UNLKS7030RamRead0);

View File

@@ -17,11 +17,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* FDS Conversion
* FDS Conversion - dracula ii - noroi no fuuin [u][!]
*
*/
#include "mapinc.h"
#include "fds_apu.h"
static uint8 reg[4];
@@ -64,6 +65,7 @@ static DECLFW(UNLKS7031Write) {
}
static void UNLKS7031Power(void) {
FDSSoundPower();
Sync();
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xffff, UNLKS7031Write);

View File

@@ -17,11 +17,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* FDS Conversion
* FDS Conversion - Metroid - Jin Ji Zhi Ling (Kaiser)(KS7037)[U][!]
*
*/
#include "mapinc.h"
#include "../fds_apu.h"
static uint8 reg[8], cmd;
static uint8 *WRAM = NULL;
@@ -66,6 +67,7 @@ static DECLFW(UNLKS7037Write) {
}
static void UNLKS7037Power(void) {
FDSSoundPower();
reg[0] = reg[1] = reg[2] = reg[3] = reg[4] = reg[5] = reg[6] = reg[7] = 0;
WSync();
SetReadHandler(0x6000, 0xFFFF, CartBR);

View File

@@ -24,6 +24,7 @@
*/
#include "mapinc.h"
#include "../fds_apu.h"
static uint8 reg, mirr;
static uint8 prg;
@@ -56,6 +57,7 @@ static DECLFW(AC08Write) {
}
static void AC08Power(void) {
FDSSoundPower();
reg = 0;
Sync();
SetReadHandler(0x6000, 0xFFFF, CartBR);

View File

@@ -20,6 +20,7 @@
#include "mapinc.h"
#include "../ines.h"
#include "../fds_apu.h"
static uint8 latche, latcheinit, bus_conflict;
static uint16 addrreg0, addrreg1;
@@ -518,8 +519,14 @@ static void M538Sync(void) {
setmirror(1);
}
static void M538Power(void) {
FDSSoundPower();
LatchPower();
}
void Mapper538_Init(CartInfo *info) {
Latch_Init(info, M538Sync, 0, 0xC000, 0xCFFF, 1, 0);
info->Power = M538Power;
}
/* ------------------ A65AS --------------------------- */

View File

@@ -17,11 +17,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* FDS Conversion
* FDS Conversion - Monty no Doki Doki Daisassō, Monty on the Run, cartridge code LH32
*
*/
#include "mapinc.h"
#include "../fds_apu.h"
static uint8 reg;
static uint8 *WRAM = NULL;
@@ -48,6 +49,7 @@ static DECLFW(LH32Write) {
}
static void LH32Power(void) {
FDSSoundPower();
Sync();
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0xC000, 0xDFFF, CartBW);

View File

@@ -26,6 +26,7 @@
*/
#include "mapinc.h"
#include "../fds_apu.h"
static uint8 reg, mirr;
static uint8 *WRAM = NULL;
@@ -56,6 +57,7 @@ static DECLFW(LH51Write) {
}
static void LH51Power(void) {
FDSSoundPower();
Sync();
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW);

View File

@@ -17,11 +17,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* FDS Conversion
* FDS Conversion - Nazo no Murasamejō
*
*/
#include "mapinc.h"
#include "../fds_apu.h"
static uint8 reg, IRQa;
static int32 IRQCount;
@@ -75,6 +76,7 @@ static void FP_FASTAPASS(1) LH53IRQ(int a) {
}
static void LH53Power(void) {
FDSSoundPower();
Sync();
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0xB800, 0xD7FF, LH53RamWrite);