Merge pull request #183 from retro-wertz/change_eol
Change *.c and *.h end-of-line character to LF
This commit is contained in:
@@ -1,111 +1,111 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* TXC mappers, originally much complex banksitching
|
||||
*
|
||||
* 01-22111-000 (05-00002-010) (132, 22211) - MGC-001 Qi Wang
|
||||
* 01-22110-000 (52S ) - MGC-002 2-in-1 Gun
|
||||
* 01-22111-100 (02-00002-010) (173 ) - MGC-008 Mahjong Block
|
||||
* (079 ) - MGC-012 Poke Block
|
||||
* 01-22110-200 (05-00002-010) (036 ) - MGC-014 Strike Wolf
|
||||
* 01-22000-400 (05-00002-010) (036 ) - MGC-015 Policeman
|
||||
* 01-22017-000 (05-PT017-080) (189 ) - MGC-017 Thunder Warrior
|
||||
* 01-11160-000 (04-02310-000) ( , 11160) - MGC-023 6-in-1
|
||||
* 01-22270-000 (05-00002-010) (132, 22211) - MGC-xxx Creatom
|
||||
* 01-22200-400 (------------) (079 ) - ET.03 F-15 City War
|
||||
* (172 ) - 1991 Du Ma Racing
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[4], cmd, is172, is173;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 4, "REGS" },
|
||||
{ &cmd, 1, "CMD" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, (reg[2] >> 2) & 1);
|
||||
if (is172)
|
||||
setchr8((((cmd ^ reg[2]) >> 3) & 2) | (((cmd ^ reg[2]) >> 5) & 1)); /* 1991 DU MA Racing probably CHR bank sequence is WRONG, so it is possible to
|
||||
* rearrange CHR banks for normal UNIF board and mapper 172 is unneccessary */
|
||||
else
|
||||
setchr8(reg[2] & 3);
|
||||
}
|
||||
|
||||
static DECLFW(UNL22211WriteLo) {
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V); */
|
||||
reg[A & 3] = V;
|
||||
}
|
||||
|
||||
static DECLFW(UNL22211WriteHi) {
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V); */
|
||||
cmd = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(UNL22211ReadLo) {
|
||||
return (reg[1] ^ reg[2]) | (is173 ? 0x01 : 0x40);
|
||||
#if 0
|
||||
if(reg[3])
|
||||
return reg[2];
|
||||
else
|
||||
return X.DB;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void UNL22211Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetReadHandler(0x4100, 0x4100, UNL22211ReadLo);
|
||||
SetWriteHandler(0x4100, 0x4103, UNL22211WriteLo);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNL22211WriteHi);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNL22211_Init(CartInfo *info) {
|
||||
is172 = 0;
|
||||
is173 = 0;
|
||||
info->Power = UNL22211Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper172_Init(CartInfo *info) {
|
||||
is172 = 1;
|
||||
is173 = 0;
|
||||
info->Power = UNL22211Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper173_Init(CartInfo *info) {
|
||||
is172 = 0;
|
||||
is173 = 1;
|
||||
info->Power = UNL22211Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* TXC mappers, originally much complex banksitching
|
||||
*
|
||||
* 01-22111-000 (05-00002-010) (132, 22211) - MGC-001 Qi Wang
|
||||
* 01-22110-000 (52S ) - MGC-002 2-in-1 Gun
|
||||
* 01-22111-100 (02-00002-010) (173 ) - MGC-008 Mahjong Block
|
||||
* (079 ) - MGC-012 Poke Block
|
||||
* 01-22110-200 (05-00002-010) (036 ) - MGC-014 Strike Wolf
|
||||
* 01-22000-400 (05-00002-010) (036 ) - MGC-015 Policeman
|
||||
* 01-22017-000 (05-PT017-080) (189 ) - MGC-017 Thunder Warrior
|
||||
* 01-11160-000 (04-02310-000) ( , 11160) - MGC-023 6-in-1
|
||||
* 01-22270-000 (05-00002-010) (132, 22211) - MGC-xxx Creatom
|
||||
* 01-22200-400 (------------) (079 ) - ET.03 F-15 City War
|
||||
* (172 ) - 1991 Du Ma Racing
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[4], cmd, is172, is173;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 4, "REGS" },
|
||||
{ &cmd, 1, "CMD" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, (reg[2] >> 2) & 1);
|
||||
if (is172)
|
||||
setchr8((((cmd ^ reg[2]) >> 3) & 2) | (((cmd ^ reg[2]) >> 5) & 1)); /* 1991 DU MA Racing probably CHR bank sequence is WRONG, so it is possible to
|
||||
* rearrange CHR banks for normal UNIF board and mapper 172 is unneccessary */
|
||||
else
|
||||
setchr8(reg[2] & 3);
|
||||
}
|
||||
|
||||
static DECLFW(UNL22211WriteLo) {
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V); */
|
||||
reg[A & 3] = V;
|
||||
}
|
||||
|
||||
static DECLFW(UNL22211WriteHi) {
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V); */
|
||||
cmd = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(UNL22211ReadLo) {
|
||||
return (reg[1] ^ reg[2]) | (is173 ? 0x01 : 0x40);
|
||||
#if 0
|
||||
if(reg[3])
|
||||
return reg[2];
|
||||
else
|
||||
return X.DB;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void UNL22211Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetReadHandler(0x4100, 0x4100, UNL22211ReadLo);
|
||||
SetWriteHandler(0x4100, 0x4103, UNL22211WriteLo);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNL22211WriteHi);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNL22211_Init(CartInfo *info) {
|
||||
is172 = 0;
|
||||
is173 = 0;
|
||||
info->Power = UNL22211Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper172_Init(CartInfo *info) {
|
||||
is172 = 1;
|
||||
is173 = 0;
|
||||
info->Power = UNL22211Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper173_Init(CartInfo *info) {
|
||||
is172 = 0;
|
||||
is173 = 1;
|
||||
info->Power = UNL22211Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,97 +1,97 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversions
|
||||
*
|
||||
* Super Mario Bros 2j (Alt Full) is a BAD incomplete dump, should be mapper 43
|
||||
*
|
||||
* Both Voleyball and Zanac by Whirlind Manu shares the same PCB, but with
|
||||
* some differences: Voleyball has 8K CHR ROM and 8K ROM at 6000K, Zanac
|
||||
* have 8K CHR RAM and banked 16K ROM mapper at 6000 as two 8K banks.
|
||||
*
|
||||
* Super Mario Bros 2j (Alt Small) uses additionally IRQ timer to drive framerate
|
||||
*
|
||||
* PCB for this mapper is "09-034A"
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prg;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ &prg, 1, "PRG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8r(1, 0x6000, prg);
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLSMB2JWrite1) {
|
||||
prg = V & 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(UNLSMB2JWrite2) {
|
||||
IRQa = V & 1;
|
||||
IRQCount = 0;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
}
|
||||
|
||||
static DECLFR(UNLSMB2JRead) {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
static void UNLSMB2JPower(void) {
|
||||
prg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetReadHandler(0x4042, 0x4055, UNLSMB2JRead);
|
||||
SetWriteHandler(0x4068, 0x4068, UNLSMB2JWrite2);
|
||||
SetWriteHandler(0x4027, 0x4027, UNLSMB2JWrite1);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) UNLSMB2JIRQHook(int a) {
|
||||
if (IRQa)
|
||||
{
|
||||
if (IRQCount < 5750) /* completely by guess */
|
||||
IRQCount += a;
|
||||
else {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLSMB2J_Init(CartInfo *info) {
|
||||
info->Power = UNLSMB2JPower;
|
||||
MapIRQHook = UNLSMB2JIRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversions
|
||||
*
|
||||
* Super Mario Bros 2j (Alt Full) is a BAD incomplete dump, should be mapper 43
|
||||
*
|
||||
* Both Voleyball and Zanac by Whirlind Manu shares the same PCB, but with
|
||||
* some differences: Voleyball has 8K CHR ROM and 8K ROM at 6000K, Zanac
|
||||
* have 8K CHR RAM and banked 16K ROM mapper at 6000 as two 8K banks.
|
||||
*
|
||||
* Super Mario Bros 2j (Alt Small) uses additionally IRQ timer to drive framerate
|
||||
*
|
||||
* PCB for this mapper is "09-034A"
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prg;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ &prg, 1, "PRG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8r(1, 0x6000, prg);
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLSMB2JWrite1) {
|
||||
prg = V & 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(UNLSMB2JWrite2) {
|
||||
IRQa = V & 1;
|
||||
IRQCount = 0;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
}
|
||||
|
||||
static DECLFR(UNLSMB2JRead) {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
static void UNLSMB2JPower(void) {
|
||||
prg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetReadHandler(0x4042, 0x4055, UNLSMB2JRead);
|
||||
SetWriteHandler(0x4068, 0x4068, UNLSMB2JWrite2);
|
||||
SetWriteHandler(0x4027, 0x4027, UNLSMB2JWrite1);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) UNLSMB2JIRQHook(int a) {
|
||||
if (IRQa)
|
||||
{
|
||||
if (IRQCount < 5750) /* completely by guess */
|
||||
IRQCount += a;
|
||||
else {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLSMB2J_Init(CartInfo *info) {
|
||||
info->Power = UNLSMB2JPower;
|
||||
MapIRQHook = UNLSMB2JIRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
230
src/boards/103.c
230
src/boards/103.c
@@ -1,115 +1,115 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg0, reg1, reg2;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®0, 1, "REG0" },
|
||||
{ ®1, 1, "REG1" },
|
||||
{ ®2, 1, "REG2" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(0);
|
||||
setprg8(0x8000, 0xc);
|
||||
setprg8(0xe000, 0xf);
|
||||
if (reg2 & 0x10) {
|
||||
setprg8(0x6000, reg0);
|
||||
setprg8(0xa000, 0xd);
|
||||
setprg8(0xc000, 0xe);
|
||||
} else {
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg4(0xa000, (0xd << 1));
|
||||
setprg2(0xb000, (0xd << 2) + 2);
|
||||
setprg2r(0x10, 0xb800, 4);
|
||||
setprg2r(0x10, 0xc000, 5);
|
||||
setprg2r(0x10, 0xc800, 6);
|
||||
setprg2r(0x10, 0xd000, 7);
|
||||
setprg2(0xd800, (0xe << 2) + 3);
|
||||
}
|
||||
setmirror(reg1 ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M103RamWrite0) {
|
||||
WRAM[A & 0x1FFF] = V;
|
||||
}
|
||||
|
||||
static DECLFW(M103RamWrite1) {
|
||||
WRAM[0x2000 + ((A - 0xB800) & 0x1FFF)] = V;
|
||||
}
|
||||
|
||||
static DECLFW(M103Write0) {
|
||||
reg0 = V & 0xf;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M103Write1) {
|
||||
reg1 = (V >> 3) & 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M103Write2) {
|
||||
reg2 = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M103Power(void) {
|
||||
reg0 = reg1 = 0; reg2 = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, M103RamWrite0);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0xB800, 0xD7FF, M103RamWrite1);
|
||||
SetWriteHandler(0x8000, 0x8FFF, M103Write0);
|
||||
SetWriteHandler(0xE000, 0xEFFF, M103Write1);
|
||||
SetWriteHandler(0xF000, 0xFFFF, M103Write2);
|
||||
}
|
||||
|
||||
static void M103Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper103_Init(CartInfo *info) {
|
||||
info->Power = M103Power;
|
||||
info->Close = M103Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 16384;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg0, reg1, reg2;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®0, 1, "REG0" },
|
||||
{ ®1, 1, "REG1" },
|
||||
{ ®2, 1, "REG2" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(0);
|
||||
setprg8(0x8000, 0xc);
|
||||
setprg8(0xe000, 0xf);
|
||||
if (reg2 & 0x10) {
|
||||
setprg8(0x6000, reg0);
|
||||
setprg8(0xa000, 0xd);
|
||||
setprg8(0xc000, 0xe);
|
||||
} else {
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg4(0xa000, (0xd << 1));
|
||||
setprg2(0xb000, (0xd << 2) + 2);
|
||||
setprg2r(0x10, 0xb800, 4);
|
||||
setprg2r(0x10, 0xc000, 5);
|
||||
setprg2r(0x10, 0xc800, 6);
|
||||
setprg2r(0x10, 0xd000, 7);
|
||||
setprg2(0xd800, (0xe << 2) + 3);
|
||||
}
|
||||
setmirror(reg1 ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M103RamWrite0) {
|
||||
WRAM[A & 0x1FFF] = V;
|
||||
}
|
||||
|
||||
static DECLFW(M103RamWrite1) {
|
||||
WRAM[0x2000 + ((A - 0xB800) & 0x1FFF)] = V;
|
||||
}
|
||||
|
||||
static DECLFW(M103Write0) {
|
||||
reg0 = V & 0xf;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M103Write1) {
|
||||
reg1 = (V >> 3) & 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M103Write2) {
|
||||
reg2 = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M103Power(void) {
|
||||
reg0 = reg1 = 0; reg2 = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, M103RamWrite0);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0xB800, 0xD7FF, M103RamWrite1);
|
||||
SetWriteHandler(0x8000, 0x8FFF, M103Write0);
|
||||
SetWriteHandler(0xE000, 0xEFFF, M103Write1);
|
||||
SetWriteHandler(0xF000, 0xFFFF, M103Write2);
|
||||
}
|
||||
|
||||
static void M103Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper103_Init(CartInfo *info) {
|
||||
info->Power = M103Power;
|
||||
info->Close = M103Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 16384;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
216
src/boards/106.c
216
src/boards/106.c
@@ -1,108 +1,108 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg[16], IRQa;
|
||||
static uint32 IRQCount;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ reg, 16, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr1(0x0000, reg[0] & 0xfe);
|
||||
setchr1(0x0400, reg[1] | 1);
|
||||
setchr1(0x0800, reg[2] & 0xfe);
|
||||
setchr1(0x0c00, reg[3] | 1);
|
||||
setchr1(0x1000, reg[4]);
|
||||
setchr1(0x1400, reg[5]);
|
||||
setchr1(0x1800, reg[6]);
|
||||
setchr1(0x1c00, reg[7]);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000, (reg[0x8] & 0xf) | 0x10);
|
||||
setprg8(0xA000, (reg[0x9] & 0x1f));
|
||||
setprg8(0xC000, (reg[0xa] & 0x1f));
|
||||
setprg8(0xE000, (reg[0xb] & 0xf) | 0x10);
|
||||
setmirror((reg[0xc] & 1) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M106Write) {
|
||||
A &= 0xF;
|
||||
switch (A) {
|
||||
case 0xD: IRQa = 0; IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xE: IRQCount = (IRQCount & 0xFF00) | V; break;
|
||||
case 0xF: IRQCount = (IRQCount & 0x00FF) | (V << 8); IRQa = 1; break;
|
||||
default: reg[A] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M106Power(void) {
|
||||
reg[8] = reg[9] = reg[0xa] = reg[0xb] = -1;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M106Write);
|
||||
}
|
||||
|
||||
static void M106Reset(void) {
|
||||
}
|
||||
|
||||
static void M106Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
void FP_FASTAPASS(1) M106CpuHook(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount += a;
|
||||
if (IRQCount > 0x10000) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper106_Init(CartInfo *info) {
|
||||
info->Reset = M106Reset;
|
||||
info->Power = M106Power;
|
||||
info->Close = M106Close;
|
||||
MapIRQHook = M106CpuHook;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg[16], IRQa;
|
||||
static uint32 IRQCount;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ reg, 16, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr1(0x0000, reg[0] & 0xfe);
|
||||
setchr1(0x0400, reg[1] | 1);
|
||||
setchr1(0x0800, reg[2] & 0xfe);
|
||||
setchr1(0x0c00, reg[3] | 1);
|
||||
setchr1(0x1000, reg[4]);
|
||||
setchr1(0x1400, reg[5]);
|
||||
setchr1(0x1800, reg[6]);
|
||||
setchr1(0x1c00, reg[7]);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000, (reg[0x8] & 0xf) | 0x10);
|
||||
setprg8(0xA000, (reg[0x9] & 0x1f));
|
||||
setprg8(0xC000, (reg[0xa] & 0x1f));
|
||||
setprg8(0xE000, (reg[0xb] & 0xf) | 0x10);
|
||||
setmirror((reg[0xc] & 1) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M106Write) {
|
||||
A &= 0xF;
|
||||
switch (A) {
|
||||
case 0xD: IRQa = 0; IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xE: IRQCount = (IRQCount & 0xFF00) | V; break;
|
||||
case 0xF: IRQCount = (IRQCount & 0x00FF) | (V << 8); IRQa = 1; break;
|
||||
default: reg[A] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M106Power(void) {
|
||||
reg[8] = reg[9] = reg[0xa] = reg[0xb] = -1;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M106Write);
|
||||
}
|
||||
|
||||
static void M106Reset(void) {
|
||||
}
|
||||
|
||||
static void M106Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
void FP_FASTAPASS(1) M106CpuHook(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount += a;
|
||||
if (IRQCount > 0x10000) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper106_Init(CartInfo *info) {
|
||||
info->Reset = M106Reset;
|
||||
info->Power = M106Power;
|
||||
info->Close = M106Close;
|
||||
MapIRQHook = M106CpuHook;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
128
src/boards/108.c
128
src/boards/108.c
@@ -1,64 +1,64 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
* Meikyuu Jin Dababa
|
||||
* Bubble Bobble Kaiser
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, reg);
|
||||
setprg32(0x8000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M108Write) {
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M108Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0x8FFF, M108Write); /* regular 108 */
|
||||
SetWriteHandler(0xF000, 0xFFFF, M108Write); /* simplified Kaiser BB Hack */
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper108_Init(CartInfo *info) {
|
||||
info->Power = M108Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
* Meikyuu Jin Dababa
|
||||
* Bubble Bobble Kaiser
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, reg);
|
||||
setprg32(0x8000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M108Write) {
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M108Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0x8FFF, M108Write); /* regular 108 */
|
||||
SetWriteHandler(0xF000, 0xFFFF, M108Write); /* simplified Kaiser BB Hack */
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper108_Init(CartInfo *info) {
|
||||
info->Power = M108Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
650
src/boards/116.c
650
src/boards/116.c
@@ -1,325 +1,325 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* SL12 Protected 3-in-1 mapper hardware (VRC2, MMC3, MMC1)
|
||||
* the same as 603-5052 board (TODO: add reading registers, merge)
|
||||
* SL1632 2-in-1 protected board, similar to SL12 (TODO: find difference)
|
||||
*
|
||||
* Known PCB:
|
||||
*
|
||||
* Garou Densetsu Special (G0904.PCB, Huang-1, GAL dip: W conf.)
|
||||
* Kart Fighter (008, Huang-1, GAL dip: W conf.)
|
||||
* Somari (008, C5052-13, GAL dip: P conf., GK2-P/GK2-V maskroms)
|
||||
* Somari (008, Huang-1, GAL dip: W conf., GK1-P/GK1-V maskroms)
|
||||
* AV Mei Shao Nv Zhan Shi (aka AV Pretty Girl Fighting) (SL-12 PCB, Hunag-1, GAL dip: unk conf. SL-11A/SL-11B maskroms)
|
||||
* Samurai Spirits (Full version) (Huang-1, GAL dip: unk conf. GS-2A/GS-4A maskroms)
|
||||
* Contra Fighter (603-5052 PCB, C5052-3, GAL dip: unk conf. SC603-A/SCB603-B maskroms)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 mode;
|
||||
static uint8 vrc2_chr[8], vrc2_prg[2], vrc2_mirr;
|
||||
static uint8 mmc3_regs[10], mmc3_ctrl, mmc3_mirr;
|
||||
static uint8 IRQCount, IRQLatch, IRQa;
|
||||
static uint8 IRQReload;
|
||||
static uint8 mmc1_regs[4], mmc1_buffer, mmc1_shift;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &mode, 1, "MODE" },
|
||||
{ vrc2_chr, 8, "VRCC" },
|
||||
{ vrc2_prg, 2, "VRCP" },
|
||||
{ &vrc2_mirr, 1, "VRCM" },
|
||||
{ mmc3_regs, 10, "M3RG" },
|
||||
{ &mmc3_ctrl, 1, "M3CT" },
|
||||
{ &mmc3_mirr, 1, "M3MR" },
|
||||
{ &IRQReload, 1, "IRQR" },
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ &IRQLatch, 1, "IRQL" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ mmc1_regs, 4, "M1RG" },
|
||||
{ &mmc1_buffer, 1, "M1BF" },
|
||||
{ &mmc1_shift, 1, "M1MR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void SyncPRG(void) {
|
||||
switch (mode & 3) {
|
||||
case 0:
|
||||
setprg8(0x8000, vrc2_prg[0]);
|
||||
setprg8(0xA000, vrc2_prg[1]);
|
||||
setprg8(0xC000, ~1);
|
||||
setprg8(0xE000, ~0);
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
uint32 swap = (mmc3_ctrl >> 5) & 2;
|
||||
setprg8(0x8000, mmc3_regs[6 + swap]);
|
||||
setprg8(0xA000, mmc3_regs[7]);
|
||||
setprg8(0xC000, mmc3_regs[6 + (swap ^ 2)]);
|
||||
setprg8(0xE000, mmc3_regs[9]);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 3:
|
||||
{
|
||||
uint8 bank = mmc1_regs[3] & 0xF;
|
||||
if (mmc1_regs[0] & 8) {
|
||||
if (mmc1_regs[0] & 4) {
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, 0x0F);
|
||||
} else {
|
||||
setprg16(0x8000, 0);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
} else
|
||||
setprg32(0x8000, bank >> 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void SyncCHR(void) {
|
||||
uint32 base = (mode & 4) << 6;
|
||||
switch (mode & 3) {
|
||||
case 0:
|
||||
setchr1(0x0000, base | vrc2_chr[0]);
|
||||
setchr1(0x0400, base | vrc2_chr[1]);
|
||||
setchr1(0x0800, base | vrc2_chr[2]);
|
||||
setchr1(0x0c00, base | vrc2_chr[3]);
|
||||
setchr1(0x1000, base | vrc2_chr[4]);
|
||||
setchr1(0x1400, base | vrc2_chr[5]);
|
||||
setchr1(0x1800, base | vrc2_chr[6]);
|
||||
setchr1(0x1c00, base | vrc2_chr[7]);
|
||||
break;
|
||||
case 1: {
|
||||
uint32 swap = (mmc3_ctrl & 0x80) << 5;
|
||||
setchr1(0x0000 ^ swap, base | ((mmc3_regs[0]) & 0xFE));
|
||||
setchr1(0x0400 ^ swap, base | (mmc3_regs[0] | 1));
|
||||
setchr1(0x0800 ^ swap, base | ((mmc3_regs[1]) & 0xFE));
|
||||
setchr1(0x0c00 ^ swap, base | (mmc3_regs[1] | 1));
|
||||
setchr1(0x1000 ^ swap, base | mmc3_regs[2]);
|
||||
setchr1(0x1400 ^ swap, base | mmc3_regs[3]);
|
||||
setchr1(0x1800 ^ swap, base | mmc3_regs[4]);
|
||||
setchr1(0x1c00 ^ swap, base | mmc3_regs[5]);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 3:
|
||||
if (mmc1_regs[0] & 0x10) {
|
||||
setchr4(0x0000, mmc1_regs[1]);
|
||||
setchr4(0x1000, mmc1_regs[2]);
|
||||
} else
|
||||
setchr8(mmc1_regs[1] >> 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void SyncMIR(void) {
|
||||
switch (mode & 3) {
|
||||
case 0: {
|
||||
setmirror((vrc2_mirr & 1) ^ 1);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
setmirror((mmc3_mirr & 1) ^ 1);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 3: {
|
||||
switch (mmc1_regs[0] & 3) {
|
||||
case 0: setmirror(MI_0); break;
|
||||
case 1: setmirror(MI_1); break;
|
||||
case 2: setmirror(MI_V); break;
|
||||
case 3: setmirror(MI_H); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Sync(void) {
|
||||
SyncPRG();
|
||||
SyncCHR();
|
||||
SyncMIR();
|
||||
}
|
||||
|
||||
static DECLFW(UNLSL12ModeWrite) {
|
||||
/* FCEU_printf("%04X:%02X\n",A,V); */
|
||||
if ((A & 0x4100) == 0x4100) {
|
||||
mode = V;
|
||||
if (A & 1) { /* hacky hacky, there are two configuration modes on SOMARI HUANG-1 PCBs
|
||||
* Solder pads with P1/P2 shorted called SOMARI P,
|
||||
* Solder pads with W1/W2 shorted called SOMARI W
|
||||
* Both identical 3-in-1 but W wanted MMC1 registers
|
||||
* to be reset when switch to MMC1 mode P one - doesn't
|
||||
* There is issue with W version of Somari at starting copyrights
|
||||
*/
|
||||
mmc1_regs[0] = 0xc;
|
||||
mmc1_regs[3] = 0;
|
||||
mmc1_buffer = 0;
|
||||
mmc1_shift = 0;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(UNLSL12Write) {
|
||||
/* FCEU_printf("%04X:%02X\n",A,V); */
|
||||
switch (mode & 3) {
|
||||
case 0: {
|
||||
if ((A >= 0xB000) && (A <= 0xE003)) {
|
||||
int32 ind = ((((A & 2) | (A >> 10)) >> 1) + 2) & 7;
|
||||
int32 sar = ((A & 1) << 2);
|
||||
vrc2_chr[ind] = (vrc2_chr[ind] & (0xF0 >> sar)) | ((V & 0x0F) << sar);
|
||||
SyncCHR();
|
||||
} else
|
||||
switch (A & 0xF000) {
|
||||
case 0x8000: vrc2_prg[0] = V; SyncPRG(); break;
|
||||
case 0xA000: vrc2_prg[1] = V; SyncPRG(); break;
|
||||
case 0x9000: vrc2_mirr = V; SyncMIR(); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
switch (A & 0xE001) {
|
||||
case 0x8000: {
|
||||
uint8 old_ctrl = mmc3_ctrl;
|
||||
mmc3_ctrl = V;
|
||||
if ((old_ctrl & 0x40) != (mmc3_ctrl & 0x40))
|
||||
SyncPRG();
|
||||
if ((old_ctrl & 0x80) != (mmc3_ctrl & 0x80))
|
||||
SyncCHR();
|
||||
break;
|
||||
}
|
||||
case 0x8001:
|
||||
mmc3_regs[mmc3_ctrl & 7] = V;
|
||||
if ((mmc3_ctrl & 7) < 6)
|
||||
SyncCHR();
|
||||
else
|
||||
SyncPRG();
|
||||
break;
|
||||
case 0xA000:
|
||||
mmc3_mirr = V;
|
||||
SyncMIR();
|
||||
break;
|
||||
case 0xC000:
|
||||
IRQLatch = V;
|
||||
break;
|
||||
case 0xC001:
|
||||
IRQReload = 1;
|
||||
break;
|
||||
case 0xE000:
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
break;
|
||||
case 0xE001:
|
||||
IRQa = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 3: {
|
||||
if (V & 0x80) {
|
||||
mmc1_regs[0] |= 0xc;
|
||||
mmc1_buffer = mmc1_shift = 0;
|
||||
SyncPRG();
|
||||
} else {
|
||||
uint8 n = (A >> 13) - 4;
|
||||
mmc1_buffer |= (V & 1) << (mmc1_shift++);
|
||||
if (mmc1_shift == 5) {
|
||||
mmc1_regs[n] = mmc1_buffer;
|
||||
mmc1_buffer = mmc1_shift = 0;
|
||||
switch (n) {
|
||||
case 0: SyncMIR();
|
||||
case 2: SyncCHR();
|
||||
case 3:
|
||||
case 1: SyncPRG();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLSL12HBIRQ(void) {
|
||||
if ((mode & 3) == 1) {
|
||||
int32 count = IRQCount;
|
||||
if (!count || IRQReload) {
|
||||
IRQCount = IRQLatch;
|
||||
IRQReload = 0;
|
||||
} else
|
||||
IRQCount--;
|
||||
if (!IRQCount) {
|
||||
if (IRQa)
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLSL12Power(void) {
|
||||
mode = 0;
|
||||
vrc2_chr[0] = ~0;
|
||||
vrc2_chr[1] = ~0;
|
||||
vrc2_chr[2] = ~0;
|
||||
vrc2_chr[3] = ~0; /* W conf. of Somari wanted CHR3 has to be set to BB bank (or similar), but doesn't do that directly */
|
||||
vrc2_chr[4] = 4;
|
||||
vrc2_chr[5] = 5;
|
||||
vrc2_chr[6] = 6;
|
||||
vrc2_chr[7] = 7;
|
||||
vrc2_prg[0] = 0;
|
||||
vrc2_prg[1] = 1;
|
||||
vrc2_mirr = 0;
|
||||
mmc3_regs[0] = 0;
|
||||
mmc3_regs[1] = 2;
|
||||
mmc3_regs[2] = 4;
|
||||
mmc3_regs[3] = 5;
|
||||
mmc3_regs[4] = 6;
|
||||
mmc3_regs[5] = 7;
|
||||
mmc3_regs[6] = ~3;
|
||||
mmc3_regs[7] = ~2;
|
||||
mmc3_regs[8] = ~1;
|
||||
mmc3_regs[9] = ~0;
|
||||
mmc3_ctrl = mmc3_mirr = IRQCount = IRQLatch = IRQa = 0;
|
||||
mmc1_regs[0] = 0xc;
|
||||
mmc1_regs[1] = 0;
|
||||
mmc1_regs[2] = 0;
|
||||
mmc1_regs[3] = 0;
|
||||
mmc1_buffer = 0;
|
||||
mmc1_shift = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4100, 0x7FFF, UNLSL12ModeWrite);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLSL12Write);
|
||||
}
|
||||
|
||||
void UNLSL12_Init(CartInfo *info) {
|
||||
info->Power = UNLSL12Power;
|
||||
GameHBIRQHook = UNLSL12HBIRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* SL12 Protected 3-in-1 mapper hardware (VRC2, MMC3, MMC1)
|
||||
* the same as 603-5052 board (TODO: add reading registers, merge)
|
||||
* SL1632 2-in-1 protected board, similar to SL12 (TODO: find difference)
|
||||
*
|
||||
* Known PCB:
|
||||
*
|
||||
* Garou Densetsu Special (G0904.PCB, Huang-1, GAL dip: W conf.)
|
||||
* Kart Fighter (008, Huang-1, GAL dip: W conf.)
|
||||
* Somari (008, C5052-13, GAL dip: P conf., GK2-P/GK2-V maskroms)
|
||||
* Somari (008, Huang-1, GAL dip: W conf., GK1-P/GK1-V maskroms)
|
||||
* AV Mei Shao Nv Zhan Shi (aka AV Pretty Girl Fighting) (SL-12 PCB, Hunag-1, GAL dip: unk conf. SL-11A/SL-11B maskroms)
|
||||
* Samurai Spirits (Full version) (Huang-1, GAL dip: unk conf. GS-2A/GS-4A maskroms)
|
||||
* Contra Fighter (603-5052 PCB, C5052-3, GAL dip: unk conf. SC603-A/SCB603-B maskroms)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 mode;
|
||||
static uint8 vrc2_chr[8], vrc2_prg[2], vrc2_mirr;
|
||||
static uint8 mmc3_regs[10], mmc3_ctrl, mmc3_mirr;
|
||||
static uint8 IRQCount, IRQLatch, IRQa;
|
||||
static uint8 IRQReload;
|
||||
static uint8 mmc1_regs[4], mmc1_buffer, mmc1_shift;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &mode, 1, "MODE" },
|
||||
{ vrc2_chr, 8, "VRCC" },
|
||||
{ vrc2_prg, 2, "VRCP" },
|
||||
{ &vrc2_mirr, 1, "VRCM" },
|
||||
{ mmc3_regs, 10, "M3RG" },
|
||||
{ &mmc3_ctrl, 1, "M3CT" },
|
||||
{ &mmc3_mirr, 1, "M3MR" },
|
||||
{ &IRQReload, 1, "IRQR" },
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ &IRQLatch, 1, "IRQL" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ mmc1_regs, 4, "M1RG" },
|
||||
{ &mmc1_buffer, 1, "M1BF" },
|
||||
{ &mmc1_shift, 1, "M1MR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void SyncPRG(void) {
|
||||
switch (mode & 3) {
|
||||
case 0:
|
||||
setprg8(0x8000, vrc2_prg[0]);
|
||||
setprg8(0xA000, vrc2_prg[1]);
|
||||
setprg8(0xC000, ~1);
|
||||
setprg8(0xE000, ~0);
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
uint32 swap = (mmc3_ctrl >> 5) & 2;
|
||||
setprg8(0x8000, mmc3_regs[6 + swap]);
|
||||
setprg8(0xA000, mmc3_regs[7]);
|
||||
setprg8(0xC000, mmc3_regs[6 + (swap ^ 2)]);
|
||||
setprg8(0xE000, mmc3_regs[9]);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 3:
|
||||
{
|
||||
uint8 bank = mmc1_regs[3] & 0xF;
|
||||
if (mmc1_regs[0] & 8) {
|
||||
if (mmc1_regs[0] & 4) {
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, 0x0F);
|
||||
} else {
|
||||
setprg16(0x8000, 0);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
} else
|
||||
setprg32(0x8000, bank >> 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void SyncCHR(void) {
|
||||
uint32 base = (mode & 4) << 6;
|
||||
switch (mode & 3) {
|
||||
case 0:
|
||||
setchr1(0x0000, base | vrc2_chr[0]);
|
||||
setchr1(0x0400, base | vrc2_chr[1]);
|
||||
setchr1(0x0800, base | vrc2_chr[2]);
|
||||
setchr1(0x0c00, base | vrc2_chr[3]);
|
||||
setchr1(0x1000, base | vrc2_chr[4]);
|
||||
setchr1(0x1400, base | vrc2_chr[5]);
|
||||
setchr1(0x1800, base | vrc2_chr[6]);
|
||||
setchr1(0x1c00, base | vrc2_chr[7]);
|
||||
break;
|
||||
case 1: {
|
||||
uint32 swap = (mmc3_ctrl & 0x80) << 5;
|
||||
setchr1(0x0000 ^ swap, base | ((mmc3_regs[0]) & 0xFE));
|
||||
setchr1(0x0400 ^ swap, base | (mmc3_regs[0] | 1));
|
||||
setchr1(0x0800 ^ swap, base | ((mmc3_regs[1]) & 0xFE));
|
||||
setchr1(0x0c00 ^ swap, base | (mmc3_regs[1] | 1));
|
||||
setchr1(0x1000 ^ swap, base | mmc3_regs[2]);
|
||||
setchr1(0x1400 ^ swap, base | mmc3_regs[3]);
|
||||
setchr1(0x1800 ^ swap, base | mmc3_regs[4]);
|
||||
setchr1(0x1c00 ^ swap, base | mmc3_regs[5]);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 3:
|
||||
if (mmc1_regs[0] & 0x10) {
|
||||
setchr4(0x0000, mmc1_regs[1]);
|
||||
setchr4(0x1000, mmc1_regs[2]);
|
||||
} else
|
||||
setchr8(mmc1_regs[1] >> 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void SyncMIR(void) {
|
||||
switch (mode & 3) {
|
||||
case 0: {
|
||||
setmirror((vrc2_mirr & 1) ^ 1);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
setmirror((mmc3_mirr & 1) ^ 1);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 3: {
|
||||
switch (mmc1_regs[0] & 3) {
|
||||
case 0: setmirror(MI_0); break;
|
||||
case 1: setmirror(MI_1); break;
|
||||
case 2: setmirror(MI_V); break;
|
||||
case 3: setmirror(MI_H); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Sync(void) {
|
||||
SyncPRG();
|
||||
SyncCHR();
|
||||
SyncMIR();
|
||||
}
|
||||
|
||||
static DECLFW(UNLSL12ModeWrite) {
|
||||
/* FCEU_printf("%04X:%02X\n",A,V); */
|
||||
if ((A & 0x4100) == 0x4100) {
|
||||
mode = V;
|
||||
if (A & 1) { /* hacky hacky, there are two configuration modes on SOMARI HUANG-1 PCBs
|
||||
* Solder pads with P1/P2 shorted called SOMARI P,
|
||||
* Solder pads with W1/W2 shorted called SOMARI W
|
||||
* Both identical 3-in-1 but W wanted MMC1 registers
|
||||
* to be reset when switch to MMC1 mode P one - doesn't
|
||||
* There is issue with W version of Somari at starting copyrights
|
||||
*/
|
||||
mmc1_regs[0] = 0xc;
|
||||
mmc1_regs[3] = 0;
|
||||
mmc1_buffer = 0;
|
||||
mmc1_shift = 0;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(UNLSL12Write) {
|
||||
/* FCEU_printf("%04X:%02X\n",A,V); */
|
||||
switch (mode & 3) {
|
||||
case 0: {
|
||||
if ((A >= 0xB000) && (A <= 0xE003)) {
|
||||
int32 ind = ((((A & 2) | (A >> 10)) >> 1) + 2) & 7;
|
||||
int32 sar = ((A & 1) << 2);
|
||||
vrc2_chr[ind] = (vrc2_chr[ind] & (0xF0 >> sar)) | ((V & 0x0F) << sar);
|
||||
SyncCHR();
|
||||
} else
|
||||
switch (A & 0xF000) {
|
||||
case 0x8000: vrc2_prg[0] = V; SyncPRG(); break;
|
||||
case 0xA000: vrc2_prg[1] = V; SyncPRG(); break;
|
||||
case 0x9000: vrc2_mirr = V; SyncMIR(); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
switch (A & 0xE001) {
|
||||
case 0x8000: {
|
||||
uint8 old_ctrl = mmc3_ctrl;
|
||||
mmc3_ctrl = V;
|
||||
if ((old_ctrl & 0x40) != (mmc3_ctrl & 0x40))
|
||||
SyncPRG();
|
||||
if ((old_ctrl & 0x80) != (mmc3_ctrl & 0x80))
|
||||
SyncCHR();
|
||||
break;
|
||||
}
|
||||
case 0x8001:
|
||||
mmc3_regs[mmc3_ctrl & 7] = V;
|
||||
if ((mmc3_ctrl & 7) < 6)
|
||||
SyncCHR();
|
||||
else
|
||||
SyncPRG();
|
||||
break;
|
||||
case 0xA000:
|
||||
mmc3_mirr = V;
|
||||
SyncMIR();
|
||||
break;
|
||||
case 0xC000:
|
||||
IRQLatch = V;
|
||||
break;
|
||||
case 0xC001:
|
||||
IRQReload = 1;
|
||||
break;
|
||||
case 0xE000:
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
break;
|
||||
case 0xE001:
|
||||
IRQa = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 3: {
|
||||
if (V & 0x80) {
|
||||
mmc1_regs[0] |= 0xc;
|
||||
mmc1_buffer = mmc1_shift = 0;
|
||||
SyncPRG();
|
||||
} else {
|
||||
uint8 n = (A >> 13) - 4;
|
||||
mmc1_buffer |= (V & 1) << (mmc1_shift++);
|
||||
if (mmc1_shift == 5) {
|
||||
mmc1_regs[n] = mmc1_buffer;
|
||||
mmc1_buffer = mmc1_shift = 0;
|
||||
switch (n) {
|
||||
case 0: SyncMIR();
|
||||
case 2: SyncCHR();
|
||||
case 3:
|
||||
case 1: SyncPRG();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLSL12HBIRQ(void) {
|
||||
if ((mode & 3) == 1) {
|
||||
int32 count = IRQCount;
|
||||
if (!count || IRQReload) {
|
||||
IRQCount = IRQLatch;
|
||||
IRQReload = 0;
|
||||
} else
|
||||
IRQCount--;
|
||||
if (!IRQCount) {
|
||||
if (IRQa)
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLSL12Power(void) {
|
||||
mode = 0;
|
||||
vrc2_chr[0] = ~0;
|
||||
vrc2_chr[1] = ~0;
|
||||
vrc2_chr[2] = ~0;
|
||||
vrc2_chr[3] = ~0; /* W conf. of Somari wanted CHR3 has to be set to BB bank (or similar), but doesn't do that directly */
|
||||
vrc2_chr[4] = 4;
|
||||
vrc2_chr[5] = 5;
|
||||
vrc2_chr[6] = 6;
|
||||
vrc2_chr[7] = 7;
|
||||
vrc2_prg[0] = 0;
|
||||
vrc2_prg[1] = 1;
|
||||
vrc2_mirr = 0;
|
||||
mmc3_regs[0] = 0;
|
||||
mmc3_regs[1] = 2;
|
||||
mmc3_regs[2] = 4;
|
||||
mmc3_regs[3] = 5;
|
||||
mmc3_regs[4] = 6;
|
||||
mmc3_regs[5] = 7;
|
||||
mmc3_regs[6] = ~3;
|
||||
mmc3_regs[7] = ~2;
|
||||
mmc3_regs[8] = ~1;
|
||||
mmc3_regs[9] = ~0;
|
||||
mmc3_ctrl = mmc3_mirr = IRQCount = IRQLatch = IRQa = 0;
|
||||
mmc1_regs[0] = 0xc;
|
||||
mmc1_regs[1] = 0;
|
||||
mmc1_regs[2] = 0;
|
||||
mmc1_regs[3] = 0;
|
||||
mmc1_buffer = 0;
|
||||
mmc1_shift = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4100, 0x7FFF, UNLSL12ModeWrite);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLSL12Write);
|
||||
}
|
||||
|
||||
void UNLSL12_Init(CartInfo *info) {
|
||||
info->Power = UNLSL12Power;
|
||||
GameHBIRQHook = UNLSL12HBIRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
124
src/boards/120.c
124
src/boards/120.c
@@ -1,62 +1,62 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, reg);
|
||||
setprg32(0x8000, 2);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M120Write) {
|
||||
if (A == 0x41FF) {
|
||||
reg = V & 7;
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void M120Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4100, 0x5FFF, M120Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper120_Init(CartInfo *info) {
|
||||
info->Power = M120Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, reg);
|
||||
setprg32(0x8000, 2);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M120Write) {
|
||||
if (A == 0x41FF) {
|
||||
reg = V & 7;
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void M120Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4100, 0x5FFF, M120Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper120_Init(CartInfo *info) {
|
||||
info->Power = M120Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
258
src/boards/121.c
258
src/boards/121.c
@@ -1,129 +1,129 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007-2008 Mad Dumper, CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Panda prince pirate.
|
||||
* MK4, MK6, A9711/A9713 board
|
||||
* 6035052 seems to be the same too, but with prot array in reverse
|
||||
* A9746 seems to be the same too, check
|
||||
* 187 seems to be the same too, check (A98402 board)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void Sync() {
|
||||
switch (EXPREGS[5] & 0x3F) {
|
||||
case 0x20: EXPREGS[7] = 1; EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x29: EXPREGS[7] = 1; EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x26: EXPREGS[7] = 0; EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x2B: EXPREGS[7] = 1; EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x2C: EXPREGS[7] = 1; if (EXPREGS[6]) EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x3C:
|
||||
case 0x3F: EXPREGS[7] = 1; EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x28: EXPREGS[7] = 0; EXPREGS[1] = EXPREGS[6]; break;
|
||||
case 0x2A: EXPREGS[7] = 0; EXPREGS[2] = EXPREGS[6]; break;
|
||||
case 0x2F: break;
|
||||
default: EXPREGS[5] = 0; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M121CW(uint32 A, uint8 V) {
|
||||
if (PRGsize[0] == CHRsize[0]) { /* A9713 multigame extension hack! */
|
||||
setchr1(A, V | ((EXPREGS[3] & 0x80) << 1));
|
||||
} else {
|
||||
if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5))
|
||||
setchr1(A, V | 0x100);
|
||||
else
|
||||
setchr1(A, V);
|
||||
}
|
||||
}
|
||||
|
||||
static void M121PW(uint32 A, uint8 V) {
|
||||
if (EXPREGS[5] & 0x3F) {
|
||||
/* FCEU_printf("prot banks: %02x %02x %02x %02x\n",V,EXPREGS[2],EXPREGS[1],EXPREGS[0]); */
|
||||
setprg8(A, (V & 0x1F) | ((EXPREGS[3] & 0x80) >> 2));
|
||||
setprg8(0xE000, (EXPREGS[0]) | ((EXPREGS[3] & 0x80) >> 2));
|
||||
setprg8(0xC000, (EXPREGS[1]) | ((EXPREGS[3] & 0x80) >> 2));
|
||||
setprg8(0xA000, (EXPREGS[2]) | ((EXPREGS[3] & 0x80) >> 2));
|
||||
} else {
|
||||
/* FCEU_printf("gen banks: %04x %02x\n",A,V); */
|
||||
setprg8(A, (V & 0x1F) | ((EXPREGS[3] & 0x80) >> 2));
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M121Write) {
|
||||
/* FCEU_printf("write: %04x:%04x\n",A&0xE003,V); */
|
||||
switch (A & 0xE003) {
|
||||
case 0x8000:
|
||||
/* EXPREGS[5] = 0; */
|
||||
/* FCEU_printf("gen: %02x\n",V); */
|
||||
MMC3_CMDWrite(A, V);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
break;
|
||||
case 0x8001:
|
||||
EXPREGS[6] = ((V & 1) << 5) | ((V & 2) << 3) | ((V & 4) << 1) | ((V & 8) >> 1) | ((V & 0x10) >> 3) | ((V & 0x20) >> 5);
|
||||
/* FCEU_printf("bank: %02x (%02x)\n",V,EXPREGS[6]); */
|
||||
if (!EXPREGS[7]) Sync();
|
||||
MMC3_CMDWrite(A, V);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
break;
|
||||
case 0x8003:
|
||||
EXPREGS[5] = V;
|
||||
/* EXPREGS[7] = 0; */
|
||||
/* FCEU_printf("prot: %02x\n",EXPREGS[5]); */
|
||||
Sync();
|
||||
MMC3_CMDWrite(0x8000, V);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 prot_array[16] = { 0x83, 0x83, 0x42, 0x00 };
|
||||
static DECLFW(M121LoWrite) {
|
||||
EXPREGS[4] = prot_array[V & 3]; /* 0x100 bit in address seems to be switch arrays 0, 2, 2, 3 (Contra Fighter) */
|
||||
if ((A & 0x5180) == 0x5180) { /* A9713 multigame extension */
|
||||
EXPREGS[3] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
/* FCEU_printf("write: %04x:%04x\n",A,V); */
|
||||
}
|
||||
|
||||
static DECLFR(M121Read) {
|
||||
/* FCEU_printf("read: %04x->\n",A,EXPREGS[0]); */
|
||||
return EXPREGS[4];
|
||||
}
|
||||
|
||||
static void M121Power(void) {
|
||||
EXPREGS[3] = 0x80;
|
||||
EXPREGS[5] = 0;
|
||||
GenMMC3Power();
|
||||
SetReadHandler(0x5000, 0x5FFF, M121Read);
|
||||
SetWriteHandler(0x5000, 0x5FFF, M121LoWrite);
|
||||
SetWriteHandler(0x8000, 0x9FFF, M121Write);
|
||||
}
|
||||
|
||||
void Mapper121_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 256, 8, 0);
|
||||
pwrap = M121PW;
|
||||
cwrap = M121CW;
|
||||
info->Power = M121Power;
|
||||
AddExState(EXPREGS, 8, 0, "EXPR");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007-2008 Mad Dumper, CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Panda prince pirate.
|
||||
* MK4, MK6, A9711/A9713 board
|
||||
* 6035052 seems to be the same too, but with prot array in reverse
|
||||
* A9746 seems to be the same too, check
|
||||
* 187 seems to be the same too, check (A98402 board)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void Sync() {
|
||||
switch (EXPREGS[5] & 0x3F) {
|
||||
case 0x20: EXPREGS[7] = 1; EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x29: EXPREGS[7] = 1; EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x26: EXPREGS[7] = 0; EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x2B: EXPREGS[7] = 1; EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x2C: EXPREGS[7] = 1; if (EXPREGS[6]) EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x3C:
|
||||
case 0x3F: EXPREGS[7] = 1; EXPREGS[0] = EXPREGS[6]; break;
|
||||
case 0x28: EXPREGS[7] = 0; EXPREGS[1] = EXPREGS[6]; break;
|
||||
case 0x2A: EXPREGS[7] = 0; EXPREGS[2] = EXPREGS[6]; break;
|
||||
case 0x2F: break;
|
||||
default: EXPREGS[5] = 0; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M121CW(uint32 A, uint8 V) {
|
||||
if (PRGsize[0] == CHRsize[0]) { /* A9713 multigame extension hack! */
|
||||
setchr1(A, V | ((EXPREGS[3] & 0x80) << 1));
|
||||
} else {
|
||||
if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5))
|
||||
setchr1(A, V | 0x100);
|
||||
else
|
||||
setchr1(A, V);
|
||||
}
|
||||
}
|
||||
|
||||
static void M121PW(uint32 A, uint8 V) {
|
||||
if (EXPREGS[5] & 0x3F) {
|
||||
/* FCEU_printf("prot banks: %02x %02x %02x %02x\n",V,EXPREGS[2],EXPREGS[1],EXPREGS[0]); */
|
||||
setprg8(A, (V & 0x1F) | ((EXPREGS[3] & 0x80) >> 2));
|
||||
setprg8(0xE000, (EXPREGS[0]) | ((EXPREGS[3] & 0x80) >> 2));
|
||||
setprg8(0xC000, (EXPREGS[1]) | ((EXPREGS[3] & 0x80) >> 2));
|
||||
setprg8(0xA000, (EXPREGS[2]) | ((EXPREGS[3] & 0x80) >> 2));
|
||||
} else {
|
||||
/* FCEU_printf("gen banks: %04x %02x\n",A,V); */
|
||||
setprg8(A, (V & 0x1F) | ((EXPREGS[3] & 0x80) >> 2));
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M121Write) {
|
||||
/* FCEU_printf("write: %04x:%04x\n",A&0xE003,V); */
|
||||
switch (A & 0xE003) {
|
||||
case 0x8000:
|
||||
/* EXPREGS[5] = 0; */
|
||||
/* FCEU_printf("gen: %02x\n",V); */
|
||||
MMC3_CMDWrite(A, V);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
break;
|
||||
case 0x8001:
|
||||
EXPREGS[6] = ((V & 1) << 5) | ((V & 2) << 3) | ((V & 4) << 1) | ((V & 8) >> 1) | ((V & 0x10) >> 3) | ((V & 0x20) >> 5);
|
||||
/* FCEU_printf("bank: %02x (%02x)\n",V,EXPREGS[6]); */
|
||||
if (!EXPREGS[7]) Sync();
|
||||
MMC3_CMDWrite(A, V);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
break;
|
||||
case 0x8003:
|
||||
EXPREGS[5] = V;
|
||||
/* EXPREGS[7] = 0; */
|
||||
/* FCEU_printf("prot: %02x\n",EXPREGS[5]); */
|
||||
Sync();
|
||||
MMC3_CMDWrite(0x8000, V);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 prot_array[16] = { 0x83, 0x83, 0x42, 0x00 };
|
||||
static DECLFW(M121LoWrite) {
|
||||
EXPREGS[4] = prot_array[V & 3]; /* 0x100 bit in address seems to be switch arrays 0, 2, 2, 3 (Contra Fighter) */
|
||||
if ((A & 0x5180) == 0x5180) { /* A9713 multigame extension */
|
||||
EXPREGS[3] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
/* FCEU_printf("write: %04x:%04x\n",A,V); */
|
||||
}
|
||||
|
||||
static DECLFR(M121Read) {
|
||||
/* FCEU_printf("read: %04x->\n",A,EXPREGS[0]); */
|
||||
return EXPREGS[4];
|
||||
}
|
||||
|
||||
static void M121Power(void) {
|
||||
EXPREGS[3] = 0x80;
|
||||
EXPREGS[5] = 0;
|
||||
GenMMC3Power();
|
||||
SetReadHandler(0x5000, 0x5FFF, M121Read);
|
||||
SetWriteHandler(0x5000, 0x5FFF, M121LoWrite);
|
||||
SetWriteHandler(0x8000, 0x9FFF, M121Write);
|
||||
}
|
||||
|
||||
void Mapper121_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 256, 8, 0);
|
||||
pwrap = M121PW;
|
||||
cwrap = M121CW;
|
||||
info->Power = M121Power;
|
||||
AddExState(EXPREGS, 8, 0, "EXPR");
|
||||
}
|
||||
|
||||
@@ -1,73 +1,73 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 7-in-1 Darkwing Duck, Snake, MagicBlock (PCB marked as "12 in 1")
|
||||
* 12-in-1 1991 New Star Co. Ltd.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prgchr[2], ctrl;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ prgchr, 2, "REGS" },
|
||||
{ &ctrl, 1, "CTRL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 bank = (ctrl & 3) << 3;
|
||||
setchr4(0x0000, (prgchr[0] >> 3) | (bank << 2));
|
||||
setchr4(0x1000, (prgchr[1] >> 3) | (bank << 2));
|
||||
if (ctrl & 8) {
|
||||
setprg16(0x8000, bank | (prgchr[0] & 6) | 0); /* actually, both 0 and 1 registers used, but they will switch each PA12 transition */
|
||||
setprg16(0xc000, bank | (prgchr[0] & 6) | 1); /* if bits are different for both registers, so they must be programmed strongly the same! */
|
||||
} else {
|
||||
setprg16(0x8000, bank | (prgchr[0] & 7));
|
||||
setprg16(0xc000, bank | 7 );
|
||||
}
|
||||
setmirror(((ctrl & 4) >> 2) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(BMC12IN1Write) {
|
||||
switch (A & 0xE000) {
|
||||
case 0xA000: prgchr[0] = V; Sync(); break;
|
||||
case 0xC000: prgchr[1] = V; Sync(); break;
|
||||
case 0xE000: ctrl = V & 0x0F; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void BMC12IN1Power(void) {
|
||||
prgchr[0] = prgchr[1] = ctrl = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, BMC12IN1Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC12IN1_Init(CartInfo *info) {
|
||||
info->Power = BMC12IN1Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 7-in-1 Darkwing Duck, Snake, MagicBlock (PCB marked as "12 in 1")
|
||||
* 12-in-1 1991 New Star Co. Ltd.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prgchr[2], ctrl;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ prgchr, 2, "REGS" },
|
||||
{ &ctrl, 1, "CTRL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 bank = (ctrl & 3) << 3;
|
||||
setchr4(0x0000, (prgchr[0] >> 3) | (bank << 2));
|
||||
setchr4(0x1000, (prgchr[1] >> 3) | (bank << 2));
|
||||
if (ctrl & 8) {
|
||||
setprg16(0x8000, bank | (prgchr[0] & 6) | 0); /* actually, both 0 and 1 registers used, but they will switch each PA12 transition */
|
||||
setprg16(0xc000, bank | (prgchr[0] & 6) | 1); /* if bits are different for both registers, so they must be programmed strongly the same! */
|
||||
} else {
|
||||
setprg16(0x8000, bank | (prgchr[0] & 7));
|
||||
setprg16(0xc000, bank | 7 );
|
||||
}
|
||||
setmirror(((ctrl & 4) >> 2) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(BMC12IN1Write) {
|
||||
switch (A & 0xE000) {
|
||||
case 0xA000: prgchr[0] = V; Sync(); break;
|
||||
case 0xC000: prgchr[1] = V; Sync(); break;
|
||||
case 0xE000: ctrl = V & 0x0F; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void BMC12IN1Power(void) {
|
||||
prgchr[0] = prgchr[1] = ctrl = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, BMC12IN1Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC12IN1_Init(CartInfo *info) {
|
||||
info->Power = BMC12IN1Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
220
src/boards/15.c
220
src/boards/15.c
@@ -1,110 +1,110 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint16 latchea;
|
||||
static uint8 latched;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &latchea, 2, "AREG" },
|
||||
{ &latched, 1, "DREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
int i;
|
||||
setmirror(((latched >> 6) & 1) ^ 1);
|
||||
switch (latchea) {
|
||||
case 0x8000:
|
||||
for (i = 0; i < 4; i++)
|
||||
setprg8(0x8000 + (i << 13), (((latched & 0x7F) << 1) + i) ^ (latched >> 7));
|
||||
break;
|
||||
case 0x8002:
|
||||
for (i = 0; i < 4; i++)
|
||||
setprg8(0x8000 + (i << 13), ((latched & 0x7F) << 1) + (latched >> 7));
|
||||
break;
|
||||
case 0x8001:
|
||||
case 0x8003:
|
||||
for (i = 0; i < 4; i++) {
|
||||
unsigned int b;
|
||||
b = latched & 0x7F;
|
||||
if (i >= 2 && !(latchea & 0x2))
|
||||
b = 0x7F;
|
||||
setprg8(0x8000 + (i << 13), (i & 1) + ((b << 1) ^ (latched >> 7)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M15Write) {
|
||||
latchea = A;
|
||||
latched = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M15Power(void) {
|
||||
latchea = 0x8000;
|
||||
latched = 0;
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M15Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M15Reset(void) {
|
||||
latchea = 0x8000;
|
||||
latched = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M15Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
void Mapper15_Init(CartInfo *info) {
|
||||
info->Power = M15Power;
|
||||
info->Reset = M15Reset;
|
||||
info->Close = M15Close;
|
||||
GameStateRestore = StateRestore;
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint16 latchea;
|
||||
static uint8 latched;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &latchea, 2, "AREG" },
|
||||
{ &latched, 1, "DREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
int i;
|
||||
setmirror(((latched >> 6) & 1) ^ 1);
|
||||
switch (latchea) {
|
||||
case 0x8000:
|
||||
for (i = 0; i < 4; i++)
|
||||
setprg8(0x8000 + (i << 13), (((latched & 0x7F) << 1) + i) ^ (latched >> 7));
|
||||
break;
|
||||
case 0x8002:
|
||||
for (i = 0; i < 4; i++)
|
||||
setprg8(0x8000 + (i << 13), ((latched & 0x7F) << 1) + (latched >> 7));
|
||||
break;
|
||||
case 0x8001:
|
||||
case 0x8003:
|
||||
for (i = 0; i < 4; i++) {
|
||||
unsigned int b;
|
||||
b = latched & 0x7F;
|
||||
if (i >= 2 && !(latchea & 0x2))
|
||||
b = 0x7F;
|
||||
setprg8(0x8000 + (i << 13), (i & 1) + ((b << 1) ^ (latched >> 7)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M15Write) {
|
||||
latchea = A;
|
||||
latched = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M15Power(void) {
|
||||
latchea = 0x8000;
|
||||
latched = 0;
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M15Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M15Reset(void) {
|
||||
latchea = 0x8000;
|
||||
latched = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M15Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
void Mapper15_Init(CartInfo *info) {
|
||||
info->Power = M15Power;
|
||||
info->Reset = M15Reset;
|
||||
info->Close = M15Close;
|
||||
GameStateRestore = StateRestore;
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
118
src/boards/151.c
118
src/boards/151.c
@@ -1,59 +1,59 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 regs[8];
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x8000, regs[0]);
|
||||
setprg8(0xA000, regs[2]);
|
||||
setprg8(0xC000, regs[4]);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr4(0x0000, regs[6]);
|
||||
setchr4(0x1000, regs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(M151Write) {
|
||||
regs[(A >> 12) & 7] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M151Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M151Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper151_Init(CartInfo *info) {
|
||||
info->Power = M151Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 regs[8];
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x8000, regs[0]);
|
||||
setprg8(0xA000, regs[2]);
|
||||
setprg8(0xC000, regs[4]);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr4(0x0000, regs[6]);
|
||||
setchr4(0x1000, regs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(M151Write) {
|
||||
regs[(A >> 12) & 7] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M151Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M151Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper151_Init(CartInfo *info) {
|
||||
info->Power = M151Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
240
src/boards/156.c
240
src/boards/156.c
@@ -1,120 +1,120 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* DIS23C01 DAOU ROM CONTROLLER, Korea
|
||||
* Metal Force (K)
|
||||
* Buzz and Waldog (K)
|
||||
* General's Son (K)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 chrlo[8], chrhi[8], prg, mirr, mirrisused = 0;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &prg, 1, "PREG" },
|
||||
{ chrlo, 8, "CRGL" },
|
||||
{ chrhi, 8, "CRGH" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint32 i;
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, chrlo[i] | (chrhi[i] << 8));
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg16(0x8000, prg);
|
||||
setprg16(0xC000, ~0);
|
||||
if (mirrisused)
|
||||
setmirror(mirr ^ 1);
|
||||
else
|
||||
setmirror(MI_0);
|
||||
}
|
||||
|
||||
static DECLFW(M156Write) {
|
||||
switch (A) {
|
||||
case 0xC000:
|
||||
case 0xC001:
|
||||
case 0xC002:
|
||||
case 0xC003: chrlo[A & 3] = V; Sync(); break;
|
||||
case 0xC004:
|
||||
case 0xC005:
|
||||
case 0xC006:
|
||||
case 0xC007: chrhi[A & 3] = V; Sync(); break;
|
||||
case 0xC008:
|
||||
case 0xC009:
|
||||
case 0xC00A:
|
||||
case 0xC00B: chrlo[4 + (A & 3)] = V; Sync(); break;
|
||||
case 0xC00C:
|
||||
case 0xC00D:
|
||||
case 0xC00E:
|
||||
case 0xC00F: chrhi[4 + (A & 3)] = V; Sync(); break;
|
||||
case 0xC010: prg = V; Sync(); break;
|
||||
case 0xC014: mirr = V; mirrisused = 1; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M156Reset(void) {
|
||||
uint32 i;
|
||||
for (i = 0; i < 8; i++) {
|
||||
chrlo[i] = 0;
|
||||
chrhi[i] = 0;
|
||||
}
|
||||
prg = 0;
|
||||
mirr = 0;
|
||||
mirrisused = 0;
|
||||
}
|
||||
|
||||
static void M156Power(void) {
|
||||
M156Reset();
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0xC000, 0xCFFF, M156Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M156Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper156_Init(CartInfo *info) {
|
||||
info->Reset = M156Reset;
|
||||
info->Power = M156Power;
|
||||
info->Close = M156Close;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* DIS23C01 DAOU ROM CONTROLLER, Korea
|
||||
* Metal Force (K)
|
||||
* Buzz and Waldog (K)
|
||||
* General's Son (K)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 chrlo[8], chrhi[8], prg, mirr, mirrisused = 0;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &prg, 1, "PREG" },
|
||||
{ chrlo, 8, "CRGL" },
|
||||
{ chrhi, 8, "CRGH" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint32 i;
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, chrlo[i] | (chrhi[i] << 8));
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg16(0x8000, prg);
|
||||
setprg16(0xC000, ~0);
|
||||
if (mirrisused)
|
||||
setmirror(mirr ^ 1);
|
||||
else
|
||||
setmirror(MI_0);
|
||||
}
|
||||
|
||||
static DECLFW(M156Write) {
|
||||
switch (A) {
|
||||
case 0xC000:
|
||||
case 0xC001:
|
||||
case 0xC002:
|
||||
case 0xC003: chrlo[A & 3] = V; Sync(); break;
|
||||
case 0xC004:
|
||||
case 0xC005:
|
||||
case 0xC006:
|
||||
case 0xC007: chrhi[A & 3] = V; Sync(); break;
|
||||
case 0xC008:
|
||||
case 0xC009:
|
||||
case 0xC00A:
|
||||
case 0xC00B: chrlo[4 + (A & 3)] = V; Sync(); break;
|
||||
case 0xC00C:
|
||||
case 0xC00D:
|
||||
case 0xC00E:
|
||||
case 0xC00F: chrhi[4 + (A & 3)] = V; Sync(); break;
|
||||
case 0xC010: prg = V; Sync(); break;
|
||||
case 0xC014: mirr = V; mirrisused = 1; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M156Reset(void) {
|
||||
uint32 i;
|
||||
for (i = 0; i < 8; i++) {
|
||||
chrlo[i] = 0;
|
||||
chrhi[i] = 0;
|
||||
}
|
||||
prg = 0;
|
||||
mirr = 0;
|
||||
mirrisused = 0;
|
||||
}
|
||||
|
||||
static void M156Power(void) {
|
||||
M156Reset();
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0xC000, 0xCFFF, M156Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M156Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper156_Init(CartInfo *info) {
|
||||
info->Reset = M156Reset;
|
||||
info->Power = M156Power;
|
||||
info->Close = M156Close;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
162
src/boards/168.c
162
src/boards/168.c
@@ -1,81 +1,81 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* RacerMate Challenge II
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr4r(0x10, 0x0000, 0);
|
||||
setchr4r(0x10, 0x1000, reg & 0x0f);
|
||||
setprg16(0x8000, reg >> 6);
|
||||
setprg16(0xc000, ~0);
|
||||
}
|
||||
|
||||
static DECLFW(M168Write) {
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M168Dummy) {
|
||||
}
|
||||
|
||||
static void M168Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x4020, 0x7fff, M168Dummy);
|
||||
SetWriteHandler(0xB000, 0xB000, M168Write);
|
||||
SetWriteHandler(0xF000, 0xF000, M168Dummy);
|
||||
SetWriteHandler(0xF080, 0xF080, M168Dummy);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void M168Close(void) {
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper168_Init(CartInfo *info) {
|
||||
info->Power = M168Power;
|
||||
info->Close = M168Close;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
||||
CHRRAMSIZE = 8192 * 8;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* RacerMate Challenge II
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr4r(0x10, 0x0000, 0);
|
||||
setchr4r(0x10, 0x1000, reg & 0x0f);
|
||||
setprg16(0x8000, reg >> 6);
|
||||
setprg16(0xc000, ~0);
|
||||
}
|
||||
|
||||
static DECLFW(M168Write) {
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M168Dummy) {
|
||||
}
|
||||
|
||||
static void M168Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x4020, 0x7fff, M168Dummy);
|
||||
SetWriteHandler(0xB000, 0xB000, M168Write);
|
||||
SetWriteHandler(0xF000, 0xF000, M168Dummy);
|
||||
SetWriteHandler(0xF080, 0xF080, M168Dummy);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void M168Close(void) {
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper168_Init(CartInfo *info) {
|
||||
info->Power = M168Power;
|
||||
info->Close = M168Close;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
||||
CHRRAMSIZE = 8192 * 8;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
}
|
||||
|
||||
124
src/boards/170.c
124
src/boards/170.c
@@ -1,62 +1,62 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, 0);
|
||||
setprg16(0xc000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M170ProtW) {
|
||||
reg = V << 1 & 0x80;
|
||||
}
|
||||
|
||||
static DECLFR(M170ProtR) {
|
||||
return reg | (X.DB & 0x7F);
|
||||
}
|
||||
|
||||
static void M170Power(void) {
|
||||
Sync();
|
||||
SetWriteHandler(0x6502, 0x6502, M170ProtW);
|
||||
SetWriteHandler(0x7000, 0x7000, M170ProtW);
|
||||
SetReadHandler(0x7001, 0x7001, M170ProtR);
|
||||
SetReadHandler(0x7777, 0x7777, M170ProtR);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper170_Init(CartInfo *info) {
|
||||
info->Power = M170Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, 0);
|
||||
setprg16(0xc000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M170ProtW) {
|
||||
reg = V << 1 & 0x80;
|
||||
}
|
||||
|
||||
static DECLFR(M170ProtR) {
|
||||
return reg | (X.DB & 0x7F);
|
||||
}
|
||||
|
||||
static void M170Power(void) {
|
||||
Sync();
|
||||
SetWriteHandler(0x6502, 0x6502, M170ProtW);
|
||||
SetWriteHandler(0x7000, 0x7000, M170ProtW);
|
||||
SetReadHandler(0x7001, 0x7001, M170ProtR);
|
||||
SetReadHandler(0x7777, 0x7777, M170ProtR);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper170_Init(CartInfo *info) {
|
||||
info->Power = M170Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
158
src/boards/175.c
158
src/boards/175.c
@@ -1,79 +1,79 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg, delay, mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(reg);
|
||||
if (!delay) {
|
||||
setprg16(0x8000, reg);
|
||||
setprg8(0xC000, reg << 1);
|
||||
}
|
||||
setprg8(0xE000, (reg << 1) + 1);
|
||||
setmirror(((mirr & 4) >> 2) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M175Write1) {
|
||||
mirr = V;
|
||||
delay = 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M175Write2) {
|
||||
reg = V & 0x0F;
|
||||
delay = 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(M175Read) {
|
||||
if (A == 0xFFFC) {
|
||||
delay = 0;
|
||||
Sync();
|
||||
}
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static void M175Power(void) {
|
||||
reg = mirr = delay = 0;
|
||||
SetReadHandler(0x8000, 0xFFFF, M175Read);
|
||||
SetWriteHandler(0x8000, 0x8000, M175Write1);
|
||||
SetWriteHandler(0xA000, 0xA000, M175Write2);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper175_Init(CartInfo *info) {
|
||||
info->Power = M175Power;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg, delay, mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(reg);
|
||||
if (!delay) {
|
||||
setprg16(0x8000, reg);
|
||||
setprg8(0xC000, reg << 1);
|
||||
}
|
||||
setprg8(0xE000, (reg << 1) + 1);
|
||||
setmirror(((mirr & 4) >> 2) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M175Write1) {
|
||||
mirr = V;
|
||||
delay = 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M175Write2) {
|
||||
reg = V & 0x0F;
|
||||
delay = 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(M175Read) {
|
||||
if (A == 0xFFFC) {
|
||||
delay = 0;
|
||||
Sync();
|
||||
}
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static void M175Power(void) {
|
||||
reg = mirr = delay = 0;
|
||||
SetReadHandler(0x8000, 0xFFFF, M175Read);
|
||||
SetWriteHandler(0x8000, 0x8000, M175Write1);
|
||||
SetWriteHandler(0xA000, 0xA000, M175Write2);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper175_Init(CartInfo *info) {
|
||||
info->Power = M175Power;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
162
src/boards/177.c
162
src/boards/177.c
@@ -1,81 +1,81 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg;
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, reg & 0x1f);
|
||||
setmirror(((reg & 0x20) >> 5) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M177Write) {
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M177Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7fff, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M177Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M177Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper177_Init(CartInfo *info) {
|
||||
info->Power = M177Power;
|
||||
info->Close = M177Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg;
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, reg & 0x1f);
|
||||
setmirror(((reg & 0x20) >> 5) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M177Write) {
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M177Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7fff, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M177Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M177Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper177_Init(CartInfo *info) {
|
||||
info->Power = M177Power;
|
||||
info->Close = M177Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
354
src/boards/178.c
354
src/boards/178.c
@@ -1,177 +1,177 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2013 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* DSOUNDV1/FL-TR8MA boards (32K WRAM, 8/16M), 178 mapper boards (8K WRAM, 4/8M)
|
||||
* Various Education Cartridges
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[4];
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
/* SND Registers */
|
||||
static uint8 pcm_enable = 0;
|
||||
static int16 pcm_latch = 0x3F6, pcm_clock = 0x3F6;
|
||||
static writefunc pcmwrite;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 4, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static int16 step_size[49] = {
|
||||
16, 17, 19, 21, 23, 25, 28, 31, 34, 37,
|
||||
41, 45, 50, 55, 60, 66, 73, 80, 88, 97,
|
||||
107, 118, 130, 143, 157, 173, 190, 209, 230, 253,
|
||||
279, 307, 337, 371, 408, 449, 494, 544, 598, 658,
|
||||
724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552
|
||||
}; /* 49 items */
|
||||
static int32 step_adj[16] = { -1, -1, -1, -1, 2, 5, 7, 9, -1, -1, -1, -1, 2, 5, 7, 9 };
|
||||
|
||||
/* decode stuff */
|
||||
static int32 jedi_table[16 * 49];
|
||||
static int32 acc = 0; /* ADPCM accumulator, initial condition must be 0 */
|
||||
static int32 decstep = 0; /* ADPCM decoding step, initial condition must be 0 */
|
||||
|
||||
static void jedi_table_init() {
|
||||
int step, nib;
|
||||
|
||||
for (step = 0; step < 49; step++) {
|
||||
for (nib = 0; nib < 16; nib++) {
|
||||
int value = (2 * (nib & 0x07) + 1) * step_size[step] / 8;
|
||||
jedi_table[step * 16 + nib] = ((nib & 0x08) != 0) ? -value : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 decode(uint8 code) {
|
||||
acc += jedi_table[decstep + code];
|
||||
if ((acc & ~0x7ff) != 0) /* acc is > 2047 */
|
||||
acc |= ~0xfff;
|
||||
else acc &= 0xfff;
|
||||
decstep += step_adj[code & 7] * 16;
|
||||
if (decstep < 0) decstep = 0;
|
||||
if (decstep > 48 * 16) decstep = 48 * 16;
|
||||
return (acc >> 8) & 0xff;
|
||||
}
|
||||
|
||||
static void Sync(void) {
|
||||
uint32 sbank = reg[1] & 0x7;
|
||||
uint32 bbank = reg[2];
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, reg[3] & 3);
|
||||
if (reg[0] & 2) { /* UNROM mode */
|
||||
setprg16(0x8000, (bbank << 3) | sbank);
|
||||
if (reg[0] & 4)
|
||||
setprg16(0xC000, (bbank << 3) | 6 | (reg[1] & 1));
|
||||
else
|
||||
setprg16(0xC000, (bbank << 3) | 7);
|
||||
} else { /* NROM mode */
|
||||
uint32 bank = (bbank << 3) | sbank;
|
||||
if (reg[0] & 4) {
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
} else
|
||||
setprg32(0x8000, bank >> 1);
|
||||
}
|
||||
setmirror((reg[0] & 1) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M178Write) {
|
||||
reg[A & 3] = V;
|
||||
/* FCEU_printf("cmd %04x:%02x\n", A, V); */
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M178WriteSnd) {
|
||||
if (A == 0x5800) {
|
||||
if (V & 0xF0) {
|
||||
pcm_enable = 1;
|
||||
/* pcmwrite(0x4011, (V & 0xF) << 3); */
|
||||
pcmwrite(0x4011, decode(V & 0xf));
|
||||
} else
|
||||
pcm_enable = 0;
|
||||
} else
|
||||
FCEU_printf("misc %04x:%02x\n", A, V);
|
||||
}
|
||||
|
||||
static DECLFR(M178ReadSnd) {
|
||||
if (A == 0x5800)
|
||||
return (X.DB & 0xBF) | ((pcm_enable ^ 1) << 6);
|
||||
else
|
||||
return X.DB;
|
||||
}
|
||||
|
||||
static void M178Power(void) {
|
||||
reg[0] = reg[1] = reg[2] = reg[3] = 0;
|
||||
Sync();
|
||||
pcmwrite = GetWriteHandler(0x4011);
|
||||
SetWriteHandler(0x4800, 0x4fff, M178Write);
|
||||
SetWriteHandler(0x5800, 0x5fff, M178WriteSnd);
|
||||
SetReadHandler(0x5800, 0x5fff, M178ReadSnd);
|
||||
SetReadHandler(0x6000, 0x7fff, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M178SndClk(int a) {
|
||||
if (pcm_enable) {
|
||||
pcm_latch -= a;
|
||||
if (pcm_latch <= 0) {
|
||||
pcm_latch += pcm_clock;
|
||||
pcm_enable = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M178Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper178_Init(CartInfo *info) {
|
||||
info->Power = M178Power;
|
||||
info->Close = M178Close;
|
||||
GameStateRestore = StateRestore;
|
||||
MapIRQHook = M178SndClk;
|
||||
|
||||
jedi_table_init();
|
||||
|
||||
WRAMSIZE = 32768;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2013 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* DSOUNDV1/FL-TR8MA boards (32K WRAM, 8/16M), 178 mapper boards (8K WRAM, 4/8M)
|
||||
* Various Education Cartridges
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[4];
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
/* SND Registers */
|
||||
static uint8 pcm_enable = 0;
|
||||
static int16 pcm_latch = 0x3F6, pcm_clock = 0x3F6;
|
||||
static writefunc pcmwrite;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 4, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static int16 step_size[49] = {
|
||||
16, 17, 19, 21, 23, 25, 28, 31, 34, 37,
|
||||
41, 45, 50, 55, 60, 66, 73, 80, 88, 97,
|
||||
107, 118, 130, 143, 157, 173, 190, 209, 230, 253,
|
||||
279, 307, 337, 371, 408, 449, 494, 544, 598, 658,
|
||||
724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552
|
||||
}; /* 49 items */
|
||||
static int32 step_adj[16] = { -1, -1, -1, -1, 2, 5, 7, 9, -1, -1, -1, -1, 2, 5, 7, 9 };
|
||||
|
||||
/* decode stuff */
|
||||
static int32 jedi_table[16 * 49];
|
||||
static int32 acc = 0; /* ADPCM accumulator, initial condition must be 0 */
|
||||
static int32 decstep = 0; /* ADPCM decoding step, initial condition must be 0 */
|
||||
|
||||
static void jedi_table_init() {
|
||||
int step, nib;
|
||||
|
||||
for (step = 0; step < 49; step++) {
|
||||
for (nib = 0; nib < 16; nib++) {
|
||||
int value = (2 * (nib & 0x07) + 1) * step_size[step] / 8;
|
||||
jedi_table[step * 16 + nib] = ((nib & 0x08) != 0) ? -value : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 decode(uint8 code) {
|
||||
acc += jedi_table[decstep + code];
|
||||
if ((acc & ~0x7ff) != 0) /* acc is > 2047 */
|
||||
acc |= ~0xfff;
|
||||
else acc &= 0xfff;
|
||||
decstep += step_adj[code & 7] * 16;
|
||||
if (decstep < 0) decstep = 0;
|
||||
if (decstep > 48 * 16) decstep = 48 * 16;
|
||||
return (acc >> 8) & 0xff;
|
||||
}
|
||||
|
||||
static void Sync(void) {
|
||||
uint32 sbank = reg[1] & 0x7;
|
||||
uint32 bbank = reg[2];
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, reg[3] & 3);
|
||||
if (reg[0] & 2) { /* UNROM mode */
|
||||
setprg16(0x8000, (bbank << 3) | sbank);
|
||||
if (reg[0] & 4)
|
||||
setprg16(0xC000, (bbank << 3) | 6 | (reg[1] & 1));
|
||||
else
|
||||
setprg16(0xC000, (bbank << 3) | 7);
|
||||
} else { /* NROM mode */
|
||||
uint32 bank = (bbank << 3) | sbank;
|
||||
if (reg[0] & 4) {
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
} else
|
||||
setprg32(0x8000, bank >> 1);
|
||||
}
|
||||
setmirror((reg[0] & 1) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M178Write) {
|
||||
reg[A & 3] = V;
|
||||
/* FCEU_printf("cmd %04x:%02x\n", A, V); */
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M178WriteSnd) {
|
||||
if (A == 0x5800) {
|
||||
if (V & 0xF0) {
|
||||
pcm_enable = 1;
|
||||
/* pcmwrite(0x4011, (V & 0xF) << 3); */
|
||||
pcmwrite(0x4011, decode(V & 0xf));
|
||||
} else
|
||||
pcm_enable = 0;
|
||||
} else
|
||||
FCEU_printf("misc %04x:%02x\n", A, V);
|
||||
}
|
||||
|
||||
static DECLFR(M178ReadSnd) {
|
||||
if (A == 0x5800)
|
||||
return (X.DB & 0xBF) | ((pcm_enable ^ 1) << 6);
|
||||
else
|
||||
return X.DB;
|
||||
}
|
||||
|
||||
static void M178Power(void) {
|
||||
reg[0] = reg[1] = reg[2] = reg[3] = 0;
|
||||
Sync();
|
||||
pcmwrite = GetWriteHandler(0x4011);
|
||||
SetWriteHandler(0x4800, 0x4fff, M178Write);
|
||||
SetWriteHandler(0x5800, 0x5fff, M178WriteSnd);
|
||||
SetReadHandler(0x5800, 0x5fff, M178ReadSnd);
|
||||
SetReadHandler(0x6000, 0x7fff, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M178SndClk(int a) {
|
||||
if (pcm_enable) {
|
||||
pcm_latch -= a;
|
||||
if (pcm_latch <= 0) {
|
||||
pcm_latch += pcm_clock;
|
||||
pcm_enable = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M178Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper178_Init(CartInfo *info) {
|
||||
info->Power = M178Power;
|
||||
info->Close = M178Close;
|
||||
GameStateRestore = StateRestore;
|
||||
MapIRQHook = M178SndClk;
|
||||
|
||||
jedi_table_init();
|
||||
|
||||
WRAMSIZE = 32768;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
266
src/boards/18.c
266
src/boards/18.c
@@ -1,133 +1,133 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg[4], creg[8];
|
||||
static uint8 IRQa, mirr;
|
||||
static int32 IRQCount, IRQLatch;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ preg, 4, "PREG" },
|
||||
{ creg, 8, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQLatch, 4, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
int i;
|
||||
for (i = 0; i < 8; i++) setchr1(i << 10, creg[i]);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000, preg[0]);
|
||||
setprg8(0xA000, preg[1]);
|
||||
setprg8(0xC000, preg[2]);
|
||||
setprg8(0xE000, ~0);
|
||||
if (mirr & 2)
|
||||
setmirror(MI_0);
|
||||
else
|
||||
setmirror(mirr & 1);
|
||||
}
|
||||
|
||||
static DECLFW(M18WriteIRQ) {
|
||||
switch (A & 0xF003) {
|
||||
case 0xE000: IRQLatch &= 0xFFF0; IRQLatch |= (V & 0x0f) << 0x0; break;
|
||||
case 0xE001: IRQLatch &= 0xFF0F; IRQLatch |= (V & 0x0f) << 0x4; break;
|
||||
case 0xE002: IRQLatch &= 0xF0FF; IRQLatch |= (V & 0x0f) << 0x8; break;
|
||||
case 0xE003: IRQLatch &= 0x0FFF; IRQLatch |= (V & 0x0f) << 0xC; break;
|
||||
case 0xF000: IRQCount = IRQLatch; break;
|
||||
case 0xF001: IRQa = V & 1; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xF002: mirr = V & 3; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M18WritePrg) {
|
||||
uint32 i = ((A >> 1) & 1) | ((A - 0x8000) >> 11);
|
||||
preg[i] &= (0xF0) >> ((A & 1) << 2);
|
||||
preg[i] |= (V & 0xF) << ((A & 1) << 2);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M18WriteChr) {
|
||||
uint32 i = ((A >> 1) & 1) | ((A - 0xA000) >> 11);
|
||||
creg[i] &= (0xF0) >> ((A & 1) << 2);
|
||||
creg[i] |= (V & 0xF) << ((A & 1) << 2);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M18Power(void) {
|
||||
IRQa = 0;
|
||||
preg[0] = 0;
|
||||
preg[1] = 1;
|
||||
preg[2] = ~1;
|
||||
preg[3] = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0x9FFF, M18WritePrg);
|
||||
SetWriteHandler(0xA000, 0xDFFF, M18WriteChr);
|
||||
SetWriteHandler(0xE000, 0xFFFF, M18WriteIRQ);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M18IRQHook(int a) {
|
||||
if (IRQa && IRQCount) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount <= 0) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount = 0;
|
||||
IRQa = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M18Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper18_Init(CartInfo *info) {
|
||||
info->Power = M18Power;
|
||||
info->Close = M18Close;
|
||||
MapIRQHook = M18IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg[4], creg[8];
|
||||
static uint8 IRQa, mirr;
|
||||
static int32 IRQCount, IRQLatch;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ preg, 4, "PREG" },
|
||||
{ creg, 8, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQLatch, 4, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
int i;
|
||||
for (i = 0; i < 8; i++) setchr1(i << 10, creg[i]);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000, preg[0]);
|
||||
setprg8(0xA000, preg[1]);
|
||||
setprg8(0xC000, preg[2]);
|
||||
setprg8(0xE000, ~0);
|
||||
if (mirr & 2)
|
||||
setmirror(MI_0);
|
||||
else
|
||||
setmirror(mirr & 1);
|
||||
}
|
||||
|
||||
static DECLFW(M18WriteIRQ) {
|
||||
switch (A & 0xF003) {
|
||||
case 0xE000: IRQLatch &= 0xFFF0; IRQLatch |= (V & 0x0f) << 0x0; break;
|
||||
case 0xE001: IRQLatch &= 0xFF0F; IRQLatch |= (V & 0x0f) << 0x4; break;
|
||||
case 0xE002: IRQLatch &= 0xF0FF; IRQLatch |= (V & 0x0f) << 0x8; break;
|
||||
case 0xE003: IRQLatch &= 0x0FFF; IRQLatch |= (V & 0x0f) << 0xC; break;
|
||||
case 0xF000: IRQCount = IRQLatch; break;
|
||||
case 0xF001: IRQa = V & 1; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xF002: mirr = V & 3; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M18WritePrg) {
|
||||
uint32 i = ((A >> 1) & 1) | ((A - 0x8000) >> 11);
|
||||
preg[i] &= (0xF0) >> ((A & 1) << 2);
|
||||
preg[i] |= (V & 0xF) << ((A & 1) << 2);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M18WriteChr) {
|
||||
uint32 i = ((A >> 1) & 1) | ((A - 0xA000) >> 11);
|
||||
creg[i] &= (0xF0) >> ((A & 1) << 2);
|
||||
creg[i] |= (V & 0xF) << ((A & 1) << 2);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M18Power(void) {
|
||||
IRQa = 0;
|
||||
preg[0] = 0;
|
||||
preg[1] = 1;
|
||||
preg[2] = ~1;
|
||||
preg[3] = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0x9FFF, M18WritePrg);
|
||||
SetWriteHandler(0xA000, 0xDFFF, M18WriteChr);
|
||||
SetWriteHandler(0xE000, 0xFFFF, M18WriteIRQ);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M18IRQHook(int a) {
|
||||
if (IRQa && IRQCount) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount <= 0) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount = 0;
|
||||
IRQa = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M18Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper18_Init(CartInfo *info) {
|
||||
info->Power = M18Power;
|
||||
info->Close = M18Close;
|
||||
MapIRQHook = M18IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
222
src/boards/183.c
222
src/boards/183.c
@@ -1,111 +1,111 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Gimmick Bootleg (VRC4 mapper)
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prg[4], chr[8], mirr;
|
||||
static uint8 IRQCount;
|
||||
static uint8 IRQPre;
|
||||
static uint8 IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ prg, 4, "PRG" },
|
||||
{ chr, 8, "CHR" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ &IRQPre, 1, "IRQP" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void SyncPrg(void) {
|
||||
setprg8(0x6000, prg[3]);
|
||||
setprg8(0x8000, prg[0]);
|
||||
setprg8(0xA000, prg[1]);
|
||||
setprg8(0xC000, prg[2]);
|
||||
setprg8(0xE000, ~0);
|
||||
}
|
||||
|
||||
static void SyncMirr(void) {
|
||||
switch (mirr) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void SyncChr(void) {
|
||||
int i;
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, chr[i]);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
SyncPrg();
|
||||
SyncChr();
|
||||
SyncMirr();
|
||||
}
|
||||
|
||||
static DECLFW(M183Write) {
|
||||
if ((A & 0xF800) == 0x6800) {
|
||||
prg[3] = A & 0x3F;
|
||||
SyncPrg();
|
||||
} else if (((A & 0xF80C) >= 0xB000) && ((A & 0xF80C) <= 0xE00C)) {
|
||||
int index = (((A >> 11) - 6) | (A >> 3)) & 7;
|
||||
chr[index] = (chr[index] & (0xF0 >> (A & 4))) | ((V & 0x0F) << (A & 4));
|
||||
SyncChr();
|
||||
} else switch (A & 0xF80C) {
|
||||
case 0x8800: prg[0] = V; SyncPrg(); break;
|
||||
case 0xA800: prg[1] = V; SyncPrg(); break;
|
||||
case 0xA000: prg[2] = V; SyncPrg(); break;
|
||||
case 0x9800: mirr = V & 3; SyncMirr(); break;
|
||||
case 0xF000: IRQCount = ((IRQCount & 0xF0) | (V & 0xF)); break;
|
||||
case 0xF004: IRQCount = ((IRQCount & 0x0F) | ((V & 0xF) << 4)); break;
|
||||
case 0xF008: IRQa = V; if (!V) IRQPre = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xF00C: IRQPre = 16; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M183IRQCounter(void) {
|
||||
if (IRQa) {
|
||||
IRQCount++;
|
||||
if ((IRQCount - IRQPre) == 238)
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static void M183Power(void) {
|
||||
IRQPre = IRQCount = IRQa = 0;
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, M183Write);
|
||||
SyncPrg();
|
||||
SyncChr();
|
||||
}
|
||||
|
||||
void Mapper183_Init(CartInfo *info) {
|
||||
info->Power = M183Power;
|
||||
GameHBIRQHook = M183IRQCounter;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Gimmick Bootleg (VRC4 mapper)
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prg[4], chr[8], mirr;
|
||||
static uint8 IRQCount;
|
||||
static uint8 IRQPre;
|
||||
static uint8 IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ prg, 4, "PRG" },
|
||||
{ chr, 8, "CHR" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ &IRQPre, 1, "IRQP" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void SyncPrg(void) {
|
||||
setprg8(0x6000, prg[3]);
|
||||
setprg8(0x8000, prg[0]);
|
||||
setprg8(0xA000, prg[1]);
|
||||
setprg8(0xC000, prg[2]);
|
||||
setprg8(0xE000, ~0);
|
||||
}
|
||||
|
||||
static void SyncMirr(void) {
|
||||
switch (mirr) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void SyncChr(void) {
|
||||
int i;
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, chr[i]);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
SyncPrg();
|
||||
SyncChr();
|
||||
SyncMirr();
|
||||
}
|
||||
|
||||
static DECLFW(M183Write) {
|
||||
if ((A & 0xF800) == 0x6800) {
|
||||
prg[3] = A & 0x3F;
|
||||
SyncPrg();
|
||||
} else if (((A & 0xF80C) >= 0xB000) && ((A & 0xF80C) <= 0xE00C)) {
|
||||
int index = (((A >> 11) - 6) | (A >> 3)) & 7;
|
||||
chr[index] = (chr[index] & (0xF0 >> (A & 4))) | ((V & 0x0F) << (A & 4));
|
||||
SyncChr();
|
||||
} else switch (A & 0xF80C) {
|
||||
case 0x8800: prg[0] = V; SyncPrg(); break;
|
||||
case 0xA800: prg[1] = V; SyncPrg(); break;
|
||||
case 0xA000: prg[2] = V; SyncPrg(); break;
|
||||
case 0x9800: mirr = V & 3; SyncMirr(); break;
|
||||
case 0xF000: IRQCount = ((IRQCount & 0xF0) | (V & 0xF)); break;
|
||||
case 0xF004: IRQCount = ((IRQCount & 0x0F) | ((V & 0xF) << 4)); break;
|
||||
case 0xF008: IRQa = V; if (!V) IRQPre = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xF00C: IRQPre = 16; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M183IRQCounter(void) {
|
||||
if (IRQa) {
|
||||
IRQCount++;
|
||||
if ((IRQCount - IRQPre) == 238)
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static void M183Power(void) {
|
||||
IRQPre = IRQCount = IRQa = 0;
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, M183Write);
|
||||
SyncPrg();
|
||||
SyncChr();
|
||||
}
|
||||
|
||||
void Mapper183_Init(CartInfo *info) {
|
||||
info->Power = M183Power;
|
||||
GameHBIRQHook = M183IRQCounter;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
216
src/boards/185.c
216
src/boards/185.c
@@ -1,108 +1,108 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 *DummyCHR = NULL;
|
||||
static uint8 datareg;
|
||||
static void (*Sync)(void);
|
||||
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &datareg, 1, "DREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* on off
|
||||
1 0x0F, 0xF0 - Bird Week
|
||||
2 0x33, 0x00 - B-Wings
|
||||
3 0x11, 0x00 - Mighty Bomb Jack
|
||||
4 0x22, 0x20 - Sansuu 1 Nen, Sansuu 2 Nen
|
||||
5 0xFF, 0x00 - Sansuu 3 Nen
|
||||
6 0x21, 0x13 - Spy vs Spy
|
||||
7 0x20, 0x21 - Seicross
|
||||
*/
|
||||
|
||||
static void Sync185(void) {
|
||||
/* little dirty eh? ;_) */
|
||||
if ((datareg & 3) && (datareg != 0x13)) /* 1, 2, 3, 4, 5, 6 */
|
||||
setchr8(0);
|
||||
else
|
||||
setchr8r(0x10, 0);
|
||||
}
|
||||
|
||||
static void Sync181(void) {
|
||||
if (!(datareg & 1)) /* 7 */
|
||||
setchr8(0);
|
||||
else
|
||||
setchr8r(0x10, 0);
|
||||
}
|
||||
|
||||
static DECLFW(MWrite) {
|
||||
datareg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void MPower(void) {
|
||||
datareg = 0;
|
||||
Sync();
|
||||
setprg16(0x8000, 0);
|
||||
setprg16(0xC000, ~0);
|
||||
SetWriteHandler(0x8000, 0xFFFF, MWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void MClose(void) {
|
||||
if (DummyCHR)
|
||||
FCEU_gfree(DummyCHR);
|
||||
DummyCHR = NULL;
|
||||
}
|
||||
|
||||
static void MRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper185_Init(CartInfo *info) {
|
||||
int x;
|
||||
Sync = Sync185;
|
||||
info->Power = MPower;
|
||||
info->Close = MClose;
|
||||
GameStateRestore = MRestore;
|
||||
DummyCHR = (uint8*)FCEU_gmalloc(8192);
|
||||
for (x = 0; x < 8192; x++)
|
||||
DummyCHR[x] = 0xff;
|
||||
SetupCartCHRMapping(0x10, DummyCHR, 8192, 0);
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper181_Init(CartInfo *info) {
|
||||
int x;
|
||||
Sync = Sync181;
|
||||
info->Power = MPower;
|
||||
info->Close = MClose;
|
||||
GameStateRestore = MRestore;
|
||||
DummyCHR = (uint8*)FCEU_gmalloc(8192);
|
||||
for (x = 0; x < 8192; x++)
|
||||
DummyCHR[x] = 0xff;
|
||||
SetupCartCHRMapping(0x10, DummyCHR, 8192, 0);
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 *DummyCHR = NULL;
|
||||
static uint8 datareg;
|
||||
static void (*Sync)(void);
|
||||
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &datareg, 1, "DREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* on off
|
||||
1 0x0F, 0xF0 - Bird Week
|
||||
2 0x33, 0x00 - B-Wings
|
||||
3 0x11, 0x00 - Mighty Bomb Jack
|
||||
4 0x22, 0x20 - Sansuu 1 Nen, Sansuu 2 Nen
|
||||
5 0xFF, 0x00 - Sansuu 3 Nen
|
||||
6 0x21, 0x13 - Spy vs Spy
|
||||
7 0x20, 0x21 - Seicross
|
||||
*/
|
||||
|
||||
static void Sync185(void) {
|
||||
/* little dirty eh? ;_) */
|
||||
if ((datareg & 3) && (datareg != 0x13)) /* 1, 2, 3, 4, 5, 6 */
|
||||
setchr8(0);
|
||||
else
|
||||
setchr8r(0x10, 0);
|
||||
}
|
||||
|
||||
static void Sync181(void) {
|
||||
if (!(datareg & 1)) /* 7 */
|
||||
setchr8(0);
|
||||
else
|
||||
setchr8r(0x10, 0);
|
||||
}
|
||||
|
||||
static DECLFW(MWrite) {
|
||||
datareg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void MPower(void) {
|
||||
datareg = 0;
|
||||
Sync();
|
||||
setprg16(0x8000, 0);
|
||||
setprg16(0xC000, ~0);
|
||||
SetWriteHandler(0x8000, 0xFFFF, MWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void MClose(void) {
|
||||
if (DummyCHR)
|
||||
FCEU_gfree(DummyCHR);
|
||||
DummyCHR = NULL;
|
||||
}
|
||||
|
||||
static void MRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper185_Init(CartInfo *info) {
|
||||
int x;
|
||||
Sync = Sync185;
|
||||
info->Power = MPower;
|
||||
info->Close = MClose;
|
||||
GameStateRestore = MRestore;
|
||||
DummyCHR = (uint8*)FCEU_gmalloc(8192);
|
||||
for (x = 0; x < 8192; x++)
|
||||
DummyCHR[x] = 0xff;
|
||||
SetupCartCHRMapping(0x10, DummyCHR, 8192, 0);
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper181_Init(CartInfo *info) {
|
||||
int x;
|
||||
Sync = Sync181;
|
||||
info->Power = MPower;
|
||||
info->Close = MClose;
|
||||
GameStateRestore = MRestore;
|
||||
DummyCHR = (uint8*)FCEU_gmalloc(8192);
|
||||
for (x = 0; x < 8192; x++)
|
||||
DummyCHR[x] = 0xff;
|
||||
SetupCartCHRMapping(0x10, DummyCHR, 8192, 0);
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
190
src/boards/186.c
190
src/boards/186.c
@@ -1,95 +1,95 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Family Study Box by Fukutake Shoten
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 SWRAM[3072];
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint8 regs[4];
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 4, "DREG" },
|
||||
{ SWRAM, 3072, "SWRM" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8r(0x10, 0x6000, regs[0] >> 6);
|
||||
setprg16(0x8000, regs[1]);
|
||||
setprg16(0xc000, 0);
|
||||
}
|
||||
|
||||
static DECLFW(M186Write) {
|
||||
if (A & 0x4203) regs[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(M186Read) {
|
||||
switch (A) {
|
||||
case 0x4200: return 0x00; break;
|
||||
case 0x4201: return 0x00; break;
|
||||
case 0x4202: return 0x40; break;
|
||||
case 0x4203: return 0x00; break;
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
static DECLFR(ASWRAM) {
|
||||
return(SWRAM[A - 0x4400]);
|
||||
}
|
||||
static DECLFW(BSWRAM) {
|
||||
SWRAM[A - 0x4400] = V;
|
||||
}
|
||||
|
||||
static void M186Power(void) {
|
||||
setchr8(0);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, CartBW);
|
||||
SetReadHandler(0x4200, 0x43FF, M186Read);
|
||||
SetWriteHandler(0x4200, 0x43FF, M186Write);
|
||||
SetReadHandler(0x4400, 0x4FFF, ASWRAM);
|
||||
SetWriteHandler(0x4400, 0x4FFF, BSWRAM);
|
||||
FCEU_CheatAddRAM(32, 0x6000, WRAM);
|
||||
regs[0] = regs[1] = regs[2] = regs[3];
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M186Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void M186Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper186_Init(CartInfo *info) {
|
||||
info->Power = M186Power;
|
||||
info->Close = M186Close;
|
||||
GameStateRestore = M186Restore;
|
||||
WRAM = (uint8*)FCEU_gmalloc(32768);
|
||||
SetupCartPRGMapping(0x10, WRAM, 32768, 1);
|
||||
AddExState(WRAM, 32768, 0, "WRAM");
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Family Study Box by Fukutake Shoten
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 SWRAM[3072];
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint8 regs[4];
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 4, "DREG" },
|
||||
{ SWRAM, 3072, "SWRM" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8r(0x10, 0x6000, regs[0] >> 6);
|
||||
setprg16(0x8000, regs[1]);
|
||||
setprg16(0xc000, 0);
|
||||
}
|
||||
|
||||
static DECLFW(M186Write) {
|
||||
if (A & 0x4203) regs[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(M186Read) {
|
||||
switch (A) {
|
||||
case 0x4200: return 0x00; break;
|
||||
case 0x4201: return 0x00; break;
|
||||
case 0x4202: return 0x40; break;
|
||||
case 0x4203: return 0x00; break;
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
static DECLFR(ASWRAM) {
|
||||
return(SWRAM[A - 0x4400]);
|
||||
}
|
||||
static DECLFW(BSWRAM) {
|
||||
SWRAM[A - 0x4400] = V;
|
||||
}
|
||||
|
||||
static void M186Power(void) {
|
||||
setchr8(0);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, CartBW);
|
||||
SetReadHandler(0x4200, 0x43FF, M186Read);
|
||||
SetWriteHandler(0x4200, 0x43FF, M186Write);
|
||||
SetReadHandler(0x4400, 0x4FFF, ASWRAM);
|
||||
SetWriteHandler(0x4400, 0x4FFF, BSWRAM);
|
||||
FCEU_CheatAddRAM(32, 0x6000, WRAM);
|
||||
regs[0] = regs[1] = regs[2] = regs[3];
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M186Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void M186Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper186_Init(CartInfo *info) {
|
||||
info->Power = M186Power;
|
||||
info->Close = M186Close;
|
||||
GameStateRestore = M186Restore;
|
||||
WRAM = (uint8*)FCEU_gmalloc(32768);
|
||||
SetupCartPRGMapping(0x10, WRAM, 32768, 1);
|
||||
AddExState(WRAM, 32768, 0, "WRAM");
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
176
src/boards/187.c
176
src/boards/187.c
@@ -1,88 +1,88 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* A98402 board, A9711, A9746 similar
|
||||
* King of Fighters 96, The (Unl), Street Fighter Zero 2 (Unl)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void M187CW(uint32 A, uint8 V) {
|
||||
if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5))
|
||||
setchr1(A, V | 0x100);
|
||||
else
|
||||
setchr1(A, V);
|
||||
}
|
||||
|
||||
static void M187PW(uint32 A, uint8 V) {
|
||||
if (EXPREGS[0] & 0x80) {
|
||||
uint8 bank = EXPREGS[0] & 0x1F;
|
||||
if (EXPREGS[0] & 0x20) {
|
||||
if (EXPREGS[0] & 0x40)
|
||||
setprg32(0x8000, bank >> 2);
|
||||
else
|
||||
setprg32(0x8000, bank >> 1); /* hacky hacky! two mappers in one! need real hw carts to test */
|
||||
} else {
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
} else
|
||||
setprg8(A, V & 0x3F);
|
||||
}
|
||||
|
||||
static DECLFW(M187Write8000) {
|
||||
EXPREGS[1] = 1;
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
|
||||
static DECLFW(M187Write8001) {
|
||||
if (EXPREGS[1])
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
|
||||
static DECLFW(M187WriteLo) {
|
||||
if ((A == 0x5000) || (A == 0x6000)) {
|
||||
EXPREGS[0] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 prot_data[4] = { 0x83, 0x83, 0x42, 0x00 };
|
||||
static DECLFR(M187Read) {
|
||||
return prot_data[EXPREGS[1] & 3];
|
||||
}
|
||||
|
||||
static void M187Power(void) {
|
||||
EXPREGS[0] = EXPREGS[1] = 0;
|
||||
GenMMC3Power();
|
||||
SetReadHandler(0x5000, 0x5FFF, M187Read);
|
||||
SetWriteHandler(0x5000, 0x6FFF, M187WriteLo);
|
||||
SetWriteHandler(0x8000, 0x8000, M187Write8000);
|
||||
SetWriteHandler(0x8001, 0x8001, M187Write8001);
|
||||
}
|
||||
|
||||
void Mapper187_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 256, 256, 0, 0);
|
||||
pwrap = M187PW;
|
||||
cwrap = M187CW;
|
||||
info->Power = M187Power;
|
||||
AddExState(EXPREGS, 3, 0, "EXPR");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* A98402 board, A9711, A9746 similar
|
||||
* King of Fighters 96, The (Unl), Street Fighter Zero 2 (Unl)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void M187CW(uint32 A, uint8 V) {
|
||||
if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5))
|
||||
setchr1(A, V | 0x100);
|
||||
else
|
||||
setchr1(A, V);
|
||||
}
|
||||
|
||||
static void M187PW(uint32 A, uint8 V) {
|
||||
if (EXPREGS[0] & 0x80) {
|
||||
uint8 bank = EXPREGS[0] & 0x1F;
|
||||
if (EXPREGS[0] & 0x20) {
|
||||
if (EXPREGS[0] & 0x40)
|
||||
setprg32(0x8000, bank >> 2);
|
||||
else
|
||||
setprg32(0x8000, bank >> 1); /* hacky hacky! two mappers in one! need real hw carts to test */
|
||||
} else {
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
} else
|
||||
setprg8(A, V & 0x3F);
|
||||
}
|
||||
|
||||
static DECLFW(M187Write8000) {
|
||||
EXPREGS[1] = 1;
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
|
||||
static DECLFW(M187Write8001) {
|
||||
if (EXPREGS[1])
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
|
||||
static DECLFW(M187WriteLo) {
|
||||
if ((A == 0x5000) || (A == 0x6000)) {
|
||||
EXPREGS[0] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 prot_data[4] = { 0x83, 0x83, 0x42, 0x00 };
|
||||
static DECLFR(M187Read) {
|
||||
return prot_data[EXPREGS[1] & 3];
|
||||
}
|
||||
|
||||
static void M187Power(void) {
|
||||
EXPREGS[0] = EXPREGS[1] = 0;
|
||||
GenMMC3Power();
|
||||
SetReadHandler(0x5000, 0x5FFF, M187Read);
|
||||
SetWriteHandler(0x5000, 0x6FFF, M187WriteLo);
|
||||
SetWriteHandler(0x8000, 0x8000, M187Write8000);
|
||||
SetWriteHandler(0x8001, 0x8001, M187Write8001);
|
||||
}
|
||||
|
||||
void Mapper187_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 256, 256, 0, 0);
|
||||
pwrap = M187PW;
|
||||
cwrap = M187CW;
|
||||
info->Power = M187Power;
|
||||
AddExState(EXPREGS, 3, 0, "EXPR");
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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 "mmc3.h"
|
||||
|
||||
static void M189PW(uint32 A, uint8 V) {
|
||||
setprg32(0x8000, EXPREGS[0] & 7);
|
||||
}
|
||||
|
||||
static DECLFW(M189Write) {
|
||||
EXPREGS[0] = V | (V >> 4); /* actually, there is a two versions of 189 mapper with hi or lo bits bankswitching. */
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void M189Power(void) {
|
||||
EXPREGS[0] = EXPREGS[1] = 0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4120, 0x7FFF, M189Write);
|
||||
}
|
||||
|
||||
void Mapper189_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 256, 256, 0, 0);
|
||||
pwrap = M189PW;
|
||||
info->Power = M189Power;
|
||||
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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 "mmc3.h"
|
||||
|
||||
static void M189PW(uint32 A, uint8 V) {
|
||||
setprg32(0x8000, EXPREGS[0] & 7);
|
||||
}
|
||||
|
||||
static DECLFW(M189Write) {
|
||||
EXPREGS[0] = V | (V >> 4); /* actually, there is a two versions of 189 mapper with hi or lo bits bankswitching. */
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void M189Power(void) {
|
||||
EXPREGS[0] = EXPREGS[1] = 0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4120, 0x7FFF, M189Write);
|
||||
}
|
||||
|
||||
void Mapper189_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 256, 256, 0, 0);
|
||||
pwrap = M189PW;
|
||||
info->Power = M189Power;
|
||||
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||
}
|
||||
|
||||
180
src/boards/190.c
180
src/boards/190.c
@@ -1,90 +1,90 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright (C) 2017 FCEUX Team
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Magic Kid GooGoo
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 preg, creg[4];
|
||||
static uint8 *WRAM = NULL;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ creg, 4, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg16(0x8000, preg);
|
||||
setprg16(0xC000, 0);
|
||||
setchr2(0x0000, creg[0]);
|
||||
setchr2(0x0800, creg[1]);
|
||||
setchr2(0x1000, creg[2]);
|
||||
setchr2(0x1800, creg[3]);
|
||||
}
|
||||
|
||||
static DECLFW(M190Write89) {
|
||||
preg = V & 7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M190WriteCD) {
|
||||
preg = 8 | (V & 7);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M190WriteAB) {
|
||||
creg[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M190Power(void) {
|
||||
creg[0] = creg[1] = creg[2] = creg[3] = 0;
|
||||
preg = 0;
|
||||
FCEU_CheatAddRAM(0x2000 >> 10, 0x6000, WRAM);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0x9FFF, M190Write89);
|
||||
SetWriteHandler(0xA000, 0xBFFF, M190WriteAB);
|
||||
SetWriteHandler(0xC000, 0xDFFF, M190WriteCD);
|
||||
setmirror(MI_V);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M190Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper190_Init(CartInfo *info) {
|
||||
info->Power = M190Power;
|
||||
info->Close = M190Close;
|
||||
WRAM = (uint8*)FCEU_gmalloc(0x2000);
|
||||
SetupCartPRGMapping(0x10, WRAM, 0x2000, 1);
|
||||
AddExState(WRAM, 0x2000, 0, "WRAM");
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright (C) 2017 FCEUX Team
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Magic Kid GooGoo
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 preg, creg[4];
|
||||
static uint8 *WRAM = NULL;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ creg, 4, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg16(0x8000, preg);
|
||||
setprg16(0xC000, 0);
|
||||
setchr2(0x0000, creg[0]);
|
||||
setchr2(0x0800, creg[1]);
|
||||
setchr2(0x1000, creg[2]);
|
||||
setchr2(0x1800, creg[3]);
|
||||
}
|
||||
|
||||
static DECLFW(M190Write89) {
|
||||
preg = V & 7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M190WriteCD) {
|
||||
preg = 8 | (V & 7);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M190WriteAB) {
|
||||
creg[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M190Power(void) {
|
||||
creg[0] = creg[1] = creg[2] = creg[3] = 0;
|
||||
preg = 0;
|
||||
FCEU_CheatAddRAM(0x2000 >> 10, 0x6000, WRAM);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0x9FFF, M190Write89);
|
||||
SetWriteHandler(0xA000, 0xBFFF, M190WriteAB);
|
||||
SetWriteHandler(0xC000, 0xDFFF, M190WriteCD);
|
||||
setmirror(MI_V);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M190Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper190_Init(CartInfo *info) {
|
||||
info->Power = M190Power;
|
||||
info->Close = M190Close;
|
||||
WRAM = (uint8*)FCEU_gmalloc(0x2000);
|
||||
SetupCartPRGMapping(0x10, WRAM, 0x2000, 1);
|
||||
AddExState(WRAM, 0x2000, 0, "WRAM");
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
148
src/boards/193.c
148
src/boards/193.c
@@ -1,74 +1,74 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* MEGA-SOFT WAR IN THE GULF
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[8];
|
||||
static uint8 mirror, cmd, bank;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &cmd, 1, "CMD" },
|
||||
{ &mirror, 1, "MIRR" },
|
||||
{ &bank, 1, "BANK" },
|
||||
{ reg, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror(mirror ^ 1);
|
||||
setprg8(0x8000, reg[3]);
|
||||
setprg8(0xA000, 0xD);
|
||||
setprg8(0xC000, 0xE);
|
||||
setprg8(0xE000, 0xF);
|
||||
setchr4(0x0000, reg[0] >> 2);
|
||||
setchr2(0x1000, reg[1] >> 1);
|
||||
setchr2(0x1800, reg[2] >> 1);
|
||||
}
|
||||
|
||||
static DECLFW(M193Write) {
|
||||
reg[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M193Power(void) {
|
||||
bank = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x6000, 0x6003, M193Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, CartBW);
|
||||
}
|
||||
|
||||
static void M193Reset(void) {
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper193_Init(CartInfo *info) {
|
||||
info->Reset = M193Reset;
|
||||
info->Power = M193Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* MEGA-SOFT WAR IN THE GULF
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[8];
|
||||
static uint8 mirror, cmd, bank;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &cmd, 1, "CMD" },
|
||||
{ &mirror, 1, "MIRR" },
|
||||
{ &bank, 1, "BANK" },
|
||||
{ reg, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror(mirror ^ 1);
|
||||
setprg8(0x8000, reg[3]);
|
||||
setprg8(0xA000, 0xD);
|
||||
setprg8(0xC000, 0xE);
|
||||
setprg8(0xE000, 0xF);
|
||||
setchr4(0x0000, reg[0] >> 2);
|
||||
setchr2(0x1000, reg[1] >> 1);
|
||||
setchr2(0x1800, reg[2] >> 1);
|
||||
}
|
||||
|
||||
static DECLFW(M193Write) {
|
||||
reg[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M193Power(void) {
|
||||
bank = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x6000, 0x6003, M193Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, CartBW);
|
||||
}
|
||||
|
||||
static void M193Reset(void) {
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper193_Init(CartInfo *info) {
|
||||
info->Reset = M193Reset;
|
||||
info->Power = M193Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
194
src/boards/199.c
194
src/boards/199.c
@@ -1,97 +1,97 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Dragon Ball Z 2 - Gekishin Freeza! (C)
|
||||
* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C)
|
||||
* San Guo Zhi 2 (C)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static void M199PW(uint32 A, uint8 V) {
|
||||
setprg8(A, V);
|
||||
setprg8(0xC000, EXPREGS[0]);
|
||||
setprg8(0xE000, EXPREGS[1]);
|
||||
}
|
||||
|
||||
static void M199CW(uint32 A, uint8 V) {
|
||||
setchr1r((V < 8) ? 0x10 : 0x00, A, V);
|
||||
setchr1r((DRegBuf[0] < 8) ? 0x10 : 0x00, 0x0000, DRegBuf[0]);
|
||||
setchr1r((EXPREGS[2] < 8) ? 0x10 : 0x00, 0x0400, EXPREGS[2]);
|
||||
setchr1r((DRegBuf[1] < 8) ? 0x10 : 0x00, 0x0800, DRegBuf[1]);
|
||||
setchr1r((EXPREGS[3] < 8) ? 0x10 : 0x00, 0x0c00, EXPREGS[3]);
|
||||
}
|
||||
|
||||
static void M199MW(uint8 V) {
|
||||
/* FCEU_printf("%02x\n",V); */
|
||||
switch (V & 3) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M199Write) {
|
||||
if ((A == 0x8001) && (MMC3_cmd & 8)) {
|
||||
EXPREGS[MMC3_cmd & 3] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
} else
|
||||
if (A < 0xC000)
|
||||
MMC3_CMDWrite(A, V);
|
||||
else
|
||||
MMC3_IRQWrite(A, V);
|
||||
}
|
||||
|
||||
static void M199Power(void) {
|
||||
EXPREGS[0] = ~1;
|
||||
EXPREGS[1] = ~0;
|
||||
EXPREGS[2] = 1;
|
||||
EXPREGS[3] = 3;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M199Write);
|
||||
}
|
||||
|
||||
static void M199Close(void) {
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM = NULL;
|
||||
}
|
||||
|
||||
void Mapper199_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 256, 8, info->battery);
|
||||
cwrap = M199CW;
|
||||
pwrap = M199PW;
|
||||
mwrap = M199MW;
|
||||
info->Power = M199Power;
|
||||
info->Close = M199Close;
|
||||
|
||||
CHRRAMSIZE = 8192;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
|
||||
|
||||
AddExState(EXPREGS, 4, 0, "EXPR");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Dragon Ball Z 2 - Gekishin Freeza! (C)
|
||||
* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C)
|
||||
* San Guo Zhi 2 (C)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static void M199PW(uint32 A, uint8 V) {
|
||||
setprg8(A, V);
|
||||
setprg8(0xC000, EXPREGS[0]);
|
||||
setprg8(0xE000, EXPREGS[1]);
|
||||
}
|
||||
|
||||
static void M199CW(uint32 A, uint8 V) {
|
||||
setchr1r((V < 8) ? 0x10 : 0x00, A, V);
|
||||
setchr1r((DRegBuf[0] < 8) ? 0x10 : 0x00, 0x0000, DRegBuf[0]);
|
||||
setchr1r((EXPREGS[2] < 8) ? 0x10 : 0x00, 0x0400, EXPREGS[2]);
|
||||
setchr1r((DRegBuf[1] < 8) ? 0x10 : 0x00, 0x0800, DRegBuf[1]);
|
||||
setchr1r((EXPREGS[3] < 8) ? 0x10 : 0x00, 0x0c00, EXPREGS[3]);
|
||||
}
|
||||
|
||||
static void M199MW(uint8 V) {
|
||||
/* FCEU_printf("%02x\n",V); */
|
||||
switch (V & 3) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M199Write) {
|
||||
if ((A == 0x8001) && (MMC3_cmd & 8)) {
|
||||
EXPREGS[MMC3_cmd & 3] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
} else
|
||||
if (A < 0xC000)
|
||||
MMC3_CMDWrite(A, V);
|
||||
else
|
||||
MMC3_IRQWrite(A, V);
|
||||
}
|
||||
|
||||
static void M199Power(void) {
|
||||
EXPREGS[0] = ~1;
|
||||
EXPREGS[1] = ~0;
|
||||
EXPREGS[2] = 1;
|
||||
EXPREGS[3] = 3;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M199Write);
|
||||
}
|
||||
|
||||
static void M199Close(void) {
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM = NULL;
|
||||
}
|
||||
|
||||
void Mapper199_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 256, 8, info->battery);
|
||||
cwrap = M199CW;
|
||||
pwrap = M199PW;
|
||||
mwrap = M199MW;
|
||||
info->Power = M199Power;
|
||||
info->Close = M199Close;
|
||||
|
||||
CHRRAMSIZE = 8192;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
|
||||
|
||||
AddExState(EXPREGS, 4, 0, "EXPR");
|
||||
}
|
||||
|
||||
156
src/boards/208.c
156
src/boards/208.c
@@ -1,78 +1,78 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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 "mmc3.h"
|
||||
|
||||
static uint8 lut[256] = {
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01,
|
||||
0x00, 0x10, 0x40, 0x50, 0x00, 0x10, 0x40, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x08, 0x18, 0x48, 0x58, 0x08, 0x18, 0x48, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x10, 0x40, 0x50, 0x00, 0x10, 0x40, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x08, 0x18, 0x48, 0x58, 0x08, 0x18, 0x48, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x58, 0x48, 0x18, 0x08, 0x58, 0x48, 0x18, 0x08,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x50, 0x40, 0x10, 0x00, 0x50, 0x40, 0x10, 0x00,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x58, 0x48, 0x18, 0x08, 0x58, 0x48, 0x18, 0x08,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x50, 0x40, 0x10, 0x00, 0x50, 0x40, 0x10, 0x00,
|
||||
0x01, 0x11, 0x41, 0x51, 0x01, 0x11, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x11, 0x41, 0x51, 0x01, 0x11, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
static void M208PW(uint32 A, uint8 V) {
|
||||
setprg32(0x8000, EXPREGS[5]);
|
||||
}
|
||||
|
||||
static DECLFW(M208Write) {
|
||||
EXPREGS[5] = (V & 0x1) | ((V >> 3) & 0x2);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static DECLFW(M208ProtWrite) {
|
||||
if (A <= 0x57FF)
|
||||
EXPREGS[4] = V;
|
||||
else
|
||||
EXPREGS[(A & 0x03)] = V ^ lut[EXPREGS[4]];
|
||||
}
|
||||
|
||||
static DECLFR(M208ProtRead) {
|
||||
return(EXPREGS[(A & 0x3)]);
|
||||
}
|
||||
|
||||
static void M208Power(void) {
|
||||
EXPREGS[5] = 3;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4800, 0x4fff, M208Write);
|
||||
SetWriteHandler(0x6800, 0x6fff, M208Write);
|
||||
SetWriteHandler(0x5000, 0x5fff, M208ProtWrite);
|
||||
SetReadHandler(0x5800, 0x5fff, M208ProtRead);
|
||||
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||
}
|
||||
|
||||
void Mapper208_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
pwrap = M208PW;
|
||||
info->Power = M208Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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 "mmc3.h"
|
||||
|
||||
static uint8 lut[256] = {
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01,
|
||||
0x00, 0x10, 0x40, 0x50, 0x00, 0x10, 0x40, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x08, 0x18, 0x48, 0x58, 0x08, 0x18, 0x48, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x10, 0x40, 0x50, 0x00, 0x10, 0x40, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x08, 0x18, 0x48, 0x58, 0x08, 0x18, 0x48, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x58, 0x48, 0x18, 0x08, 0x58, 0x48, 0x18, 0x08,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x50, 0x40, 0x10, 0x00, 0x50, 0x40, 0x10, 0x00,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x58, 0x48, 0x18, 0x08, 0x58, 0x48, 0x18, 0x08,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x50, 0x40, 0x10, 0x00, 0x50, 0x40, 0x10, 0x00,
|
||||
0x01, 0x11, 0x41, 0x51, 0x01, 0x11, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x11, 0x41, 0x51, 0x01, 0x11, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
static void M208PW(uint32 A, uint8 V) {
|
||||
setprg32(0x8000, EXPREGS[5]);
|
||||
}
|
||||
|
||||
static DECLFW(M208Write) {
|
||||
EXPREGS[5] = (V & 0x1) | ((V >> 3) & 0x2);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static DECLFW(M208ProtWrite) {
|
||||
if (A <= 0x57FF)
|
||||
EXPREGS[4] = V;
|
||||
else
|
||||
EXPREGS[(A & 0x03)] = V ^ lut[EXPREGS[4]];
|
||||
}
|
||||
|
||||
static DECLFR(M208ProtRead) {
|
||||
return(EXPREGS[(A & 0x3)]);
|
||||
}
|
||||
|
||||
static void M208Power(void) {
|
||||
EXPREGS[5] = 3;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4800, 0x4fff, M208Write);
|
||||
SetWriteHandler(0x6800, 0x6fff, M208Write);
|
||||
SetWriteHandler(0x5000, 0x5fff, M208ProtWrite);
|
||||
SetReadHandler(0x5800, 0x5fff, M208ProtRead);
|
||||
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||
}
|
||||
|
||||
void Mapper208_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
pwrap = M208PW;
|
||||
info->Power = M208Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
}
|
||||
|
||||
202
src/boards/222.c
202
src/boards/222.c
@@ -1,101 +1,101 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* (VRC4 mapper)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 IRQCount; /*, IRQPre; */
|
||||
static uint8 IRQa;
|
||||
static uint8 prg_reg[2];
|
||||
static uint8 chr_reg[8];
|
||||
static uint8 mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ prg_reg, 2, "PRG" },
|
||||
{ chr_reg, 8, "CHR" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void M222IRQ(void) {
|
||||
if (IRQa) {
|
||||
IRQCount++;
|
||||
if (IRQCount >= 238) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
/* IRQa=0; */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Sync(void) {
|
||||
int i;
|
||||
setprg8(0x8000, prg_reg[0]);
|
||||
setprg8(0xA000, prg_reg[1]);
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, chr_reg[i]);
|
||||
setmirror(mirr ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M222Write) {
|
||||
switch (A & 0xF003) {
|
||||
case 0x8000: prg_reg[0] = V; break;
|
||||
case 0x9000: mirr = V & 1; break;
|
||||
case 0xA000: prg_reg[1] = V; break;
|
||||
case 0xB000: chr_reg[0] = V; break;
|
||||
case 0xB002: chr_reg[1] = V; break;
|
||||
case 0xC000: chr_reg[2] = V; break;
|
||||
case 0xC002: chr_reg[3] = V; break;
|
||||
case 0xD000: chr_reg[4] = V; break;
|
||||
case 0xD002: chr_reg[5] = V; break;
|
||||
case 0xE000: chr_reg[6] = V; break;
|
||||
case 0xE002: chr_reg[7] = V; break;
|
||||
#if 0
|
||||
case 0xF000: FCEU_printf("%04x:%02x %d\n",A,V,scanline); IRQa=V; if(!V)IRQPre=0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xF001: FCEU_printf("%04x:%02x %d\n",A,V,scanline); IRQCount=V; break;
|
||||
case 0xF002: FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
|
||||
case 0xD001: IRQa=V; X6502_IRQEnd(FCEU_IQEXT); FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
|
||||
case 0xC001: IRQPre=16; FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
|
||||
#endif
|
||||
case 0xF000: IRQa = IRQCount = V; if (scanline < 240) IRQCount -= 8; else IRQCount += 4; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M222Power(void) {
|
||||
setprg16(0xC000, ~0);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M222Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper222_Init(CartInfo *info) {
|
||||
info->Power = M222Power;
|
||||
GameHBIRQHook = M222IRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* (VRC4 mapper)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 IRQCount; /*, IRQPre; */
|
||||
static uint8 IRQa;
|
||||
static uint8 prg_reg[2];
|
||||
static uint8 chr_reg[8];
|
||||
static uint8 mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ prg_reg, 2, "PRG" },
|
||||
{ chr_reg, 8, "CHR" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void M222IRQ(void) {
|
||||
if (IRQa) {
|
||||
IRQCount++;
|
||||
if (IRQCount >= 238) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
/* IRQa=0; */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Sync(void) {
|
||||
int i;
|
||||
setprg8(0x8000, prg_reg[0]);
|
||||
setprg8(0xA000, prg_reg[1]);
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, chr_reg[i]);
|
||||
setmirror(mirr ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M222Write) {
|
||||
switch (A & 0xF003) {
|
||||
case 0x8000: prg_reg[0] = V; break;
|
||||
case 0x9000: mirr = V & 1; break;
|
||||
case 0xA000: prg_reg[1] = V; break;
|
||||
case 0xB000: chr_reg[0] = V; break;
|
||||
case 0xB002: chr_reg[1] = V; break;
|
||||
case 0xC000: chr_reg[2] = V; break;
|
||||
case 0xC002: chr_reg[3] = V; break;
|
||||
case 0xD000: chr_reg[4] = V; break;
|
||||
case 0xD002: chr_reg[5] = V; break;
|
||||
case 0xE000: chr_reg[6] = V; break;
|
||||
case 0xE002: chr_reg[7] = V; break;
|
||||
#if 0
|
||||
case 0xF000: FCEU_printf("%04x:%02x %d\n",A,V,scanline); IRQa=V; if(!V)IRQPre=0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xF001: FCEU_printf("%04x:%02x %d\n",A,V,scanline); IRQCount=V; break;
|
||||
case 0xF002: FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
|
||||
case 0xD001: IRQa=V; X6502_IRQEnd(FCEU_IQEXT); FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
|
||||
case 0xC001: IRQPre=16; FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
|
||||
#endif
|
||||
case 0xF000: IRQa = IRQCount = V; if (scanline < 240) IRQCount -= 8; else IRQCount += 4; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M222Power(void) {
|
||||
setprg16(0xC000, ~0);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M222Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper222_Init(CartInfo *info) {
|
||||
info->Power = M222Power;
|
||||
GameHBIRQHook = M222IRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
178
src/boards/225.c
178
src/boards/225.c
@@ -1,89 +1,89 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* PCB-018 board, discrete multigame cart 110-in-1
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prot[4], prg, mode, chr, mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ prot, 4, "PROT" },
|
||||
{ &prg, 1, "PRG" },
|
||||
{ &chr, 1, "CHR" },
|
||||
{ &mode, 1, "MODE" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (mode) {
|
||||
setprg16(0x8000, prg);
|
||||
setprg16(0xC000, prg);
|
||||
} else
|
||||
setprg32(0x8000, prg >> 1);
|
||||
setchr8(chr);
|
||||
setmirror(mirr ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M225Write) {
|
||||
uint32 bank = (A >> 14) & 1;
|
||||
mirr = (A >> 13) & 1;
|
||||
mode = (A >> 12) & 1;
|
||||
chr = (A & 0x3f) | (bank << 6);
|
||||
prg = ((A >> 6) & 0x3f) | (bank << 6);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M225LoWrite) {
|
||||
}
|
||||
|
||||
static DECLFR(M225LoRead) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void M225Power(void) {
|
||||
prg = 0;
|
||||
mode = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x5000, 0x5fff, M225LoRead);
|
||||
SetWriteHandler(0x5000, 0x5fff, M225LoWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M225Write);
|
||||
}
|
||||
|
||||
static void M225Reset(void) {
|
||||
prg = 0;
|
||||
mode = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper225_Init(CartInfo *info) {
|
||||
info->Reset = M225Reset;
|
||||
info->Power = M225Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* PCB-018 board, discrete multigame cart 110-in-1
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prot[4], prg, mode, chr, mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ prot, 4, "PROT" },
|
||||
{ &prg, 1, "PRG" },
|
||||
{ &chr, 1, "CHR" },
|
||||
{ &mode, 1, "MODE" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (mode) {
|
||||
setprg16(0x8000, prg);
|
||||
setprg16(0xC000, prg);
|
||||
} else
|
||||
setprg32(0x8000, prg >> 1);
|
||||
setchr8(chr);
|
||||
setmirror(mirr ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M225Write) {
|
||||
uint32 bank = (A >> 14) & 1;
|
||||
mirr = (A >> 13) & 1;
|
||||
mode = (A >> 12) & 1;
|
||||
chr = (A & 0x3f) | (bank << 6);
|
||||
prg = ((A >> 6) & 0x3f) | (bank << 6);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M225LoWrite) {
|
||||
}
|
||||
|
||||
static DECLFR(M225LoRead) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void M225Power(void) {
|
||||
prg = 0;
|
||||
mode = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x5000, 0x5fff, M225LoRead);
|
||||
SetWriteHandler(0x5000, 0x5fff, M225LoWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M225Write);
|
||||
}
|
||||
|
||||
static void M225Reset(void) {
|
||||
prg = 0;
|
||||
mode = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper225_Init(CartInfo *info) {
|
||||
info->Reset = M225Reset;
|
||||
info->Power = M225Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
170
src/boards/228.c
170
src/boards/228.c
@@ -1,85 +1,85 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 mram[4], vreg;
|
||||
static uint16 areg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ mram, 4, "MRAM" },
|
||||
{ &areg, 2, "AREG" },
|
||||
{ &vreg, 1, "VREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint32 prgl, prgh, page = (areg >> 7) & 0x3F;
|
||||
if ((page & 0x30) == 0x30)
|
||||
page -= 0x10;
|
||||
prgl = prgh = (page << 1) + (((areg >> 6) & 1) & ((areg >> 5) & 1));
|
||||
prgh += ((areg >> 5) & 1) ^ 1;
|
||||
|
||||
setmirror(((areg >> 13) & 1) ^ 1);
|
||||
setprg16(0x8000, prgl);
|
||||
setprg16(0xc000, prgh);
|
||||
setchr8(((vreg & 0x3) | ((areg & 0xF) << 2)));
|
||||
}
|
||||
|
||||
static DECLFW(M228RamWrite) {
|
||||
mram[A & 3] = V & 0x0F;
|
||||
}
|
||||
|
||||
static DECLFR(M228RamRead) {
|
||||
return mram[A & 3];
|
||||
}
|
||||
|
||||
static DECLFW(M228Write) {
|
||||
areg = A;
|
||||
vreg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M228Reset(void) {
|
||||
areg = 0x8000;
|
||||
vreg = 0;
|
||||
memset(mram, 0, sizeof(mram));
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M228Power(void) {
|
||||
M228Reset();
|
||||
SetReadHandler(0x5000, 0x5FFF, M228RamRead);
|
||||
SetWriteHandler(0x5000, 0x5FFF, M228RamWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M228Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper228_Init(CartInfo *info) {
|
||||
info->Reset = M228Reset;
|
||||
info->Power = M228Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 mram[4], vreg;
|
||||
static uint16 areg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ mram, 4, "MRAM" },
|
||||
{ &areg, 2, "AREG" },
|
||||
{ &vreg, 1, "VREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint32 prgl, prgh, page = (areg >> 7) & 0x3F;
|
||||
if ((page & 0x30) == 0x30)
|
||||
page -= 0x10;
|
||||
prgl = prgh = (page << 1) + (((areg >> 6) & 1) & ((areg >> 5) & 1));
|
||||
prgh += ((areg >> 5) & 1) ^ 1;
|
||||
|
||||
setmirror(((areg >> 13) & 1) ^ 1);
|
||||
setprg16(0x8000, prgl);
|
||||
setprg16(0xc000, prgh);
|
||||
setchr8(((vreg & 0x3) | ((areg & 0xF) << 2)));
|
||||
}
|
||||
|
||||
static DECLFW(M228RamWrite) {
|
||||
mram[A & 3] = V & 0x0F;
|
||||
}
|
||||
|
||||
static DECLFR(M228RamRead) {
|
||||
return mram[A & 3];
|
||||
}
|
||||
|
||||
static DECLFW(M228Write) {
|
||||
areg = A;
|
||||
vreg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M228Reset(void) {
|
||||
areg = 0x8000;
|
||||
vreg = 0;
|
||||
memset(mram, 0, sizeof(mram));
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M228Power(void) {
|
||||
M228Reset();
|
||||
SetReadHandler(0x5000, 0x5FFF, M228RamRead);
|
||||
SetWriteHandler(0x5000, 0x5FFF, M228RamWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M228Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper228_Init(CartInfo *info) {
|
||||
info->Reset = M228Reset;
|
||||
info->Power = M228Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
156
src/boards/230.c
156
src/boards/230.c
@@ -1,78 +1,78 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
* Copyright (C) 2009 qeed
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 22 + Contra Reset based custom mapper...
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latche, reset;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &reset, 1, "RST" },
|
||||
{ &latche, 1, "LATC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (reset) {
|
||||
setprg16(0x8000, latche & 7);
|
||||
setprg16(0xC000, 7);
|
||||
setmirror(MI_V);
|
||||
} else {
|
||||
uint32 bank = (latche & 0x1F) + 8;
|
||||
if (latche & 0x20) {
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
} else
|
||||
setprg32(0x8000, bank >> 1);
|
||||
setmirror((latche >> 6) & 1);
|
||||
}
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M230Write) {
|
||||
latche = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M230Reset(void) {
|
||||
reset ^= 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M230Power(void) {
|
||||
latche = reset = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M230Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper230_Init(CartInfo *info) {
|
||||
info->Power = M230Power;
|
||||
info->Reset = M230Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
* Copyright (C) 2009 qeed
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 22 + Contra Reset based custom mapper...
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latche, reset;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &reset, 1, "RST" },
|
||||
{ &latche, 1, "LATC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (reset) {
|
||||
setprg16(0x8000, latche & 7);
|
||||
setprg16(0xC000, 7);
|
||||
setmirror(MI_V);
|
||||
} else {
|
||||
uint32 bank = (latche & 0x1F) + 8;
|
||||
if (latche & 0x20) {
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
} else
|
||||
setprg32(0x8000, bank >> 1);
|
||||
setmirror((latche >> 6) & 1);
|
||||
}
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M230Write) {
|
||||
latche = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M230Reset(void) {
|
||||
reset ^= 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M230Power(void) {
|
||||
latche = reset = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M230Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper230_Init(CartInfo *info) {
|
||||
info->Power = M230Power;
|
||||
info->Reset = M230Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
138
src/boards/232.c
138
src/boards/232.c
@@ -1,69 +1,69 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 bank, preg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &bank, 1, "BANK" },
|
||||
{ &preg, 1, "PREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
/* uint32 bbank = (bank & 0x18) >> 1; */
|
||||
uint32 bbank = ((bank & 0x10) >> 2) | (bank & 8); /* some dumps have bbanks swapped, if swap commands,
|
||||
* then all roms can be played, but with some swapped
|
||||
* games in menu. if not, some dumps are unplayable
|
||||
* make hard dump for both cart types to check
|
||||
*/
|
||||
setprg16(0x8000, bbank | (preg & 3));
|
||||
setprg16(0xC000, bbank | 3);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M232WriteBank) {
|
||||
bank = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M232WritePreg) {
|
||||
preg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M232Power(void) {
|
||||
bank = preg = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xBFFF, M232WriteBank);
|
||||
SetWriteHandler(0xC000, 0xFFFF, M232WritePreg);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper232_Init(CartInfo *info) {
|
||||
info->Power = M232Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 bank, preg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &bank, 1, "BANK" },
|
||||
{ &preg, 1, "PREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
/* uint32 bbank = (bank & 0x18) >> 1; */
|
||||
uint32 bbank = ((bank & 0x10) >> 2) | (bank & 8); /* some dumps have bbanks swapped, if swap commands,
|
||||
* then all roms can be played, but with some swapped
|
||||
* games in menu. if not, some dumps are unplayable
|
||||
* make hard dump for both cart types to check
|
||||
*/
|
||||
setprg16(0x8000, bbank | (preg & 3));
|
||||
setprg16(0xC000, bbank | 3);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M232WriteBank) {
|
||||
bank = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M232WritePreg) {
|
||||
preg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M232Power(void) {
|
||||
bank = preg = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xBFFF, M232WriteBank);
|
||||
SetWriteHandler(0xC000, 0xFFFF, M232WritePreg);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper232_Init(CartInfo *info) {
|
||||
info->Power = M232Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
158
src/boards/234.c
158
src/boards/234.c
@@ -1,79 +1,79 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 bank, preg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &bank, 1, "BANK" },
|
||||
{ &preg, 1, "PREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (bank & 0x40) {
|
||||
setprg32(0x8000, (bank & 0xE) | (preg & 1));
|
||||
setchr8(((bank & 0xE) << 2) | ((preg >> 4) & 7));
|
||||
} else {
|
||||
setprg32(0x8000, bank & 0xF);
|
||||
setchr8(((bank & 0xF) << 2) | ((preg >> 4) & 3));
|
||||
}
|
||||
setmirror((bank >> 7) ^ 1);
|
||||
}
|
||||
|
||||
DECLFR(M234ReadBank) {
|
||||
uint8 r = CartBR(A);
|
||||
if (!bank) {
|
||||
bank = r;
|
||||
Sync();
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
DECLFR(M234ReadPreg) {
|
||||
uint8 r = CartBR(A);
|
||||
preg = r;
|
||||
Sync();
|
||||
return r;
|
||||
}
|
||||
|
||||
static void M234Reset(void) {
|
||||
bank = preg = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M234Power(void) {
|
||||
M234Reset();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetReadHandler(0xFF80, 0xFF9F, M234ReadBank);
|
||||
SetReadHandler(0xFFE8, 0xFFF7, M234ReadPreg);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper234_Init(CartInfo *info) {
|
||||
info->Power = M234Power;
|
||||
info->Reset = M234Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 bank, preg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &bank, 1, "BANK" },
|
||||
{ &preg, 1, "PREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (bank & 0x40) {
|
||||
setprg32(0x8000, (bank & 0xE) | (preg & 1));
|
||||
setchr8(((bank & 0xE) << 2) | ((preg >> 4) & 7));
|
||||
} else {
|
||||
setprg32(0x8000, bank & 0xF);
|
||||
setchr8(((bank & 0xF) << 2) | ((preg >> 4) & 3));
|
||||
}
|
||||
setmirror((bank >> 7) ^ 1);
|
||||
}
|
||||
|
||||
DECLFR(M234ReadBank) {
|
||||
uint8 r = CartBR(A);
|
||||
if (!bank) {
|
||||
bank = r;
|
||||
Sync();
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
DECLFR(M234ReadPreg) {
|
||||
uint8 r = CartBR(A);
|
||||
preg = r;
|
||||
Sync();
|
||||
return r;
|
||||
}
|
||||
|
||||
static void M234Reset(void) {
|
||||
bank = preg = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M234Power(void) {
|
||||
M234Reset();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetReadHandler(0xFF80, 0xFF9F, M234ReadBank);
|
||||
SetReadHandler(0xFFE8, 0xFFF7, M234ReadPreg);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper234_Init(CartInfo *info) {
|
||||
info->Power = M234Power;
|
||||
info->Reset = M234Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
126
src/boards/235.c
126
src/boards/235.c
@@ -1,63 +1,63 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint16 cmdreg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &cmdreg, 2, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (cmdreg & 0x400)
|
||||
setmirror(MI_0);
|
||||
else
|
||||
setmirror(((cmdreg >> 13) & 1) ^ 1);
|
||||
if (cmdreg & 0x800) {
|
||||
setprg16(0x8000, ((cmdreg & 0x300) >> 3) | ((cmdreg & 0x1F) << 1) | ((cmdreg >> 12) & 1));
|
||||
setprg16(0xC000, ((cmdreg & 0x300) >> 3) | ((cmdreg & 0x1F) << 1) | ((cmdreg >> 12) & 1));
|
||||
} else
|
||||
setprg32(0x8000, ((cmdreg & 0x300) >> 4) | (cmdreg & 0x1F));
|
||||
}
|
||||
|
||||
static DECLFW(M235Write) {
|
||||
cmdreg = A;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M235Power(void) {
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M235Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
cmdreg = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M235Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper235_Init(CartInfo *info) {
|
||||
info->Power = M235Power;
|
||||
GameStateRestore = M235Restore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint16 cmdreg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &cmdreg, 2, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (cmdreg & 0x400)
|
||||
setmirror(MI_0);
|
||||
else
|
||||
setmirror(((cmdreg >> 13) & 1) ^ 1);
|
||||
if (cmdreg & 0x800) {
|
||||
setprg16(0x8000, ((cmdreg & 0x300) >> 3) | ((cmdreg & 0x1F) << 1) | ((cmdreg >> 12) & 1));
|
||||
setprg16(0xC000, ((cmdreg & 0x300) >> 3) | ((cmdreg & 0x1F) << 1) | ((cmdreg >> 12) & 1));
|
||||
} else
|
||||
setprg32(0x8000, ((cmdreg & 0x300) >> 4) | (cmdreg & 0x1F));
|
||||
}
|
||||
|
||||
static DECLFW(M235Write) {
|
||||
cmdreg = A;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M235Power(void) {
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M235Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
cmdreg = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M235Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper235_Init(CartInfo *info) {
|
||||
info->Power = M235Power;
|
||||
GameStateRestore = M235Restore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
154
src/boards/244.c
154
src/boards/244.c
@@ -1,77 +1,77 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg, creg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ &creg, 1, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static uint8 prg_perm[4][4] = {
|
||||
{ 0, 1, 2, 3, },
|
||||
{ 3, 2, 1, 0, },
|
||||
{ 0, 2, 1, 3, },
|
||||
{ 3, 1, 2, 0, },
|
||||
};
|
||||
|
||||
static uint8 chr_perm[8][8] = {
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, },
|
||||
{ 0, 2, 1, 3, 4, 6, 5, 7, },
|
||||
{ 0, 1, 4, 5, 2, 3, 6, 7, },
|
||||
{ 0, 4, 1, 5, 2, 6, 3, 7, },
|
||||
{ 0, 4, 2, 6, 1, 5, 3, 7, },
|
||||
{ 0, 2, 4, 6, 1, 3, 5, 7, },
|
||||
{ 7, 6, 5, 4, 3, 2, 1, 0, },
|
||||
{ 7, 6, 5, 4, 3, 2, 1, 0, },
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, preg);
|
||||
setchr8(creg);
|
||||
}
|
||||
|
||||
static DECLFW(M244Write) {
|
||||
if (V & 8)
|
||||
creg = chr_perm[(V >> 4) & 7][V & 7];
|
||||
else
|
||||
preg = prg_perm[(V >> 4) & 3][V & 3];
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M244Power(void) {
|
||||
preg = creg = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M244Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper244_Init(CartInfo *info) {
|
||||
info->Power = M244Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg, creg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ &creg, 1, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static uint8 prg_perm[4][4] = {
|
||||
{ 0, 1, 2, 3, },
|
||||
{ 3, 2, 1, 0, },
|
||||
{ 0, 2, 1, 3, },
|
||||
{ 3, 1, 2, 0, },
|
||||
};
|
||||
|
||||
static uint8 chr_perm[8][8] = {
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, },
|
||||
{ 0, 2, 1, 3, 4, 6, 5, 7, },
|
||||
{ 0, 1, 4, 5, 2, 3, 6, 7, },
|
||||
{ 0, 4, 1, 5, 2, 6, 3, 7, },
|
||||
{ 0, 4, 2, 6, 1, 5, 3, 7, },
|
||||
{ 0, 2, 4, 6, 1, 3, 5, 7, },
|
||||
{ 7, 6, 5, 4, 3, 2, 1, 0, },
|
||||
{ 7, 6, 5, 4, 3, 2, 1, 0, },
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, preg);
|
||||
setchr8(creg);
|
||||
}
|
||||
|
||||
static DECLFW(M244Write) {
|
||||
if (V & 8)
|
||||
creg = chr_perm[(V >> 4) & 7][V & 7];
|
||||
else
|
||||
preg = prg_perm[(V >> 4) & 3][V & 3];
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M244Power(void) {
|
||||
preg = creg = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M244Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper244_Init(CartInfo *info) {
|
||||
info->Power = M244Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
172
src/boards/246.c
172
src/boards/246.c
@@ -1,86 +1,86 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 regs[8];
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg2r(0x10, 0x6800, 0);
|
||||
setprg8(0x8000, regs[0]);
|
||||
setprg8(0xA000, regs[1]);
|
||||
setprg8(0xC000, regs[2]);
|
||||
setprg8(0xE000, regs[3]);
|
||||
setchr2(0x0000, regs[4]);
|
||||
setchr2(0x0800, regs[5]);
|
||||
setchr2(0x1000, regs[6]);
|
||||
setchr2(0x1800, regs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(M246Write) {
|
||||
regs[A & 7] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M246Power(void) {
|
||||
regs[0] = regs[1] = regs[2] = regs[3] = ~0;
|
||||
Sync();
|
||||
SetWriteHandler(0x6000, 0x67FF, M246Write);
|
||||
SetReadHandler(0x6800, 0x6FFF, CartBR);
|
||||
SetWriteHandler(0x6800, 0x6FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M246Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper246_Init(CartInfo *info) {
|
||||
info->Power = M246Power;
|
||||
info->Close = M246Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 2048;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 regs[8];
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg2r(0x10, 0x6800, 0);
|
||||
setprg8(0x8000, regs[0]);
|
||||
setprg8(0xA000, regs[1]);
|
||||
setprg8(0xC000, regs[2]);
|
||||
setprg8(0xE000, regs[3]);
|
||||
setchr2(0x0000, regs[4]);
|
||||
setchr2(0x0800, regs[5]);
|
||||
setchr2(0x1000, regs[6]);
|
||||
setchr2(0x1800, regs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(M246Write) {
|
||||
regs[A & 7] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M246Power(void) {
|
||||
regs[0] = regs[1] = regs[2] = regs[3] = ~0;
|
||||
Sync();
|
||||
SetWriteHandler(0x6000, 0x67FF, M246Write);
|
||||
SetReadHandler(0x6800, 0x6FFF, CartBR);
|
||||
SetWriteHandler(0x6800, 0x6FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M246Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper246_Init(CartInfo *info) {
|
||||
info->Power = M246Power;
|
||||
info->Close = M246Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 2048;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
270
src/boards/252.c
270
src/boards/252.c
@@ -1,135 +1,135 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 creg[8], preg[2];
|
||||
static int32 IRQa, IRQCount, IRQClock, IRQLatch;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ creg, 8, "CREG" },
|
||||
{ preg, 2, "PREG" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQLatch, 4, "IRQL" },
|
||||
{ &IRQClock, 4, "IRQK" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 i;
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000, preg[0]);
|
||||
setprg8(0xa000, preg[1]);
|
||||
setprg8(0xc000, ~1);
|
||||
setprg8(0xe000, ~0);
|
||||
for (i = 0; i < 8; i++)
|
||||
if ((creg[i] == 6) || (creg[i] == 7))
|
||||
setchr1r(0x10, i << 10, creg[i] & 1);
|
||||
else
|
||||
setchr1(i << 10, creg[i]);
|
||||
}
|
||||
|
||||
static DECLFW(M252Write) {
|
||||
if ((A >= 0xB000) && (A <= 0xEFFF)) {
|
||||
uint8 ind = ((((A & 8) | (A >> 8)) >> 3) + 2) & 7;
|
||||
uint8 sar = A & 4;
|
||||
creg[ind] = (creg[ind] & (0xF0 >> sar)) | ((V & 0x0F) << sar);
|
||||
Sync();
|
||||
} else
|
||||
switch (A & 0xF00C) {
|
||||
case 0x8000:
|
||||
case 0x8004:
|
||||
case 0x8008:
|
||||
case 0x800C: preg[0] = V; Sync(); break;
|
||||
case 0xA000:
|
||||
case 0xA004:
|
||||
case 0xA008:
|
||||
case 0xA00C: preg[1] = V; Sync(); break;
|
||||
case 0xF000: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0xF0; IRQLatch |= V & 0xF; break;
|
||||
case 0xF004: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0x0F; IRQLatch |= V << 4; break;
|
||||
case 0xF008: X6502_IRQEnd(FCEU_IQEXT); IRQClock = 0; IRQCount = IRQLatch; IRQa = V & 2; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M252Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M252Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M252IRQ(int a) {
|
||||
#define LCYCS 341
|
||||
if (IRQa) {
|
||||
IRQClock += a * 3;
|
||||
if (IRQClock >= LCYCS) {
|
||||
while (IRQClock >= LCYCS) {
|
||||
IRQClock -= LCYCS;
|
||||
IRQCount++;
|
||||
if (IRQCount & 0x100) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount = IRQLatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M252Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
WRAM = CHRRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper252_Init(CartInfo *info) {
|
||||
info->Power = M252Power;
|
||||
info->Close = M252Close;
|
||||
MapIRQHook = M252IRQ;
|
||||
|
||||
CHRRAMSIZE = 2048;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 creg[8], preg[2];
|
||||
static int32 IRQa, IRQCount, IRQClock, IRQLatch;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ creg, 8, "CREG" },
|
||||
{ preg, 2, "PREG" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQLatch, 4, "IRQL" },
|
||||
{ &IRQClock, 4, "IRQK" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 i;
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000, preg[0]);
|
||||
setprg8(0xa000, preg[1]);
|
||||
setprg8(0xc000, ~1);
|
||||
setprg8(0xe000, ~0);
|
||||
for (i = 0; i < 8; i++)
|
||||
if ((creg[i] == 6) || (creg[i] == 7))
|
||||
setchr1r(0x10, i << 10, creg[i] & 1);
|
||||
else
|
||||
setchr1(i << 10, creg[i]);
|
||||
}
|
||||
|
||||
static DECLFW(M252Write) {
|
||||
if ((A >= 0xB000) && (A <= 0xEFFF)) {
|
||||
uint8 ind = ((((A & 8) | (A >> 8)) >> 3) + 2) & 7;
|
||||
uint8 sar = A & 4;
|
||||
creg[ind] = (creg[ind] & (0xF0 >> sar)) | ((V & 0x0F) << sar);
|
||||
Sync();
|
||||
} else
|
||||
switch (A & 0xF00C) {
|
||||
case 0x8000:
|
||||
case 0x8004:
|
||||
case 0x8008:
|
||||
case 0x800C: preg[0] = V; Sync(); break;
|
||||
case 0xA000:
|
||||
case 0xA004:
|
||||
case 0xA008:
|
||||
case 0xA00C: preg[1] = V; Sync(); break;
|
||||
case 0xF000: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0xF0; IRQLatch |= V & 0xF; break;
|
||||
case 0xF004: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0x0F; IRQLatch |= V << 4; break;
|
||||
case 0xF008: X6502_IRQEnd(FCEU_IQEXT); IRQClock = 0; IRQCount = IRQLatch; IRQa = V & 2; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M252Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M252Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M252IRQ(int a) {
|
||||
#define LCYCS 341
|
||||
if (IRQa) {
|
||||
IRQClock += a * 3;
|
||||
if (IRQClock >= LCYCS) {
|
||||
while (IRQClock >= LCYCS) {
|
||||
IRQClock -= LCYCS;
|
||||
IRQCount++;
|
||||
if (IRQCount & 0x100) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount = IRQLatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M252Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
WRAM = CHRRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper252_Init(CartInfo *info) {
|
||||
info->Power = M252Power;
|
||||
info->Close = M252Close;
|
||||
MapIRQHook = M252IRQ;
|
||||
|
||||
CHRRAMSIZE = 2048;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
304
src/boards/253.c
304
src/boards/253.c
@@ -1,152 +1,152 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 chrlo[8], chrhi[8], prg[2], mirr, vlock;
|
||||
static int32 IRQa, IRQCount, IRQLatch, IRQClock;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ chrlo, 8, "CHRL" },
|
||||
{ chrhi, 8, "CHRH" },
|
||||
{ prg, 2, "PRGR" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &vlock, 1, "VLCK" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQLatch, 4, "IRQL" },
|
||||
{ &IRQClock, 4, "IRQK" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 i;
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000, prg[0]);
|
||||
setprg8(0xa000, prg[1]);
|
||||
setprg8(0xc000, ~1);
|
||||
setprg8(0xe000, ~0);
|
||||
for (i = 0; i < 8; i++) {
|
||||
uint32 chr = chrlo[i] | (chrhi[i] << 8);
|
||||
if (((chrlo[i] == 4) || (chrlo[i] == 5)) && !vlock)
|
||||
setchr1r(0x10, i << 10, chr & 1);
|
||||
else
|
||||
setchr1(i << 10, chr);
|
||||
}
|
||||
switch (mirr) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M253Write) {
|
||||
if ((A >= 0xB000) && (A <= 0xE00C)) {
|
||||
uint8 ind = ((((A & 8) | (A >> 8)) >> 3) + 2) & 7;
|
||||
uint8 sar = A & 4;
|
||||
uint8 clo = (chrlo[ind] & (0xF0 >> sar)) | ((V & 0x0F) << sar);
|
||||
chrlo[ind] = clo;
|
||||
if (ind == 0) {
|
||||
if (clo == 0xc8)
|
||||
vlock = 0;
|
||||
else if (clo == 0x88)
|
||||
vlock = 1;
|
||||
}
|
||||
if (sar)
|
||||
chrhi[ind] = V >> 4;
|
||||
Sync();
|
||||
} else
|
||||
switch (A) {
|
||||
case 0x8010: prg[0] = V; Sync(); break;
|
||||
case 0xA010: prg[1] = V; Sync(); break;
|
||||
case 0x9400: mirr = V & 3; Sync(); break;
|
||||
case 0xF000: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0xF0; IRQLatch |= V & 0xF; break;
|
||||
case 0xF004: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0x0F; IRQLatch |= V << 4; break;
|
||||
case 0xF008: X6502_IRQEnd(FCEU_IQEXT); IRQClock = 0; IRQCount = IRQLatch; IRQa = V & 2; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M253Power(void) {
|
||||
vlock = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M253Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M253Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
WRAM = CHRRAM = NULL;
|
||||
}
|
||||
|
||||
static void M253IRQ(int a) {
|
||||
#define LCYCS 341
|
||||
if (IRQa) {
|
||||
IRQClock += a * 3;
|
||||
if (IRQClock >= LCYCS) {
|
||||
while (IRQClock >= LCYCS) {
|
||||
IRQClock -= LCYCS;
|
||||
IRQCount++;
|
||||
if (IRQCount & 0x100) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount = IRQLatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper253_Init(CartInfo *info) {
|
||||
info->Power = M253Power;
|
||||
info->Close = M253Close;
|
||||
MapIRQHook = M253IRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
CHRRAMSIZE = 2048;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 chrlo[8], chrhi[8], prg[2], mirr, vlock;
|
||||
static int32 IRQa, IRQCount, IRQLatch, IRQClock;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ chrlo, 8, "CHRL" },
|
||||
{ chrhi, 8, "CHRH" },
|
||||
{ prg, 2, "PRGR" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &vlock, 1, "VLCK" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQLatch, 4, "IRQL" },
|
||||
{ &IRQClock, 4, "IRQK" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 i;
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000, prg[0]);
|
||||
setprg8(0xa000, prg[1]);
|
||||
setprg8(0xc000, ~1);
|
||||
setprg8(0xe000, ~0);
|
||||
for (i = 0; i < 8; i++) {
|
||||
uint32 chr = chrlo[i] | (chrhi[i] << 8);
|
||||
if (((chrlo[i] == 4) || (chrlo[i] == 5)) && !vlock)
|
||||
setchr1r(0x10, i << 10, chr & 1);
|
||||
else
|
||||
setchr1(i << 10, chr);
|
||||
}
|
||||
switch (mirr) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M253Write) {
|
||||
if ((A >= 0xB000) && (A <= 0xE00C)) {
|
||||
uint8 ind = ((((A & 8) | (A >> 8)) >> 3) + 2) & 7;
|
||||
uint8 sar = A & 4;
|
||||
uint8 clo = (chrlo[ind] & (0xF0 >> sar)) | ((V & 0x0F) << sar);
|
||||
chrlo[ind] = clo;
|
||||
if (ind == 0) {
|
||||
if (clo == 0xc8)
|
||||
vlock = 0;
|
||||
else if (clo == 0x88)
|
||||
vlock = 1;
|
||||
}
|
||||
if (sar)
|
||||
chrhi[ind] = V >> 4;
|
||||
Sync();
|
||||
} else
|
||||
switch (A) {
|
||||
case 0x8010: prg[0] = V; Sync(); break;
|
||||
case 0xA010: prg[1] = V; Sync(); break;
|
||||
case 0x9400: mirr = V & 3; Sync(); break;
|
||||
case 0xF000: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0xF0; IRQLatch |= V & 0xF; break;
|
||||
case 0xF004: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0x0F; IRQLatch |= V << 4; break;
|
||||
case 0xF008: X6502_IRQEnd(FCEU_IQEXT); IRQClock = 0; IRQCount = IRQLatch; IRQa = V & 2; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M253Power(void) {
|
||||
vlock = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M253Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M253Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
WRAM = CHRRAM = NULL;
|
||||
}
|
||||
|
||||
static void M253IRQ(int a) {
|
||||
#define LCYCS 341
|
||||
if (IRQa) {
|
||||
IRQClock += a * 3;
|
||||
if (IRQClock >= LCYCS) {
|
||||
while (IRQClock >= LCYCS) {
|
||||
IRQClock -= LCYCS;
|
||||
IRQCount++;
|
||||
if (IRQCount & 0x100) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount = IRQLatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper253_Init(CartInfo *info) {
|
||||
info->Power = M253Power;
|
||||
info->Close = M253Close;
|
||||
MapIRQHook = M253IRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
CHRRAMSIZE = 2048;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
204
src/boards/32.c
204
src/boards/32.c
@@ -1,102 +1,102 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg[2], creg[8], mirr;
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ preg, 4, "PREG" },
|
||||
{ creg, 8, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 i;
|
||||
uint16 swap = ((mirr & 2) << 13);
|
||||
setmirror((mirr & 1) ^ 1);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000 ^ swap, preg[0]);
|
||||
setprg8(0xA000, preg[1]);
|
||||
setprg8(0xC000 ^ swap, ~1);
|
||||
setprg8(0xE000, ~0);
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, creg[i]);
|
||||
}
|
||||
|
||||
static DECLFW(M32Write0) {
|
||||
preg[0] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M32Write1) {
|
||||
mirr = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M32Write2) {
|
||||
preg[1] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M32Write3) {
|
||||
creg[A & 7] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M32Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7fff, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0x8FFF, M32Write0);
|
||||
SetWriteHandler(0x9000, 0x9FFF, M32Write1);
|
||||
SetWriteHandler(0xA000, 0xAFFF, M32Write2);
|
||||
SetWriteHandler(0xB000, 0xBFFF, M32Write3);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M32Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper32_Init(CartInfo *info) {
|
||||
info->Power = M32Power;
|
||||
info->Close = M32Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg[2], creg[8], mirr;
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ preg, 4, "PREG" },
|
||||
{ creg, 8, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 i;
|
||||
uint16 swap = ((mirr & 2) << 13);
|
||||
setmirror((mirr & 1) ^ 1);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000 ^ swap, preg[0]);
|
||||
setprg8(0xA000, preg[1]);
|
||||
setprg8(0xC000 ^ swap, ~1);
|
||||
setprg8(0xE000, ~0);
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, creg[i]);
|
||||
}
|
||||
|
||||
static DECLFW(M32Write0) {
|
||||
preg[0] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M32Write1) {
|
||||
mirr = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M32Write2) {
|
||||
preg[1] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M32Write3) {
|
||||
creg[A & 7] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M32Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7fff, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0x8FFF, M32Write0);
|
||||
SetWriteHandler(0x9000, 0x9FFF, M32Write1);
|
||||
SetWriteHandler(0xA000, 0xAFFF, M32Write2);
|
||||
SetWriteHandler(0xB000, 0xBFFF, M32Write3);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M32Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper32_Init(CartInfo *info) {
|
||||
info->Power = M32Power;
|
||||
info->Close = M32Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
234
src/boards/33.c
234
src/boards/33.c
@@ -1,117 +1,117 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 is48;
|
||||
static uint8 regs[8], mirr;
|
||||
static uint8 IRQa;
|
||||
static int16 IRQCount, IRQLatch;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 8, "PREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 2, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror(mirr);
|
||||
setprg8(0x8000, regs[0]);
|
||||
setprg8(0xA000, regs[1]);
|
||||
setprg8(0xC000, ~1);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr2(0x0000, regs[2]);
|
||||
setchr2(0x0800, regs[3]);
|
||||
setchr1(0x1000, regs[4]);
|
||||
setchr1(0x1400, regs[5]);
|
||||
setchr1(0x1800, regs[6]);
|
||||
setchr1(0x1C00, regs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(M33Write) {
|
||||
A &= 0xF003;
|
||||
switch (A) {
|
||||
case 0x8000: regs[0] = V & 0x3F; if (!is48) mirr = ((V >> 6) & 1) ^ 1; Sync(); break;
|
||||
case 0x8001: regs[1] = V & 0x3F; Sync(); break;
|
||||
case 0x8002: regs[2] = V; Sync(); break;
|
||||
case 0x8003: regs[3] = V; Sync(); break;
|
||||
case 0xA000: regs[4] = V; Sync(); break;
|
||||
case 0xA001: regs[5] = V; Sync(); break;
|
||||
case 0xA002: regs[6] = V; Sync(); break;
|
||||
case 0xA003: regs[7] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M48Write) {
|
||||
switch (A & 0xF003) {
|
||||
case 0xC000: IRQLatch = V; break;
|
||||
case 0xC001: IRQCount = IRQLatch; break;
|
||||
case 0xC003: IRQa = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xC002: IRQa = 1; break;
|
||||
case 0xE000: mirr = ((V >> 6) & 1) ^ 1; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M33Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M33Write);
|
||||
}
|
||||
|
||||
static void M48Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xBFFF, M33Write);
|
||||
SetWriteHandler(0xC000, 0xFFFF, M48Write);
|
||||
}
|
||||
|
||||
static void M48IRQ(void) {
|
||||
if (IRQa) {
|
||||
IRQCount++;
|
||||
if (IRQCount == 0x100) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper33_Init(CartInfo *info) {
|
||||
is48 = 0;
|
||||
info->Power = M33Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper48_Init(CartInfo *info) {
|
||||
is48 = 1;
|
||||
info->Power = M48Power;
|
||||
GameHBIRQHook = M48IRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 is48;
|
||||
static uint8 regs[8], mirr;
|
||||
static uint8 IRQa;
|
||||
static int16 IRQCount, IRQLatch;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 8, "PREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 2, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror(mirr);
|
||||
setprg8(0x8000, regs[0]);
|
||||
setprg8(0xA000, regs[1]);
|
||||
setprg8(0xC000, ~1);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr2(0x0000, regs[2]);
|
||||
setchr2(0x0800, regs[3]);
|
||||
setchr1(0x1000, regs[4]);
|
||||
setchr1(0x1400, regs[5]);
|
||||
setchr1(0x1800, regs[6]);
|
||||
setchr1(0x1C00, regs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(M33Write) {
|
||||
A &= 0xF003;
|
||||
switch (A) {
|
||||
case 0x8000: regs[0] = V & 0x3F; if (!is48) mirr = ((V >> 6) & 1) ^ 1; Sync(); break;
|
||||
case 0x8001: regs[1] = V & 0x3F; Sync(); break;
|
||||
case 0x8002: regs[2] = V; Sync(); break;
|
||||
case 0x8003: regs[3] = V; Sync(); break;
|
||||
case 0xA000: regs[4] = V; Sync(); break;
|
||||
case 0xA001: regs[5] = V; Sync(); break;
|
||||
case 0xA002: regs[6] = V; Sync(); break;
|
||||
case 0xA003: regs[7] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M48Write) {
|
||||
switch (A & 0xF003) {
|
||||
case 0xC000: IRQLatch = V; break;
|
||||
case 0xC001: IRQCount = IRQLatch; break;
|
||||
case 0xC003: IRQa = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xC002: IRQa = 1; break;
|
||||
case 0xE000: mirr = ((V >> 6) & 1) ^ 1; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M33Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M33Write);
|
||||
}
|
||||
|
||||
static void M48Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xBFFF, M33Write);
|
||||
SetWriteHandler(0xC000, 0xFFFF, M48Write);
|
||||
}
|
||||
|
||||
static void M48IRQ(void) {
|
||||
if (IRQa) {
|
||||
IRQCount++;
|
||||
if (IRQCount == 0x100) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper33_Init(CartInfo *info) {
|
||||
is48 = 0;
|
||||
info->Power = M33Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper48_Init(CartInfo *info) {
|
||||
is48 = 1;
|
||||
info->Power = M48Power;
|
||||
GameHBIRQHook = M48IRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
186
src/boards/34.c
186
src/boards/34.c
@@ -1,93 +1,93 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Many-in-one hacked mapper crap.
|
||||
*
|
||||
* Original BNROM is actually AxROM variations without mirroring control,
|
||||
* and haven't SRAM on-board, so it must be removed from here
|
||||
*
|
||||
* Difficult banking is what NINA board doing, most hacks for 34 mapper are
|
||||
* NINA hacks, so this is actually 34 mapper
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[3];
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 3, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, regs[0]);
|
||||
setchr4(0x0000, regs[1]);
|
||||
setchr4(0x1000, regs[2]);
|
||||
}
|
||||
|
||||
static DECLFW(M34Write) {
|
||||
if (A >= 0x8000)
|
||||
regs[0] = V;
|
||||
else
|
||||
switch (A) {
|
||||
case 0x7ffd: regs[0] = V; break;
|
||||
case 0x7ffe: regs[1] = V; break;
|
||||
case 0x7fff: regs[2] = V; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M34Power(void) {
|
||||
regs[0] = regs[1] = 0;
|
||||
regs[2] = 1;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7ffc, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7ffc, CartBW);
|
||||
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x7ffd, 0xffff, M34Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M34Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper34_Init(CartInfo *info) {
|
||||
info->Power = M34Power;
|
||||
info->Close = M34Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Many-in-one hacked mapper crap.
|
||||
*
|
||||
* Original BNROM is actually AxROM variations without mirroring control,
|
||||
* and haven't SRAM on-board, so it must be removed from here
|
||||
*
|
||||
* Difficult banking is what NINA board doing, most hacks for 34 mapper are
|
||||
* NINA hacks, so this is actually 34 mapper
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[3];
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 3, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, regs[0]);
|
||||
setchr4(0x0000, regs[1]);
|
||||
setchr4(0x1000, regs[2]);
|
||||
}
|
||||
|
||||
static DECLFW(M34Write) {
|
||||
if (A >= 0x8000)
|
||||
regs[0] = V;
|
||||
else
|
||||
switch (A) {
|
||||
case 0x7ffd: regs[0] = V; break;
|
||||
case 0x7ffe: regs[1] = V; break;
|
||||
case 0x7fff: regs[2] = V; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M34Power(void) {
|
||||
regs[0] = regs[1] = 0;
|
||||
regs[2] = 1;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7ffc, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7ffc, CartBW);
|
||||
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x7ffd, 0xffff, M34Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M34Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper34_Init(CartInfo *info) {
|
||||
info->Power = M34Power;
|
||||
info->Close = M34Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
126
src/boards/36.c
126
src/boards/36.c
@@ -1,63 +1,63 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* TXC/Micro Genius simplified mapper
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latche;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &latche, 1, "LATC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, latche >> 4);
|
||||
setchr8(latche & 0xf);
|
||||
}
|
||||
|
||||
static DECLFW(M36Write) {
|
||||
latche = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(M36Read) {
|
||||
return latche; /* Need by Strike Wolf, being simplified mapper, this cart still uses some TCX mapper features andrely on it */
|
||||
}
|
||||
|
||||
static void M36Power(void) {
|
||||
latche = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x4100, 0x4100, M36Read);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFE, M36Write); /* Actually, BUS conflict there preventing from triggering the wrong banks */
|
||||
}
|
||||
|
||||
static void M36Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper36_Init(CartInfo *info) {
|
||||
info->Power = M36Power;
|
||||
GameStateRestore = M36Restore;
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* TXC/Micro Genius simplified mapper
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latche;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &latche, 1, "LATC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, latche >> 4);
|
||||
setchr8(latche & 0xf);
|
||||
}
|
||||
|
||||
static DECLFW(M36Write) {
|
||||
latche = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(M36Read) {
|
||||
return latche; /* Need by Strike Wolf, being simplified mapper, this cart still uses some TCX mapper features andrely on it */
|
||||
}
|
||||
|
||||
static void M36Power(void) {
|
||||
latche = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x4100, 0x4100, M36Read);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFE, M36Write); /* Actually, BUS conflict there preventing from triggering the wrong banks */
|
||||
}
|
||||
|
||||
static void M36Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper36_Init(CartInfo *info) {
|
||||
info->Power = M36Power;
|
||||
GameStateRestore = M36Restore;
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,95 +1,95 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg[4], IRQa;
|
||||
static int16 IRQCount, IRQPause;
|
||||
|
||||
static int16 Count = 0x0000;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 4, "REGS" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
/* #define Count 0x1800 */
|
||||
#define Pause 0x010
|
||||
|
||||
static DECLFW(UNL3DBlockWrite) {
|
||||
switch (A) {
|
||||
/* 4800 32 */
|
||||
/* 4900 37 */
|
||||
/* 4a00 01 */
|
||||
/* 4e00 18 */
|
||||
case 0x4800: reg[0] = V; break;
|
||||
case 0x4900: reg[1] = V; break;
|
||||
case 0x4a00: reg[2] = V; break;
|
||||
case 0x4e00: reg[3] = V; IRQCount = Count; IRQPause = Pause; IRQa = 1; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNL3DBlockPower(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4800, 0x4E00, UNL3DBlockWrite);
|
||||
}
|
||||
|
||||
static void UNL3DBlockReset(void) {
|
||||
Count += 0x10;
|
||||
FCEU_printf("Count=%04x\n", Count);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) UNL3DBlockIRQHook(int a) {
|
||||
if (IRQa) {
|
||||
if (IRQCount > 0) {
|
||||
IRQCount -= a;
|
||||
} else {
|
||||
if (IRQPause > 0) {
|
||||
IRQPause -= a;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
} else {
|
||||
IRQCount = Count;
|
||||
IRQPause = Pause;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNL3DBlock_Init(CartInfo *info) {
|
||||
info->Power = UNL3DBlockPower;
|
||||
info->Reset = UNL3DBlockReset;
|
||||
MapIRQHook = UNL3DBlockIRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg[4], IRQa;
|
||||
static int16 IRQCount, IRQPause;
|
||||
|
||||
static int16 Count = 0x0000;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 4, "REGS" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
/* #define Count 0x1800 */
|
||||
#define Pause 0x010
|
||||
|
||||
static DECLFW(UNL3DBlockWrite) {
|
||||
switch (A) {
|
||||
/* 4800 32 */
|
||||
/* 4900 37 */
|
||||
/* 4a00 01 */
|
||||
/* 4e00 18 */
|
||||
case 0x4800: reg[0] = V; break;
|
||||
case 0x4900: reg[1] = V; break;
|
||||
case 0x4a00: reg[2] = V; break;
|
||||
case 0x4e00: reg[3] = V; IRQCount = Count; IRQPause = Pause; IRQa = 1; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNL3DBlockPower(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4800, 0x4E00, UNL3DBlockWrite);
|
||||
}
|
||||
|
||||
static void UNL3DBlockReset(void) {
|
||||
Count += 0x10;
|
||||
FCEU_printf("Count=%04x\n", Count);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) UNL3DBlockIRQHook(int a) {
|
||||
if (IRQa) {
|
||||
if (IRQCount > 0) {
|
||||
IRQCount -= a;
|
||||
} else {
|
||||
if (IRQPause > 0) {
|
||||
IRQPause -= a;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
} else {
|
||||
IRQCount = Count;
|
||||
IRQPause = Pause;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNL3DBlock_Init(CartInfo *info) {
|
||||
info->Power = UNL3DBlockPower;
|
||||
info->Reset = UNL3DBlockReset;
|
||||
MapIRQHook = UNL3DBlockIRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
170
src/boards/40.c
170
src/boards/40.c
@@ -1,85 +1,85 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, ~1);
|
||||
setprg8(0x8000, ~3);
|
||||
setprg8(0xa000, ~2);
|
||||
setprg8(0xc000, reg);
|
||||
setprg8(0xe000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M40Write) {
|
||||
switch (A & 0xe000) {
|
||||
case 0x8000: IRQa = 0; IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xa000: IRQa = 1; break;
|
||||
case 0xe000: reg = V & 7; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M40Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x8000, 0xffff, M40Write);
|
||||
}
|
||||
|
||||
static void M40Reset(void) {
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M40IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
if (IRQCount < 4096)
|
||||
IRQCount += a;
|
||||
else {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper40_Init(CartInfo *info) {
|
||||
info->Reset = M40Reset;
|
||||
info->Power = M40Power;
|
||||
MapIRQHook = M40IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, ~1);
|
||||
setprg8(0x8000, ~3);
|
||||
setprg8(0xa000, ~2);
|
||||
setprg8(0xc000, reg);
|
||||
setprg8(0xe000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M40Write) {
|
||||
switch (A & 0xe000) {
|
||||
case 0x8000: IRQa = 0; IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xa000: IRQa = 1; break;
|
||||
case 0xe000: reg = V & 7; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M40Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x8000, 0xffff, M40Write);
|
||||
}
|
||||
|
||||
static void M40Reset(void) {
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M40IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
if (IRQCount < 4096)
|
||||
IRQCount += a;
|
||||
else {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper40_Init(CartInfo *info) {
|
||||
info->Reset = M40Reset;
|
||||
info->Power = M40Power;
|
||||
MapIRQHook = M40IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2008 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* actually cart ID is 811120-C, sorry ;) K-3094 - another ID */
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 reset_flag = 0;
|
||||
|
||||
static void BMC411120CCW(uint32 A, uint8 V) {
|
||||
setchr1(A, V | ((EXPREGS[0] & 3) << 7));
|
||||
}
|
||||
|
||||
static void BMC411120CPW(uint32 A, uint8 V) {
|
||||
if (EXPREGS[0] & (8 | reset_flag))
|
||||
setprg32(0x8000, ((EXPREGS[0] >> 4) & 3) | (0x0C));
|
||||
else
|
||||
setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 3) << 4));
|
||||
}
|
||||
|
||||
static DECLFW(BMC411120CLoWrite) {
|
||||
EXPREGS[0] = A;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void BMC411120CReset(void) {
|
||||
EXPREGS[0] = 0;
|
||||
reset_flag ^= 4;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void BMC411120CPower(void) {
|
||||
EXPREGS[0] = 0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x6000, 0x7FFF, BMC411120CLoWrite);
|
||||
}
|
||||
|
||||
void BMC411120C_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 128, 8, 0);
|
||||
pwrap = BMC411120CPW;
|
||||
cwrap = BMC411120CCW;
|
||||
info->Power = BMC411120CPower;
|
||||
info->Reset = BMC411120CReset;
|
||||
AddExState(EXPREGS, 1, 0, "EXPR");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2008 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* actually cart ID is 811120-C, sorry ;) K-3094 - another ID */
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 reset_flag = 0;
|
||||
|
||||
static void BMC411120CCW(uint32 A, uint8 V) {
|
||||
setchr1(A, V | ((EXPREGS[0] & 3) << 7));
|
||||
}
|
||||
|
||||
static void BMC411120CPW(uint32 A, uint8 V) {
|
||||
if (EXPREGS[0] & (8 | reset_flag))
|
||||
setprg32(0x8000, ((EXPREGS[0] >> 4) & 3) | (0x0C));
|
||||
else
|
||||
setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 3) << 4));
|
||||
}
|
||||
|
||||
static DECLFW(BMC411120CLoWrite) {
|
||||
EXPREGS[0] = A;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void BMC411120CReset(void) {
|
||||
EXPREGS[0] = 0;
|
||||
reset_flag ^= 4;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void BMC411120CPower(void) {
|
||||
EXPREGS[0] = 0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x6000, 0x7FFF, BMC411120CLoWrite);
|
||||
}
|
||||
|
||||
void BMC411120C_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 128, 8, 0);
|
||||
pwrap = BMC411120CPW;
|
||||
cwrap = BMC411120CCW;
|
||||
info->Power = BMC411120CPower;
|
||||
info->Reset = BMC411120CReset;
|
||||
AddExState(EXPREGS, 1, 0, "EXPR");
|
||||
}
|
||||
|
||||
166
src/boards/42.c
166
src/boards/42.c
@@ -1,83 +1,83 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 preg, creg, mirr;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ &creg, 1, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, preg);
|
||||
setprg32(0x8000, ~0);
|
||||
setchr8(creg);
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(M42Write) {
|
||||
switch (A & 0xE003) {
|
||||
case 0x8000: creg = V; Sync(); break;
|
||||
case 0xE000: preg = V & 0x0F; Sync(); break;
|
||||
case 0xE001: mirr = ((V >> 3) & 1) ^ 1; Sync(); break;
|
||||
case 0xE002: IRQa = V & 2; if (!IRQa) IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M42Power(void) {
|
||||
preg = 0;
|
||||
mirr = 1; /* Ai Senshi Nicol actually has fixed mirroring, but mapper forcing it's default value now */
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x6000, 0xffff, M42Write);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M42IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount += a;
|
||||
if (IRQCount >= 32768) IRQCount -= 32768;
|
||||
if (IRQCount >= 24576)
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
else
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper42_Init(CartInfo *info) {
|
||||
info->Power = M42Power;
|
||||
MapIRQHook = M42IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 preg, creg, mirr;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ &creg, 1, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, preg);
|
||||
setprg32(0x8000, ~0);
|
||||
setchr8(creg);
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(M42Write) {
|
||||
switch (A & 0xE003) {
|
||||
case 0x8000: creg = V; Sync(); break;
|
||||
case 0xE000: preg = V & 0x0F; Sync(); break;
|
||||
case 0xE001: mirr = ((V >> 3) & 1) ^ 1; Sync(); break;
|
||||
case 0xE002: IRQa = V & 2; if (!IRQa) IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M42Power(void) {
|
||||
preg = 0;
|
||||
mirr = 1; /* Ai Senshi Nicol actually has fixed mirroring, but mapper forcing it's default value now */
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x6000, 0xffff, M42Write);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M42IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount += a;
|
||||
if (IRQCount >= 32768) IRQCount -= 32768;
|
||||
if (IRQCount >= 24576)
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
else
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper42_Init(CartInfo *info) {
|
||||
info->Power = M42Power;
|
||||
MapIRQHook = M42IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
184
src/boards/43.c
184
src/boards/43.c
@@ -1,92 +1,92 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, swap;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ ®, 1, "REG" },
|
||||
{ &swap, 1, "SWAP" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg4(0x5000, 8 << 1); /* Only YS-612 advanced version */
|
||||
setprg8(0x6000, swap?0:2);
|
||||
setprg8(0x8000, 1);
|
||||
setprg8(0xa000, 0);
|
||||
setprg8(0xc000, reg);
|
||||
setprg8(0xe000, swap?8:9); /* hard dump for mr.Mary is 128K,
|
||||
* bank 9 is the last 2K ok bank 8 repeated 4 times, then till the end of 128K
|
||||
* instead used bank A, containing some CHR data, ines rom have unused banks removed,
|
||||
* and bank A moved to the bank 9 place for compatibility with other crappy dumps
|
||||
*/
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M43Write) {
|
||||
/* int transo[8]={4,3,4,4,4,7,5,6}; */
|
||||
int transo[8] = { 4, 3, 5, 3, 6, 3, 7, 3 }; /* According to hardware tests */
|
||||
switch (A & 0xf1ff) {
|
||||
case 0x4022: reg = transo[V & 7]; Sync(); break;
|
||||
case 0x4120: swap = V & 1; Sync(); break;
|
||||
case 0x8122: /* hacked version */
|
||||
case 0x4122: IRQa = V & 1; X6502_IRQEnd(FCEU_IQEXT); IRQCount = 0; break; /* original version */
|
||||
}
|
||||
}
|
||||
|
||||
static void M43Power(void) {
|
||||
reg = swap = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x5000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x4020, 0xffff, M43Write);
|
||||
}
|
||||
|
||||
static void M43Reset(void) {
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M43IRQHook(int a) {
|
||||
IRQCount += a;
|
||||
if (IRQa)
|
||||
if (IRQCount >= 4096) {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper43_Init(CartInfo *info) {
|
||||
info->Reset = M43Reset;
|
||||
info->Power = M43Power;
|
||||
MapIRQHook = M43IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, swap;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ ®, 1, "REG" },
|
||||
{ &swap, 1, "SWAP" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg4(0x5000, 8 << 1); /* Only YS-612 advanced version */
|
||||
setprg8(0x6000, swap?0:2);
|
||||
setprg8(0x8000, 1);
|
||||
setprg8(0xa000, 0);
|
||||
setprg8(0xc000, reg);
|
||||
setprg8(0xe000, swap?8:9); /* hard dump for mr.Mary is 128K,
|
||||
* bank 9 is the last 2K ok bank 8 repeated 4 times, then till the end of 128K
|
||||
* instead used bank A, containing some CHR data, ines rom have unused banks removed,
|
||||
* and bank A moved to the bank 9 place for compatibility with other crappy dumps
|
||||
*/
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M43Write) {
|
||||
/* int transo[8]={4,3,4,4,4,7,5,6}; */
|
||||
int transo[8] = { 4, 3, 5, 3, 6, 3, 7, 3 }; /* According to hardware tests */
|
||||
switch (A & 0xf1ff) {
|
||||
case 0x4022: reg = transo[V & 7]; Sync(); break;
|
||||
case 0x4120: swap = V & 1; Sync(); break;
|
||||
case 0x8122: /* hacked version */
|
||||
case 0x4122: IRQa = V & 1; X6502_IRQEnd(FCEU_IQEXT); IRQCount = 0; break; /* original version */
|
||||
}
|
||||
}
|
||||
|
||||
static void M43Power(void) {
|
||||
reg = swap = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x5000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x4020, 0xffff, M43Write);
|
||||
}
|
||||
|
||||
static void M43Reset(void) {
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M43IRQHook(int a) {
|
||||
IRQCount += a;
|
||||
if (IRQa)
|
||||
if (IRQCount >= 4096) {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper43_Init(CartInfo *info) {
|
||||
info->Reset = M43Reset;
|
||||
info->Power = M43Power;
|
||||
MapIRQHook = M43IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
168
src/boards/50.c
168
src/boards/50.c
@@ -1,84 +1,84 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, 0xF);
|
||||
setprg8(0x8000, 0x8);
|
||||
setprg8(0xa000, 0x9);
|
||||
setprg8(0xc000, reg);
|
||||
setprg8(0xe000, 0xB);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M50Write) {
|
||||
switch (A & 0xD160) {
|
||||
case 0x4120: IRQa = V & 1; if (!IRQa) IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0x4020: reg = ((V & 1) << 2) | ((V & 2) >> 1) | ((V & 4) >> 1) | (V & 8); Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M50Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x4020, 0x5fff, M50Write);
|
||||
}
|
||||
|
||||
static void M50Reset(void) {
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M50IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
if (IRQCount < 4096)
|
||||
IRQCount += a;
|
||||
else {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper50_Init(CartInfo *info) {
|
||||
info->Reset = M50Reset;
|
||||
info->Power = M50Power;
|
||||
MapIRQHook = M50IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, 0xF);
|
||||
setprg8(0x8000, 0x8);
|
||||
setprg8(0xa000, 0x9);
|
||||
setprg8(0xc000, reg);
|
||||
setprg8(0xe000, 0xB);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M50Write) {
|
||||
switch (A & 0xD160) {
|
||||
case 0x4120: IRQa = V & 1; if (!IRQa) IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0x4020: reg = ((V & 1) << 2) | ((V & 2) >> 1) | ((V & 4) >> 1) | (V & 8); Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M50Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x4020, 0x5fff, M50Write);
|
||||
}
|
||||
|
||||
static void M50Reset(void) {
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M50IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
if (IRQCount < 4096)
|
||||
IRQCount += a;
|
||||
else {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper50_Init(CartInfo *info) {
|
||||
info->Reset = M50Reset;
|
||||
info->Power = M50Power;
|
||||
MapIRQHook = M50IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
168
src/boards/51.c
168
src/boards/51.c
@@ -1,84 +1,84 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 bank, mode;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &bank, 1, "BANK" },
|
||||
{ &mode, 1, "MODE" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (mode & 2) {
|
||||
setprg8(0x6000, ((bank & 7) << 2) | 0x23);
|
||||
setprg16(0x8000, (bank << 1) | 0);
|
||||
setprg16(0xC000, (bank << 1) | 1);
|
||||
} else {
|
||||
setprg8(0x6000, ((bank & 4) << 2) | 0x2F);
|
||||
setprg16(0x8000, (bank << 1) | (mode >> 4));
|
||||
setprg16(0xC000, ((bank & 0xC) << 1) | 7);
|
||||
}
|
||||
if (mode == 0x12)
|
||||
setmirror(MI_H);
|
||||
else
|
||||
setmirror(MI_V);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M51WriteMode) {
|
||||
mode = V & 0x12;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M51WriteBank) {
|
||||
bank = V & 0x0F;
|
||||
if (A & 0x4000)
|
||||
mode = (mode & 2) | (V & 0x10);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M51Power(void) {
|
||||
bank = 0;
|
||||
mode = 2;
|
||||
Sync();
|
||||
SetWriteHandler(0x6000, 0x7FFF, M51WriteMode);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M51WriteBank);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void M51Reset(void) {
|
||||
bank = 0;
|
||||
mode = 2;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper51_Init(CartInfo *info) {
|
||||
info->Power = M51Power;
|
||||
info->Reset = M51Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 bank, mode;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &bank, 1, "BANK" },
|
||||
{ &mode, 1, "MODE" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (mode & 2) {
|
||||
setprg8(0x6000, ((bank & 7) << 2) | 0x23);
|
||||
setprg16(0x8000, (bank << 1) | 0);
|
||||
setprg16(0xC000, (bank << 1) | 1);
|
||||
} else {
|
||||
setprg8(0x6000, ((bank & 4) << 2) | 0x2F);
|
||||
setprg16(0x8000, (bank << 1) | (mode >> 4));
|
||||
setprg16(0xC000, ((bank & 0xC) << 1) | 7);
|
||||
}
|
||||
if (mode == 0x12)
|
||||
setmirror(MI_H);
|
||||
else
|
||||
setmirror(MI_V);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M51WriteMode) {
|
||||
mode = V & 0x12;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M51WriteBank) {
|
||||
bank = V & 0x0F;
|
||||
if (A & 0x4000)
|
||||
mode = (mode & 2) | (V & 0x10);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M51Power(void) {
|
||||
bank = 0;
|
||||
mode = 2;
|
||||
Sync();
|
||||
SetWriteHandler(0x6000, 0x7FFF, M51WriteMode);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M51WriteBank);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void M51Reset(void) {
|
||||
bank = 0;
|
||||
mode = 2;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper51_Init(CartInfo *info) {
|
||||
info->Power = M51Power;
|
||||
info->Reset = M51Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
160
src/boards/57.c
160
src/boards/57.c
@@ -1,80 +1,80 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 regs[2];
|
||||
static uint8 hrd_flag;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &hrd_flag, 1, "DPSW" },
|
||||
{ regs, 2, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (regs[1] & 0x10)
|
||||
setprg32(0x8000, (regs[1] >> 6) & 3);
|
||||
else {
|
||||
setprg16(0x8000, (regs[1] >> 5) & 7);
|
||||
setprg16(0xC000, (regs[1] >> 5) & 7);
|
||||
}
|
||||
setmirror((regs[1] & 8) >> 3 ^ 1);
|
||||
setchr8((regs[0] & 7) | (regs[1] & 7) | ((regs[0] & 0x40) >> 3));
|
||||
}
|
||||
|
||||
static DECLFR(M57Read) {
|
||||
return hrd_flag;
|
||||
}
|
||||
|
||||
static DECLFW(M57Write) {
|
||||
switch (A & 0x8800) {
|
||||
case 0x8000: regs[0] = V; Sync(); break;
|
||||
case 0x8800: regs[1] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M57Power(void) {
|
||||
regs[1] = regs[0] = 0;
|
||||
hrd_flag = 0;
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M57Write);
|
||||
SetReadHandler(0x6000, 0x6000, M57Read);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M57Reset() {
|
||||
hrd_flag++;
|
||||
hrd_flag &= 3;
|
||||
FCEU_printf("Select Register = %02x\n", hrd_flag);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper57_Init(CartInfo *info) {
|
||||
info->Power = M57Power;
|
||||
info->Reset = M57Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 regs[2];
|
||||
static uint8 hrd_flag;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &hrd_flag, 1, "DPSW" },
|
||||
{ regs, 2, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (regs[1] & 0x10)
|
||||
setprg32(0x8000, (regs[1] >> 6) & 3);
|
||||
else {
|
||||
setprg16(0x8000, (regs[1] >> 5) & 7);
|
||||
setprg16(0xC000, (regs[1] >> 5) & 7);
|
||||
}
|
||||
setmirror((regs[1] & 8) >> 3 ^ 1);
|
||||
setchr8((regs[0] & 7) | (regs[1] & 7) | ((regs[0] & 0x40) >> 3));
|
||||
}
|
||||
|
||||
static DECLFR(M57Read) {
|
||||
return hrd_flag;
|
||||
}
|
||||
|
||||
static DECLFW(M57Write) {
|
||||
switch (A & 0x8800) {
|
||||
case 0x8000: regs[0] = V; Sync(); break;
|
||||
case 0x8800: regs[1] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M57Power(void) {
|
||||
regs[1] = regs[0] = 0;
|
||||
hrd_flag = 0;
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M57Write);
|
||||
SetReadHandler(0x6000, 0x6000, M57Read);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M57Reset() {
|
||||
hrd_flag++;
|
||||
hrd_flag &= 3;
|
||||
FCEU_printf("Select Register = %02x\n", hrd_flag);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper57_Init(CartInfo *info) {
|
||||
info->Power = M57Power;
|
||||
info->Reset = M57Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* SL12 Protected 3-in-1 mapper hardware (VRC2, MMC3, MMC1)
|
||||
* the same as 603-5052 board (TODO: add reading registers, merge)
|
||||
*
|
||||
* Contra Fighter prot board
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 lut[4] = { 0x00, 0x02, 0x02, 0x03 };
|
||||
|
||||
static DECLFW(UNL6035052ProtWrite) {
|
||||
EXPREGS[0] = lut[V & 3];
|
||||
}
|
||||
|
||||
static DECLFR(UNL6035052ProtRead) {
|
||||
return EXPREGS[0];
|
||||
}
|
||||
|
||||
static void UNL6035052Power(void) {
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4020, 0x7FFF, UNL6035052ProtWrite);
|
||||
SetReadHandler(0x4020, 0x7FFF, UNL6035052ProtRead);
|
||||
}
|
||||
|
||||
void UNL6035052_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
info->Power = UNL6035052Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* SL12 Protected 3-in-1 mapper hardware (VRC2, MMC3, MMC1)
|
||||
* the same as 603-5052 board (TODO: add reading registers, merge)
|
||||
*
|
||||
* Contra Fighter prot board
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 lut[4] = { 0x00, 0x02, 0x02, 0x03 };
|
||||
|
||||
static DECLFW(UNL6035052ProtWrite) {
|
||||
EXPREGS[0] = lut[V & 3];
|
||||
}
|
||||
|
||||
static DECLFR(UNL6035052ProtRead) {
|
||||
return EXPREGS[0];
|
||||
}
|
||||
|
||||
static void UNL6035052Power(void) {
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4020, 0x7FFF, UNL6035052ProtWrite);
|
||||
SetReadHandler(0x4020, 0x7FFF, UNL6035052ProtRead);
|
||||
}
|
||||
|
||||
void UNL6035052_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
info->Power = UNL6035052Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
}
|
||||
|
||||
138
src/boards/62.c
138
src/boards/62.c
@@ -1,69 +1,69 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 bank;
|
||||
static uint16 mode;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &bank, 1, "BANK" },
|
||||
{ &mode, 2, "MODE" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(((mode & 0x1F) << 2) | (bank & 0x03));
|
||||
if (mode & 0x20) {
|
||||
setprg16(0x8000, (mode & 0x40) | ((mode >> 8) & 0x3F));
|
||||
setprg16(0xc000, (mode & 0x40) | ((mode >> 8) & 0x3F));
|
||||
} else
|
||||
setprg32(0x8000, ((mode & 0x40) | ((mode >> 8) & 0x3F)) >> 1);
|
||||
setmirror(((mode >> 7) & 1) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M62Write) {
|
||||
mode = A & 0x3FFF;
|
||||
bank = V & 3;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M62Power(void) {
|
||||
bank = mode = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M62Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void M62Reset(void) {
|
||||
bank = mode = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper62_Init(CartInfo *info) {
|
||||
info->Power = M62Power;
|
||||
info->Reset = M62Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 bank;
|
||||
static uint16 mode;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &bank, 1, "BANK" },
|
||||
{ &mode, 2, "MODE" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(((mode & 0x1F) << 2) | (bank & 0x03));
|
||||
if (mode & 0x20) {
|
||||
setprg16(0x8000, (mode & 0x40) | ((mode >> 8) & 0x3F));
|
||||
setprg16(0xc000, (mode & 0x40) | ((mode >> 8) & 0x3F));
|
||||
} else
|
||||
setprg32(0x8000, ((mode & 0x40) | ((mode >> 8) & 0x3F)) >> 1);
|
||||
setmirror(((mode >> 7) & 1) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M62Write) {
|
||||
mode = A & 0x3FFF;
|
||||
bank = V & 3;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M62Power(void) {
|
||||
bank = mode = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M62Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void M62Reset(void) {
|
||||
bank = mode = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper62_Init(CartInfo *info) {
|
||||
info->Power = M62Power;
|
||||
info->Reset = M62Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
208
src/boards/65.c
208
src/boards/65.c
@@ -1,104 +1,104 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg[3], creg[8], mirr;
|
||||
static uint8 IRQa;
|
||||
static int16 IRQCount, IRQLatch;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ preg, 3, "PREG" },
|
||||
{ creg, 8, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 2, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror(mirr);
|
||||
setprg8(0x8000, preg[0]);
|
||||
setprg8(0xA000, preg[1]);
|
||||
setprg8(0xC000, preg[2]);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr1(0x0000, creg[0]);
|
||||
setchr1(0x0400, creg[1]);
|
||||
setchr1(0x0800, creg[2]);
|
||||
setchr1(0x0C00, creg[3]);
|
||||
setchr1(0x1000, creg[4]);
|
||||
setchr1(0x1400, creg[5]);
|
||||
setchr1(0x1800, creg[6]);
|
||||
setchr1(0x1C00, creg[7]);
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(M65Write) {
|
||||
switch (A) {
|
||||
case 0x8000: preg[0] = V; Sync(); break;
|
||||
case 0xA000: preg[1] = V; Sync(); break;
|
||||
case 0xC000: preg[2] = V; Sync(); break;
|
||||
case 0x9001: mirr = ((V >> 7) & 1) ^ 1; Sync(); break;
|
||||
case 0x9003: IRQa = V & 0x80; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0x9004: IRQCount = IRQLatch; break;
|
||||
case 0x9005: IRQLatch &= 0x00FF; IRQLatch |= V << 8; break;
|
||||
case 0x9006: IRQLatch &= 0xFF00; IRQLatch |= V; break;
|
||||
case 0xB000: creg[0] = V; Sync(); break;
|
||||
case 0xB001: creg[1] = V; Sync(); break;
|
||||
case 0xB002: creg[2] = V; Sync(); break;
|
||||
case 0xB003: creg[3] = V; Sync(); break;
|
||||
case 0xB004: creg[4] = V; Sync(); break;
|
||||
case 0xB005: creg[5] = V; Sync(); break;
|
||||
case 0xB006: creg[6] = V; Sync(); break;
|
||||
case 0xB007: creg[7] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M65Power(void) {
|
||||
preg[2] = ~1;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M65Write);
|
||||
}
|
||||
|
||||
void FP_FASTAPASS(1) M65IRQ(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount < -4) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
IRQCount = 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper65_Init(CartInfo *info) {
|
||||
info->Power = M65Power;
|
||||
MapIRQHook = M65IRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg[3], creg[8], mirr;
|
||||
static uint8 IRQa;
|
||||
static int16 IRQCount, IRQLatch;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ preg, 3, "PREG" },
|
||||
{ creg, 8, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 2, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror(mirr);
|
||||
setprg8(0x8000, preg[0]);
|
||||
setprg8(0xA000, preg[1]);
|
||||
setprg8(0xC000, preg[2]);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr1(0x0000, creg[0]);
|
||||
setchr1(0x0400, creg[1]);
|
||||
setchr1(0x0800, creg[2]);
|
||||
setchr1(0x0C00, creg[3]);
|
||||
setchr1(0x1000, creg[4]);
|
||||
setchr1(0x1400, creg[5]);
|
||||
setchr1(0x1800, creg[6]);
|
||||
setchr1(0x1C00, creg[7]);
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(M65Write) {
|
||||
switch (A) {
|
||||
case 0x8000: preg[0] = V; Sync(); break;
|
||||
case 0xA000: preg[1] = V; Sync(); break;
|
||||
case 0xC000: preg[2] = V; Sync(); break;
|
||||
case 0x9001: mirr = ((V >> 7) & 1) ^ 1; Sync(); break;
|
||||
case 0x9003: IRQa = V & 0x80; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0x9004: IRQCount = IRQLatch; break;
|
||||
case 0x9005: IRQLatch &= 0x00FF; IRQLatch |= V << 8; break;
|
||||
case 0x9006: IRQLatch &= 0xFF00; IRQLatch |= V; break;
|
||||
case 0xB000: creg[0] = V; Sync(); break;
|
||||
case 0xB001: creg[1] = V; Sync(); break;
|
||||
case 0xB002: creg[2] = V; Sync(); break;
|
||||
case 0xB003: creg[3] = V; Sync(); break;
|
||||
case 0xB004: creg[4] = V; Sync(); break;
|
||||
case 0xB005: creg[5] = V; Sync(); break;
|
||||
case 0xB006: creg[6] = V; Sync(); break;
|
||||
case 0xB007: creg[7] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M65Power(void) {
|
||||
preg[2] = ~1;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M65Write);
|
||||
}
|
||||
|
||||
void FP_FASTAPASS(1) M65IRQ(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount < -4) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
IRQCount = 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper65_Init(CartInfo *info) {
|
||||
info->Power = M65Power;
|
||||
MapIRQHook = M65IRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
210
src/boards/67.c
210
src/boards/67.c
@@ -1,105 +1,105 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg, creg[4], mirr, suntoggle = 0;
|
||||
static uint8 IRQa;
|
||||
static int16 IRQCount, IRQLatch;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ &suntoggle, 1, "STOG" },
|
||||
{ creg, 4, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 2, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror(mirr);
|
||||
setprg16(0x8000, preg);
|
||||
setprg16(0xC000, ~0);
|
||||
setchr2(0x0000, creg[0]);
|
||||
setchr2(0x0800, creg[1]);
|
||||
setchr2(0x1000, creg[2]);
|
||||
setchr2(0x1800, creg[3]);
|
||||
switch (mirr) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M67Write) {
|
||||
switch (A & 0xF800) {
|
||||
case 0x8800: creg[0] = V; Sync(); break;
|
||||
case 0x9800: creg[1] = V; Sync(); break;
|
||||
case 0xA800: creg[2] = V; Sync(); break;
|
||||
case 0xB800: creg[3] = V; Sync(); break;
|
||||
case 0xC000:
|
||||
case 0xC800:
|
||||
IRQCount &= 0xFF << (suntoggle << 3);
|
||||
IRQCount |= V << ((suntoggle ^ 1) << 3);
|
||||
suntoggle ^= 1;
|
||||
break;
|
||||
case 0xD800:
|
||||
suntoggle = 0;
|
||||
IRQa = V & 0x10;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
break;
|
||||
case 0xE800: mirr = V & 3; Sync(); break;
|
||||
case 0xF800: preg = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M67Power(void) {
|
||||
suntoggle = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M67Write);
|
||||
}
|
||||
|
||||
void FP_FASTAPASS(1) M67IRQ(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount <= 0) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
IRQCount = 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper67_Init(CartInfo *info) {
|
||||
info->Power = M67Power;
|
||||
MapIRQHook = M67IRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg, creg[4], mirr, suntoggle = 0;
|
||||
static uint8 IRQa;
|
||||
static int16 IRQCount, IRQLatch;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ &suntoggle, 1, "STOG" },
|
||||
{ creg, 4, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 2, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror(mirr);
|
||||
setprg16(0x8000, preg);
|
||||
setprg16(0xC000, ~0);
|
||||
setchr2(0x0000, creg[0]);
|
||||
setchr2(0x0800, creg[1]);
|
||||
setchr2(0x1000, creg[2]);
|
||||
setchr2(0x1800, creg[3]);
|
||||
switch (mirr) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M67Write) {
|
||||
switch (A & 0xF800) {
|
||||
case 0x8800: creg[0] = V; Sync(); break;
|
||||
case 0x9800: creg[1] = V; Sync(); break;
|
||||
case 0xA800: creg[2] = V; Sync(); break;
|
||||
case 0xB800: creg[3] = V; Sync(); break;
|
||||
case 0xC000:
|
||||
case 0xC800:
|
||||
IRQCount &= 0xFF << (suntoggle << 3);
|
||||
IRQCount |= V << ((suntoggle ^ 1) << 3);
|
||||
suntoggle ^= 1;
|
||||
break;
|
||||
case 0xD800:
|
||||
suntoggle = 0;
|
||||
IRQa = V & 0x10;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
break;
|
||||
case 0xE800: mirr = V & 3; Sync(); break;
|
||||
case 0xF800: preg = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M67Power(void) {
|
||||
suntoggle = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M67Write);
|
||||
}
|
||||
|
||||
void FP_FASTAPASS(1) M67IRQ(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount <= 0) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
IRQCount = 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper67_Init(CartInfo *info) {
|
||||
info->Power = M67Power;
|
||||
MapIRQHook = M67IRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
328
src/boards/68.c
328
src/boards/68.c
@@ -1,164 +1,164 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 chr_reg[4];
|
||||
static uint8 kogame, prg_reg, nt1, nt2, mirr;
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE, count;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &nt1, 1, "NT1" },
|
||||
{ &nt2, 1, "NT2" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &prg_reg, 1, "PRG" },
|
||||
{ &kogame, 1, "KGME" },
|
||||
{ &count, 4, "CNT" },
|
||||
{ chr_reg, 4, "CHR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void M68NTfix(void) {
|
||||
if ((!UNIFchrrama) && (mirr & 0x10)) {
|
||||
PPUNTARAM = 0;
|
||||
switch (mirr & 3) {
|
||||
case 0:
|
||||
vnapage[0] = vnapage[2] = CHRptr[0] + (((nt1 | 128) & CHRmask1[0]) << 10);
|
||||
vnapage[1] = vnapage[3] = CHRptr[0] + (((nt2 | 128) & CHRmask1[0]) << 10);
|
||||
break;
|
||||
case 1:
|
||||
vnapage[0] = vnapage[1] = CHRptr[0] + (((nt1 | 128) & CHRmask1[0]) << 10);
|
||||
vnapage[2] = vnapage[3] = CHRptr[0] + (((nt2 | 128) & CHRmask1[0]) << 10);
|
||||
break;
|
||||
case 2:
|
||||
vnapage[0] = vnapage[1] = vnapage[2] = vnapage[3] = CHRptr[0] + (((nt1 | 128) & CHRmask1[0]) << 10);
|
||||
break;
|
||||
case 3:
|
||||
vnapage[0] = vnapage[1] = vnapage[2] = vnapage[3] = CHRptr[0] + (((nt2 | 128) & CHRmask1[0]) << 10);
|
||||
break;
|
||||
}
|
||||
} else
|
||||
switch (mirr & 3) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Sync(void) {
|
||||
setchr2(0x0000, chr_reg[0]);
|
||||
setchr2(0x0800, chr_reg[1]);
|
||||
setchr2(0x1000, chr_reg[2]);
|
||||
setchr2(0x1800, chr_reg[3]);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg16r((PRGptr[1]) ? kogame : 0, 0x8000, prg_reg);
|
||||
setprg16(0xC000, ~0);
|
||||
}
|
||||
|
||||
static DECLFR(M68Read) {
|
||||
if (!(kogame & 8)) {
|
||||
count++;
|
||||
if (count == 1784)
|
||||
setprg16r(0, 0x8000, prg_reg);
|
||||
}
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteLo) {
|
||||
if (!V) {
|
||||
count = 0;
|
||||
setprg16r((PRGptr[1]) ? kogame : 0, 0x8000, prg_reg);
|
||||
}
|
||||
CartBW(A, V);
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteCHR) {
|
||||
chr_reg[(A >> 12) & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteNT1) {
|
||||
nt1 = V;
|
||||
M68NTfix();
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteNT2) {
|
||||
nt2 = V;
|
||||
M68NTfix();
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteMIR) {
|
||||
mirr = V;
|
||||
M68NTfix();
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteROM) {
|
||||
prg_reg = V & 7;
|
||||
kogame = ((V >> 3) & 1) ^ 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M68Power(void) {
|
||||
prg_reg = 0;
|
||||
kogame = 0;
|
||||
Sync();
|
||||
M68NTfix();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xBFFF, M68Read);
|
||||
SetReadHandler(0xC000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xBFFF, M68WriteCHR);
|
||||
SetWriteHandler(0xC000, 0xCFFF, M68WriteNT1);
|
||||
SetWriteHandler(0xD000, 0xDFFF, M68WriteNT2);
|
||||
SetWriteHandler(0xE000, 0xEFFF, M68WriteMIR);
|
||||
SetWriteHandler(0xF000, 0xFFFF, M68WriteROM);
|
||||
SetWriteHandler(0x6000, 0x6000, M68WriteLo);
|
||||
SetWriteHandler(0x6001, 0x7FFF, CartBW);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M68Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
M68NTfix();
|
||||
}
|
||||
|
||||
void Mapper68_Init(CartInfo *info) {
|
||||
info->Power = M68Power;
|
||||
info->Close = M68Close;
|
||||
GameStateRestore = StateRestore;
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 chr_reg[4];
|
||||
static uint8 kogame, prg_reg, nt1, nt2, mirr;
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE, count;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &nt1, 1, "NT1" },
|
||||
{ &nt2, 1, "NT2" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &prg_reg, 1, "PRG" },
|
||||
{ &kogame, 1, "KGME" },
|
||||
{ &count, 4, "CNT" },
|
||||
{ chr_reg, 4, "CHR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void M68NTfix(void) {
|
||||
if ((!UNIFchrrama) && (mirr & 0x10)) {
|
||||
PPUNTARAM = 0;
|
||||
switch (mirr & 3) {
|
||||
case 0:
|
||||
vnapage[0] = vnapage[2] = CHRptr[0] + (((nt1 | 128) & CHRmask1[0]) << 10);
|
||||
vnapage[1] = vnapage[3] = CHRptr[0] + (((nt2 | 128) & CHRmask1[0]) << 10);
|
||||
break;
|
||||
case 1:
|
||||
vnapage[0] = vnapage[1] = CHRptr[0] + (((nt1 | 128) & CHRmask1[0]) << 10);
|
||||
vnapage[2] = vnapage[3] = CHRptr[0] + (((nt2 | 128) & CHRmask1[0]) << 10);
|
||||
break;
|
||||
case 2:
|
||||
vnapage[0] = vnapage[1] = vnapage[2] = vnapage[3] = CHRptr[0] + (((nt1 | 128) & CHRmask1[0]) << 10);
|
||||
break;
|
||||
case 3:
|
||||
vnapage[0] = vnapage[1] = vnapage[2] = vnapage[3] = CHRptr[0] + (((nt2 | 128) & CHRmask1[0]) << 10);
|
||||
break;
|
||||
}
|
||||
} else
|
||||
switch (mirr & 3) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Sync(void) {
|
||||
setchr2(0x0000, chr_reg[0]);
|
||||
setchr2(0x0800, chr_reg[1]);
|
||||
setchr2(0x1000, chr_reg[2]);
|
||||
setchr2(0x1800, chr_reg[3]);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg16r((PRGptr[1]) ? kogame : 0, 0x8000, prg_reg);
|
||||
setprg16(0xC000, ~0);
|
||||
}
|
||||
|
||||
static DECLFR(M68Read) {
|
||||
if (!(kogame & 8)) {
|
||||
count++;
|
||||
if (count == 1784)
|
||||
setprg16r(0, 0x8000, prg_reg);
|
||||
}
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteLo) {
|
||||
if (!V) {
|
||||
count = 0;
|
||||
setprg16r((PRGptr[1]) ? kogame : 0, 0x8000, prg_reg);
|
||||
}
|
||||
CartBW(A, V);
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteCHR) {
|
||||
chr_reg[(A >> 12) & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteNT1) {
|
||||
nt1 = V;
|
||||
M68NTfix();
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteNT2) {
|
||||
nt2 = V;
|
||||
M68NTfix();
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteMIR) {
|
||||
mirr = V;
|
||||
M68NTfix();
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteROM) {
|
||||
prg_reg = V & 7;
|
||||
kogame = ((V >> 3) & 1) ^ 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M68Power(void) {
|
||||
prg_reg = 0;
|
||||
kogame = 0;
|
||||
Sync();
|
||||
M68NTfix();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xBFFF, M68Read);
|
||||
SetReadHandler(0xC000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xBFFF, M68WriteCHR);
|
||||
SetWriteHandler(0xC000, 0xCFFF, M68WriteNT1);
|
||||
SetWriteHandler(0xD000, 0xDFFF, M68WriteNT2);
|
||||
SetWriteHandler(0xE000, 0xEFFF, M68WriteMIR);
|
||||
SetWriteHandler(0xF000, 0xFFFF, M68WriteROM);
|
||||
SetWriteHandler(0x6000, 0x6000, M68WriteLo);
|
||||
SetWriteHandler(0x6001, 0x7FFF, CartBW);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M68Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
M68NTfix();
|
||||
}
|
||||
|
||||
void Mapper68_Init(CartInfo *info) {
|
||||
info->Power = M68Power;
|
||||
info->Close = M68Close;
|
||||
GameStateRestore = StateRestore;
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
564
src/boards/69.c
564
src/boards/69.c
@@ -1,282 +1,282 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 cmdreg, preg[4], creg[8], mirr;
|
||||
static uint8 IRQa;
|
||||
static int32 IRQCount;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &cmdreg, 1, "CMDR" },
|
||||
{ preg, 4, "PREG" },
|
||||
{ creg, 8, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 i;
|
||||
if ((preg[3] & 0xC0) == 0xC0)
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
else
|
||||
setprg8(0x6000, preg[3] & 0x3F);
|
||||
setprg8(0x8000, preg[0]);
|
||||
setprg8(0xA000, preg[1]);
|
||||
setprg8(0xC000, preg[2]);
|
||||
setprg8(0xE000, ~0);
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, creg[i]);
|
||||
switch (mirr & 3) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M69WRAMWrite) {
|
||||
if ((preg[3] & 0xC0) == 0xC0)
|
||||
CartBW(A, V);
|
||||
}
|
||||
|
||||
static DECLFR(M69WRAMRead) {
|
||||
if ((preg[3] & 0xC0) == 0x40)
|
||||
return X.DB;
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(M69Write0) {
|
||||
cmdreg = V & 0xF;
|
||||
}
|
||||
|
||||
static DECLFW(M69Write1) {
|
||||
switch (cmdreg) {
|
||||
case 0x0: creg[0] = V; Sync(); break;
|
||||
case 0x1: creg[1] = V; Sync(); break;
|
||||
case 0x2: creg[2] = V; Sync(); break;
|
||||
case 0x3: creg[3] = V; Sync(); break;
|
||||
case 0x4: creg[4] = V; Sync(); break;
|
||||
case 0x5: creg[5] = V; Sync(); break;
|
||||
case 0x6: creg[6] = V; Sync(); break;
|
||||
case 0x7: creg[7] = V; Sync(); break;
|
||||
case 0x8: preg[3] = V; Sync(); break;
|
||||
case 0x9: preg[0] = V; Sync(); break;
|
||||
case 0xA: preg[1] = V; Sync(); break;
|
||||
case 0xB: preg[2] = V; Sync(); break;
|
||||
case 0xC: mirr = V & 3; Sync();break;
|
||||
/* 17/10/17- reg $0D should awknowledge IRQ and no other
|
||||
* http://forums.nesdev.com/viewtopic.php?f=2&t=12436&start=15
|
||||
*/
|
||||
case 0xD: IRQa = V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xE: IRQCount &= 0xFF00; IRQCount |= V; break;
|
||||
case 0xF: IRQCount &= 0x00FF; IRQCount |= V << 8; break;
|
||||
}
|
||||
}
|
||||
|
||||
/* SUNSOFT-5/FME-7 Sound */
|
||||
|
||||
static void AYSound(int Count);
|
||||
static void AYSoundHQ(void);
|
||||
static void DoAYSQ(int x);
|
||||
static void DoAYSQHQ(int x);
|
||||
|
||||
static uint8 sndcmd, sreg[14];
|
||||
static int32 vcount[3];
|
||||
static int32 dcount[3];
|
||||
static int CAYBC[3];
|
||||
|
||||
static SFORMAT SStateRegs[] =
|
||||
{
|
||||
{ &sndcmd, 1, "SCMD" },
|
||||
{ sreg, 14, "SREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static DECLFW(M69SWrite0) {
|
||||
sndcmd = V % 14;
|
||||
}
|
||||
|
||||
static DECLFW(M69SWrite1) {
|
||||
int x;
|
||||
GameExpSound.Fill = AYSound;
|
||||
GameExpSound.HiFill = AYSoundHQ;
|
||||
if (FSettings.SndRate)
|
||||
switch (sndcmd) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 8: if (FSettings.soundq >= 1) DoAYSQHQ(0); else DoAYSQ(0); break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 9: if (FSettings.soundq >= 1) DoAYSQHQ(1); else DoAYSQ(1); break;
|
||||
case 4:
|
||||
case 5:
|
||||
case 10: if (FSettings.soundq >= 1) DoAYSQHQ(2); else DoAYSQ(2); break;
|
||||
case 7:
|
||||
for (x = 0; x < 2; x++)
|
||||
if (FSettings.soundq >= 1) DoAYSQHQ(x); else DoAYSQ(x);
|
||||
break;
|
||||
}
|
||||
sreg[sndcmd] = V;
|
||||
}
|
||||
|
||||
static void DoAYSQ(int x) {
|
||||
int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << (4 + 17);
|
||||
int32 amp = (sreg[0x8 + x] & 15) << 2;
|
||||
int32 start, end;
|
||||
int V;
|
||||
|
||||
amp += amp >> 1;
|
||||
|
||||
start = CAYBC[x];
|
||||
end = (SOUNDTS << 16) / soundtsinc;
|
||||
if (end <= start) return;
|
||||
CAYBC[x] = end;
|
||||
|
||||
if (amp && !(sreg[0x7] & (1 << x)))
|
||||
for (V = start; V < end; V++) {
|
||||
if (dcount[x])
|
||||
Wave[V >> 4] += amp;
|
||||
vcount[x] -= nesincsize;
|
||||
while (vcount[x] <= 0) {
|
||||
dcount[x] ^= 1;
|
||||
vcount[x] += freq;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DoAYSQHQ(int x) {
|
||||
uint32 V;
|
||||
int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << 4;
|
||||
int32 amp = (sreg[0x8 + x] & 15) << 6;
|
||||
|
||||
amp += amp >> 1;
|
||||
|
||||
if (!(sreg[0x7] & (1 << x))) {
|
||||
for (V = CAYBC[x]; V < SOUNDTS; V++) {
|
||||
if (dcount[x])
|
||||
WaveHi[V] += amp;
|
||||
vcount[x]--;
|
||||
if (vcount[x] <= 0) {
|
||||
dcount[x] ^= 1;
|
||||
vcount[x] = freq;
|
||||
}
|
||||
}
|
||||
}
|
||||
CAYBC[x] = SOUNDTS;
|
||||
}
|
||||
|
||||
static void AYSound(int Count) {
|
||||
int x;
|
||||
DoAYSQ(0);
|
||||
DoAYSQ(1);
|
||||
DoAYSQ(2);
|
||||
for (x = 0; x < 3; x++)
|
||||
CAYBC[x] = Count;
|
||||
}
|
||||
|
||||
static void AYSoundHQ(void) {
|
||||
DoAYSQHQ(0);
|
||||
DoAYSQHQ(1);
|
||||
DoAYSQHQ(2);
|
||||
}
|
||||
|
||||
static void AYHiSync(int32 ts) {
|
||||
int x;
|
||||
|
||||
for (x = 0; x < 3; x++)
|
||||
CAYBC[x] = ts;
|
||||
}
|
||||
|
||||
void Mapper69_ESI(void) {
|
||||
GameExpSound.RChange = Mapper69_ESI;
|
||||
GameExpSound.HiSync = AYHiSync;
|
||||
memset(dcount, 0, sizeof(dcount));
|
||||
memset(vcount, 0, sizeof(vcount));
|
||||
memset(CAYBC, 0, sizeof(CAYBC));
|
||||
AddExState(&SStateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* SUNSOFT-5/FME-7 Sound */
|
||||
|
||||
static void M69Power(void) {
|
||||
cmdreg = sndcmd = 0;
|
||||
IRQCount = 0xFFFF;
|
||||
IRQa = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, M69WRAMRead);
|
||||
SetWriteHandler(0x6000, 0x7FFF, M69WRAMWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0x9FFF, M69Write0);
|
||||
SetWriteHandler(0xA000, 0xBFFF, M69Write1);
|
||||
SetWriteHandler(0xC000, 0xDFFF, M69SWrite0);
|
||||
SetWriteHandler(0xE000, 0xFFFF, M69SWrite1);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M69Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void M69IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount <= 0) {
|
||||
X6502_IRQBegin(FCEU_IQEXT); IRQa = 0; IRQCount = 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper69_Init(CartInfo *info) {
|
||||
info->Power = M69Power;
|
||||
info->Close = M69Close;
|
||||
MapIRQHook = M69IRQHook;
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
Mapper69_ESI();
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void NSFAY_Init(void) {
|
||||
sndcmd = 0;
|
||||
SetWriteHandler(0xC000, 0xDFFF, M69SWrite0);
|
||||
SetWriteHandler(0xE000, 0xFFFF, M69SWrite1);
|
||||
Mapper69_ESI();
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 cmdreg, preg[4], creg[8], mirr;
|
||||
static uint8 IRQa;
|
||||
static int32 IRQCount;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &cmdreg, 1, "CMDR" },
|
||||
{ preg, 4, "PREG" },
|
||||
{ creg, 8, "CREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 i;
|
||||
if ((preg[3] & 0xC0) == 0xC0)
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
else
|
||||
setprg8(0x6000, preg[3] & 0x3F);
|
||||
setprg8(0x8000, preg[0]);
|
||||
setprg8(0xA000, preg[1]);
|
||||
setprg8(0xC000, preg[2]);
|
||||
setprg8(0xE000, ~0);
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, creg[i]);
|
||||
switch (mirr & 3) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M69WRAMWrite) {
|
||||
if ((preg[3] & 0xC0) == 0xC0)
|
||||
CartBW(A, V);
|
||||
}
|
||||
|
||||
static DECLFR(M69WRAMRead) {
|
||||
if ((preg[3] & 0xC0) == 0x40)
|
||||
return X.DB;
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(M69Write0) {
|
||||
cmdreg = V & 0xF;
|
||||
}
|
||||
|
||||
static DECLFW(M69Write1) {
|
||||
switch (cmdreg) {
|
||||
case 0x0: creg[0] = V; Sync(); break;
|
||||
case 0x1: creg[1] = V; Sync(); break;
|
||||
case 0x2: creg[2] = V; Sync(); break;
|
||||
case 0x3: creg[3] = V; Sync(); break;
|
||||
case 0x4: creg[4] = V; Sync(); break;
|
||||
case 0x5: creg[5] = V; Sync(); break;
|
||||
case 0x6: creg[6] = V; Sync(); break;
|
||||
case 0x7: creg[7] = V; Sync(); break;
|
||||
case 0x8: preg[3] = V; Sync(); break;
|
||||
case 0x9: preg[0] = V; Sync(); break;
|
||||
case 0xA: preg[1] = V; Sync(); break;
|
||||
case 0xB: preg[2] = V; Sync(); break;
|
||||
case 0xC: mirr = V & 3; Sync();break;
|
||||
/* 17/10/17- reg $0D should awknowledge IRQ and no other
|
||||
* http://forums.nesdev.com/viewtopic.php?f=2&t=12436&start=15
|
||||
*/
|
||||
case 0xD: IRQa = V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xE: IRQCount &= 0xFF00; IRQCount |= V; break;
|
||||
case 0xF: IRQCount &= 0x00FF; IRQCount |= V << 8; break;
|
||||
}
|
||||
}
|
||||
|
||||
/* SUNSOFT-5/FME-7 Sound */
|
||||
|
||||
static void AYSound(int Count);
|
||||
static void AYSoundHQ(void);
|
||||
static void DoAYSQ(int x);
|
||||
static void DoAYSQHQ(int x);
|
||||
|
||||
static uint8 sndcmd, sreg[14];
|
||||
static int32 vcount[3];
|
||||
static int32 dcount[3];
|
||||
static int CAYBC[3];
|
||||
|
||||
static SFORMAT SStateRegs[] =
|
||||
{
|
||||
{ &sndcmd, 1, "SCMD" },
|
||||
{ sreg, 14, "SREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static DECLFW(M69SWrite0) {
|
||||
sndcmd = V % 14;
|
||||
}
|
||||
|
||||
static DECLFW(M69SWrite1) {
|
||||
int x;
|
||||
GameExpSound.Fill = AYSound;
|
||||
GameExpSound.HiFill = AYSoundHQ;
|
||||
if (FSettings.SndRate)
|
||||
switch (sndcmd) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 8: if (FSettings.soundq >= 1) DoAYSQHQ(0); else DoAYSQ(0); break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 9: if (FSettings.soundq >= 1) DoAYSQHQ(1); else DoAYSQ(1); break;
|
||||
case 4:
|
||||
case 5:
|
||||
case 10: if (FSettings.soundq >= 1) DoAYSQHQ(2); else DoAYSQ(2); break;
|
||||
case 7:
|
||||
for (x = 0; x < 2; x++)
|
||||
if (FSettings.soundq >= 1) DoAYSQHQ(x); else DoAYSQ(x);
|
||||
break;
|
||||
}
|
||||
sreg[sndcmd] = V;
|
||||
}
|
||||
|
||||
static void DoAYSQ(int x) {
|
||||
int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << (4 + 17);
|
||||
int32 amp = (sreg[0x8 + x] & 15) << 2;
|
||||
int32 start, end;
|
||||
int V;
|
||||
|
||||
amp += amp >> 1;
|
||||
|
||||
start = CAYBC[x];
|
||||
end = (SOUNDTS << 16) / soundtsinc;
|
||||
if (end <= start) return;
|
||||
CAYBC[x] = end;
|
||||
|
||||
if (amp && !(sreg[0x7] & (1 << x)))
|
||||
for (V = start; V < end; V++) {
|
||||
if (dcount[x])
|
||||
Wave[V >> 4] += amp;
|
||||
vcount[x] -= nesincsize;
|
||||
while (vcount[x] <= 0) {
|
||||
dcount[x] ^= 1;
|
||||
vcount[x] += freq;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DoAYSQHQ(int x) {
|
||||
uint32 V;
|
||||
int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << 4;
|
||||
int32 amp = (sreg[0x8 + x] & 15) << 6;
|
||||
|
||||
amp += amp >> 1;
|
||||
|
||||
if (!(sreg[0x7] & (1 << x))) {
|
||||
for (V = CAYBC[x]; V < SOUNDTS; V++) {
|
||||
if (dcount[x])
|
||||
WaveHi[V] += amp;
|
||||
vcount[x]--;
|
||||
if (vcount[x] <= 0) {
|
||||
dcount[x] ^= 1;
|
||||
vcount[x] = freq;
|
||||
}
|
||||
}
|
||||
}
|
||||
CAYBC[x] = SOUNDTS;
|
||||
}
|
||||
|
||||
static void AYSound(int Count) {
|
||||
int x;
|
||||
DoAYSQ(0);
|
||||
DoAYSQ(1);
|
||||
DoAYSQ(2);
|
||||
for (x = 0; x < 3; x++)
|
||||
CAYBC[x] = Count;
|
||||
}
|
||||
|
||||
static void AYSoundHQ(void) {
|
||||
DoAYSQHQ(0);
|
||||
DoAYSQHQ(1);
|
||||
DoAYSQHQ(2);
|
||||
}
|
||||
|
||||
static void AYHiSync(int32 ts) {
|
||||
int x;
|
||||
|
||||
for (x = 0; x < 3; x++)
|
||||
CAYBC[x] = ts;
|
||||
}
|
||||
|
||||
void Mapper69_ESI(void) {
|
||||
GameExpSound.RChange = Mapper69_ESI;
|
||||
GameExpSound.HiSync = AYHiSync;
|
||||
memset(dcount, 0, sizeof(dcount));
|
||||
memset(vcount, 0, sizeof(vcount));
|
||||
memset(CAYBC, 0, sizeof(CAYBC));
|
||||
AddExState(&SStateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* SUNSOFT-5/FME-7 Sound */
|
||||
|
||||
static void M69Power(void) {
|
||||
cmdreg = sndcmd = 0;
|
||||
IRQCount = 0xFFFF;
|
||||
IRQa = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, M69WRAMRead);
|
||||
SetWriteHandler(0x6000, 0x7FFF, M69WRAMWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0x9FFF, M69Write0);
|
||||
SetWriteHandler(0xA000, 0xBFFF, M69Write1);
|
||||
SetWriteHandler(0xC000, 0xDFFF, M69SWrite0);
|
||||
SetWriteHandler(0xE000, 0xFFFF, M69SWrite1);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M69Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void M69IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount <= 0) {
|
||||
X6502_IRQBegin(FCEU_IQEXT); IRQa = 0; IRQCount = 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper69_Init(CartInfo *info) {
|
||||
info->Power = M69Power;
|
||||
info->Close = M69Close;
|
||||
MapIRQHook = M69IRQHook;
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
Mapper69_ESI();
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void NSFAY_Init(void) {
|
||||
sndcmd = 0;
|
||||
SetWriteHandler(0xC000, 0xDFFF, M69SWrite0);
|
||||
SetWriteHandler(0xE000, 0xFFFF, M69SWrite1);
|
||||
Mapper69_ESI();
|
||||
}
|
||||
|
||||
128
src/boards/71.c
128
src/boards/71.c
@@ -1,64 +1,64 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg, mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, preg);
|
||||
setprg16(0xC000, ~0);
|
||||
setchr8(0);
|
||||
if (mirr)
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(M71Write) {
|
||||
if ((A & 0xF000) == 0x9000)
|
||||
mirr = MI_0 + ((V >> 4) & 1); /* 2-in-1, some carts are normal hardwire V/H mirror, some uses mapper selectable 0/1 mirror */
|
||||
else
|
||||
preg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M71Power(void) {
|
||||
mirr = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M71Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper71_Init(CartInfo *info) {
|
||||
info->Power = M71Power;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg, mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, preg);
|
||||
setprg16(0xC000, ~0);
|
||||
setchr8(0);
|
||||
if (mirr)
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(M71Write) {
|
||||
if ((A & 0xF000) == 0x9000)
|
||||
mirr = MI_0 + ((V >> 4) & 1); /* 2-in-1, some carts are normal hardwire V/H mirror, some uses mapper selectable 0/1 mirror */
|
||||
else
|
||||
preg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M71Power(void) {
|
||||
mirr = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M71Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper71_Init(CartInfo *info) {
|
||||
info->Power = M71Power;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
128
src/boards/72.c
128
src/boards/72.c
@@ -1,64 +1,64 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Moero!! Pro Tennis have ADPCM codec on-board, PROM isn't dumped, emulation isn't
|
||||
* possible just now.
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 preg, creg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ &creg, 1, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, preg);
|
||||
setprg16(0xC000, ~0);
|
||||
setchr8(creg);
|
||||
}
|
||||
|
||||
static DECLFW(M72Write) {
|
||||
if (V & 0x80)
|
||||
preg = V & 0xF;
|
||||
if (V & 0x40)
|
||||
creg = V & 0xF;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M72Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, M72Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper72_Init(CartInfo *info) {
|
||||
info->Power = M72Power;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Moero!! Pro Tennis have ADPCM codec on-board, PROM isn't dumped, emulation isn't
|
||||
* possible just now.
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 preg, creg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &preg, 1, "PREG" },
|
||||
{ &creg, 1, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, preg);
|
||||
setprg16(0xC000, ~0);
|
||||
setchr8(creg);
|
||||
}
|
||||
|
||||
static DECLFW(M72Write) {
|
||||
if (V & 0x80)
|
||||
preg = V & 0xF;
|
||||
if (V & 0x40)
|
||||
creg = V & 0xF;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M72Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, M72Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper72_Init(CartInfo *info) {
|
||||
info->Power = M72Power;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
148
src/boards/77.c
148
src/boards/77.c
@@ -1,74 +1,74 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 latche;
|
||||
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &latche, 1, "LATC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, latche & 7);
|
||||
setchr2(0x0000, latche >> 4);
|
||||
setchr2r(0x10, 0x0800, 2);
|
||||
setchr4r(0x10, 0x1000, 0);
|
||||
}
|
||||
|
||||
static DECLFW(M77Write) {
|
||||
latche = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M77Power(void) {
|
||||
latche = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M77Write);
|
||||
}
|
||||
|
||||
static void M77Close(void) {
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper77_Init(CartInfo *info) {
|
||||
info->Power = M77Power;
|
||||
info->Close = M77Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
CHRRAMSIZE = 6 * 1024;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 latche;
|
||||
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &latche, 1, "LATC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, latche & 7);
|
||||
setchr2(0x0000, latche >> 4);
|
||||
setchr2r(0x10, 0x0800, 2);
|
||||
setchr4r(0x10, 0x1000, 0);
|
||||
}
|
||||
|
||||
static DECLFW(M77Write) {
|
||||
latche = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M77Power(void) {
|
||||
latche = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M77Write);
|
||||
}
|
||||
|
||||
static void M77Close(void) {
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper77_Init(CartInfo *info) {
|
||||
info->Power = M77Power;
|
||||
info->Close = M77Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
CHRRAMSIZE = 6 * 1024;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
122
src/boards/79.c
122
src/boards/79.c
@@ -1,61 +1,61 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 creg, preg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &creg, 1, "CREG" },
|
||||
{ &preg, 1, "PREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, preg);
|
||||
setchr8(creg);
|
||||
}
|
||||
|
||||
static DECLFW(M79Write) {
|
||||
if ((A < 0x8000) && ((A ^ 0x4100) == 0)) {
|
||||
preg = (V >> 3) & 1;
|
||||
}
|
||||
creg = V & 7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M79Power(void) {
|
||||
preg = ~0;
|
||||
Sync();
|
||||
SetWriteHandler(0x4100, 0x5FFF, M79Write);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M79Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper79_Init(CartInfo *info) {
|
||||
info->Power = M79Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 creg, preg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &creg, 1, "CREG" },
|
||||
{ &preg, 1, "PREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, preg);
|
||||
setchr8(creg);
|
||||
}
|
||||
|
||||
static DECLFW(M79Write) {
|
||||
if ((A < 0x8000) && ((A ^ 0x4100) == 0)) {
|
||||
preg = (V >> 3) & 1;
|
||||
}
|
||||
creg = V & 7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M79Power(void) {
|
||||
preg = ~0;
|
||||
Sync();
|
||||
SetWriteHandler(0x4100, 0x5FFF, M79Write);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M79Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper79_Init(CartInfo *info) {
|
||||
info->Power = M79Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
386
src/boards/80.c
386
src/boards/80.c
@@ -1,193 +1,193 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg[3], creg[6], isExMirr;
|
||||
static uint8 mirr, cmd, wram_enable, wram[256];
|
||||
static uint8 mcache[8];
|
||||
static uint32 lastppu;
|
||||
|
||||
static SFORMAT StateRegs80[] =
|
||||
{
|
||||
{ preg, 3, "PREG" },
|
||||
{ creg, 6, "CREG" },
|
||||
{ wram, 256, "WRAM" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &wram_enable, 1, "WRME" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static SFORMAT StateRegs95[] =
|
||||
{
|
||||
{ &cmd, 1, "CMDR" },
|
||||
{ preg, 3, "PREG" },
|
||||
{ creg, 6, "CREG" },
|
||||
{ mcache, 8, "MCCH" },
|
||||
{ &lastppu, 4, "LPPU" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static SFORMAT StateRegs207[] =
|
||||
{
|
||||
{ preg, 3, "PREG" },
|
||||
{ creg, 6, "CREG" },
|
||||
{ mcache, 8, "MCCH" },
|
||||
{ &lastppu, 4, "LPPU" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x8000, preg[0]);
|
||||
setprg8(0xA000, preg[1]);
|
||||
setprg8(0xC000, preg[2]);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr2(0x0000, (creg[0] >> 1) & 0x3F);
|
||||
setchr2(0x0800, (creg[1] >> 1) & 0x3F);
|
||||
setchr1(0x1000, creg[2]);
|
||||
setchr1(0x1400, creg[3]);
|
||||
setchr1(0x1800, creg[4]);
|
||||
setchr1(0x1C00, creg[5]);
|
||||
if (isExMirr) {
|
||||
setmirror(MI_0 + mcache[lastppu]);
|
||||
} else
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(M80RamWrite) {
|
||||
if (wram_enable == 0xA3)
|
||||
wram[A & 0xFF] = V;
|
||||
}
|
||||
|
||||
static DECLFR(M80RamRead) {
|
||||
if (wram_enable == 0xA3)
|
||||
return wram[A & 0xFF];
|
||||
else
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
static DECLFW(M80Write) {
|
||||
switch (A) {
|
||||
case 0x7EF0: creg[0] = V; mcache[0] = mcache[1] = V >> 7; Sync(); break;
|
||||
case 0x7EF1: creg[1] = V; mcache[2] = mcache[3] = V >> 7; Sync(); break;
|
||||
case 0x7EF2: creg[2] = V; mcache[4] = V >> 7; Sync(); break;
|
||||
case 0x7EF3: creg[3] = V; mcache[5] = V >> 7; Sync(); break;
|
||||
case 0x7EF4: creg[4] = V; mcache[6] = V >> 7; Sync(); break;
|
||||
case 0x7EF5: creg[5] = V; mcache[7] = V >> 7; Sync(); break;
|
||||
case 0x7EF6: mirr = V & 1; Sync(); break;
|
||||
case 0x7EF8: wram_enable = V; break;
|
||||
case 0x7EFA:
|
||||
case 0x7EFB: preg[0] = V; Sync(); break;
|
||||
case 0x7EFC:
|
||||
case 0x7EFD: preg[1] = V; Sync(); break;
|
||||
case 0x7EFE:
|
||||
case 0x7EFF: preg[2] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M95Write) {
|
||||
switch (A & 0xF001) {
|
||||
case 0x8000: cmd = V; break;
|
||||
case 0x8001:
|
||||
switch (cmd & 0x07) {
|
||||
case 0: creg[0] = V & 0x1F; mcache[0] = mcache[1] = (V >> 5) & 1; Sync(); break;
|
||||
case 1: creg[1] = V & 0x1F; mcache[2] = mcache[3] = (V >> 5) & 1; Sync(); break;
|
||||
case 2: creg[2] = V & 0x1F; mcache[4] = (V >> 5) & 1; Sync(); break;
|
||||
case 3: creg[3] = V & 0x1F; mcache[5] = (V >> 5) & 1; Sync(); break;
|
||||
case 4: creg[4] = V & 0x1F; mcache[6] = (V >> 5) & 1; Sync(); break;
|
||||
case 5: creg[5] = V & 0x1F; mcache[7] = (V >> 5) & 1; Sync(); break;
|
||||
case 6: preg[0] = V; Sync(); break;
|
||||
case 7: preg[1] = V; Sync(); break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) MExMirrPPU(uint32 A) {
|
||||
static int8 lastmirr = -1, curmirr;
|
||||
if (A < 0x2000) {
|
||||
lastppu = A >> 10;
|
||||
curmirr = mcache[lastppu];
|
||||
if (curmirr != lastmirr) {
|
||||
setmirror(MI_0 + curmirr);
|
||||
lastmirr = curmirr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M80Power(void) {
|
||||
wram_enable = 0xFF;
|
||||
Sync();
|
||||
SetReadHandler(0x7F00, 0x7FFF, M80RamRead);
|
||||
SetWriteHandler(0x7F00, 0x7FFF, M80RamWrite);
|
||||
SetWriteHandler(0x7EF0, 0x7EFF, M80Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void M207Power(void) {
|
||||
mcache[0] = mcache[1] = mcache[2] = mcache[3] = 0;
|
||||
mcache[4] = mcache[5] = mcache[6] = mcache[7] = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x7EF0, 0x7EFF, M80Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void M95Power(void) {
|
||||
preg[2] = ~1;
|
||||
mcache[0] = mcache[1] = mcache[2] = mcache[3] = 0;
|
||||
mcache[4] = mcache[5] = mcache[6] = mcache[7] = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M95Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper80_Init(CartInfo *info) {
|
||||
isExMirr = 0;
|
||||
info->Power = M80Power;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = wram;
|
||||
info->SaveGameLen[0] = 256;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs80, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper95_Init(CartInfo *info) {
|
||||
isExMirr = 1;
|
||||
info->Power = M95Power;
|
||||
PPU_hook = MExMirrPPU;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs95, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper207_Init(CartInfo *info) {
|
||||
isExMirr = 1;
|
||||
info->Power = M207Power;
|
||||
PPU_hook = MExMirrPPU;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs207, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 preg[3], creg[6], isExMirr;
|
||||
static uint8 mirr, cmd, wram_enable, wram[256];
|
||||
static uint8 mcache[8];
|
||||
static uint32 lastppu;
|
||||
|
||||
static SFORMAT StateRegs80[] =
|
||||
{
|
||||
{ preg, 3, "PREG" },
|
||||
{ creg, 6, "CREG" },
|
||||
{ wram, 256, "WRAM" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &wram_enable, 1, "WRME" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static SFORMAT StateRegs95[] =
|
||||
{
|
||||
{ &cmd, 1, "CMDR" },
|
||||
{ preg, 3, "PREG" },
|
||||
{ creg, 6, "CREG" },
|
||||
{ mcache, 8, "MCCH" },
|
||||
{ &lastppu, 4, "LPPU" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static SFORMAT StateRegs207[] =
|
||||
{
|
||||
{ preg, 3, "PREG" },
|
||||
{ creg, 6, "CREG" },
|
||||
{ mcache, 8, "MCCH" },
|
||||
{ &lastppu, 4, "LPPU" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x8000, preg[0]);
|
||||
setprg8(0xA000, preg[1]);
|
||||
setprg8(0xC000, preg[2]);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr2(0x0000, (creg[0] >> 1) & 0x3F);
|
||||
setchr2(0x0800, (creg[1] >> 1) & 0x3F);
|
||||
setchr1(0x1000, creg[2]);
|
||||
setchr1(0x1400, creg[3]);
|
||||
setchr1(0x1800, creg[4]);
|
||||
setchr1(0x1C00, creg[5]);
|
||||
if (isExMirr) {
|
||||
setmirror(MI_0 + mcache[lastppu]);
|
||||
} else
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(M80RamWrite) {
|
||||
if (wram_enable == 0xA3)
|
||||
wram[A & 0xFF] = V;
|
||||
}
|
||||
|
||||
static DECLFR(M80RamRead) {
|
||||
if (wram_enable == 0xA3)
|
||||
return wram[A & 0xFF];
|
||||
else
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
static DECLFW(M80Write) {
|
||||
switch (A) {
|
||||
case 0x7EF0: creg[0] = V; mcache[0] = mcache[1] = V >> 7; Sync(); break;
|
||||
case 0x7EF1: creg[1] = V; mcache[2] = mcache[3] = V >> 7; Sync(); break;
|
||||
case 0x7EF2: creg[2] = V; mcache[4] = V >> 7; Sync(); break;
|
||||
case 0x7EF3: creg[3] = V; mcache[5] = V >> 7; Sync(); break;
|
||||
case 0x7EF4: creg[4] = V; mcache[6] = V >> 7; Sync(); break;
|
||||
case 0x7EF5: creg[5] = V; mcache[7] = V >> 7; Sync(); break;
|
||||
case 0x7EF6: mirr = V & 1; Sync(); break;
|
||||
case 0x7EF8: wram_enable = V; break;
|
||||
case 0x7EFA:
|
||||
case 0x7EFB: preg[0] = V; Sync(); break;
|
||||
case 0x7EFC:
|
||||
case 0x7EFD: preg[1] = V; Sync(); break;
|
||||
case 0x7EFE:
|
||||
case 0x7EFF: preg[2] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M95Write) {
|
||||
switch (A & 0xF001) {
|
||||
case 0x8000: cmd = V; break;
|
||||
case 0x8001:
|
||||
switch (cmd & 0x07) {
|
||||
case 0: creg[0] = V & 0x1F; mcache[0] = mcache[1] = (V >> 5) & 1; Sync(); break;
|
||||
case 1: creg[1] = V & 0x1F; mcache[2] = mcache[3] = (V >> 5) & 1; Sync(); break;
|
||||
case 2: creg[2] = V & 0x1F; mcache[4] = (V >> 5) & 1; Sync(); break;
|
||||
case 3: creg[3] = V & 0x1F; mcache[5] = (V >> 5) & 1; Sync(); break;
|
||||
case 4: creg[4] = V & 0x1F; mcache[6] = (V >> 5) & 1; Sync(); break;
|
||||
case 5: creg[5] = V & 0x1F; mcache[7] = (V >> 5) & 1; Sync(); break;
|
||||
case 6: preg[0] = V; Sync(); break;
|
||||
case 7: preg[1] = V; Sync(); break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) MExMirrPPU(uint32 A) {
|
||||
static int8 lastmirr = -1, curmirr;
|
||||
if (A < 0x2000) {
|
||||
lastppu = A >> 10;
|
||||
curmirr = mcache[lastppu];
|
||||
if (curmirr != lastmirr) {
|
||||
setmirror(MI_0 + curmirr);
|
||||
lastmirr = curmirr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M80Power(void) {
|
||||
wram_enable = 0xFF;
|
||||
Sync();
|
||||
SetReadHandler(0x7F00, 0x7FFF, M80RamRead);
|
||||
SetWriteHandler(0x7F00, 0x7FFF, M80RamWrite);
|
||||
SetWriteHandler(0x7EF0, 0x7EFF, M80Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void M207Power(void) {
|
||||
mcache[0] = mcache[1] = mcache[2] = mcache[3] = 0;
|
||||
mcache[4] = mcache[5] = mcache[6] = mcache[7] = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x7EF0, 0x7EFF, M80Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void M95Power(void) {
|
||||
preg[2] = ~1;
|
||||
mcache[0] = mcache[1] = mcache[2] = mcache[3] = 0;
|
||||
mcache[4] = mcache[5] = mcache[6] = mcache[7] = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M95Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper80_Init(CartInfo *info) {
|
||||
isExMirr = 0;
|
||||
info->Power = M80Power;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = wram;
|
||||
info->SaveGameLen[0] = 256;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs80, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper95_Init(CartInfo *info) {
|
||||
isExMirr = 1;
|
||||
info->Power = M95Power;
|
||||
PPU_hook = MExMirrPPU;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs95, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper207_Init(CartInfo *info) {
|
||||
isExMirr = 1;
|
||||
info->Power = M207Power;
|
||||
PPU_hook = MExMirrPPU;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs207, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,85 +1,85 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* GG1 boards, similar to T-262, with no Data latch
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint16 cmdreg;
|
||||
static uint8 reset;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &reset, 1, "REST" },
|
||||
{ &cmdreg, 2, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint32 base = ((cmdreg & 0x060) | ((cmdreg & 0x100) >> 1)) >> 2;
|
||||
uint32 bank = (cmdreg & 0x01C) >> 2;
|
||||
uint32 lbank = (cmdreg & 0x200) ? 7 : ((cmdreg & 0x80) ? bank : 0);
|
||||
if (PRGptr[1]) {
|
||||
setprg16r(base >> 3, 0x8000, bank); /* for versions with split ROMs */
|
||||
setprg16r(base >> 3, 0xC000, lbank);
|
||||
} else {
|
||||
setprg16(0x8000, base | bank);
|
||||
setprg16(0xC000, base | lbank);
|
||||
}
|
||||
setmirror(((cmdreg & 2) >> 1) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFR(UNL8157Read) {
|
||||
if ((cmdreg & 0x100) && (PRGsize[0] < (1024 * 1024))) {
|
||||
A = (A & 0xFFF0) + reset;
|
||||
}
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(UNL8157Write) {
|
||||
cmdreg = A;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Power(void) {
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNL8157Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, UNL8157Read);
|
||||
cmdreg = reset = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Reset(void) {
|
||||
cmdreg = reset = 0;
|
||||
reset++;
|
||||
reset &= 0x1F;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNL8157_Init(CartInfo *info) {
|
||||
info->Power = UNL8157Power;
|
||||
info->Reset = UNL8157Reset;
|
||||
GameStateRestore = UNL8157Restore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* GG1 boards, similar to T-262, with no Data latch
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint16 cmdreg;
|
||||
static uint8 reset;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &reset, 1, "REST" },
|
||||
{ &cmdreg, 2, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint32 base = ((cmdreg & 0x060) | ((cmdreg & 0x100) >> 1)) >> 2;
|
||||
uint32 bank = (cmdreg & 0x01C) >> 2;
|
||||
uint32 lbank = (cmdreg & 0x200) ? 7 : ((cmdreg & 0x80) ? bank : 0);
|
||||
if (PRGptr[1]) {
|
||||
setprg16r(base >> 3, 0x8000, bank); /* for versions with split ROMs */
|
||||
setprg16r(base >> 3, 0xC000, lbank);
|
||||
} else {
|
||||
setprg16(0x8000, base | bank);
|
||||
setprg16(0xC000, base | lbank);
|
||||
}
|
||||
setmirror(((cmdreg & 2) >> 1) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFR(UNL8157Read) {
|
||||
if ((cmdreg & 0x100) && (PRGsize[0] < (1024 * 1024))) {
|
||||
A = (A & 0xFFF0) + reset;
|
||||
}
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(UNL8157Write) {
|
||||
cmdreg = A;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Power(void) {
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNL8157Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, UNL8157Read);
|
||||
cmdreg = reset = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Reset(void) {
|
||||
cmdreg = reset = 0;
|
||||
reset++;
|
||||
reset &= 0x1F;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNL8157_Init(CartInfo *info) {
|
||||
info->Power = UNL8157Power;
|
||||
info->Reset = UNL8157Reset;
|
||||
GameStateRestore = UNL8157Restore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
196
src/boards/82.c
196
src/boards/82.c
@@ -1,98 +1,98 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Taito X1-017 board, battery backed
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[9], ctrl;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 9, "REGS" },
|
||||
{ &ctrl, 1, "CTRL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint32 swap = ((ctrl & 2) << 11);
|
||||
setchr2(0x0000 ^ swap, regs[0] >> 1);
|
||||
setchr2(0x0800 ^ swap, regs[1] >> 1);
|
||||
setchr1(0x1000 ^ swap, regs[2]);
|
||||
setchr1(0x1400 ^ swap, regs[3]);
|
||||
setchr1(0x1800 ^ swap, regs[4]);
|
||||
setchr1(0x1c00 ^ swap, regs[5]);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000, regs[6]);
|
||||
setprg8(0xA000, regs[7]);
|
||||
setprg8(0xC000, regs[8]);
|
||||
setprg8(0xE000, ~0);
|
||||
setmirror(ctrl & 1);
|
||||
}
|
||||
|
||||
static DECLFW(M82Write) {
|
||||
if (A <= 0x7ef5)
|
||||
regs[A & 7] = V;
|
||||
else
|
||||
switch (A) {
|
||||
case 0x7ef6: ctrl = V & 3; break;
|
||||
case 0x7efa: regs[6] = V >> 2; break;
|
||||
case 0x7efb: regs[7] = V >> 2; break;
|
||||
case 0x7efc: regs[8] = V >> 2; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M82Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||
SetWriteHandler(0x7ef0, 0x7efc, M82Write); /* external WRAM might end at $73FF */
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M82Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper82_Init(CartInfo *info) {
|
||||
info->Power = M82Power;
|
||||
info->Close = M82Close;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Taito X1-017 board, battery backed
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[9], ctrl;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 9, "REGS" },
|
||||
{ &ctrl, 1, "CTRL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint32 swap = ((ctrl & 2) << 11);
|
||||
setchr2(0x0000 ^ swap, regs[0] >> 1);
|
||||
setchr2(0x0800 ^ swap, regs[1] >> 1);
|
||||
setchr1(0x1000 ^ swap, regs[2]);
|
||||
setchr1(0x1400 ^ swap, regs[3]);
|
||||
setchr1(0x1800 ^ swap, regs[4]);
|
||||
setchr1(0x1c00 ^ swap, regs[5]);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000, regs[6]);
|
||||
setprg8(0xA000, regs[7]);
|
||||
setprg8(0xC000, regs[8]);
|
||||
setprg8(0xE000, ~0);
|
||||
setmirror(ctrl & 1);
|
||||
}
|
||||
|
||||
static DECLFW(M82Write) {
|
||||
if (A <= 0x7ef5)
|
||||
regs[A & 7] = V;
|
||||
else
|
||||
switch (A) {
|
||||
case 0x7ef6: ctrl = V & 3; break;
|
||||
case 0x7efa: regs[6] = V >> 2; break;
|
||||
case 0x7efb: regs[7] = V >> 2; break;
|
||||
case 0x7efc: regs[8] = V >> 2; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M82Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||
SetWriteHandler(0x7ef0, 0x7efc, M82Write); /* external WRAM might end at $73FF */
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M82Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper82_Init(CartInfo *info) {
|
||||
info->Power = M82Power;
|
||||
info->Close = M82Close;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,68 +1,68 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2008 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* M-022 MMC3 based 830118C T-106 4M + 4M */
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void BMC830118CCW(uint32 A, uint8 V) {
|
||||
setchr1(A, (V & 0x7F) | ((EXPREGS[0] & 0x0c) << 5));
|
||||
}
|
||||
|
||||
static void BMC830118CPW(uint32 A, uint8 V) {
|
||||
if ((EXPREGS[0] & 0x0C) == 0x0C) {
|
||||
if (A == 0x8000) {
|
||||
setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 0x0c) << 2));
|
||||
setprg8(0xC000, (V & 0x0F) | 0x32);
|
||||
} else if (A == 0xA000) {
|
||||
setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 0x0c) << 2));
|
||||
setprg8(0xE000, (V & 0x0F) | 0x32);
|
||||
}
|
||||
} else {
|
||||
setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 0x0c) << 2));
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(BMC830118CLoWrite) {
|
||||
EXPREGS[0] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void BMC830118CReset(void) {
|
||||
EXPREGS[0] = 0;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void BMC830118CPower(void) {
|
||||
EXPREGS[0] = 0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x6800, 0x68FF, BMC830118CLoWrite);
|
||||
}
|
||||
|
||||
void BMC830118C_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 128, 8, 0);
|
||||
pwrap = BMC830118CPW;
|
||||
cwrap = BMC830118CCW;
|
||||
info->Power = BMC830118CPower;
|
||||
info->Reset = BMC830118CReset;
|
||||
AddExState(EXPREGS, 1, 0, "EXPR");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2008 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* M-022 MMC3 based 830118C T-106 4M + 4M */
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void BMC830118CCW(uint32 A, uint8 V) {
|
||||
setchr1(A, (V & 0x7F) | ((EXPREGS[0] & 0x0c) << 5));
|
||||
}
|
||||
|
||||
static void BMC830118CPW(uint32 A, uint8 V) {
|
||||
if ((EXPREGS[0] & 0x0C) == 0x0C) {
|
||||
if (A == 0x8000) {
|
||||
setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 0x0c) << 2));
|
||||
setprg8(0xC000, (V & 0x0F) | 0x32);
|
||||
} else if (A == 0xA000) {
|
||||
setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 0x0c) << 2));
|
||||
setprg8(0xE000, (V & 0x0F) | 0x32);
|
||||
}
|
||||
} else {
|
||||
setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 0x0c) << 2));
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(BMC830118CLoWrite) {
|
||||
EXPREGS[0] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void BMC830118CReset(void) {
|
||||
EXPREGS[0] = 0;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void BMC830118CPower(void) {
|
||||
EXPREGS[0] = 0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x6800, 0x68FF, BMC830118CLoWrite);
|
||||
}
|
||||
|
||||
void BMC830118C_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 128, 8, 0);
|
||||
pwrap = BMC830118CPW;
|
||||
cwrap = BMC830118CCW;
|
||||
info->Power = BMC830118CPower;
|
||||
info->Reset = BMC830118CReset;
|
||||
AddExState(EXPREGS, 1, 0, "EXPR");
|
||||
}
|
||||
|
||||
170
src/boards/91.c
170
src/boards/91.c
@@ -1,85 +1,85 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 cregs[4], pregs[2];
|
||||
static uint8 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ cregs, 4, "CREG" },
|
||||
{ pregs, 2, "PREG" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x8000, pregs[0]);
|
||||
setprg8(0xa000, pregs[1]);
|
||||
setprg8(0xc000, ~1);
|
||||
setprg8(0xe000, ~0);
|
||||
setchr2(0x0000, cregs[0]);
|
||||
setchr2(0x0800, cregs[1]);
|
||||
setchr2(0x1000, cregs[2]);
|
||||
setchr2(0x1800, cregs[3]);
|
||||
}
|
||||
|
||||
static DECLFW(M91Write0) {
|
||||
cregs[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M91Write1) {
|
||||
switch (A & 3) {
|
||||
case 0:
|
||||
case 1: pregs[A & 1] = V; Sync(); break;
|
||||
case 2: IRQa = IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 3: IRQa = 1; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M91Power(void) {
|
||||
Sync();
|
||||
SetWriteHandler(0x6000, 0x6fff, M91Write0);
|
||||
SetWriteHandler(0x7000, 0x7fff, M91Write1);
|
||||
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||
}
|
||||
|
||||
static void M91IRQHook(void) {
|
||||
if (IRQCount < 8 && IRQa) {
|
||||
IRQCount++;
|
||||
if (IRQCount >= 8) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper91_Init(CartInfo *info) {
|
||||
info->Power = M91Power;
|
||||
GameHBIRQHook = M91IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 cregs[4], pregs[2];
|
||||
static uint8 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ cregs, 4, "CREG" },
|
||||
{ pregs, 2, "PREG" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x8000, pregs[0]);
|
||||
setprg8(0xa000, pregs[1]);
|
||||
setprg8(0xc000, ~1);
|
||||
setprg8(0xe000, ~0);
|
||||
setchr2(0x0000, cregs[0]);
|
||||
setchr2(0x0800, cregs[1]);
|
||||
setchr2(0x1000, cregs[2]);
|
||||
setchr2(0x1800, cregs[3]);
|
||||
}
|
||||
|
||||
static DECLFW(M91Write0) {
|
||||
cregs[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M91Write1) {
|
||||
switch (A & 3) {
|
||||
case 0:
|
||||
case 1: pregs[A & 1] = V; Sync(); break;
|
||||
case 2: IRQa = IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 3: IRQa = 1; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M91Power(void) {
|
||||
Sync();
|
||||
SetWriteHandler(0x6000, 0x6fff, M91Write0);
|
||||
SetWriteHandler(0x7000, 0x7fff, M91Write1);
|
||||
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||
}
|
||||
|
||||
static void M91IRQHook(void) {
|
||||
if (IRQCount < 8 && IRQa) {
|
||||
IRQCount++;
|
||||
if (IRQCount >= 8) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper91_Init(CartInfo *info) {
|
||||
info->Power = M91Power;
|
||||
GameHBIRQHook = M91IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
154
src/boards/96.c
154
src/boards/96.c
@@ -1,77 +1,77 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 1998 BERO
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Oeka-kids board
|
||||
*
|
||||
* I might want to add some code to the mapper 96 PPU hook function
|
||||
* to not change CHR banks if the attribute table is being accessed,
|
||||
* if I make emulation a little more accurate in the future.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, ppulatch;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ &ppulatch, 1, "PPUL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror(MI_0);
|
||||
setprg32(0x8000, reg & 3);
|
||||
setchr4(0x0000, (reg & 4) | ppulatch);
|
||||
setchr4(0x1000, (reg & 4) | 3);
|
||||
}
|
||||
|
||||
static DECLFW(M96Write) {
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M96Hook(uint32 A) {
|
||||
if ((A & 0x3000) == 0x2000) {
|
||||
ppulatch = (A >> 8) & 3;
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void M96Power(void) {
|
||||
reg = ppulatch = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x8000, 0xffff, M96Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper96_Init(CartInfo *info) {
|
||||
info->Power = M96Power;
|
||||
PPU_hook = M96Hook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 1998 BERO
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Oeka-kids board
|
||||
*
|
||||
* I might want to add some code to the mapper 96 PPU hook function
|
||||
* to not change CHR banks if the attribute table is being accessed,
|
||||
* if I make emulation a little more accurate in the future.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, ppulatch;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ &ppulatch, 1, "PPUL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror(MI_0);
|
||||
setprg32(0x8000, reg & 3);
|
||||
setchr4(0x0000, (reg & 4) | ppulatch);
|
||||
setchr4(0x1000, (reg & 4) | 3);
|
||||
}
|
||||
|
||||
static DECLFW(M96Write) {
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M96Hook(uint32 A) {
|
||||
if ((A & 0x3000) == 0x2000) {
|
||||
ppulatch = (A >> 8) & 3;
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void M96Power(void) {
|
||||
reg = ppulatch = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x8000, 0xffff, M96Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper96_Init(CartInfo *info) {
|
||||
info->Power = M96Power;
|
||||
PPU_hook = M96Hook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
156
src/boards/99.c
156
src/boards/99.c
@@ -1,78 +1,78 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 latch;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static writefunc old4016;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &latch, 1, "LATC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8((latch >> 2) & 1);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, 0);
|
||||
setprg8(0x8000, latch & 4); /* Special for VS Gumshoe */
|
||||
}
|
||||
|
||||
static DECLFW(M99Write) {
|
||||
latch = V;
|
||||
Sync();
|
||||
old4016(A, V);
|
||||
}
|
||||
|
||||
static void M99Power(void) {
|
||||
latch = 0;
|
||||
Sync();
|
||||
old4016 = GetWriteHandler(0x4016);
|
||||
SetWriteHandler(0x4016, 0x4016, M99Write);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M99Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper99_Init(CartInfo *info) {
|
||||
info->Power = M99Power;
|
||||
info->Close = M99Close;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 latch;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static writefunc old4016;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &latch, 1, "LATC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8((latch >> 2) & 1);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, 0);
|
||||
setprg8(0x8000, latch & 4); /* Special for VS Gumshoe */
|
||||
}
|
||||
|
||||
static DECLFW(M99Write) {
|
||||
latch = V;
|
||||
Sync();
|
||||
old4016(A, V);
|
||||
}
|
||||
|
||||
static void M99Power(void) {
|
||||
latch = 0;
|
||||
Sync();
|
||||
old4016 = GetWriteHandler(0x4016);
|
||||
SetWriteHandler(0x4016, 0x4016, M99Write);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M99Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper99_Init(CartInfo *info) {
|
||||
info->Power = M99Power;
|
||||
info->Close = M99Close;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,87 +1,87 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, reg & 1);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7012Write) {
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V); */
|
||||
switch (A) {
|
||||
case 0xE0A0: reg = 0; Sync(); break;
|
||||
case 0xEE36: reg = 1; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLKS7012Power(void) {
|
||||
reg = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLKS7012Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void UNLKS7012Reset(void) {
|
||||
reg = ~0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLKS7012Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
void UNLKS7012_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7012Power;
|
||||
info->Reset = UNLKS7012Reset;
|
||||
info->Close = UNLKS7012Close;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, reg & 1);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7012Write) {
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V); */
|
||||
switch (A) {
|
||||
case 0xE0A0: reg = 0; Sync(); break;
|
||||
case 0xEE36: reg = 1; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLKS7012Power(void) {
|
||||
reg = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLKS7012Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void UNLKS7012Reset(void) {
|
||||
reg = ~0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLKS7012Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
void UNLKS7012_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7012Power;
|
||||
info->Reset = UNLKS7012Reset;
|
||||
info->Close = UNLKS7012Close;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,77 +1,77 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Just another pirate cart with pirate mapper, instead of original MMC1
|
||||
* Kaiser Highway Star
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REGS" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, reg);
|
||||
setprg16(0xc000, ~0);
|
||||
setmirror(mirr);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7013BLoWrite) {
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7013BHiWrite) {
|
||||
mirr = (V & 1) ^ 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLKS7013BPower(void) {
|
||||
reg = 0;
|
||||
mirr = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x6000, 0x7FFF, UNLKS7013BLoWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLKS7013BHiWrite);
|
||||
}
|
||||
|
||||
static void UNLKS7013BReset(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7013B_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7013BPower;
|
||||
info->Reset = UNLKS7013BReset;
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Just another pirate cart with pirate mapper, instead of original MMC1
|
||||
* Kaiser Highway Star
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REGS" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, reg);
|
||||
setprg16(0xc000, ~0);
|
||||
setmirror(mirr);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7013BLoWrite) {
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7013BHiWrite) {
|
||||
mirr = (V & 1) ^ 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLKS7013BPower(void) {
|
||||
reg = 0;
|
||||
mirr = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x6000, 0x7FFF, UNLKS7013BLoWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLKS7013BHiWrite);
|
||||
}
|
||||
|
||||
static void UNLKS7013BReset(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7013B_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7013BPower;
|
||||
info->Reset = UNLKS7013BReset;
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,115 +1,115 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, mirr;
|
||||
static int32 IRQa, IRQCount, IRQLatch;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ ®, 1, "REGS" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQLatch, 4, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, reg);
|
||||
setprg16(0xC000, 2);
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7017Write) {
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V); */
|
||||
if ((A & 0xFF00) == 0x4A00) {
|
||||
reg = ((A >> 2) & 3) | ((A >> 4) & 4);
|
||||
} else if ((A & 0xFF00) == 0x5100) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
static DECLFR(FDSRead4030) {
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
return X.IRQlow & FCEU_IQEXT ? 1 : 0;
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) UNL7017IRQ(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount <= 0) {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLKS7017Power(void) {
|
||||
Sync();
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetReadHandler(0x4030, 0x4030, FDSRead4030);
|
||||
SetWriteHandler(0x4020, 0x5FFF, UNLKS7017Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void UNLKS7017Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7017_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7017Power;
|
||||
info->Close = UNLKS7017Close;
|
||||
MapIRQHook = UNL7017IRQ;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, mirr;
|
||||
static int32 IRQa, IRQCount, IRQLatch;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ ®, 1, "REGS" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQLatch, 4, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, reg);
|
||||
setprg16(0xC000, 2);
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7017Write) {
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V); */
|
||||
if ((A & 0xFF00) == 0x4A00) {
|
||||
reg = ((A >> 2) & 3) | ((A >> 4) & 4);
|
||||
} else if ((A & 0xFF00) == 0x5100) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
static DECLFR(FDSRead4030) {
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
return X.IRQlow & FCEU_IQEXT ? 1 : 0;
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) UNL7017IRQ(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount <= 0) {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLKS7017Power(void) {
|
||||
Sync();
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetReadHandler(0x4030, 0x4030, FDSRead4030);
|
||||
SetWriteHandler(0x4020, 0x5FFF, UNLKS7017Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void UNLKS7017Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7017_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7017Power;
|
||||
info->Close = UNLKS7017Close;
|
||||
MapIRQHook = UNL7017IRQ;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,142 +1,142 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
* Logical bank layot 32 K BANK 0, 64K BANK 1, 32K ~0 hardwired, 8K is missing
|
||||
* need redump from MASKROM!
|
||||
* probably need refix mapper after hard dump
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg0, reg1;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®0, 1, "REG0" },
|
||||
{ ®1, 1, "REG1" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(0);
|
||||
setprg32(0x8000, ~0);
|
||||
setprg4(0xb800, reg0);
|
||||
setprg4(0xc800, 8 + reg1);
|
||||
}
|
||||
|
||||
/* 6000 - 6BFF - RAM
|
||||
* 6C00 - 6FFF - BANK 1K REG1
|
||||
* 7000 - 7FFF - BANK 4K REG0
|
||||
*/
|
||||
|
||||
static DECLFW(UNLKS7030RamWrite0) {
|
||||
if ((A >= 0x6000) && A <= 0x6BFF) {
|
||||
WRAM[A - 0x6000] = V;
|
||||
} else if ((A >= 0x6C00) && A <= 0x6FFF) {
|
||||
CartBW(0xC800 + (A - 0x6C00), V);
|
||||
} else if ((A >= 0x7000) && A <= 0x7FFF) {
|
||||
CartBW(0xB800 + (A - 0x7000), V);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(UNLKS7030RamRead0) {
|
||||
if ((A >= 0x6000) && A <= 0x6BFF) {
|
||||
return WRAM[A - 0x6000];
|
||||
} else if ((A >= 0x6C00) && A <= 0x6FFF) {
|
||||
return CartBR(0xC800 + (A - 0x6C00));
|
||||
} else if ((A >= 0x7000) && A <= 0x7FFF) {
|
||||
return CartBR(0xB800 + (A - 0x7000));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* B800 - BFFF - RAM
|
||||
* C000 - CBFF - BANK 3K
|
||||
* CC00 - D7FF - RAM
|
||||
*/
|
||||
|
||||
static DECLFW(UNLKS7030RamWrite1) {
|
||||
if ((A >= 0xB800) && A <= 0xBFFF) {
|
||||
WRAM[0x0C00 + (A - 0xB800)] = V;
|
||||
} else if ((A >= 0xC000) && A <= 0xCBFF) {
|
||||
CartBW(0xCC00 + (A - 0xC000), V);
|
||||
} else if ((A >= 0xCC00) && A <= 0xD7FF) {
|
||||
WRAM[0x1400 + (A - 0xCC00)] = V;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(UNLKS7030RamRead1) {
|
||||
if ((A >= 0xB800) && A <= 0xBFFF) {
|
||||
return WRAM[0x0C00 + (A - 0xB800)];
|
||||
} else if ((A >= 0xC000) && A <= 0xCBFF) {
|
||||
return CartBR(0xCC00 + (A - 0xC000));
|
||||
} else if ((A >= 0xCC00) && A <= 0xD7FF) {
|
||||
return WRAM[0x1400 + (A - 0xCC00)];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7030Write0) {
|
||||
reg0 = A & 7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7030Write1) {
|
||||
reg1 = A & 15;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLKS7030Power(void) {
|
||||
reg0 = reg1 = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, UNLKS7030RamRead0);
|
||||
SetWriteHandler(0x6000, 0x7FFF, UNLKS7030RamWrite0);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0x8FFF, UNLKS7030Write0);
|
||||
SetWriteHandler(0x9000, 0x9FFF, UNLKS7030Write1);
|
||||
SetReadHandler(0xB800, 0xD7FF, UNLKS7030RamRead1);
|
||||
SetWriteHandler(0xB800, 0xD7FF, UNLKS7030RamWrite1);
|
||||
}
|
||||
|
||||
static void UNLKS7030Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7030_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7030Power;
|
||||
info->Close = UNLKS7030Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
* Logical bank layot 32 K BANK 0, 64K BANK 1, 32K ~0 hardwired, 8K is missing
|
||||
* need redump from MASKROM!
|
||||
* probably need refix mapper after hard dump
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg0, reg1;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®0, 1, "REG0" },
|
||||
{ ®1, 1, "REG1" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(0);
|
||||
setprg32(0x8000, ~0);
|
||||
setprg4(0xb800, reg0);
|
||||
setprg4(0xc800, 8 + reg1);
|
||||
}
|
||||
|
||||
/* 6000 - 6BFF - RAM
|
||||
* 6C00 - 6FFF - BANK 1K REG1
|
||||
* 7000 - 7FFF - BANK 4K REG0
|
||||
*/
|
||||
|
||||
static DECLFW(UNLKS7030RamWrite0) {
|
||||
if ((A >= 0x6000) && A <= 0x6BFF) {
|
||||
WRAM[A - 0x6000] = V;
|
||||
} else if ((A >= 0x6C00) && A <= 0x6FFF) {
|
||||
CartBW(0xC800 + (A - 0x6C00), V);
|
||||
} else if ((A >= 0x7000) && A <= 0x7FFF) {
|
||||
CartBW(0xB800 + (A - 0x7000), V);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(UNLKS7030RamRead0) {
|
||||
if ((A >= 0x6000) && A <= 0x6BFF) {
|
||||
return WRAM[A - 0x6000];
|
||||
} else if ((A >= 0x6C00) && A <= 0x6FFF) {
|
||||
return CartBR(0xC800 + (A - 0x6C00));
|
||||
} else if ((A >= 0x7000) && A <= 0x7FFF) {
|
||||
return CartBR(0xB800 + (A - 0x7000));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* B800 - BFFF - RAM
|
||||
* C000 - CBFF - BANK 3K
|
||||
* CC00 - D7FF - RAM
|
||||
*/
|
||||
|
||||
static DECLFW(UNLKS7030RamWrite1) {
|
||||
if ((A >= 0xB800) && A <= 0xBFFF) {
|
||||
WRAM[0x0C00 + (A - 0xB800)] = V;
|
||||
} else if ((A >= 0xC000) && A <= 0xCBFF) {
|
||||
CartBW(0xCC00 + (A - 0xC000), V);
|
||||
} else if ((A >= 0xCC00) && A <= 0xD7FF) {
|
||||
WRAM[0x1400 + (A - 0xCC00)] = V;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(UNLKS7030RamRead1) {
|
||||
if ((A >= 0xB800) && A <= 0xBFFF) {
|
||||
return WRAM[0x0C00 + (A - 0xB800)];
|
||||
} else if ((A >= 0xC000) && A <= 0xCBFF) {
|
||||
return CartBR(0xCC00 + (A - 0xC000));
|
||||
} else if ((A >= 0xCC00) && A <= 0xD7FF) {
|
||||
return WRAM[0x1400 + (A - 0xCC00)];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7030Write0) {
|
||||
reg0 = A & 7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7030Write1) {
|
||||
reg1 = A & 15;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLKS7030Power(void) {
|
||||
reg0 = reg1 = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, UNLKS7030RamRead0);
|
||||
SetWriteHandler(0x6000, 0x7FFF, UNLKS7030RamWrite0);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0x8FFF, UNLKS7030Write0);
|
||||
SetWriteHandler(0x9000, 0x9FFF, UNLKS7030Write1);
|
||||
SetReadHandler(0xB800, 0xD7FF, UNLKS7030RamRead1);
|
||||
SetWriteHandler(0xB800, 0xD7FF, UNLKS7030RamWrite1);
|
||||
}
|
||||
|
||||
static void UNLKS7030Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7030_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7030Power;
|
||||
info->Close = UNLKS7030Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,80 +1,80 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[4];
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 4, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg2(0x6000, reg[0]);
|
||||
setprg2(0x6800, reg[1]);
|
||||
setprg2(0x7000, reg[2]);
|
||||
setprg2(0x7800, reg[3]);
|
||||
|
||||
setprg2(0x8000, 15);
|
||||
setprg2(0x8800, 14);
|
||||
setprg2(0x9000, 13);
|
||||
setprg2(0x9800, 12);
|
||||
setprg2(0xa000, 11);
|
||||
setprg2(0xa800, 10);
|
||||
setprg2(0xb000, 9);
|
||||
setprg2(0xb800, 8);
|
||||
|
||||
setprg2(0xc000, 7);
|
||||
setprg2(0xc800, 6);
|
||||
setprg2(0xd000, 5);
|
||||
setprg2(0xd800, 4);
|
||||
setprg2(0xe000, 3);
|
||||
setprg2(0xe800, 2);
|
||||
setprg2(0xf000, 1);
|
||||
setprg2(0xf800, 0);
|
||||
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7031Write) {
|
||||
reg[(A >> 11) & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLKS7031Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xffff, UNLKS7031Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7031_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7031Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[4];
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 4, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg2(0x6000, reg[0]);
|
||||
setprg2(0x6800, reg[1]);
|
||||
setprg2(0x7000, reg[2]);
|
||||
setprg2(0x7800, reg[3]);
|
||||
|
||||
setprg2(0x8000, 15);
|
||||
setprg2(0x8800, 14);
|
||||
setprg2(0x9000, 13);
|
||||
setprg2(0x9800, 12);
|
||||
setprg2(0xa000, 11);
|
||||
setprg2(0xa800, 10);
|
||||
setprg2(0xb000, 9);
|
||||
setprg2(0xb800, 8);
|
||||
|
||||
setprg2(0xc000, 7);
|
||||
setprg2(0xc800, 6);
|
||||
setprg2(0xd000, 5);
|
||||
setprg2(0xd800, 4);
|
||||
setprg2(0xe000, 3);
|
||||
setprg2(0xe800, 2);
|
||||
setprg2(0xf000, 1);
|
||||
setprg2(0xf800, 0);
|
||||
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7031Write) {
|
||||
reg[(A >> 11) & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLKS7031Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xffff, UNLKS7031Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7031_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7031Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,91 +1,91 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[8], cmd, IRQa = 0, isirqused = 0;
|
||||
static int32 IRQCount;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &cmd, 1, "CMD" },
|
||||
{ reg, 8, "REGS" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, reg[4]);
|
||||
setprg8(0x8000, reg[1]);
|
||||
setprg8(0xA000, reg[2]);
|
||||
setprg8(0xC000, reg[3]);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7032Write) {
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V); */
|
||||
switch (A & 0xF000) {
|
||||
/* case 0x8FFF: reg[4]=V; Sync(); break; */
|
||||
case 0x8000: X6502_IRQEnd(FCEU_IQEXT); IRQCount = (IRQCount & 0x000F) | (V & 0x0F); isirqused = 1; break;
|
||||
case 0x9000: X6502_IRQEnd(FCEU_IQEXT); IRQCount = (IRQCount & 0x00F0) | ((V & 0x0F) << 4); isirqused = 1; break;
|
||||
case 0xA000: X6502_IRQEnd(FCEU_IQEXT); IRQCount = (IRQCount & 0x0F00) | ((V & 0x0F) << 8); isirqused = 1; break;
|
||||
case 0xB000: X6502_IRQEnd(FCEU_IQEXT); IRQCount = (IRQCount & 0xF000) | (V << 12); isirqused = 1; break;
|
||||
case 0xC000: if (isirqused) {
|
||||
X6502_IRQEnd(FCEU_IQEXT); IRQa = 1;
|
||||
}
|
||||
break;
|
||||
case 0xE000: cmd = V & 7; break;
|
||||
case 0xF000: reg[cmd] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) UNLSMB2JIRQHook(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount += a;
|
||||
if (IRQCount >= 0xFFFF) {
|
||||
IRQa = 0;
|
||||
IRQCount = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLKS7032Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4020, 0xFFFF, UNLKS7032Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7032_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7032Power;
|
||||
MapIRQHook = UNLSMB2JIRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[8], cmd, IRQa = 0, isirqused = 0;
|
||||
static int32 IRQCount;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &cmd, 1, "CMD" },
|
||||
{ reg, 8, "REGS" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, reg[4]);
|
||||
setprg8(0x8000, reg[1]);
|
||||
setprg8(0xA000, reg[2]);
|
||||
setprg8(0xC000, reg[3]);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7032Write) {
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V); */
|
||||
switch (A & 0xF000) {
|
||||
/* case 0x8FFF: reg[4]=V; Sync(); break; */
|
||||
case 0x8000: X6502_IRQEnd(FCEU_IQEXT); IRQCount = (IRQCount & 0x000F) | (V & 0x0F); isirqused = 1; break;
|
||||
case 0x9000: X6502_IRQEnd(FCEU_IQEXT); IRQCount = (IRQCount & 0x00F0) | ((V & 0x0F) << 4); isirqused = 1; break;
|
||||
case 0xA000: X6502_IRQEnd(FCEU_IQEXT); IRQCount = (IRQCount & 0x0F00) | ((V & 0x0F) << 8); isirqused = 1; break;
|
||||
case 0xB000: X6502_IRQEnd(FCEU_IQEXT); IRQCount = (IRQCount & 0xF000) | (V << 12); isirqused = 1; break;
|
||||
case 0xC000: if (isirqused) {
|
||||
X6502_IRQEnd(FCEU_IQEXT); IRQa = 1;
|
||||
}
|
||||
break;
|
||||
case 0xE000: cmd = V & 7; break;
|
||||
case 0xF000: reg[cmd] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) UNLSMB2JIRQHook(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount += a;
|
||||
if (IRQCount >= 0xFFFF) {
|
||||
IRQa = 0;
|
||||
IRQCount = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLKS7032Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4020, 0xFFFF, UNLKS7032Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7032_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7032Power;
|
||||
MapIRQHook = UNLSMB2JIRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,126 +1,126 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[8], cmd;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static void (*WSync)(void);
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &cmd, 1, "CMD" },
|
||||
{ reg, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void SyncKS7037(void) {
|
||||
setprg4r(0x10, 0x6000, 0);
|
||||
setprg4(0x7000, 15);
|
||||
setprg8(0x8000, reg[6]);
|
||||
setprg4(0xA000, ~3);
|
||||
setprg4r(0x10, 0xB000, 1);
|
||||
setprg8(0xC000, reg[7]);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr8(0);
|
||||
setmirrorw(reg[2] & 1, reg[4] & 1, reg[3] & 1, reg[5] & 1);
|
||||
}
|
||||
|
||||
static void SyncLH10(void) {
|
||||
setprg8(0x6000, ~1);
|
||||
setprg8(0x8000, reg[6]);
|
||||
setprg8(0xA000, reg[7]);
|
||||
setprg8r(0x10, 0xC000, 0);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr8(0);
|
||||
setmirror(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7037Write) {
|
||||
switch (A & 0xE001) {
|
||||
case 0x8000: cmd = V & 7; break;
|
||||
case 0x8001: reg[cmd] = V; WSync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLKS7037Power(void) {
|
||||
reg[0] = reg[1] = reg[2] = reg[3] = reg[4] = reg[5] = reg[6] = reg[7] = 0;
|
||||
WSync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0x9FFF, UNLKS7037Write);
|
||||
SetWriteHandler(0xA000, 0xBFFF, CartBW);
|
||||
SetWriteHandler(0xC000, 0xFFFF, UNLKS7037Write);
|
||||
}
|
||||
|
||||
static void LH10Power(void) {
|
||||
reg[0] = reg[1] = reg[2] = reg[3] = reg[4] = reg[5] = reg[6] = reg[7] = 0;
|
||||
WSync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xBFFF, UNLKS7037Write);
|
||||
SetWriteHandler(0xC000, 0xDFFF, CartBW);
|
||||
SetWriteHandler(0xE000, 0xFFFF, UNLKS7037Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
WSync();
|
||||
}
|
||||
|
||||
void UNLKS7037_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7037Power;
|
||||
info->Close = Close;
|
||||
|
||||
WSync = SyncKS7037;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void LH10_Init(CartInfo *info) {
|
||||
info->Power = LH10Power;
|
||||
info->Close = Close;
|
||||
|
||||
WSync = SyncLH10;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[8], cmd;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static void (*WSync)(void);
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &cmd, 1, "CMD" },
|
||||
{ reg, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void SyncKS7037(void) {
|
||||
setprg4r(0x10, 0x6000, 0);
|
||||
setprg4(0x7000, 15);
|
||||
setprg8(0x8000, reg[6]);
|
||||
setprg4(0xA000, ~3);
|
||||
setprg4r(0x10, 0xB000, 1);
|
||||
setprg8(0xC000, reg[7]);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr8(0);
|
||||
setmirrorw(reg[2] & 1, reg[4] & 1, reg[3] & 1, reg[5] & 1);
|
||||
}
|
||||
|
||||
static void SyncLH10(void) {
|
||||
setprg8(0x6000, ~1);
|
||||
setprg8(0x8000, reg[6]);
|
||||
setprg8(0xA000, reg[7]);
|
||||
setprg8r(0x10, 0xC000, 0);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr8(0);
|
||||
setmirror(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7037Write) {
|
||||
switch (A & 0xE001) {
|
||||
case 0x8000: cmd = V & 7; break;
|
||||
case 0x8001: reg[cmd] = V; WSync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLKS7037Power(void) {
|
||||
reg[0] = reg[1] = reg[2] = reg[3] = reg[4] = reg[5] = reg[6] = reg[7] = 0;
|
||||
WSync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0x9FFF, UNLKS7037Write);
|
||||
SetWriteHandler(0xA000, 0xBFFF, CartBW);
|
||||
SetWriteHandler(0xC000, 0xFFFF, UNLKS7037Write);
|
||||
}
|
||||
|
||||
static void LH10Power(void) {
|
||||
reg[0] = reg[1] = reg[2] = reg[3] = reg[4] = reg[5] = reg[6] = reg[7] = 0;
|
||||
WSync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xBFFF, UNLKS7037Write);
|
||||
SetWriteHandler(0xC000, 0xDFFF, CartBW);
|
||||
SetWriteHandler(0xE000, 0xFFFF, UNLKS7037Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
WSync();
|
||||
}
|
||||
|
||||
void UNLKS7037_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7037Power;
|
||||
info->Close = Close;
|
||||
|
||||
WSync = SyncKS7037;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void LH10_Init(CartInfo *info) {
|
||||
info->Power = LH10Power;
|
||||
info->Close = Close;
|
||||
|
||||
WSync = SyncLH10;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,92 +1,92 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[8], mirror;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 8, "PRG" },
|
||||
{ &mirror, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg2(0x6000, reg[4]);
|
||||
setprg2(0x6800, reg[5]);
|
||||
setprg2(0x7000, reg[6]);
|
||||
setprg2(0x7800, reg[7]);
|
||||
setprg2(0x8000, reg[0]);
|
||||
setprg2(0x8800, reg[1]);
|
||||
setprg2(0x9000, reg[2]);
|
||||
setprg2(0x9800, reg[3]);
|
||||
setprg8(0xA000, 0xd);
|
||||
setprg16(0xC000, 7);
|
||||
setchr8(0);
|
||||
setmirror(mirror);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7057Write) {
|
||||
switch (A & 0xF003) {
|
||||
case 0x8000:
|
||||
case 0x8001:
|
||||
case 0x8002:
|
||||
case 0x8003:
|
||||
case 0x9000:
|
||||
case 0x9001:
|
||||
case 0x9002:
|
||||
case 0x9003: mirror = V & 1; Sync(); break;
|
||||
case 0xB000: reg[0] = (reg[0] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xB001: reg[0] = (reg[0] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xB002: reg[1] = (reg[1] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xB003: reg[1] = (reg[1] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xC000: reg[2] = (reg[2] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xC001: reg[2] = (reg[2] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xC002: reg[3] = (reg[3] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xC003: reg[3] = (reg[3] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xD000: reg[4] = (reg[4] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xD001: reg[4] = (reg[4] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xD002: reg[5] = (reg[5] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xD003: reg[5] = (reg[5] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xE000: reg[6] = (reg[6] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xE001: reg[6] = (reg[6] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xE002: reg[7] = (reg[7] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xE003: reg[7] = (reg[7] & 0x0F) | (V << 4); Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLKS7057Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLKS7057Write);
|
||||
}
|
||||
|
||||
static void UNLKS7057Reset(void) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7057_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7057Power;
|
||||
info->Reset = UNLKS7057Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[8], mirror;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 8, "PRG" },
|
||||
{ &mirror, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg2(0x6000, reg[4]);
|
||||
setprg2(0x6800, reg[5]);
|
||||
setprg2(0x7000, reg[6]);
|
||||
setprg2(0x7800, reg[7]);
|
||||
setprg2(0x8000, reg[0]);
|
||||
setprg2(0x8800, reg[1]);
|
||||
setprg2(0x9000, reg[2]);
|
||||
setprg2(0x9800, reg[3]);
|
||||
setprg8(0xA000, 0xd);
|
||||
setprg16(0xC000, 7);
|
||||
setchr8(0);
|
||||
setmirror(mirror);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKS7057Write) {
|
||||
switch (A & 0xF003) {
|
||||
case 0x8000:
|
||||
case 0x8001:
|
||||
case 0x8002:
|
||||
case 0x8003:
|
||||
case 0x9000:
|
||||
case 0x9001:
|
||||
case 0x9002:
|
||||
case 0x9003: mirror = V & 1; Sync(); break;
|
||||
case 0xB000: reg[0] = (reg[0] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xB001: reg[0] = (reg[0] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xB002: reg[1] = (reg[1] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xB003: reg[1] = (reg[1] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xC000: reg[2] = (reg[2] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xC001: reg[2] = (reg[2] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xC002: reg[3] = (reg[3] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xC003: reg[3] = (reg[3] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xD000: reg[4] = (reg[4] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xD001: reg[4] = (reg[4] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xD002: reg[5] = (reg[5] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xD003: reg[5] = (reg[5] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xE000: reg[6] = (reg[6] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xE001: reg[6] = (reg[6] & 0x0F) | (V << 4); Sync(); break;
|
||||
case 0xE002: reg[7] = (reg[7] & 0xF0) | (V & 0x0F); Sync(); break;
|
||||
case 0xE003: reg[7] = (reg[7] & 0x0F) | (V << 4); Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLKS7057Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLKS7057Write);
|
||||
}
|
||||
|
||||
static void UNLKS7057Reset(void) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLKS7057_Init(CartInfo *info) {
|
||||
info->Power = UNLKS7057Power;
|
||||
info->Reset = UNLKS7057Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,61 +1,61 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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 "mmc3.h"
|
||||
|
||||
static void SA9602BPW(uint32 A, uint8 V) {
|
||||
setprg8r(EXPREGS[1], A, V & 0x3F);
|
||||
if (MMC3_cmd & 0x40)
|
||||
setprg8r(0, 0x8000, ~(1));
|
||||
else
|
||||
setprg8r(0, 0xc000, ~(1));
|
||||
setprg8r(0, 0xe000, ~(0));
|
||||
}
|
||||
|
||||
static DECLFW(SA9602BWrite) {
|
||||
switch (A & 0xe001) {
|
||||
case 0x8000: EXPREGS[0] = V; break;
|
||||
case 0x8001:
|
||||
if ((EXPREGS[0] & 7) < 6) {
|
||||
EXPREGS[1] = V >> 6;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
|
||||
static void SA9602BPower(void) {
|
||||
EXPREGS[0] = EXPREGS[1] = 0;
|
||||
GenMMC3Power();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xBFFF, SA9602BWrite);
|
||||
}
|
||||
|
||||
void SA9602B_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 0, 0, 0);
|
||||
pwrap = SA9602BPW;
|
||||
mmc3opts |= 2;
|
||||
info->SaveGame[0] = UNIFchrrama;
|
||||
info->SaveGameLen[0] = 32 * 1024;
|
||||
info->Power = SA9602BPower;
|
||||
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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 "mmc3.h"
|
||||
|
||||
static void SA9602BPW(uint32 A, uint8 V) {
|
||||
setprg8r(EXPREGS[1], A, V & 0x3F);
|
||||
if (MMC3_cmd & 0x40)
|
||||
setprg8r(0, 0x8000, ~(1));
|
||||
else
|
||||
setprg8r(0, 0xc000, ~(1));
|
||||
setprg8r(0, 0xe000, ~(0));
|
||||
}
|
||||
|
||||
static DECLFW(SA9602BWrite) {
|
||||
switch (A & 0xe001) {
|
||||
case 0x8000: EXPREGS[0] = V; break;
|
||||
case 0x8001:
|
||||
if ((EXPREGS[0] & 7) < 6) {
|
||||
EXPREGS[1] = V >> 6;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
|
||||
static void SA9602BPower(void) {
|
||||
EXPREGS[0] = EXPREGS[1] = 0;
|
||||
GenMMC3Power();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xBFFF, SA9602BWrite);
|
||||
}
|
||||
|
||||
void SA9602B_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 0, 0, 0);
|
||||
pwrap = SA9602BPW;
|
||||
mmc3opts |= 2;
|
||||
info->SaveGame[0] = UNIFchrrama;
|
||||
info->SaveGameLen[0] = 32 * 1024;
|
||||
info->Power = SA9602BPower;
|
||||
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||
}
|
||||
|
||||
@@ -1,98 +1,98 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2013 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg[8];
|
||||
static uint8 IRQa;
|
||||
static int16 IRQCount, IRQLatch;
|
||||
/*
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
*/
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 8, "REGS" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 2, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
}
|
||||
|
||||
static DECLFW(MNNNWrite) {
|
||||
}
|
||||
|
||||
static void MNNNPower(void) {
|
||||
/* SetReadHandler(0x6000, 0x7fff, CartBR); */
|
||||
/* SetWriteHandler(0x6000, 0x7fff, CartBW); */
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, MNNNWrite);
|
||||
}
|
||||
|
||||
static void MNNNReset(void) {
|
||||
}
|
||||
|
||||
/*
|
||||
static void MNNNClose(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
WRAM = CHRRAM = NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
static void MNNNIRQHook() {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void MapperNNN_Init(CartInfo *info) {
|
||||
info->Reset = MNNNReset;
|
||||
info->Power = MNNNPower;
|
||||
/* info->Close = MNNNClose; */
|
||||
GameHBIRQHook = MNNNIRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
#if 0
|
||||
CHRRAMSIZE = 8192;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
#endif
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2013 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg[8];
|
||||
static uint8 IRQa;
|
||||
static int16 IRQCount, IRQLatch;
|
||||
/*
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
*/
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 8, "REGS" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 2, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
}
|
||||
|
||||
static DECLFW(MNNNWrite) {
|
||||
}
|
||||
|
||||
static void MNNNPower(void) {
|
||||
/* SetReadHandler(0x6000, 0x7fff, CartBR); */
|
||||
/* SetWriteHandler(0x6000, 0x7fff, CartBW); */
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, MNNNWrite);
|
||||
}
|
||||
|
||||
static void MNNNReset(void) {
|
||||
}
|
||||
|
||||
/*
|
||||
static void MNNNClose(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
WRAM = CHRRAM = NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
static void MNNNIRQHook() {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void MapperNNN_Init(CartInfo *info) {
|
||||
info->Reset = MNNNReset;
|
||||
info->Power = MNNNPower;
|
||||
/* info->Close = MNNNClose; */
|
||||
GameHBIRQHook = MNNNIRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
#if 0
|
||||
CHRRAMSIZE = 8192;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
#endif
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,150 +1,150 @@
|
||||
#include "__serial.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__LIBRETRO__)
|
||||
|
||||
HANDLE SerialPort = NULL; /* Handle of SerialPort itself. */
|
||||
|
||||
BOOL SerialOpen(int port, int baud) {
|
||||
HANDLE Comport;
|
||||
DCB myDCB;
|
||||
COMMTIMEOUTS CTout;
|
||||
char str[100];
|
||||
|
||||
if (port > 9)
|
||||
sprintf(str, "\\\\.\\COM%d", port);
|
||||
else
|
||||
sprintf(str, "COM%d", port);
|
||||
|
||||
/* Open the serial port */
|
||||
if ((Comport = CreateFile(str, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
|
||||
/* Configure Serial port (Setup Comm) */
|
||||
|
||||
/* Buffer sizes */
|
||||
if (!SetupComm(Comport, 128, 128))
|
||||
return FALSE;
|
||||
|
||||
/* Setup DCB using current values */
|
||||
if (!GetCommState(Comport, &myDCB))
|
||||
return FALSE;
|
||||
|
||||
myDCB.fInX = FALSE; /* Turn off xon/xoff handler */
|
||||
myDCB.fOutX = FALSE;
|
||||
myDCB.fOutxDsrFlow = FALSE;
|
||||
myDCB.fOutxCtsFlow = FALSE; /* no hardware flow control. */
|
||||
myDCB.BaudRate = baud;
|
||||
myDCB.DCBlength = sizeof(DCB);
|
||||
myDCB.fBinary = 1;
|
||||
myDCB.fParity = 0;
|
||||
myDCB.fDtrControl = DTR_CONTROL_DISABLE;
|
||||
myDCB.fDsrSensitivity = 0;
|
||||
myDCB.fTXContinueOnXoff = 1;
|
||||
myDCB.fNull = 0;
|
||||
myDCB.fRtsControl = RTS_CONTROL_DISABLE;
|
||||
myDCB.fDummy2 = 0;
|
||||
myDCB.wReserved = 0;
|
||||
myDCB.Parity = NOPARITY;
|
||||
myDCB.StopBits = ONESTOPBIT;
|
||||
myDCB.wReserved1 = 0;
|
||||
myDCB.ByteSize = 8;
|
||||
|
||||
if (!SetCommState(Comport, &myDCB))
|
||||
return FALSE;
|
||||
|
||||
/* Set timeouts */
|
||||
CTout.ReadIntervalTimeout = 0xffffffff;
|
||||
CTout.ReadTotalTimeoutMultiplier = 0;
|
||||
CTout.ReadTotalTimeoutConstant = 0;
|
||||
CTout.WriteTotalTimeoutMultiplier = 0;
|
||||
CTout.WriteTotalTimeoutConstant = 5000; /* don't hang if CTS is locked, for example */
|
||||
|
||||
SetCommTimeouts(Comport, &CTout);
|
||||
EscapeCommFunction(Comport, SETDTR);
|
||||
PurgeComm(Comport, PURGE_TXCLEAR | PURGE_RXCLEAR);
|
||||
|
||||
SerialPort = Comport;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void SerialClose(void) {
|
||||
if (SerialPort == NULL) return;
|
||||
|
||||
PurgeComm(SerialPort, PURGE_TXCLEAR | PURGE_RXCLEAR);
|
||||
CloseHandle(SerialPort);
|
||||
|
||||
SerialPort = NULL;
|
||||
}
|
||||
|
||||
BOOL SerialSendChar(int c) {
|
||||
DWORD cr;
|
||||
if (WriteFile(SerialPort, &c, 1, (LPDWORD)&cr, NULL) && cr)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int SerialIsOpen(void) {
|
||||
return(SerialPort != NULL);
|
||||
}
|
||||
|
||||
int SerialGetChar(void) {
|
||||
uint8 ch;
|
||||
DWORD cr;
|
||||
if (SerialPort != NULL) {
|
||||
if (ReadFile(SerialPort, &ch, 1, (LPDWORD)&cr, NULL) && cr)
|
||||
return (int)ch;
|
||||
}
|
||||
return EOF;
|
||||
}
|
||||
|
||||
void SendCmd(uint8 *cmd, int size) {
|
||||
int i;
|
||||
for (i = 0; i < size; i++) {
|
||||
SerialSendChar(cmd[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int ReadResp(uint8 *resp, int size) {
|
||||
int i = 0, sum = 0, data;
|
||||
while (i < size) {
|
||||
while ((data = SerialGetChar()) == EOF) {
|
||||
}
|
||||
resp[i] = data & 0xff;
|
||||
sum += (data & 0xff);
|
||||
i++;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
#else
|
||||
|
||||
/* code is not portable, so make stubs for now */
|
||||
|
||||
BOOL SerialOpen(int port, int baud) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void SerialClose(void) {
|
||||
}
|
||||
|
||||
BOOL SerialSendChar(int c) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int SerialIsOpen(void) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int SerialGetChar(void) {
|
||||
return EOF;
|
||||
}
|
||||
|
||||
void SendCmd(uint8 *cmd, int size) {
|
||||
}
|
||||
|
||||
int ReadResp(uint8 *resp, int size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#include "__serial.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__LIBRETRO__)
|
||||
|
||||
HANDLE SerialPort = NULL; /* Handle of SerialPort itself. */
|
||||
|
||||
BOOL SerialOpen(int port, int baud) {
|
||||
HANDLE Comport;
|
||||
DCB myDCB;
|
||||
COMMTIMEOUTS CTout;
|
||||
char str[100];
|
||||
|
||||
if (port > 9)
|
||||
sprintf(str, "\\\\.\\COM%d", port);
|
||||
else
|
||||
sprintf(str, "COM%d", port);
|
||||
|
||||
/* Open the serial port */
|
||||
if ((Comport = CreateFile(str, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
|
||||
/* Configure Serial port (Setup Comm) */
|
||||
|
||||
/* Buffer sizes */
|
||||
if (!SetupComm(Comport, 128, 128))
|
||||
return FALSE;
|
||||
|
||||
/* Setup DCB using current values */
|
||||
if (!GetCommState(Comport, &myDCB))
|
||||
return FALSE;
|
||||
|
||||
myDCB.fInX = FALSE; /* Turn off xon/xoff handler */
|
||||
myDCB.fOutX = FALSE;
|
||||
myDCB.fOutxDsrFlow = FALSE;
|
||||
myDCB.fOutxCtsFlow = FALSE; /* no hardware flow control. */
|
||||
myDCB.BaudRate = baud;
|
||||
myDCB.DCBlength = sizeof(DCB);
|
||||
myDCB.fBinary = 1;
|
||||
myDCB.fParity = 0;
|
||||
myDCB.fDtrControl = DTR_CONTROL_DISABLE;
|
||||
myDCB.fDsrSensitivity = 0;
|
||||
myDCB.fTXContinueOnXoff = 1;
|
||||
myDCB.fNull = 0;
|
||||
myDCB.fRtsControl = RTS_CONTROL_DISABLE;
|
||||
myDCB.fDummy2 = 0;
|
||||
myDCB.wReserved = 0;
|
||||
myDCB.Parity = NOPARITY;
|
||||
myDCB.StopBits = ONESTOPBIT;
|
||||
myDCB.wReserved1 = 0;
|
||||
myDCB.ByteSize = 8;
|
||||
|
||||
if (!SetCommState(Comport, &myDCB))
|
||||
return FALSE;
|
||||
|
||||
/* Set timeouts */
|
||||
CTout.ReadIntervalTimeout = 0xffffffff;
|
||||
CTout.ReadTotalTimeoutMultiplier = 0;
|
||||
CTout.ReadTotalTimeoutConstant = 0;
|
||||
CTout.WriteTotalTimeoutMultiplier = 0;
|
||||
CTout.WriteTotalTimeoutConstant = 5000; /* don't hang if CTS is locked, for example */
|
||||
|
||||
SetCommTimeouts(Comport, &CTout);
|
||||
EscapeCommFunction(Comport, SETDTR);
|
||||
PurgeComm(Comport, PURGE_TXCLEAR | PURGE_RXCLEAR);
|
||||
|
||||
SerialPort = Comport;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void SerialClose(void) {
|
||||
if (SerialPort == NULL) return;
|
||||
|
||||
PurgeComm(SerialPort, PURGE_TXCLEAR | PURGE_RXCLEAR);
|
||||
CloseHandle(SerialPort);
|
||||
|
||||
SerialPort = NULL;
|
||||
}
|
||||
|
||||
BOOL SerialSendChar(int c) {
|
||||
DWORD cr;
|
||||
if (WriteFile(SerialPort, &c, 1, (LPDWORD)&cr, NULL) && cr)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int SerialIsOpen(void) {
|
||||
return(SerialPort != NULL);
|
||||
}
|
||||
|
||||
int SerialGetChar(void) {
|
||||
uint8 ch;
|
||||
DWORD cr;
|
||||
if (SerialPort != NULL) {
|
||||
if (ReadFile(SerialPort, &ch, 1, (LPDWORD)&cr, NULL) && cr)
|
||||
return (int)ch;
|
||||
}
|
||||
return EOF;
|
||||
}
|
||||
|
||||
void SendCmd(uint8 *cmd, int size) {
|
||||
int i;
|
||||
for (i = 0; i < size; i++) {
|
||||
SerialSendChar(cmd[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int ReadResp(uint8 *resp, int size) {
|
||||
int i = 0, sum = 0, data;
|
||||
while (i < size) {
|
||||
while ((data = SerialGetChar()) == EOF) {
|
||||
}
|
||||
resp[i] = data & 0xff;
|
||||
sum += (data & 0xff);
|
||||
i++;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
#else
|
||||
|
||||
/* code is not portable, so make stubs for now */
|
||||
|
||||
BOOL SerialOpen(int port, int baud) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void SerialClose(void) {
|
||||
}
|
||||
|
||||
BOOL SerialSendChar(int c) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int SerialIsOpen(void) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int SerialGetChar(void) {
|
||||
return EOF;
|
||||
}
|
||||
|
||||
void SendCmd(uint8 *cmd, int size) {
|
||||
}
|
||||
|
||||
int ReadResp(uint8 *resp, int size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
#ifndef __SERIAL_H
|
||||
#define __SERIAL_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef int BOOL;
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#include "../fceu-types.h"
|
||||
|
||||
void SendCmd(uint8 *cmd, int size);
|
||||
int ReadResp(uint8 *resp, int size);
|
||||
|
||||
#define SEND(cmd) SendCmd((uint8*)&cmd[0], sizeof(cmd))
|
||||
#define GET(buf, size) ReadResp((uint8*)&buf, size)
|
||||
#define SENDGET(cmd, buf, size) SEND(cmd); GET(buf, size)
|
||||
|
||||
BOOL SerialOpen(int port, int baud);
|
||||
void SerialClose(void);
|
||||
BOOL SerialSendChar(int c);
|
||||
int SerialIsOpen(void);
|
||||
int SerialGetChar(void);
|
||||
|
||||
#endif
|
||||
#ifndef __SERIAL_H
|
||||
#define __SERIAL_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef int BOOL;
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#include "../fceu-types.h"
|
||||
|
||||
void SendCmd(uint8 *cmd, int size);
|
||||
int ReadResp(uint8 *resp, int size);
|
||||
|
||||
#define SEND(cmd) SendCmd((uint8*)&cmd[0], sizeof(cmd))
|
||||
#define GET(buf, size) ReadResp((uint8*)&buf, size)
|
||||
#define SENDGET(cmd, buf, size) SEND(cmd); GET(buf, size)
|
||||
|
||||
BOOL SerialOpen(int port, int baud);
|
||||
void SerialClose(void);
|
||||
BOOL SerialSendChar(int c);
|
||||
int SerialIsOpen(void);
|
||||
int SerialGetChar(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,75 +1,75 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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 "mmc3.h"
|
||||
|
||||
static DECLFW(UNLA9746Write) {
|
||||
/* FCEU_printf("write raw %04x:%02x\n",A,V); */
|
||||
switch (A & 0xE003) {
|
||||
case 0x8000: EXPREGS[1] = V; EXPREGS[0] = 0; break;
|
||||
case 0x8002: EXPREGS[0] = V; EXPREGS[1] = 0; break;
|
||||
case 0x8001:
|
||||
{
|
||||
uint8 bits_rev = ((V & 0x20) >> 5) | ((V & 0x10) >> 3) | ((V & 0x08) >> 1) | ((V & 0x04) << 1);
|
||||
switch (EXPREGS[0]) {
|
||||
case 0x26: setprg8(0x8000, bits_rev); break;
|
||||
case 0x25: setprg8(0xA000, bits_rev); break;
|
||||
case 0x24: setprg8(0xC000, bits_rev); break;
|
||||
case 0x23: setprg8(0xE000, bits_rev); break;
|
||||
}
|
||||
switch (EXPREGS[1]) {
|
||||
case 0x0a:
|
||||
case 0x08: EXPREGS[2] = (V << 4); break;
|
||||
case 0x09: setchr1(0x0000, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x0b: setchr1(0x0400, EXPREGS[2] | (V >> 1) | 1); break;
|
||||
case 0x0c:
|
||||
case 0x0e: EXPREGS[2] = (V << 4); break;
|
||||
case 0x0d: setchr1(0x0800, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x0f: setchr1(0x0c00, EXPREGS[2] | (V >> 1) | 1); break;
|
||||
case 0x10:
|
||||
case 0x12: EXPREGS[2] = (V << 4); break;
|
||||
case 0x11: setchr1(0x1000, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x14:
|
||||
case 0x16: EXPREGS[2] = (V << 4); break;
|
||||
case 0x15: setchr1(0x1400, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x18:
|
||||
case 0x1a: EXPREGS[2] = (V << 4); break;
|
||||
case 0x19: setchr1(0x1800, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x1c:
|
||||
case 0x1e: EXPREGS[2] = (V << 4); break;
|
||||
case 0x1d: setchr1(0x1c00, EXPREGS[2] | (V >> 1)); break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLA9746Power(void) {
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x8000, 0xbfff, UNLA9746Write);
|
||||
}
|
||||
|
||||
void UNLA9746_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
info->Power = UNLA9746Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
}
|
||||
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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 "mmc3.h"
|
||||
|
||||
static DECLFW(UNLA9746Write) {
|
||||
/* FCEU_printf("write raw %04x:%02x\n",A,V); */
|
||||
switch (A & 0xE003) {
|
||||
case 0x8000: EXPREGS[1] = V; EXPREGS[0] = 0; break;
|
||||
case 0x8002: EXPREGS[0] = V; EXPREGS[1] = 0; break;
|
||||
case 0x8001:
|
||||
{
|
||||
uint8 bits_rev = ((V & 0x20) >> 5) | ((V & 0x10) >> 3) | ((V & 0x08) >> 1) | ((V & 0x04) << 1);
|
||||
switch (EXPREGS[0]) {
|
||||
case 0x26: setprg8(0x8000, bits_rev); break;
|
||||
case 0x25: setprg8(0xA000, bits_rev); break;
|
||||
case 0x24: setprg8(0xC000, bits_rev); break;
|
||||
case 0x23: setprg8(0xE000, bits_rev); break;
|
||||
}
|
||||
switch (EXPREGS[1]) {
|
||||
case 0x0a:
|
||||
case 0x08: EXPREGS[2] = (V << 4); break;
|
||||
case 0x09: setchr1(0x0000, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x0b: setchr1(0x0400, EXPREGS[2] | (V >> 1) | 1); break;
|
||||
case 0x0c:
|
||||
case 0x0e: EXPREGS[2] = (V << 4); break;
|
||||
case 0x0d: setchr1(0x0800, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x0f: setchr1(0x0c00, EXPREGS[2] | (V >> 1) | 1); break;
|
||||
case 0x10:
|
||||
case 0x12: EXPREGS[2] = (V << 4); break;
|
||||
case 0x11: setchr1(0x1000, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x14:
|
||||
case 0x16: EXPREGS[2] = (V << 4); break;
|
||||
case 0x15: setchr1(0x1400, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x18:
|
||||
case 0x1a: EXPREGS[2] = (V << 4); break;
|
||||
case 0x19: setchr1(0x1800, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x1c:
|
||||
case 0x1e: EXPREGS[2] = (V << 4); break;
|
||||
case 0x1d: setchr1(0x1c00, EXPREGS[2] | (V >> 1)); break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLA9746Power(void) {
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x8000, 0xbfff, UNLA9746Write);
|
||||
}
|
||||
|
||||
void UNLA9746_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
info->Power = UNLA9746Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,71 +1,71 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, reg);
|
||||
setprg32r(1, 0x8000, 0);
|
||||
setchr8(0);
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(AC08Mirr) {
|
||||
mirr = ((V & 8) >> 3) ^ 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(AC08Write) {
|
||||
if (A == 0x8001) /* Green Berret bank switching is only 100x xxxx xxxx xxx1 mask */
|
||||
reg = (V >> 1) & 0xf;
|
||||
else
|
||||
reg = V & 0xf; /* Sad But True, 2-in-1 mapper, Green Berret need value shifted left one byte, Castlevania doesn't */
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void AC08Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4025, 0x4025, AC08Mirr);
|
||||
SetWriteHandler(0x8000, 0xFFFF, AC08Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void AC08_Init(CartInfo *info) {
|
||||
info->Power = AC08Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, reg);
|
||||
setprg32r(1, 0x8000, 0);
|
||||
setchr8(0);
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(AC08Mirr) {
|
||||
mirr = ((V & 8) >> 3) ^ 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(AC08Write) {
|
||||
if (A == 0x8001) /* Green Berret bank switching is only 100x xxxx xxxx xxx1 mask */
|
||||
reg = (V >> 1) & 0xf;
|
||||
else
|
||||
reg = V & 0xf; /* Sad But True, 2-in-1 mapper, Green Berret need value shifted left one byte, Castlevania doesn't */
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void AC08Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4025, 0x4025, AC08Mirr);
|
||||
SetWriteHandler(0x8000, 0xFFFF, AC08Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void AC08_Init(CartInfo *info) {
|
||||
info->Power = AC08Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,116 +1,116 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Super Bros. Pocker Mali (VRC4 mapper)
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 IRQCount; /*, IRQPre; */
|
||||
static uint8 IRQa;
|
||||
static uint8 prg_reg[2];
|
||||
static uint8 chr_reg[8];
|
||||
static uint8 mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ prg_reg, 2, "PRG" },
|
||||
{ chr_reg, 8, "CHR" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
#if 0
|
||||
static void UNLAX5705IRQ(void) {
|
||||
if(IRQa) {
|
||||
IRQCount++;
|
||||
if(IRQCount>=238) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
/* IRQa=0; */
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Sync(void) {
|
||||
int i;
|
||||
setprg8(0x8000, prg_reg[0]);
|
||||
setprg8(0xA000, prg_reg[1]);
|
||||
setprg8(0xC000, ~1);
|
||||
setprg8(0xE000, ~0);
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, chr_reg[i]);
|
||||
setmirror(mirr ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(UNLAX5705Write) {
|
||||
#if 0
|
||||
if((A>=0xA008)&&(A<=0xE003)) {
|
||||
int ind=(((A>>11)-6)|(A&1))&7;
|
||||
int sar=((A&2)<<1);
|
||||
chr_reg[ind]=(chr_reg[ind]&(0xF0>>sar))|((V&0x0F)<<sar);
|
||||
SyncChr();
|
||||
} else
|
||||
#endif
|
||||
switch (A & 0xF00F) {
|
||||
case 0x8000: prg_reg[0] = ((V & 2) << 2) | ((V & 8) >> 2) | (V & 5); break; /* EPROM dump have mixed PRG and CHR banks, data lines to mapper seems to be mixed */
|
||||
case 0x8008: mirr = V & 1; break;
|
||||
case 0xA000: prg_reg[1] = ((V & 2) << 2) | ((V & 8) >> 2) | (V & 5); break;
|
||||
case 0xA008: chr_reg[0] = (chr_reg[0] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xA009: chr_reg[0] = (chr_reg[0] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xA00A: chr_reg[1] = (chr_reg[1] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xA00B: chr_reg[1] = (chr_reg[1] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xC000: chr_reg[2] = (chr_reg[2] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xC001: chr_reg[2] = (chr_reg[2] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xC002: chr_reg[3] = (chr_reg[3] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xC003: chr_reg[3] = (chr_reg[3] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xC008: chr_reg[4] = (chr_reg[4] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xC009: chr_reg[4] = (chr_reg[4] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xC00A: chr_reg[5] = (chr_reg[5] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xC00B: chr_reg[5] = (chr_reg[5] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xE000: chr_reg[6] = (chr_reg[6] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xE001: chr_reg[6] = (chr_reg[6] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xE002: chr_reg[7] = (chr_reg[7] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xE003: chr_reg[7] = (chr_reg[7] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
#if 0
|
||||
case 0x800A: X6502_IRQEnd(FCEU_IQEXT); IRQa=0; break;
|
||||
case 0xE00B: X6502_IRQEnd(FCEU_IQEXT); IRQa=IRQCount=V; /*if(scanline<240) IRQCount-=8; else IRQCount+=4;*/ break;
|
||||
#endif
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLAX5705Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLAX5705Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLAX5705_Init(CartInfo *info) {
|
||||
info->Power = UNLAX5705Power;
|
||||
/* GameHBIRQHook=UNLAX5705IRQ; */
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Super Bros. Pocker Mali (VRC4 mapper)
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 IRQCount; /*, IRQPre; */
|
||||
static uint8 IRQa;
|
||||
static uint8 prg_reg[2];
|
||||
static uint8 chr_reg[8];
|
||||
static uint8 mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ prg_reg, 2, "PRG" },
|
||||
{ chr_reg, 8, "CHR" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
#if 0
|
||||
static void UNLAX5705IRQ(void) {
|
||||
if(IRQa) {
|
||||
IRQCount++;
|
||||
if(IRQCount>=238) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
/* IRQa=0; */
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Sync(void) {
|
||||
int i;
|
||||
setprg8(0x8000, prg_reg[0]);
|
||||
setprg8(0xA000, prg_reg[1]);
|
||||
setprg8(0xC000, ~1);
|
||||
setprg8(0xE000, ~0);
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, chr_reg[i]);
|
||||
setmirror(mirr ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(UNLAX5705Write) {
|
||||
#if 0
|
||||
if((A>=0xA008)&&(A<=0xE003)) {
|
||||
int ind=(((A>>11)-6)|(A&1))&7;
|
||||
int sar=((A&2)<<1);
|
||||
chr_reg[ind]=(chr_reg[ind]&(0xF0>>sar))|((V&0x0F)<<sar);
|
||||
SyncChr();
|
||||
} else
|
||||
#endif
|
||||
switch (A & 0xF00F) {
|
||||
case 0x8000: prg_reg[0] = ((V & 2) << 2) | ((V & 8) >> 2) | (V & 5); break; /* EPROM dump have mixed PRG and CHR banks, data lines to mapper seems to be mixed */
|
||||
case 0x8008: mirr = V & 1; break;
|
||||
case 0xA000: prg_reg[1] = ((V & 2) << 2) | ((V & 8) >> 2) | (V & 5); break;
|
||||
case 0xA008: chr_reg[0] = (chr_reg[0] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xA009: chr_reg[0] = (chr_reg[0] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xA00A: chr_reg[1] = (chr_reg[1] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xA00B: chr_reg[1] = (chr_reg[1] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xC000: chr_reg[2] = (chr_reg[2] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xC001: chr_reg[2] = (chr_reg[2] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xC002: chr_reg[3] = (chr_reg[3] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xC003: chr_reg[3] = (chr_reg[3] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xC008: chr_reg[4] = (chr_reg[4] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xC009: chr_reg[4] = (chr_reg[4] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xC00A: chr_reg[5] = (chr_reg[5] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xC00B: chr_reg[5] = (chr_reg[5] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xE000: chr_reg[6] = (chr_reg[6] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xE001: chr_reg[6] = (chr_reg[6] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
case 0xE002: chr_reg[7] = (chr_reg[7] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xE003: chr_reg[7] = (chr_reg[7] & 0x0F) | ((((V & 4) >> 1) | ((V & 2) << 1) | (V & 0x09)) << 4); break;
|
||||
#if 0
|
||||
case 0x800A: X6502_IRQEnd(FCEU_IQEXT); IRQa=0; break;
|
||||
case 0xE00B: X6502_IRQEnd(FCEU_IQEXT); IRQa=IRQCount=V; /*if(scanline<240) IRQCount-=8; else IRQCount+=4;*/ break;
|
||||
#endif
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLAX5705Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLAX5705Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLAX5705_Init(CartInfo *info) {
|
||||
info->Power = UNLAX5705Power;
|
||||
/* GameHBIRQHook=UNLAX5705IRQ; */
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,464 +1,464 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
* Copyright (C) 2011 FCEUX team
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Bandai mappers
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[16], is153, x24c02;
|
||||
static uint8 IRQa;
|
||||
static int16 IRQCount, IRQLatch;
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 16, "REGS" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 2, "IRQL" }, /* need for Famicom Jump II - Saikyou no 7 Nin (J) [!] */
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* x24C0x interface */
|
||||
|
||||
#define X24C0X_STANDBY 0
|
||||
#define X24C0X_ADDRESS 1
|
||||
#define X24C0X_WORD 2
|
||||
#define X24C0X_READ 3
|
||||
#define X24C0X_WRITE 4
|
||||
|
||||
static uint8 x24c0x_data[256], x24c0x_state;
|
||||
static uint8 x24c0x_addr, x24c0x_word, x24c0x_latch, x24c0x_bitcount;
|
||||
static uint8 x24c0x_sda, x24c0x_scl, x24c0x_out, x24c0x_oe;
|
||||
|
||||
static SFORMAT x24c0xStateRegs[] =
|
||||
{
|
||||
{ &x24c0x_addr, 1, "ADDR" },
|
||||
{ &x24c0x_word, 1, "WORD" },
|
||||
{ &x24c0x_latch, 1, "LATC" },
|
||||
{ &x24c0x_bitcount, 1, "BITC" },
|
||||
{ &x24c0x_sda, 1, "SDA" },
|
||||
{ &x24c0x_scl, 1, "SCL" },
|
||||
{ &x24c0x_out, 1, "OUT" },
|
||||
{ &x24c0x_oe, 1, "OE" },
|
||||
{ &x24c0x_state, 1, "STAT" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void x24c0x_init() {
|
||||
x24c0x_addr = x24c0x_word = x24c0x_latch = x24c0x_bitcount = x24c0x_sda = x24c0x_scl = x24c0x_oe = 0;
|
||||
x24c0x_state = X24C0X_STANDBY;
|
||||
}
|
||||
|
||||
static void x24c0x_write(uint8 data) {
|
||||
uint8 sda = (data >> 6) & 1;
|
||||
uint8 scl = (data >> 5) & 1;
|
||||
x24c0x_oe = (data >> 7);
|
||||
|
||||
if(x24c0x_scl && scl) {
|
||||
if(x24c0x_sda && !sda) { /* START */
|
||||
x24c0x_state = X24C0X_ADDRESS;
|
||||
x24c0x_bitcount = 0;
|
||||
x24c0x_addr = 0;
|
||||
} else if(!x24c0x_sda && sda) { /* STOP */
|
||||
x24c0x_state = X24C0X_STANDBY;
|
||||
}
|
||||
} else if(!x24c0x_scl && scl) { /* RISING EDGE */
|
||||
switch(x24c0x_state) {
|
||||
case X24C0X_ADDRESS:
|
||||
if(x24c0x_bitcount < 7) {
|
||||
x24c0x_addr <<= 1;
|
||||
x24c0x_addr |= sda;
|
||||
} else {
|
||||
if(!x24c02) /* X24C01 mode */
|
||||
x24c0x_word = x24c0x_addr;
|
||||
if(sda) { /* READ COMMAND */
|
||||
x24c0x_state = X24C0X_READ;
|
||||
} else { /* WRITE COMMAND */
|
||||
if(x24c02) /* X24C02 mode */
|
||||
x24c0x_state = X24C0X_WORD;
|
||||
else
|
||||
x24c0x_state = X24C0X_WRITE;
|
||||
}
|
||||
}
|
||||
x24c0x_bitcount++;
|
||||
break;
|
||||
case X24C0X_WORD:
|
||||
if(x24c0x_bitcount == 8) { /* ACK */
|
||||
x24c0x_word = 0;
|
||||
x24c0x_out = 0;
|
||||
} else { /* WORD ADDRESS INPUT */
|
||||
x24c0x_word <<= 1;
|
||||
x24c0x_word |= sda;
|
||||
if(x24c0x_bitcount == 16) { /* END OF ADDRESS INPUT */
|
||||
x24c0x_bitcount = 7;
|
||||
x24c0x_state = X24C0X_WRITE;
|
||||
}
|
||||
}
|
||||
x24c0x_bitcount++;
|
||||
break;
|
||||
case X24C0X_READ:
|
||||
if (x24c0x_bitcount == 8) { /* ACK */
|
||||
x24c0x_out = 0;
|
||||
x24c0x_latch = x24c0x_data[x24c0x_word];
|
||||
x24c0x_bitcount = 0;
|
||||
} else { /* REAL OUTPUT */
|
||||
x24c0x_out = x24c0x_latch >> 7;
|
||||
x24c0x_latch <<= 1;
|
||||
x24c0x_bitcount++;
|
||||
if(x24c0x_bitcount == 8) {
|
||||
x24c0x_word++;
|
||||
x24c0x_word &= 0xff;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case X24C0X_WRITE:
|
||||
if (x24c0x_bitcount == 8) { /* ACK */
|
||||
x24c0x_out = 0;
|
||||
x24c0x_latch = 0;
|
||||
x24c0x_bitcount = 0;
|
||||
} else { /* REAL INPUT */
|
||||
x24c0x_latch <<= 1;
|
||||
x24c0x_latch |= sda;
|
||||
x24c0x_bitcount++;
|
||||
if(x24c0x_bitcount == 8) {
|
||||
x24c0x_data[x24c0x_word] = x24c0x_latch;
|
||||
x24c0x_word++;
|
||||
x24c0x_word &= 0xff;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
x24c0x_sda = sda;
|
||||
x24c0x_scl = scl;
|
||||
}
|
||||
|
||||
static uint8 x24c0x_read() {
|
||||
return x24c0x_out << 4;
|
||||
}
|
||||
|
||||
static void Sync(void) {
|
||||
if (is153) {
|
||||
int base = (reg[0] & 1) << 4;
|
||||
setchr8(0);
|
||||
setprg16(0x8000, (reg[8] & 0x0F) | base);
|
||||
setprg16(0xC000, 0x0F | base);
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < 8; i++) setchr1(i << 10, reg[i]);
|
||||
setprg16(0x8000, reg[8]);
|
||||
setprg16(0xC000, ~0);
|
||||
}
|
||||
switch (reg[9] & 3) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(BandaiWrite) {
|
||||
A &= 0x0F;
|
||||
if (A < 0x0A) {
|
||||
reg[A & 0x0F] = V;
|
||||
Sync();
|
||||
} else
|
||||
switch (A) {
|
||||
case 0x0A: X6502_IRQEnd(FCEU_IQEXT); IRQa = V & 1; IRQCount = IRQLatch; break;
|
||||
case 0x0B: IRQLatch &= 0xFF00; IRQLatch |= V; break;
|
||||
case 0x0C: IRQLatch &= 0xFF; IRQLatch |= V << 8; break;
|
||||
case 0x0D: x24c0x_write(V); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(BandaiRead) {
|
||||
return (X.DB & 0xEF) | x24c0x_read();
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) BandaiIRQHook(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount < 0) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
IRQCount = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void BandaiPower(void) {
|
||||
IRQa = 0;
|
||||
x24c0x_init();
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, BandaiRead);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, BandaiWrite);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper16_Init(CartInfo *info) {
|
||||
x24c02 = 1;
|
||||
is153 = 0;
|
||||
info->Power = BandaiPower;
|
||||
MapIRQHook = BandaiIRQHook;
|
||||
|
||||
info->battery = 1;
|
||||
info->SaveGame[0] = x24c0x_data;
|
||||
info->SaveGameLen[0] = 256;
|
||||
AddExState(x24c0x_data, 256, 0, "DATA");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&x24c0xStateRegs, ~0, 0, 0);
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper159_Init(CartInfo *info) {
|
||||
x24c02 = 0;
|
||||
is153 = 0;
|
||||
info->Power = BandaiPower;
|
||||
MapIRQHook = BandaiIRQHook;
|
||||
|
||||
info->battery = 1;
|
||||
info->SaveGame[0] = x24c0x_data;
|
||||
info->SaveGameLen[0] = 128;
|
||||
AddExState(x24c0x_data, 128, 0, "DATA");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&x24c0xStateRegs, ~0, 0, 0);
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* Famicom jump 2:
|
||||
* 0-7: Lower bit of data selects which 256KB PRG block is in use.
|
||||
* This seems to be a hack on the developers' part, so I'll make emulation
|
||||
* of it a hack(I think the current PRG block would depend on whatever the
|
||||
* lowest bit of the CHR bank switching register that corresponds to the
|
||||
* last CHR address read).
|
||||
*/
|
||||
|
||||
static void M153Power(void) {
|
||||
Sync();
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, BandaiWrite);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
|
||||
static void M153Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
void Mapper153_Init(CartInfo *info) {
|
||||
is153 = 1;
|
||||
info->Power = M153Power;
|
||||
info->Close = M153Close;
|
||||
MapIRQHook = BandaiIRQHook;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* Datach Barcode Battler */
|
||||
|
||||
static uint8 BarcodeData[256];
|
||||
static int BarcodeReadPos;
|
||||
static int BarcodeCycleCount;
|
||||
static uint32 BarcodeOut;
|
||||
|
||||
int FCEUI_DatachSet(const uint8 *rcode) {
|
||||
int prefix_parity_type[10][6] = {
|
||||
{ 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 0, 1, 1 }, { 0, 0, 1, 1, 0, 1 }, { 0, 0, 1, 1, 1, 0 },
|
||||
{ 0, 1, 0, 0, 1, 1 }, { 0, 1, 1, 0, 0, 1 }, { 0, 1, 1, 1, 0, 0 }, { 0, 1, 0, 1, 0, 1 },
|
||||
{ 0, 1, 0, 1, 1, 0 }, { 0, 1, 1, 0, 1, 0 }
|
||||
};
|
||||
int data_left_odd[10][7] = {
|
||||
{ 0, 0, 0, 1, 1, 0, 1 }, { 0, 0, 1, 1, 0, 0, 1 }, { 0, 0, 1, 0, 0, 1, 1 }, { 0, 1, 1, 1, 1, 0, 1 },
|
||||
{ 0, 1, 0, 0, 0, 1, 1 }, { 0, 1, 1, 0, 0, 0, 1 }, { 0, 1, 0, 1, 1, 1, 1 }, { 0, 1, 1, 1, 0, 1, 1 },
|
||||
{ 0, 1, 1, 0, 1, 1, 1 }, { 0, 0, 0, 1, 0, 1, 1 }
|
||||
};
|
||||
int data_left_even[10][7] = {
|
||||
{ 0, 1, 0, 0, 1, 1, 1 }, { 0, 1, 1, 0, 0, 1, 1 }, { 0, 0, 1, 1, 0, 1, 1 }, { 0, 1, 0, 0, 0, 0, 1 },
|
||||
{ 0, 0, 1, 1, 1, 0, 1 }, { 0, 1, 1, 1, 0, 0, 1 }, { 0, 0, 0, 0, 1, 0, 1 }, { 0, 0, 1, 0, 0, 0, 1 },
|
||||
{ 0, 0, 0, 1, 0, 0, 1 }, { 0, 0, 1, 0, 1, 1, 1 }
|
||||
};
|
||||
int data_right[10][7] = {
|
||||
{ 1, 1, 1, 0, 0, 1, 0 }, { 1, 1, 0, 0, 1, 1, 0 }, { 1, 1, 0, 1, 1, 0, 0 }, { 1, 0, 0, 0, 0, 1, 0 },
|
||||
{ 1, 0, 1, 1, 1, 0, 0 }, { 1, 0, 0, 1, 1, 1, 0 }, { 1, 0, 1, 0, 0, 0, 0 }, { 1, 0, 0, 0, 1, 0, 0 },
|
||||
{ 1, 0, 0, 1, 0, 0, 0 }, { 1, 1, 1, 0, 1, 0, 0 }
|
||||
};
|
||||
uint8 code[13 + 1];
|
||||
uint32 tmp_p = 0;
|
||||
int i, j;
|
||||
int len;
|
||||
|
||||
for (i = len = 0; i < 13; i++) {
|
||||
if (!rcode[i]) break;
|
||||
if ((code[i] = rcode[i] - '0') > 9)
|
||||
return(0);
|
||||
len++;
|
||||
}
|
||||
if (len != 13 && len != 12 && len != 8 && len != 7) return(0);
|
||||
|
||||
#define BS(x) BarcodeData[tmp_p] = x; tmp_p++
|
||||
|
||||
for (j = 0; j < 32; j++) {
|
||||
BS(0x00);
|
||||
}
|
||||
|
||||
/* Left guard bars */
|
||||
BS(1); BS(0); BS(1);
|
||||
|
||||
if (len == 13 || len == 12) {
|
||||
uint32 csum;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
if (prefix_parity_type[code[0]][i]) {
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_left_even[code[i + 1]][j]);
|
||||
}
|
||||
} else
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_left_odd[code[i + 1]][j]);
|
||||
}
|
||||
|
||||
/* Center guard bars */
|
||||
BS(0); BS(1); BS(0); BS(1); BS(0);
|
||||
|
||||
for (i = 7; i < 12; i++)
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_right[code[i]][j]);
|
||||
}
|
||||
csum = 0;
|
||||
for (i = 0; i < 12; i++) csum += code[i] * ((i & 1) ? 3 : 1);
|
||||
csum = (10 - (csum % 10)) % 10;
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_right[csum][j]);
|
||||
}
|
||||
} else if (len == 8 || len == 7) {
|
||||
uint32 csum = 0;
|
||||
|
||||
for (i = 0; i < 7; i++) csum += (i & 1) ? code[i] : (code[i] * 3);
|
||||
|
||||
csum = (10 - (csum % 10)) % 10;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_left_odd[code[i]][j]);
|
||||
}
|
||||
|
||||
|
||||
/* Center guard bars */
|
||||
BS(0); BS(1); BS(0); BS(1); BS(0);
|
||||
|
||||
for (i = 4; i < 7; i++)
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_right[code[i]][j]);
|
||||
}
|
||||
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_right[csum][j]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Right guard bars */
|
||||
BS(1); BS(0); BS(1);
|
||||
|
||||
for (j = 0; j < 32; j++) {
|
||||
BS(0x00);
|
||||
}
|
||||
|
||||
BS(0xFF);
|
||||
|
||||
#undef BS
|
||||
|
||||
BarcodeReadPos = 0;
|
||||
BarcodeOut = 0x8;
|
||||
BarcodeCycleCount = 0;
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) BarcodeIRQHook(int a) {
|
||||
BandaiIRQHook(a);
|
||||
|
||||
BarcodeCycleCount += a;
|
||||
|
||||
if (BarcodeCycleCount >= 1000) {
|
||||
BarcodeCycleCount -= 1000;
|
||||
if (BarcodeData[BarcodeReadPos] == 0xFF) {
|
||||
BarcodeOut = 0;
|
||||
} else {
|
||||
BarcodeOut = (BarcodeData[BarcodeReadPos] ^ 1) << 3;
|
||||
BarcodeReadPos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(BarcodeRead) {
|
||||
return BarcodeOut;
|
||||
}
|
||||
|
||||
static void M157Power(void) {
|
||||
IRQa = 0;
|
||||
BarcodeData[0] = 0xFF;
|
||||
BarcodeReadPos = 0;
|
||||
BarcodeOut = 0;
|
||||
BarcodeCycleCount = 0;
|
||||
|
||||
Sync();
|
||||
|
||||
SetWriteHandler(0x6000, 0xFFFF, BandaiWrite);
|
||||
SetReadHandler(0x6000, 0x7FFF, BarcodeRead);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
void Mapper157_Init(CartInfo *info) {
|
||||
is153 = 1;
|
||||
info->Power = M157Power;
|
||||
MapIRQHook = BarcodeIRQHook;
|
||||
|
||||
GameInfo->cspecial = SIS_DATACH;
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
* Copyright (C) 2011 FCEUX team
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Bandai mappers
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[16], is153, x24c02;
|
||||
static uint8 IRQa;
|
||||
static int16 IRQCount, IRQLatch;
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 16, "REGS" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 2, "IRQL" }, /* need for Famicom Jump II - Saikyou no 7 Nin (J) [!] */
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* x24C0x interface */
|
||||
|
||||
#define X24C0X_STANDBY 0
|
||||
#define X24C0X_ADDRESS 1
|
||||
#define X24C0X_WORD 2
|
||||
#define X24C0X_READ 3
|
||||
#define X24C0X_WRITE 4
|
||||
|
||||
static uint8 x24c0x_data[256], x24c0x_state;
|
||||
static uint8 x24c0x_addr, x24c0x_word, x24c0x_latch, x24c0x_bitcount;
|
||||
static uint8 x24c0x_sda, x24c0x_scl, x24c0x_out, x24c0x_oe;
|
||||
|
||||
static SFORMAT x24c0xStateRegs[] =
|
||||
{
|
||||
{ &x24c0x_addr, 1, "ADDR" },
|
||||
{ &x24c0x_word, 1, "WORD" },
|
||||
{ &x24c0x_latch, 1, "LATC" },
|
||||
{ &x24c0x_bitcount, 1, "BITC" },
|
||||
{ &x24c0x_sda, 1, "SDA" },
|
||||
{ &x24c0x_scl, 1, "SCL" },
|
||||
{ &x24c0x_out, 1, "OUT" },
|
||||
{ &x24c0x_oe, 1, "OE" },
|
||||
{ &x24c0x_state, 1, "STAT" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void x24c0x_init() {
|
||||
x24c0x_addr = x24c0x_word = x24c0x_latch = x24c0x_bitcount = x24c0x_sda = x24c0x_scl = x24c0x_oe = 0;
|
||||
x24c0x_state = X24C0X_STANDBY;
|
||||
}
|
||||
|
||||
static void x24c0x_write(uint8 data) {
|
||||
uint8 sda = (data >> 6) & 1;
|
||||
uint8 scl = (data >> 5) & 1;
|
||||
x24c0x_oe = (data >> 7);
|
||||
|
||||
if(x24c0x_scl && scl) {
|
||||
if(x24c0x_sda && !sda) { /* START */
|
||||
x24c0x_state = X24C0X_ADDRESS;
|
||||
x24c0x_bitcount = 0;
|
||||
x24c0x_addr = 0;
|
||||
} else if(!x24c0x_sda && sda) { /* STOP */
|
||||
x24c0x_state = X24C0X_STANDBY;
|
||||
}
|
||||
} else if(!x24c0x_scl && scl) { /* RISING EDGE */
|
||||
switch(x24c0x_state) {
|
||||
case X24C0X_ADDRESS:
|
||||
if(x24c0x_bitcount < 7) {
|
||||
x24c0x_addr <<= 1;
|
||||
x24c0x_addr |= sda;
|
||||
} else {
|
||||
if(!x24c02) /* X24C01 mode */
|
||||
x24c0x_word = x24c0x_addr;
|
||||
if(sda) { /* READ COMMAND */
|
||||
x24c0x_state = X24C0X_READ;
|
||||
} else { /* WRITE COMMAND */
|
||||
if(x24c02) /* X24C02 mode */
|
||||
x24c0x_state = X24C0X_WORD;
|
||||
else
|
||||
x24c0x_state = X24C0X_WRITE;
|
||||
}
|
||||
}
|
||||
x24c0x_bitcount++;
|
||||
break;
|
||||
case X24C0X_WORD:
|
||||
if(x24c0x_bitcount == 8) { /* ACK */
|
||||
x24c0x_word = 0;
|
||||
x24c0x_out = 0;
|
||||
} else { /* WORD ADDRESS INPUT */
|
||||
x24c0x_word <<= 1;
|
||||
x24c0x_word |= sda;
|
||||
if(x24c0x_bitcount == 16) { /* END OF ADDRESS INPUT */
|
||||
x24c0x_bitcount = 7;
|
||||
x24c0x_state = X24C0X_WRITE;
|
||||
}
|
||||
}
|
||||
x24c0x_bitcount++;
|
||||
break;
|
||||
case X24C0X_READ:
|
||||
if (x24c0x_bitcount == 8) { /* ACK */
|
||||
x24c0x_out = 0;
|
||||
x24c0x_latch = x24c0x_data[x24c0x_word];
|
||||
x24c0x_bitcount = 0;
|
||||
} else { /* REAL OUTPUT */
|
||||
x24c0x_out = x24c0x_latch >> 7;
|
||||
x24c0x_latch <<= 1;
|
||||
x24c0x_bitcount++;
|
||||
if(x24c0x_bitcount == 8) {
|
||||
x24c0x_word++;
|
||||
x24c0x_word &= 0xff;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case X24C0X_WRITE:
|
||||
if (x24c0x_bitcount == 8) { /* ACK */
|
||||
x24c0x_out = 0;
|
||||
x24c0x_latch = 0;
|
||||
x24c0x_bitcount = 0;
|
||||
} else { /* REAL INPUT */
|
||||
x24c0x_latch <<= 1;
|
||||
x24c0x_latch |= sda;
|
||||
x24c0x_bitcount++;
|
||||
if(x24c0x_bitcount == 8) {
|
||||
x24c0x_data[x24c0x_word] = x24c0x_latch;
|
||||
x24c0x_word++;
|
||||
x24c0x_word &= 0xff;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
x24c0x_sda = sda;
|
||||
x24c0x_scl = scl;
|
||||
}
|
||||
|
||||
static uint8 x24c0x_read() {
|
||||
return x24c0x_out << 4;
|
||||
}
|
||||
|
||||
static void Sync(void) {
|
||||
if (is153) {
|
||||
int base = (reg[0] & 1) << 4;
|
||||
setchr8(0);
|
||||
setprg16(0x8000, (reg[8] & 0x0F) | base);
|
||||
setprg16(0xC000, 0x0F | base);
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < 8; i++) setchr1(i << 10, reg[i]);
|
||||
setprg16(0x8000, reg[8]);
|
||||
setprg16(0xC000, ~0);
|
||||
}
|
||||
switch (reg[9] & 3) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(BandaiWrite) {
|
||||
A &= 0x0F;
|
||||
if (A < 0x0A) {
|
||||
reg[A & 0x0F] = V;
|
||||
Sync();
|
||||
} else
|
||||
switch (A) {
|
||||
case 0x0A: X6502_IRQEnd(FCEU_IQEXT); IRQa = V & 1; IRQCount = IRQLatch; break;
|
||||
case 0x0B: IRQLatch &= 0xFF00; IRQLatch |= V; break;
|
||||
case 0x0C: IRQLatch &= 0xFF; IRQLatch |= V << 8; break;
|
||||
case 0x0D: x24c0x_write(V); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(BandaiRead) {
|
||||
return (X.DB & 0xEF) | x24c0x_read();
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) BandaiIRQHook(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount < 0) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
IRQCount = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void BandaiPower(void) {
|
||||
IRQa = 0;
|
||||
x24c0x_init();
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, BandaiRead);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, BandaiWrite);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper16_Init(CartInfo *info) {
|
||||
x24c02 = 1;
|
||||
is153 = 0;
|
||||
info->Power = BandaiPower;
|
||||
MapIRQHook = BandaiIRQHook;
|
||||
|
||||
info->battery = 1;
|
||||
info->SaveGame[0] = x24c0x_data;
|
||||
info->SaveGameLen[0] = 256;
|
||||
AddExState(x24c0x_data, 256, 0, "DATA");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&x24c0xStateRegs, ~0, 0, 0);
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper159_Init(CartInfo *info) {
|
||||
x24c02 = 0;
|
||||
is153 = 0;
|
||||
info->Power = BandaiPower;
|
||||
MapIRQHook = BandaiIRQHook;
|
||||
|
||||
info->battery = 1;
|
||||
info->SaveGame[0] = x24c0x_data;
|
||||
info->SaveGameLen[0] = 128;
|
||||
AddExState(x24c0x_data, 128, 0, "DATA");
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&x24c0xStateRegs, ~0, 0, 0);
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* Famicom jump 2:
|
||||
* 0-7: Lower bit of data selects which 256KB PRG block is in use.
|
||||
* This seems to be a hack on the developers' part, so I'll make emulation
|
||||
* of it a hack(I think the current PRG block would depend on whatever the
|
||||
* lowest bit of the CHR bank switching register that corresponds to the
|
||||
* last CHR address read).
|
||||
*/
|
||||
|
||||
static void M153Power(void) {
|
||||
Sync();
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, BandaiWrite);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
|
||||
static void M153Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
void Mapper153_Init(CartInfo *info) {
|
||||
is153 = 1;
|
||||
info->Power = M153Power;
|
||||
info->Close = M153Close;
|
||||
MapIRQHook = BandaiIRQHook;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
/* Datach Barcode Battler */
|
||||
|
||||
static uint8 BarcodeData[256];
|
||||
static int BarcodeReadPos;
|
||||
static int BarcodeCycleCount;
|
||||
static uint32 BarcodeOut;
|
||||
|
||||
int FCEUI_DatachSet(const uint8 *rcode) {
|
||||
int prefix_parity_type[10][6] = {
|
||||
{ 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 0, 1, 1 }, { 0, 0, 1, 1, 0, 1 }, { 0, 0, 1, 1, 1, 0 },
|
||||
{ 0, 1, 0, 0, 1, 1 }, { 0, 1, 1, 0, 0, 1 }, { 0, 1, 1, 1, 0, 0 }, { 0, 1, 0, 1, 0, 1 },
|
||||
{ 0, 1, 0, 1, 1, 0 }, { 0, 1, 1, 0, 1, 0 }
|
||||
};
|
||||
int data_left_odd[10][7] = {
|
||||
{ 0, 0, 0, 1, 1, 0, 1 }, { 0, 0, 1, 1, 0, 0, 1 }, { 0, 0, 1, 0, 0, 1, 1 }, { 0, 1, 1, 1, 1, 0, 1 },
|
||||
{ 0, 1, 0, 0, 0, 1, 1 }, { 0, 1, 1, 0, 0, 0, 1 }, { 0, 1, 0, 1, 1, 1, 1 }, { 0, 1, 1, 1, 0, 1, 1 },
|
||||
{ 0, 1, 1, 0, 1, 1, 1 }, { 0, 0, 0, 1, 0, 1, 1 }
|
||||
};
|
||||
int data_left_even[10][7] = {
|
||||
{ 0, 1, 0, 0, 1, 1, 1 }, { 0, 1, 1, 0, 0, 1, 1 }, { 0, 0, 1, 1, 0, 1, 1 }, { 0, 1, 0, 0, 0, 0, 1 },
|
||||
{ 0, 0, 1, 1, 1, 0, 1 }, { 0, 1, 1, 1, 0, 0, 1 }, { 0, 0, 0, 0, 1, 0, 1 }, { 0, 0, 1, 0, 0, 0, 1 },
|
||||
{ 0, 0, 0, 1, 0, 0, 1 }, { 0, 0, 1, 0, 1, 1, 1 }
|
||||
};
|
||||
int data_right[10][7] = {
|
||||
{ 1, 1, 1, 0, 0, 1, 0 }, { 1, 1, 0, 0, 1, 1, 0 }, { 1, 1, 0, 1, 1, 0, 0 }, { 1, 0, 0, 0, 0, 1, 0 },
|
||||
{ 1, 0, 1, 1, 1, 0, 0 }, { 1, 0, 0, 1, 1, 1, 0 }, { 1, 0, 1, 0, 0, 0, 0 }, { 1, 0, 0, 0, 1, 0, 0 },
|
||||
{ 1, 0, 0, 1, 0, 0, 0 }, { 1, 1, 1, 0, 1, 0, 0 }
|
||||
};
|
||||
uint8 code[13 + 1];
|
||||
uint32 tmp_p = 0;
|
||||
int i, j;
|
||||
int len;
|
||||
|
||||
for (i = len = 0; i < 13; i++) {
|
||||
if (!rcode[i]) break;
|
||||
if ((code[i] = rcode[i] - '0') > 9)
|
||||
return(0);
|
||||
len++;
|
||||
}
|
||||
if (len != 13 && len != 12 && len != 8 && len != 7) return(0);
|
||||
|
||||
#define BS(x) BarcodeData[tmp_p] = x; tmp_p++
|
||||
|
||||
for (j = 0; j < 32; j++) {
|
||||
BS(0x00);
|
||||
}
|
||||
|
||||
/* Left guard bars */
|
||||
BS(1); BS(0); BS(1);
|
||||
|
||||
if (len == 13 || len == 12) {
|
||||
uint32 csum;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
if (prefix_parity_type[code[0]][i]) {
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_left_even[code[i + 1]][j]);
|
||||
}
|
||||
} else
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_left_odd[code[i + 1]][j]);
|
||||
}
|
||||
|
||||
/* Center guard bars */
|
||||
BS(0); BS(1); BS(0); BS(1); BS(0);
|
||||
|
||||
for (i = 7; i < 12; i++)
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_right[code[i]][j]);
|
||||
}
|
||||
csum = 0;
|
||||
for (i = 0; i < 12; i++) csum += code[i] * ((i & 1) ? 3 : 1);
|
||||
csum = (10 - (csum % 10)) % 10;
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_right[csum][j]);
|
||||
}
|
||||
} else if (len == 8 || len == 7) {
|
||||
uint32 csum = 0;
|
||||
|
||||
for (i = 0; i < 7; i++) csum += (i & 1) ? code[i] : (code[i] * 3);
|
||||
|
||||
csum = (10 - (csum % 10)) % 10;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_left_odd[code[i]][j]);
|
||||
}
|
||||
|
||||
|
||||
/* Center guard bars */
|
||||
BS(0); BS(1); BS(0); BS(1); BS(0);
|
||||
|
||||
for (i = 4; i < 7; i++)
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_right[code[i]][j]);
|
||||
}
|
||||
|
||||
for (j = 0; j < 7; j++) {
|
||||
BS(data_right[csum][j]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Right guard bars */
|
||||
BS(1); BS(0); BS(1);
|
||||
|
||||
for (j = 0; j < 32; j++) {
|
||||
BS(0x00);
|
||||
}
|
||||
|
||||
BS(0xFF);
|
||||
|
||||
#undef BS
|
||||
|
||||
BarcodeReadPos = 0;
|
||||
BarcodeOut = 0x8;
|
||||
BarcodeCycleCount = 0;
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) BarcodeIRQHook(int a) {
|
||||
BandaiIRQHook(a);
|
||||
|
||||
BarcodeCycleCount += a;
|
||||
|
||||
if (BarcodeCycleCount >= 1000) {
|
||||
BarcodeCycleCount -= 1000;
|
||||
if (BarcodeData[BarcodeReadPos] == 0xFF) {
|
||||
BarcodeOut = 0;
|
||||
} else {
|
||||
BarcodeOut = (BarcodeData[BarcodeReadPos] ^ 1) << 3;
|
||||
BarcodeReadPos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(BarcodeRead) {
|
||||
return BarcodeOut;
|
||||
}
|
||||
|
||||
static void M157Power(void) {
|
||||
IRQa = 0;
|
||||
BarcodeData[0] = 0xFF;
|
||||
BarcodeReadPos = 0;
|
||||
BarcodeOut = 0;
|
||||
BarcodeCycleCount = 0;
|
||||
|
||||
Sync();
|
||||
|
||||
SetWriteHandler(0x6000, 0xFFFF, BandaiWrite);
|
||||
SetReadHandler(0x6000, 0x7FFF, BarcodeRead);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
void Mapper157_Init(CartInfo *info) {
|
||||
is153 = 1;
|
||||
info->Power = M157Power;
|
||||
MapIRQHook = BarcodeIRQHook;
|
||||
|
||||
GameInfo->cspecial = SIS_DATACH;
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
136
src/boards/bb.c
136
src/boards/bb.c
@@ -1,68 +1,68 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
* Bubble Bobble CHR-ROM version
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, chr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ &chr, 1, "CHR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, reg & 3);
|
||||
setprg32(0x8000, ~0);
|
||||
setchr8(chr & 3);
|
||||
}
|
||||
|
||||
static DECLFW(UNLBBWrite) {
|
||||
if ((A & 0x9000) == 0x8000)
|
||||
reg = chr = V;
|
||||
else
|
||||
chr = V & 1; /* hacky hacky, ProWres simplified FDS conversion 2-in-1 mapper */
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLBBPower(void) {
|
||||
chr = 0;
|
||||
reg = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLBBWrite);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLBB_Init(CartInfo *info) {
|
||||
info->Power = UNLBBPower;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
* Bubble Bobble CHR-ROM version
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg, chr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ &chr, 1, "CHR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x6000, reg & 3);
|
||||
setprg32(0x8000, ~0);
|
||||
setchr8(chr & 3);
|
||||
}
|
||||
|
||||
static DECLFW(UNLBBWrite) {
|
||||
if ((A & 0x9000) == 0x8000)
|
||||
reg = chr = V;
|
||||
else
|
||||
chr = V & 1; /* hacky hacky, ProWres simplified FDS conversion 2-in-1 mapper */
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLBBPower(void) {
|
||||
chr = 0;
|
||||
reg = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLBBWrite);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLBB_Init(CartInfo *info) {
|
||||
info->Power = UNLBBPower;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,97 +1,97 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* BMC 42-in-1 "reset switch" type
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 bank_mode;
|
||||
static uint8 bank_value;
|
||||
static uint8 prgb[4];
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &bank_mode, 1, "BNM" },
|
||||
{ &bank_value, 1, "BMV" },
|
||||
{ prgb, 4, "PRGB" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
/* FCEU_printf("%02x: %02x %02x\n", bank_mode, bank_value, prgb[0]); */
|
||||
switch (bank_mode & 7) {
|
||||
case 0:
|
||||
setprg32(0x8000, bank_value & 7); break;
|
||||
case 1:
|
||||
setprg16(0x8000, ((8 + (bank_value & 7)) >> 1) + prgb[1]);
|
||||
setprg16(0xC000, (bank_value & 7) >> 1);
|
||||
case 4:
|
||||
setprg32(0x8000, 8 + (bank_value & 7)); break;
|
||||
case 5:
|
||||
setprg16(0x8000, ((8 + (bank_value & 7)) >> 1) + prgb[1]);
|
||||
setprg16(0xC000, ((8 + (bank_value & 7)) >> 1) + prgb[3]);
|
||||
case 2:
|
||||
setprg8(0x8000, prgb[0] >> 2);
|
||||
setprg8(0xa000, prgb[1]);
|
||||
setprg8(0xc000, prgb[2]);
|
||||
setprg8(0xe000, ~0);
|
||||
break;
|
||||
case 3:
|
||||
setprg8(0x8000, prgb[0]);
|
||||
setprg8(0xa000, prgb[1]);
|
||||
setprg8(0xc000, prgb[2]);
|
||||
setprg8(0xe000, prgb[3]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(BMC13in1JY110Write) {
|
||||
/* FCEU_printf("%04x:%04x\n",A,V); */
|
||||
switch (A) {
|
||||
case 0x8000:
|
||||
case 0x8001:
|
||||
case 0x8002:
|
||||
case 0x8003: prgb[A & 3] = V; break;
|
||||
case 0xD000: bank_mode = V; break;
|
||||
case 0xD001: setmirror(V & 3);
|
||||
case 0xD002: break;
|
||||
case 0xD003: bank_value = V; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC13in1JY110Power(void) {
|
||||
prgb[0] = prgb[1] = prgb[2] = prgb[3] = 0;
|
||||
bank_mode = 0;
|
||||
bank_value = 0;
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000, 0xFFFF, BMC13in1JY110Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC13in1JY110_Init(CartInfo *info) {
|
||||
info->Power = BMC13in1JY110Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* BMC 42-in-1 "reset switch" type
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 bank_mode;
|
||||
static uint8 bank_value;
|
||||
static uint8 prgb[4];
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &bank_mode, 1, "BNM" },
|
||||
{ &bank_value, 1, "BMV" },
|
||||
{ prgb, 4, "PRGB" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
/* FCEU_printf("%02x: %02x %02x\n", bank_mode, bank_value, prgb[0]); */
|
||||
switch (bank_mode & 7) {
|
||||
case 0:
|
||||
setprg32(0x8000, bank_value & 7); break;
|
||||
case 1:
|
||||
setprg16(0x8000, ((8 + (bank_value & 7)) >> 1) + prgb[1]);
|
||||
setprg16(0xC000, (bank_value & 7) >> 1);
|
||||
case 4:
|
||||
setprg32(0x8000, 8 + (bank_value & 7)); break;
|
||||
case 5:
|
||||
setprg16(0x8000, ((8 + (bank_value & 7)) >> 1) + prgb[1]);
|
||||
setprg16(0xC000, ((8 + (bank_value & 7)) >> 1) + prgb[3]);
|
||||
case 2:
|
||||
setprg8(0x8000, prgb[0] >> 2);
|
||||
setprg8(0xa000, prgb[1]);
|
||||
setprg8(0xc000, prgb[2]);
|
||||
setprg8(0xe000, ~0);
|
||||
break;
|
||||
case 3:
|
||||
setprg8(0x8000, prgb[0]);
|
||||
setprg8(0xa000, prgb[1]);
|
||||
setprg8(0xc000, prgb[2]);
|
||||
setprg8(0xe000, prgb[3]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(BMC13in1JY110Write) {
|
||||
/* FCEU_printf("%04x:%04x\n",A,V); */
|
||||
switch (A) {
|
||||
case 0x8000:
|
||||
case 0x8001:
|
||||
case 0x8002:
|
||||
case 0x8003: prgb[A & 3] = V; break;
|
||||
case 0xD000: bank_mode = V; break;
|
||||
case 0xD001: setmirror(V & 3);
|
||||
case 0xD002: break;
|
||||
case 0xD003: bank_value = V; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC13in1JY110Power(void) {
|
||||
prgb[0] = prgb[1] = prgb[2] = prgb[3] = 0;
|
||||
bank_mode = 0;
|
||||
bank_value = 0;
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000, 0xFFFF, BMC13in1JY110Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC13in1JY110_Init(CartInfo *info) {
|
||||
info->Power = BMC13in1JY110Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
@@ -1,86 +1,86 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
* Copyright (C) 2009 qeed
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* BMC 42-in-1 "reset switch" + "select switch"
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 isresetbased = 0;
|
||||
static uint8 latche[2], reset;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &reset, 1, "RST" },
|
||||
{ latche, 2, "LATC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 bank;
|
||||
if (isresetbased)
|
||||
bank = (latche[0] & 0x1f) | (reset << 5) | ((latche[1] & 1) << 6);
|
||||
else
|
||||
bank = (latche[0] & 0x1f) | ((latche[0] & 0x80) >> 2) | ((latche[1] & 1) << 6);
|
||||
if (!(latche[0] & 0x20))
|
||||
setprg32(0x8000, bank >> 1);
|
||||
else {
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
setmirror((latche[0] >> 6) & 1);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M226Write) {
|
||||
latche[A & 1] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M226Power(void) {
|
||||
latche[0] = latche[1] = reset = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M226Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper226_Init(CartInfo *info) {
|
||||
isresetbased = 0;
|
||||
info->Power = M226Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
static void M233Reset(void) {
|
||||
reset ^= 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper233_Init(CartInfo *info) {
|
||||
isresetbased = 1;
|
||||
info->Power = M226Power;
|
||||
info->Reset = M233Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
* Copyright (C) 2009 qeed
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* BMC 42-in-1 "reset switch" + "select switch"
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 isresetbased = 0;
|
||||
static uint8 latche[2], reset;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &reset, 1, "RST" },
|
||||
{ latche, 2, "LATC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
uint8 bank;
|
||||
if (isresetbased)
|
||||
bank = (latche[0] & 0x1f) | (reset << 5) | ((latche[1] & 1) << 6);
|
||||
else
|
||||
bank = (latche[0] & 0x1f) | ((latche[0] & 0x80) >> 2) | ((latche[1] & 1) << 6);
|
||||
if (!(latche[0] & 0x20))
|
||||
setprg32(0x8000, bank >> 1);
|
||||
else {
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
setmirror((latche[0] >> 6) & 1);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M226Write) {
|
||||
latche[A & 1] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M226Power(void) {
|
||||
latche[0] = latche[1] = reset = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M226Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper226_Init(CartInfo *info) {
|
||||
isresetbased = 0;
|
||||
info->Power = M226Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
static void M233Reset(void) {
|
||||
reset ^= 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper233_Init(CartInfo *info) {
|
||||
isresetbased = 1;
|
||||
info->Power = M226Power;
|
||||
info->Reset = M233Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
@@ -1,83 +1,83 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* BMC 42-in-1 "reset switch" type
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[4];
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 4, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (regs[0] & 0x80) {
|
||||
if (regs[1] & 0x80)
|
||||
setprg32(0x8000, regs[1] & 0x1F);
|
||||
else {
|
||||
int bank = ((regs[1] & 0x1f) << 1) | ((regs[1] >> 6) & 1);
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
} else {
|
||||
int bank = ((regs[1] & 0x1f) << 1) | ((regs[1] >> 6) & 1);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
if (regs[0] & 0x20)
|
||||
setmirror(MI_H);
|
||||
else
|
||||
setmirror(MI_V);
|
||||
setchr8((regs[2] << 2) | ((regs[0] >> 1) & 3));
|
||||
}
|
||||
|
||||
static DECLFW(BMC64in1nrWriteLo) {
|
||||
regs[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(BMC64in1nrWriteHi) {
|
||||
regs[3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC64in1nrPower(void) {
|
||||
regs[0] = 0x80;
|
||||
regs[1] = 0x43;
|
||||
regs[2] = regs[3] = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x5000, 0x5003, BMC64in1nrWriteLo);
|
||||
SetWriteHandler(0x8000, 0xFFFF, BMC64in1nrWriteHi);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC64in1nr_Init(CartInfo *info) {
|
||||
info->Power = BMC64in1nrPower;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* BMC 42-in-1 "reset switch" type
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[4];
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 4, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (regs[0] & 0x80) {
|
||||
if (regs[1] & 0x80)
|
||||
setprg32(0x8000, regs[1] & 0x1F);
|
||||
else {
|
||||
int bank = ((regs[1] & 0x1f) << 1) | ((regs[1] >> 6) & 1);
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
} else {
|
||||
int bank = ((regs[1] & 0x1f) << 1) | ((regs[1] >> 6) & 1);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
if (regs[0] & 0x20)
|
||||
setmirror(MI_H);
|
||||
else
|
||||
setmirror(MI_V);
|
||||
setchr8((regs[2] << 2) | ((regs[0] >> 1) & 3));
|
||||
}
|
||||
|
||||
static DECLFW(BMC64in1nrWriteLo) {
|
||||
regs[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(BMC64in1nrWriteHi) {
|
||||
regs[3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC64in1nrPower(void) {
|
||||
regs[0] = 0x80;
|
||||
regs[1] = 0x43;
|
||||
regs[2] = regs[3] = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x5000, 0x5003, BMC64in1nrWriteLo);
|
||||
SetWriteHandler(0x8000, 0xFFFF, BMC64in1nrWriteHi);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC64in1nr_Init(CartInfo *info) {
|
||||
info->Power = BMC64in1nrPower;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,123 +1,123 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 is_large_banks, hw_switch;
|
||||
static uint8 large_bank;
|
||||
static uint8 prg_bank;
|
||||
static uint8 chr_bank;
|
||||
static uint8 bank_mode;
|
||||
static uint8 mirroring;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &large_bank, 1, "LB" },
|
||||
{ &hw_switch, 1, "DPSW" },
|
||||
{ &prg_bank, 1, "PRG" },
|
||||
{ &chr_bank, 1, "CHR" },
|
||||
{ &bank_mode, 1, "BM" },
|
||||
{ &mirroring, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
switch (bank_mode) {
|
||||
case 0x00:
|
||||
case 0x10:
|
||||
setprg16(0x8000, large_bank | prg_bank);
|
||||
setprg16(0xC000, large_bank | 7);
|
||||
break;
|
||||
case 0x20:
|
||||
setprg32(0x8000, (large_bank | prg_bank) >> 1);
|
||||
break;
|
||||
case 0x30:
|
||||
setprg16(0x8000, large_bank | prg_bank);
|
||||
setprg16(0xC000, large_bank | prg_bank);
|
||||
break;
|
||||
}
|
||||
setmirror(mirroring);
|
||||
if (!is_large_banks)
|
||||
setchr8(chr_bank);
|
||||
}
|
||||
|
||||
static DECLFR(BMC70in1Read) {
|
||||
if (bank_mode == 0x10)
|
||||
/* if(is_large_banks) */
|
||||
return CartBR((A & 0xFFF0) | hw_switch);
|
||||
#if 0
|
||||
else
|
||||
return CartBR((A&0xFFF0)|hw_switch);
|
||||
#endif
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(BMC70in1Write) {
|
||||
if (A & 0x4000) {
|
||||
bank_mode = A & 0x30;
|
||||
prg_bank = A & 7;
|
||||
} else {
|
||||
mirroring = ((A & 0x20) >> 5) ^ 1;
|
||||
if (is_large_banks)
|
||||
large_bank = (A & 3) << 3;
|
||||
else
|
||||
chr_bank = A & 7;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC70in1Reset(void) {
|
||||
bank_mode = 0;
|
||||
large_bank = 0;
|
||||
Sync();
|
||||
hw_switch++;
|
||||
hw_switch &= 0xf;
|
||||
}
|
||||
|
||||
static void BMC70in1Power(void) {
|
||||
setchr8(0);
|
||||
bank_mode = 0;
|
||||
large_bank = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, BMC70in1Read);
|
||||
SetWriteHandler(0x8000, 0xffff, BMC70in1Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC70in1_Init(CartInfo *info) {
|
||||
is_large_banks = 0;
|
||||
hw_switch = 0xd;
|
||||
info->Power = BMC70in1Power;
|
||||
info->Reset = BMC70in1Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void BMC70in1B_Init(CartInfo *info) {
|
||||
is_large_banks = 1;
|
||||
hw_switch = 0x6;
|
||||
info->Power = BMC70in1Power;
|
||||
info->Reset = BMC70in1Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 is_large_banks, hw_switch;
|
||||
static uint8 large_bank;
|
||||
static uint8 prg_bank;
|
||||
static uint8 chr_bank;
|
||||
static uint8 bank_mode;
|
||||
static uint8 mirroring;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &large_bank, 1, "LB" },
|
||||
{ &hw_switch, 1, "DPSW" },
|
||||
{ &prg_bank, 1, "PRG" },
|
||||
{ &chr_bank, 1, "CHR" },
|
||||
{ &bank_mode, 1, "BM" },
|
||||
{ &mirroring, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
switch (bank_mode) {
|
||||
case 0x00:
|
||||
case 0x10:
|
||||
setprg16(0x8000, large_bank | prg_bank);
|
||||
setprg16(0xC000, large_bank | 7);
|
||||
break;
|
||||
case 0x20:
|
||||
setprg32(0x8000, (large_bank | prg_bank) >> 1);
|
||||
break;
|
||||
case 0x30:
|
||||
setprg16(0x8000, large_bank | prg_bank);
|
||||
setprg16(0xC000, large_bank | prg_bank);
|
||||
break;
|
||||
}
|
||||
setmirror(mirroring);
|
||||
if (!is_large_banks)
|
||||
setchr8(chr_bank);
|
||||
}
|
||||
|
||||
static DECLFR(BMC70in1Read) {
|
||||
if (bank_mode == 0x10)
|
||||
/* if(is_large_banks) */
|
||||
return CartBR((A & 0xFFF0) | hw_switch);
|
||||
#if 0
|
||||
else
|
||||
return CartBR((A&0xFFF0)|hw_switch);
|
||||
#endif
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(BMC70in1Write) {
|
||||
if (A & 0x4000) {
|
||||
bank_mode = A & 0x30;
|
||||
prg_bank = A & 7;
|
||||
} else {
|
||||
mirroring = ((A & 0x20) >> 5) ^ 1;
|
||||
if (is_large_banks)
|
||||
large_bank = (A & 3) << 3;
|
||||
else
|
||||
chr_bank = A & 7;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC70in1Reset(void) {
|
||||
bank_mode = 0;
|
||||
large_bank = 0;
|
||||
Sync();
|
||||
hw_switch++;
|
||||
hw_switch &= 0xf;
|
||||
}
|
||||
|
||||
static void BMC70in1Power(void) {
|
||||
setchr8(0);
|
||||
bank_mode = 0;
|
||||
large_bank = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, BMC70in1Read);
|
||||
SetWriteHandler(0x8000, 0xffff, BMC70in1Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC70in1_Init(CartInfo *info) {
|
||||
is_large_banks = 0;
|
||||
hw_switch = 0xd;
|
||||
info->Power = BMC70in1Power;
|
||||
info->Reset = BMC70in1Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void BMC70in1B_Init(CartInfo *info) {
|
||||
is_large_banks = 1;
|
||||
hw_switch = 0x6;
|
||||
info->Power = BMC70in1Power;
|
||||
info->Reset = BMC70in1Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,136 +1,136 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
#define CARD_EXTERNAL_INSERED 0x80
|
||||
|
||||
static uint8 prg_reg;
|
||||
static uint8 chr_reg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &prg_reg, 1, "PREG" },
|
||||
{ &chr_reg, 1, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
#if 0
|
||||
|
||||
cmd[0] = response on/off
|
||||
0x00 - on
|
||||
0x80 - off
|
||||
cmd[1] = cmd
|
||||
|
||||
|
||||
_GET_CHALLENGE: .BYTE 0,$B4, 0, 0,$62
|
||||
|
||||
_SELECT_FILE_1_0200: .BYTE 0,$A4, 1, 0, 2, 2, 0
|
||||
_SELECT_FILE_2_0201: .BYTE 0,$A4, 2, 0, 2, 2, 1
|
||||
_SELECT_FILE_2_0203: .BYTE 0,$A4, 2, 0, 2, 2, 3
|
||||
_SELECT_FILE_2_0204: .BYTE 0,$A4, 2, 0, 2, 2, 4
|
||||
_SELECT_FILE_2_0205: .BYTE 0,$A4, 2, 0, 2, 2, 5
|
||||
_SELECT_FILE_2_3F04: .BYTE 0,$A4, 2, 0, 2,$3F, 4
|
||||
_SELECT_FILE_2_4F00: .BYTE 0,$A4, 2, 0, 2,$4F, 0
|
||||
|
||||
_READ_BINARY_5: .BYTE 0,$B0,$85, 0, 2
|
||||
_READ_BINARY_6: .BYTE 0,$B0,$86, 0, 4
|
||||
_READ_BINARY_6_0: .BYTE 0,$B0,$86, 0,$18
|
||||
_READ_BINARY_0: .BYTE 0,$B0, 0, 2, 3
|
||||
_READ_BINARY_0_0: .BYTE 0,$B0, 0, 0, 4
|
||||
_READ_BINARY_0_1: .BYTE 0,$B0, 0, 0, $C
|
||||
_READ_BINARY_0_2: .BYTE 0,$B0, 0, 0,$10
|
||||
|
||||
_UPDATE_BINARY: .BYTE 0,$D6, 0, 0, 4
|
||||
_UPDATE_BINARY_0: .BYTE 0,$D6, 0, 0,$10
|
||||
|
||||
_GET_RESPONSE: .BYTE $80,$C0, 2,$A1, 8
|
||||
_GET_RESPONSE_0: .BYTE 0,$C0, 0, 0, 2
|
||||
_GET_RESPONSE_1: .BYTE 0,$C0, 0, 0, 6
|
||||
_GET_RESPONSE_2: .BYTE 0,$C0, 0, 0, 8
|
||||
_GET_RESPONSE_3: .BYTE 0,$C0, 0, 0, $C
|
||||
_GET_RESPONSE_4: .BYTE 0,$C0, 0, 0,$10
|
||||
|
||||
byte_8C0B: .BYTE $80,$30, 0, 2, $A, 0, 1
|
||||
byte_8C48: .BYTE $80,$32, 0, 1, 4
|
||||
byte_8C89: .BYTE $80,$34, 0, 0, 8, 0, 0
|
||||
byte_8D01: .BYTE $80,$36, 0, 0, $C
|
||||
byte_8CA7: .BYTE $80,$38, 0, 2, 4
|
||||
byte_8BEC: .BYTE $80,$3A, 0, 3, 0
|
||||
|
||||
byte_89A0: .BYTE 0,$48, 0, 0, 6
|
||||
byte_8808: .BYTE 0,$54, 0, 0,$1C
|
||||
byte_89BF: .BYTE 0,$58, 0, 0,$1C
|
||||
|
||||
_MANAGE_CHANNEL: .BYTE 0,$70, 0, 0, 8
|
||||
byte_8CE5: .BYTE 0,$74, 0, 0,$12
|
||||
byte_8C29: .BYTE 0,$76, 0, 0, 8
|
||||
byte_8CC6: .BYTE 0,$78, 0, 0,$12
|
||||
#endif
|
||||
|
||||
#if 0 /* Silenced since unused */
|
||||
static uint8 sim0reset[0x1F] = {
|
||||
0x3B, 0xE9, 0x00, 0xFF, 0xC1, 0x10, 0x31, 0xFE,
|
||||
0x55, 0xC8, 0x10, 0x20, 0x55, 0x47, 0x4F, 0x53,
|
||||
0x56, 0x53, 0x43, 0xAD, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, prg_reg);
|
||||
setchr8(chr_reg);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M216WriteHi) {
|
||||
prg_reg = A & 1;
|
||||
chr_reg = (A & 0x0E) >> 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M216Write5000) {
|
||||
/* FCEU_printf("WRITE: %04x:%04x (PC=%02x cnt=%02x)\n",A,V,X.PC,sim0bcnt); */
|
||||
}
|
||||
|
||||
static DECLFR(M216Read5000) {
|
||||
/* FCEU_printf("READ: %04x PC=%04x out=%02x byte=%02x cnt=%02x bit=%02x\n",A,X.PC,sim0out,sim0byte,sim0bcnt,sim0bit); */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Power(void) {
|
||||
prg_reg = 0;
|
||||
chr_reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M216WriteHi);
|
||||
SetWriteHandler(0x5000, 0x5000, M216Write5000);
|
||||
SetReadHandler(0x5000, 0x5000, M216Read5000);
|
||||
}
|
||||
|
||||
|
||||
void Mapper216_Init(CartInfo *info) {
|
||||
info->Power = Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
#define CARD_EXTERNAL_INSERED 0x80
|
||||
|
||||
static uint8 prg_reg;
|
||||
static uint8 chr_reg;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &prg_reg, 1, "PREG" },
|
||||
{ &chr_reg, 1, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
#if 0
|
||||
|
||||
cmd[0] = response on/off
|
||||
0x00 - on
|
||||
0x80 - off
|
||||
cmd[1] = cmd
|
||||
|
||||
|
||||
_GET_CHALLENGE: .BYTE 0,$B4, 0, 0,$62
|
||||
|
||||
_SELECT_FILE_1_0200: .BYTE 0,$A4, 1, 0, 2, 2, 0
|
||||
_SELECT_FILE_2_0201: .BYTE 0,$A4, 2, 0, 2, 2, 1
|
||||
_SELECT_FILE_2_0203: .BYTE 0,$A4, 2, 0, 2, 2, 3
|
||||
_SELECT_FILE_2_0204: .BYTE 0,$A4, 2, 0, 2, 2, 4
|
||||
_SELECT_FILE_2_0205: .BYTE 0,$A4, 2, 0, 2, 2, 5
|
||||
_SELECT_FILE_2_3F04: .BYTE 0,$A4, 2, 0, 2,$3F, 4
|
||||
_SELECT_FILE_2_4F00: .BYTE 0,$A4, 2, 0, 2,$4F, 0
|
||||
|
||||
_READ_BINARY_5: .BYTE 0,$B0,$85, 0, 2
|
||||
_READ_BINARY_6: .BYTE 0,$B0,$86, 0, 4
|
||||
_READ_BINARY_6_0: .BYTE 0,$B0,$86, 0,$18
|
||||
_READ_BINARY_0: .BYTE 0,$B0, 0, 2, 3
|
||||
_READ_BINARY_0_0: .BYTE 0,$B0, 0, 0, 4
|
||||
_READ_BINARY_0_1: .BYTE 0,$B0, 0, 0, $C
|
||||
_READ_BINARY_0_2: .BYTE 0,$B0, 0, 0,$10
|
||||
|
||||
_UPDATE_BINARY: .BYTE 0,$D6, 0, 0, 4
|
||||
_UPDATE_BINARY_0: .BYTE 0,$D6, 0, 0,$10
|
||||
|
||||
_GET_RESPONSE: .BYTE $80,$C0, 2,$A1, 8
|
||||
_GET_RESPONSE_0: .BYTE 0,$C0, 0, 0, 2
|
||||
_GET_RESPONSE_1: .BYTE 0,$C0, 0, 0, 6
|
||||
_GET_RESPONSE_2: .BYTE 0,$C0, 0, 0, 8
|
||||
_GET_RESPONSE_3: .BYTE 0,$C0, 0, 0, $C
|
||||
_GET_RESPONSE_4: .BYTE 0,$C0, 0, 0,$10
|
||||
|
||||
byte_8C0B: .BYTE $80,$30, 0, 2, $A, 0, 1
|
||||
byte_8C48: .BYTE $80,$32, 0, 1, 4
|
||||
byte_8C89: .BYTE $80,$34, 0, 0, 8, 0, 0
|
||||
byte_8D01: .BYTE $80,$36, 0, 0, $C
|
||||
byte_8CA7: .BYTE $80,$38, 0, 2, 4
|
||||
byte_8BEC: .BYTE $80,$3A, 0, 3, 0
|
||||
|
||||
byte_89A0: .BYTE 0,$48, 0, 0, 6
|
||||
byte_8808: .BYTE 0,$54, 0, 0,$1C
|
||||
byte_89BF: .BYTE 0,$58, 0, 0,$1C
|
||||
|
||||
_MANAGE_CHANNEL: .BYTE 0,$70, 0, 0, 8
|
||||
byte_8CE5: .BYTE 0,$74, 0, 0,$12
|
||||
byte_8C29: .BYTE 0,$76, 0, 0, 8
|
||||
byte_8CC6: .BYTE 0,$78, 0, 0,$12
|
||||
#endif
|
||||
|
||||
#if 0 /* Silenced since unused */
|
||||
static uint8 sim0reset[0x1F] = {
|
||||
0x3B, 0xE9, 0x00, 0xFF, 0xC1, 0x10, 0x31, 0xFE,
|
||||
0x55, 0xC8, 0x10, 0x20, 0x55, 0x47, 0x4F, 0x53,
|
||||
0x56, 0x53, 0x43, 0xAD, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, prg_reg);
|
||||
setchr8(chr_reg);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M216WriteHi) {
|
||||
prg_reg = A & 1;
|
||||
chr_reg = (A & 0x0E) >> 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M216Write5000) {
|
||||
/* FCEU_printf("WRITE: %04x:%04x (PC=%02x cnt=%02x)\n",A,V,X.PC,sim0bcnt); */
|
||||
}
|
||||
|
||||
static DECLFR(M216Read5000) {
|
||||
/* FCEU_printf("READ: %04x PC=%04x out=%02x byte=%02x cnt=%02x bit=%02x\n",A,X.PC,sim0out,sim0byte,sim0bcnt,sim0bit); */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Power(void) {
|
||||
prg_reg = 0;
|
||||
chr_reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M216WriteHi);
|
||||
SetWriteHandler(0x5000, 0x5000, M216Write5000);
|
||||
SetReadHandler(0x5000, 0x5000, M216Read5000);
|
||||
}
|
||||
|
||||
|
||||
void Mapper216_Init(CartInfo *info) {
|
||||
info->Power = Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,84 +1,84 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg_prg[4];
|
||||
static uint8 reg_chr[4];
|
||||
static uint8 dip_switch;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg_prg, 4, "PREG" },
|
||||
{ reg_chr, 4, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x8000, reg_prg[0]);
|
||||
setprg8(0xa000, reg_prg[1]);
|
||||
setprg8(0xc000, reg_prg[2]);
|
||||
setprg8(0xe000, reg_prg[3]);
|
||||
setchr2(0x0000, reg_chr[0]);
|
||||
setchr2(0x0800, reg_chr[1]);
|
||||
setchr2(0x1000, reg_chr[2]);
|
||||
setchr2(0x1800, reg_chr[3]);
|
||||
setmirror(MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(MBS5Write) {
|
||||
int bank_sel = (A & 0xC00) >> 10;
|
||||
switch (A & 0xF000) {
|
||||
case 0x8000:
|
||||
reg_chr[bank_sel] = A & 0x1F;
|
||||
break;
|
||||
case 0xA000:
|
||||
if (A & (1 << (dip_switch + 4)))
|
||||
reg_prg[bank_sel] = A & 0x0F;
|
||||
break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void MBS5Reset(void) {
|
||||
dip_switch++;
|
||||
dip_switch &= 3;
|
||||
reg_prg[0] = reg_prg[1] = reg_prg[2] = reg_prg[3] = ~0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void MBS5Power(void) {
|
||||
dip_switch = 0;
|
||||
reg_prg[0] = reg_prg[1] = reg_prg[2] = reg_prg[3] = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, MBS5Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMCBS5_Init(CartInfo *info) {
|
||||
info->Power = MBS5Power;
|
||||
info->Reset = MBS5Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 reg_prg[4];
|
||||
static uint8 reg_chr[4];
|
||||
static uint8 dip_switch;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg_prg, 4, "PREG" },
|
||||
{ reg_chr, 4, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x8000, reg_prg[0]);
|
||||
setprg8(0xa000, reg_prg[1]);
|
||||
setprg8(0xc000, reg_prg[2]);
|
||||
setprg8(0xe000, reg_prg[3]);
|
||||
setchr2(0x0000, reg_chr[0]);
|
||||
setchr2(0x0800, reg_chr[1]);
|
||||
setchr2(0x1000, reg_chr[2]);
|
||||
setchr2(0x1800, reg_chr[3]);
|
||||
setmirror(MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(MBS5Write) {
|
||||
int bank_sel = (A & 0xC00) >> 10;
|
||||
switch (A & 0xF000) {
|
||||
case 0x8000:
|
||||
reg_chr[bank_sel] = A & 0x1F;
|
||||
break;
|
||||
case 0xA000:
|
||||
if (A & (1 << (dip_switch + 4)))
|
||||
reg_prg[bank_sel] = A & 0x0F;
|
||||
break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void MBS5Reset(void) {
|
||||
dip_switch++;
|
||||
dip_switch &= 3;
|
||||
reg_prg[0] = reg_prg[1] = reg_prg[2] = reg_prg[3] = ~0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void MBS5Power(void) {
|
||||
dip_switch = 0;
|
||||
reg_prg[0] = reg_prg[1] = reg_prg[2] = reg_prg[3] = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, MBS5Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMCBS5_Init(CartInfo *info) {
|
||||
info->Power = MBS5Power;
|
||||
info->Reset = MBS5Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,124 +1,124 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* City Fighter IV sith Sound VRC4 hacked
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static int32 IRQCount;
|
||||
static uint8 IRQa;
|
||||
static uint8 prg_reg, prg_mode, mirr;
|
||||
static uint8 chr_reg[8];
|
||||
static writefunc pcmwrite;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &prg_reg, 1, "PREG" },
|
||||
{ &prg_mode, 1, "PMOD" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ chr_reg, 8, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
int i;
|
||||
setprg32(0x8000, prg_reg >> 2);
|
||||
if (!prg_mode)
|
||||
setprg8(0xC000, prg_reg);
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, chr_reg[i]);
|
||||
switch (mirr) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(UNLCITYFIGHTWrite) {
|
||||
/* FCEU_printf("%04x %02x",A,V); */
|
||||
switch (A & 0xF00C) {
|
||||
case 0x9000: prg_reg = V & 0xC; mirr = V & 3; break;
|
||||
case 0x9004:
|
||||
case 0x9008:
|
||||
case 0x900C:
|
||||
if (A & 0x800)
|
||||
pcmwrite(0x4011, (V & 0xf) << 3);
|
||||
else
|
||||
prg_reg = V & 0xC;
|
||||
break;
|
||||
case 0xC000:
|
||||
case 0xC004:
|
||||
case 0xC008:
|
||||
case 0xC00C: prg_mode = V & 1; break;
|
||||
case 0xD000: chr_reg[0] = (chr_reg[0] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xD004: chr_reg[0] = (chr_reg[0] & 0x0F) | (V << 4); break;
|
||||
case 0xD008: chr_reg[1] = (chr_reg[1] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xD00C: chr_reg[1] = (chr_reg[1] & 0x0F) | (V << 4); break;
|
||||
case 0xA000: chr_reg[2] = (chr_reg[2] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xA004: chr_reg[2] = (chr_reg[2] & 0x0F) | (V << 4); break;
|
||||
case 0xA008: chr_reg[3] = (chr_reg[3] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xA00C: chr_reg[3] = (chr_reg[3] & 0x0F) | (V << 4); break;
|
||||
case 0xB000: chr_reg[4] = (chr_reg[4] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xB004: chr_reg[4] = (chr_reg[4] & 0x0F) | (V << 4); break;
|
||||
case 0xB008: chr_reg[5] = (chr_reg[5] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xB00C: chr_reg[5] = (chr_reg[5] & 0x0F) | (V << 4); break;
|
||||
case 0xE000: chr_reg[6] = (chr_reg[6] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xE004: chr_reg[6] = (chr_reg[6] & 0x0F) | (V << 4); break;
|
||||
case 0xE008: chr_reg[7] = (chr_reg[7] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xE00C: chr_reg[7] = (chr_reg[7] & 0x0F) | (V << 4); break;
|
||||
case 0xF000: IRQCount = ((IRQCount & 0x1E0) | ((V & 0xF) << 1)); break;
|
||||
case 0xF004: IRQCount = ((IRQCount & 0x1E) | ((V & 0xF) << 5)); break;
|
||||
case 0xF008: IRQa = V & 2; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLCITYFIGHTIRQ(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount <= 0) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLCITYFIGHTPower(void) {
|
||||
prg_reg = 0;
|
||||
Sync();
|
||||
pcmwrite = GetWriteHandler(0x4011);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLCITYFIGHTWrite);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLCITYFIGHT_Init(CartInfo *info) {
|
||||
info->Power = UNLCITYFIGHTPower;
|
||||
MapIRQHook = UNLCITYFIGHTIRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* City Fighter IV sith Sound VRC4 hacked
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static int32 IRQCount;
|
||||
static uint8 IRQa;
|
||||
static uint8 prg_reg, prg_mode, mirr;
|
||||
static uint8 chr_reg[8];
|
||||
static writefunc pcmwrite;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &prg_reg, 1, "PREG" },
|
||||
{ &prg_mode, 1, "PMOD" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ chr_reg, 8, "CREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
int i;
|
||||
setprg32(0x8000, prg_reg >> 2);
|
||||
if (!prg_mode)
|
||||
setprg8(0xC000, prg_reg);
|
||||
for (i = 0; i < 8; i++)
|
||||
setchr1(i << 10, chr_reg[i]);
|
||||
switch (mirr) {
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(UNLCITYFIGHTWrite) {
|
||||
/* FCEU_printf("%04x %02x",A,V); */
|
||||
switch (A & 0xF00C) {
|
||||
case 0x9000: prg_reg = V & 0xC; mirr = V & 3; break;
|
||||
case 0x9004:
|
||||
case 0x9008:
|
||||
case 0x900C:
|
||||
if (A & 0x800)
|
||||
pcmwrite(0x4011, (V & 0xf) << 3);
|
||||
else
|
||||
prg_reg = V & 0xC;
|
||||
break;
|
||||
case 0xC000:
|
||||
case 0xC004:
|
||||
case 0xC008:
|
||||
case 0xC00C: prg_mode = V & 1; break;
|
||||
case 0xD000: chr_reg[0] = (chr_reg[0] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xD004: chr_reg[0] = (chr_reg[0] & 0x0F) | (V << 4); break;
|
||||
case 0xD008: chr_reg[1] = (chr_reg[1] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xD00C: chr_reg[1] = (chr_reg[1] & 0x0F) | (V << 4); break;
|
||||
case 0xA000: chr_reg[2] = (chr_reg[2] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xA004: chr_reg[2] = (chr_reg[2] & 0x0F) | (V << 4); break;
|
||||
case 0xA008: chr_reg[3] = (chr_reg[3] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xA00C: chr_reg[3] = (chr_reg[3] & 0x0F) | (V << 4); break;
|
||||
case 0xB000: chr_reg[4] = (chr_reg[4] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xB004: chr_reg[4] = (chr_reg[4] & 0x0F) | (V << 4); break;
|
||||
case 0xB008: chr_reg[5] = (chr_reg[5] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xB00C: chr_reg[5] = (chr_reg[5] & 0x0F) | (V << 4); break;
|
||||
case 0xE000: chr_reg[6] = (chr_reg[6] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xE004: chr_reg[6] = (chr_reg[6] & 0x0F) | (V << 4); break;
|
||||
case 0xE008: chr_reg[7] = (chr_reg[7] & 0xF0) | (V & 0x0F); break;
|
||||
case 0xE00C: chr_reg[7] = (chr_reg[7] & 0x0F) | (V << 4); break;
|
||||
case 0xF000: IRQCount = ((IRQCount & 0x1E0) | ((V & 0xF) << 1)); break;
|
||||
case 0xF004: IRQCount = ((IRQCount & 0x1E) | ((V & 0xF) << 5)); break;
|
||||
case 0xF008: IRQa = V & 2; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLCITYFIGHTIRQ(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount <= 0) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLCITYFIGHTPower(void) {
|
||||
prg_reg = 0;
|
||||
Sync();
|
||||
pcmwrite = GetWriteHandler(0x4011);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLCITYFIGHTWrite);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLCITYFIGHT_Init(CartInfo *info) {
|
||||
info->Power = UNLCITYFIGHTPower;
|
||||
MapIRQHook = UNLCITYFIGHTIRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,152 +1,152 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2015 CaH4e3, ClusteR
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* CoolBoy 400-in-1 FK23C-mimic mapper 16Mb/32Mb PROM + 128K/256K CHR RAM, optional SRAM, optional NTRAM
|
||||
* only MMC3 mode
|
||||
*
|
||||
* 6000 (xx76x210) | 0xC0
|
||||
* 6001 (xxx354x)
|
||||
* 6002 = 0
|
||||
* 6003 = 0
|
||||
*
|
||||
* hardware tested logic, don't try to understand lol
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void COOLBOYCW(uint32 A, uint8 V) {
|
||||
uint32 mask = 0xFF ^ (EXPREGS[0] & 0x80);
|
||||
if (EXPREGS[3] & 0x10) {
|
||||
if (EXPREGS[3] & 0x40) { /* Weird mode */
|
||||
int cbase = (MMC3_cmd & 0x80) << 5;
|
||||
switch (cbase ^ A) { /* Don't even try to understand */
|
||||
case 0x0400:
|
||||
case 0x0C00: V &= 0x7F; break;
|
||||
}
|
||||
}
|
||||
/* Highest bit goes from MMC3 registers when EXPREGS[3]&0x80==0 or from EXPREGS[0]&0x08 otherwise */
|
||||
setchr1(A,
|
||||
(V & 0x80 & mask) | ((((EXPREGS[0] & 0x08) << 4) & ~mask)) /* 7th bit */
|
||||
| ((EXPREGS[2] & 0x0F) << 3) /* 6-3 bits */
|
||||
| ((A >> 10) & 7) /* 2-0 bits */
|
||||
);
|
||||
} else {
|
||||
if (EXPREGS[3] & 0x40) { /* Weird mode, again */
|
||||
int cbase = (MMC3_cmd & 0x80) << 5;
|
||||
switch (cbase ^ A) { /* Don't even try to understand */
|
||||
case 0x0000: V = DRegBuf[0]; break;
|
||||
case 0x0800: V = DRegBuf[1]; break;
|
||||
case 0x0400:
|
||||
case 0x0C00: V = 0; break;
|
||||
}
|
||||
}
|
||||
/* Simple MMC3 mode
|
||||
* Highest bit goes from MMC3 registers when EXPREGS[3]&0x80==0 or from EXPREGS[0]&0x08 otherwise
|
||||
*/
|
||||
setchr1(A, (V & mask) | (((EXPREGS[0] & 0x08) << 4) & ~mask));
|
||||
}
|
||||
}
|
||||
|
||||
static void COOLBOYPW(uint32 A, uint8 V) {
|
||||
uint32 mask = ((0x3F | (EXPREGS[1] & 0x40) | ((EXPREGS[1] & 0x20) << 2)) ^ ((EXPREGS[0] & 0x40) >> 2)) ^ ((EXPREGS[1] & 0x80) >> 2);
|
||||
uint32 base = ((EXPREGS[0] & 0x07) >> 0) | ((EXPREGS[1] & 0x10) >> 1) | ((EXPREGS[1] & 0x0C) << 2) | ((EXPREGS[0] & 0x30) << 2);
|
||||
|
||||
/* Very weird mode
|
||||
* Last banks are first in this mode, ignored when MMC3_cmd&0x40
|
||||
*/
|
||||
if ((EXPREGS[3] & 0x40) && (V >= 0xFE) && !((MMC3_cmd & 0x40) != 0)) {
|
||||
switch (A & 0xE000) {
|
||||
case 0xA000:
|
||||
if ((MMC3_cmd & 0x40)) V = 0;
|
||||
break;
|
||||
case 0xC000:
|
||||
if (!(MMC3_cmd & 0x40)) V = 0;
|
||||
break;
|
||||
case 0xE000:
|
||||
V = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Regular MMC3 mode, internal ROM size can be up to 2048kb! */
|
||||
if (!(EXPREGS[3] & 0x10))
|
||||
setprg8(A, (((base << 4) & ~mask)) | (V & mask));
|
||||
else { /* NROM mode */
|
||||
uint8 emask;
|
||||
mask &= 0xF0;
|
||||
if ((((EXPREGS[1] & 2) != 0))) /* 32kb mode */
|
||||
emask = (EXPREGS[3] & 0x0C) | ((A & 0x4000) >> 13);
|
||||
else /* 16kb mode */
|
||||
emask = EXPREGS[3] & 0x0E;
|
||||
setprg8(A, ((base << 4) & ~mask) /* 7-4 bits are from base (see below) */
|
||||
| (V & mask) /* ... or from MM3 internal regs, depends on mask */
|
||||
| emask /* 3-1 (or 3-2 when (EXPREGS[3]&0x0C is set) from EXPREGS[3] */
|
||||
| ((A & 0x2000) >> 13)); /* 0th just as is */
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(COOLBOYWrite) {
|
||||
if(A001B & 0x80)
|
||||
CartBW(A,V);
|
||||
|
||||
/* Deny any further writes when 7th bit is 1 AND 4th is 0 */
|
||||
if ((EXPREGS[3] & 0x90) != 0x80) {
|
||||
EXPREGS[A & 3] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
static void COOLBOYReset(void) {
|
||||
MMC3RegReset();
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = 0;
|
||||
#if 0
|
||||
EXPREGS[0] = 0;
|
||||
EXPREGS[1] = 0x60;
|
||||
EXPREGS[2] = 0;
|
||||
EXPREGS[3] = 0;
|
||||
#endif
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void COOLBOYPower(void) {
|
||||
GenMMC3Power();
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = 0;
|
||||
#if 0
|
||||
EXPREGS[0] = 0;
|
||||
EXPREGS[1] = 0x60;
|
||||
EXPREGS[2] = 0;
|
||||
EXPREGS[3] = 0;
|
||||
#endif
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
SetWriteHandler(0x5000, 0x5fff, CartBW); /* some games access random unmapped areas and crashes because of KT-008 PCB hack in MMC3 source lol */
|
||||
SetWriteHandler(0x6000, 0x7fff, COOLBOYWrite);
|
||||
}
|
||||
|
||||
void COOLBOY_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 256, 8, 0);
|
||||
pwrap = COOLBOYPW;
|
||||
cwrap = COOLBOYCW;
|
||||
info->Power = COOLBOYPower;
|
||||
info->Reset = COOLBOYReset;
|
||||
AddExState(EXPREGS, 4, 0, "EXPR");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2015 CaH4e3, ClusteR
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* CoolBoy 400-in-1 FK23C-mimic mapper 16Mb/32Mb PROM + 128K/256K CHR RAM, optional SRAM, optional NTRAM
|
||||
* only MMC3 mode
|
||||
*
|
||||
* 6000 (xx76x210) | 0xC0
|
||||
* 6001 (xxx354x)
|
||||
* 6002 = 0
|
||||
* 6003 = 0
|
||||
*
|
||||
* hardware tested logic, don't try to understand lol
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void COOLBOYCW(uint32 A, uint8 V) {
|
||||
uint32 mask = 0xFF ^ (EXPREGS[0] & 0x80);
|
||||
if (EXPREGS[3] & 0x10) {
|
||||
if (EXPREGS[3] & 0x40) { /* Weird mode */
|
||||
int cbase = (MMC3_cmd & 0x80) << 5;
|
||||
switch (cbase ^ A) { /* Don't even try to understand */
|
||||
case 0x0400:
|
||||
case 0x0C00: V &= 0x7F; break;
|
||||
}
|
||||
}
|
||||
/* Highest bit goes from MMC3 registers when EXPREGS[3]&0x80==0 or from EXPREGS[0]&0x08 otherwise */
|
||||
setchr1(A,
|
||||
(V & 0x80 & mask) | ((((EXPREGS[0] & 0x08) << 4) & ~mask)) /* 7th bit */
|
||||
| ((EXPREGS[2] & 0x0F) << 3) /* 6-3 bits */
|
||||
| ((A >> 10) & 7) /* 2-0 bits */
|
||||
);
|
||||
} else {
|
||||
if (EXPREGS[3] & 0x40) { /* Weird mode, again */
|
||||
int cbase = (MMC3_cmd & 0x80) << 5;
|
||||
switch (cbase ^ A) { /* Don't even try to understand */
|
||||
case 0x0000: V = DRegBuf[0]; break;
|
||||
case 0x0800: V = DRegBuf[1]; break;
|
||||
case 0x0400:
|
||||
case 0x0C00: V = 0; break;
|
||||
}
|
||||
}
|
||||
/* Simple MMC3 mode
|
||||
* Highest bit goes from MMC3 registers when EXPREGS[3]&0x80==0 or from EXPREGS[0]&0x08 otherwise
|
||||
*/
|
||||
setchr1(A, (V & mask) | (((EXPREGS[0] & 0x08) << 4) & ~mask));
|
||||
}
|
||||
}
|
||||
|
||||
static void COOLBOYPW(uint32 A, uint8 V) {
|
||||
uint32 mask = ((0x3F | (EXPREGS[1] & 0x40) | ((EXPREGS[1] & 0x20) << 2)) ^ ((EXPREGS[0] & 0x40) >> 2)) ^ ((EXPREGS[1] & 0x80) >> 2);
|
||||
uint32 base = ((EXPREGS[0] & 0x07) >> 0) | ((EXPREGS[1] & 0x10) >> 1) | ((EXPREGS[1] & 0x0C) << 2) | ((EXPREGS[0] & 0x30) << 2);
|
||||
|
||||
/* Very weird mode
|
||||
* Last banks are first in this mode, ignored when MMC3_cmd&0x40
|
||||
*/
|
||||
if ((EXPREGS[3] & 0x40) && (V >= 0xFE) && !((MMC3_cmd & 0x40) != 0)) {
|
||||
switch (A & 0xE000) {
|
||||
case 0xA000:
|
||||
if ((MMC3_cmd & 0x40)) V = 0;
|
||||
break;
|
||||
case 0xC000:
|
||||
if (!(MMC3_cmd & 0x40)) V = 0;
|
||||
break;
|
||||
case 0xE000:
|
||||
V = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Regular MMC3 mode, internal ROM size can be up to 2048kb! */
|
||||
if (!(EXPREGS[3] & 0x10))
|
||||
setprg8(A, (((base << 4) & ~mask)) | (V & mask));
|
||||
else { /* NROM mode */
|
||||
uint8 emask;
|
||||
mask &= 0xF0;
|
||||
if ((((EXPREGS[1] & 2) != 0))) /* 32kb mode */
|
||||
emask = (EXPREGS[3] & 0x0C) | ((A & 0x4000) >> 13);
|
||||
else /* 16kb mode */
|
||||
emask = EXPREGS[3] & 0x0E;
|
||||
setprg8(A, ((base << 4) & ~mask) /* 7-4 bits are from base (see below) */
|
||||
| (V & mask) /* ... or from MM3 internal regs, depends on mask */
|
||||
| emask /* 3-1 (or 3-2 when (EXPREGS[3]&0x0C is set) from EXPREGS[3] */
|
||||
| ((A & 0x2000) >> 13)); /* 0th just as is */
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(COOLBOYWrite) {
|
||||
if(A001B & 0x80)
|
||||
CartBW(A,V);
|
||||
|
||||
/* Deny any further writes when 7th bit is 1 AND 4th is 0 */
|
||||
if ((EXPREGS[3] & 0x90) != 0x80) {
|
||||
EXPREGS[A & 3] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
static void COOLBOYReset(void) {
|
||||
MMC3RegReset();
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = 0;
|
||||
#if 0
|
||||
EXPREGS[0] = 0;
|
||||
EXPREGS[1] = 0x60;
|
||||
EXPREGS[2] = 0;
|
||||
EXPREGS[3] = 0;
|
||||
#endif
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void COOLBOYPower(void) {
|
||||
GenMMC3Power();
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = 0;
|
||||
#if 0
|
||||
EXPREGS[0] = 0;
|
||||
EXPREGS[1] = 0x60;
|
||||
EXPREGS[2] = 0;
|
||||
EXPREGS[3] = 0;
|
||||
#endif
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
SetWriteHandler(0x5000, 0x5fff, CartBW); /* some games access random unmapped areas and crashes because of KT-008 PCB hack in MMC3 source lol */
|
||||
SetWriteHandler(0x6000, 0x7fff, COOLBOYWrite);
|
||||
}
|
||||
|
||||
void COOLBOY_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 256, 8, 0);
|
||||
pwrap = COOLBOYPW;
|
||||
cwrap = COOLBOYCW;
|
||||
info->Power = COOLBOYPower;
|
||||
info->Reset = COOLBOYReset;
|
||||
AddExState(EXPREGS, 4, 0, "EXPR");
|
||||
}
|
||||
|
||||
@@ -1,355 +1,355 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifdef COPYFAMI
|
||||
|
||||
#include "__serial.h"
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
/* #define DEBUG_SERIAL */
|
||||
|
||||
/* *** COPY FAMICOM EMULATION *** */
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* $0000-$1FFF
|
||||
* $2000-$200F PPU
|
||||
* $2010-$3FFB
|
||||
* $3FFC-$3FFF
|
||||
* $4000-$7FFF APU /
|
||||
* $8000-$FFF9 CART/ROM
|
||||
* $FFFA-$FFFB CART/ NMI
|
||||
* $FFFE-$FFFF CART/ IRQ
|
||||
*
|
||||
*
|
||||
*
|
||||
* CTRL R/W $3FFC ---aenic ($00 at reset)
|
||||
*
|
||||
* c -
|
||||
* 0 -
|
||||
* 1 -
|
||||
* i - IRQ
|
||||
* 0 -
|
||||
* 1 -
|
||||
* n - NMI
|
||||
* 0 -
|
||||
* 1 -
|
||||
* e - NMI
|
||||
* 0 -
|
||||
* 1 -
|
||||
* a - AROM
|
||||
* 0 -
|
||||
* 1 -
|
||||
*
|
||||
* BANK R/W $3FFD ---mbbbb
|
||||
*
|
||||
* b -
|
||||
* m - ROM
|
||||
*
|
||||
* USBDATA R/W $3FFE dddddddd
|
||||
*
|
||||
* d - /
|
||||
*
|
||||
* STATUS R $3FFF vmnicptr
|
||||
*
|
||||
* r - USB
|
||||
* 0 -
|
||||
* 1 -
|
||||
* t - USB
|
||||
* 0 -
|
||||
* 1 -
|
||||
* p - USB
|
||||
* 0 -
|
||||
* 1 -
|
||||
* c -
|
||||
* 0 -
|
||||
* 1 -
|
||||
* i - IRQ
|
||||
* 0 -
|
||||
* 1 -
|
||||
* n - NMI
|
||||
* 0 -
|
||||
* 1 -
|
||||
* m - 10 VRAM ()
|
||||
* v - VRAM
|
||||
* 0 -
|
||||
* 1 -
|
||||
*
|
||||
* AROM
|
||||
*
|
||||
* VRAM
|
||||
* 8000-FFFF
|
||||
*/
|
||||
|
||||
#define CTRL 0x00
|
||||
#define CCART 0x01
|
||||
#define CVIRQ 0x02
|
||||
#define CVNMI 0x04
|
||||
#define CDNMI 0x08
|
||||
#define CAROM 0x10
|
||||
#define BANK 0x01
|
||||
#define BMIRR 0x10
|
||||
#define USB 0x02
|
||||
#define STATUS 0x03
|
||||
#define SRX 0x01
|
||||
#define STX 0x02
|
||||
#define SPEN 0x04
|
||||
#define SCART 0x08
|
||||
#define SIRQ 0x10
|
||||
#define SNMI 0x20
|
||||
#define SA10 0x40
|
||||
#define SVRAM 0x80
|
||||
|
||||
#ifdef DEBUG_SERIAL
|
||||
static uint8 debug_serial_data[] = {
|
||||
0xDE, 0xAD, 0xBE, 0xEF, 0x00,
|
||||
0xDE, 0xAD, 0xBE, 0xEF, 0x01,
|
||||
|
||||
0x02,
|
||||
|
||||
0x14, 0x50, 0xB0,
|
||||
|
||||
0x02,
|
||||
|
||||
0x14, 0x50, 0xB0,
|
||||
|
||||
0x02,
|
||||
};
|
||||
static uint32 debug_serial_data_size = sizeof(debug_serial_data);
|
||||
static uint32 debug_serial_data_pos;
|
||||
#endif
|
||||
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static uint8 regs[4];
|
||||
|
||||
static readfunc def_read_ram, def_read_rom;
|
||||
static writefunc def_write_ram;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 4, "CREGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync() {
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void MCopyFamiMMC3PW(uint32 A, uint8 V) {
|
||||
if (regs[CTRL] & CCART)
|
||||
setprg8(A, V);
|
||||
else
|
||||
setprg32r(1, 0x8000, (regs[BANK] & 0x0F) ^ 0x08);
|
||||
}
|
||||
|
||||
static void MCopyFamiMMC3CW(uint32 A, uint8 V) {
|
||||
if ((regs[STATUS] & SCART) && (regs[CTRL] & CAROM))
|
||||
setchr8r(0x10, 0);
|
||||
else
|
||||
setchr1r(0, A, V);
|
||||
}
|
||||
|
||||
static void MCopyFamiMMC3MW(uint8 V) {
|
||||
if (regs[CTRL] & CAROM) {
|
||||
setmirror(MI_0 + ((regs[BANK] >> 4) & 1));
|
||||
} else {
|
||||
A000B = V;
|
||||
setmirror((V & 1) ^ 1);
|
||||
}
|
||||
}
|
||||
|
||||
static uint32 direction = 0xffffffff;
|
||||
static uint32 bytes_count = 0;
|
||||
|
||||
static DECLFW(MCopyFamiWriteReg) {
|
||||
if (((A & 3) == USB) && !fceuindbg) {
|
||||
if (direction != 0) {
|
||||
direction = 0;
|
||||
bytes_count = 0;
|
||||
FCEU_printf(" >");
|
||||
}
|
||||
#ifndef DEBUG_SERIAL
|
||||
while (!SerialSendChar(V)) {
|
||||
}
|
||||
;
|
||||
#endif
|
||||
bytes_count++;
|
||||
/* FCEU_printf(" %02X",V); */
|
||||
} else {
|
||||
regs[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(MCopyFamiReadReg) {
|
||||
#ifdef DEBUG_SERIAL
|
||||
if (debug_serial_data_pos == debug_serial_data_size)
|
||||
regs[STATUS] |= SRX;
|
||||
else
|
||||
regs[STATUS] &= ~SRX;
|
||||
#endif
|
||||
if (!fceuindbg) {
|
||||
#ifndef DEBUG_SERIAL
|
||||
if ((A & 3) == STATUS) {
|
||||
int data;
|
||||
if ((data = SerialGetChar()) == EOF)
|
||||
regs[STATUS] |= SRX;
|
||||
else
|
||||
regs[STATUS] &= ~SRX;
|
||||
regs[USB] = data & 0xff;
|
||||
} else
|
||||
#endif
|
||||
if ((A & 3) == USB) {
|
||||
#ifdef DEBUG_SERIAL
|
||||
regs[USB] = debug_serial_data[debug_serial_data_pos++];
|
||||
#endif
|
||||
if (direction != 1) {
|
||||
if (direction != 0xffffffff) FCEU_printf(" bytes sent: %08x", bytes_count);
|
||||
direction = 1;
|
||||
bytes_count = 0;
|
||||
FCEU_printf("\n<");
|
||||
}
|
||||
FCEU_printf(" %02X", regs[USB]);
|
||||
}
|
||||
}
|
||||
return regs[A & 3];
|
||||
}
|
||||
|
||||
static DECLFW(MCopyFamiMMC3Write) {
|
||||
if (regs[CTRL] & CAROM) {
|
||||
regs[BANK] = V & 0x1F;
|
||||
Sync();
|
||||
} else {
|
||||
if (A >= 0xC000)
|
||||
MMC3_IRQWrite(A, V);
|
||||
else
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(MCopyFamiMMC3WriteNMI) {
|
||||
if (regs[CTRL] & CVNMI)
|
||||
def_write_ram(0x3FFC + (A & 1), V);
|
||||
else
|
||||
MCopyFamiMMC3Write(A, V);
|
||||
}
|
||||
|
||||
static DECLFW(MCopyFamiMMC3WriteIRQ) {
|
||||
if (regs[CTRL] & CVIRQ)
|
||||
def_write_ram(0x3FFE + (A & 1), V);
|
||||
else
|
||||
MCopyFamiMMC3Write(A, V);
|
||||
}
|
||||
|
||||
static DECLFR(MCopyFamiReadNMI) {
|
||||
if (regs[CTRL] & CVNMI)
|
||||
return def_read_ram(0x3FFC + (A & 1));
|
||||
else
|
||||
return def_read_rom(A);
|
||||
}
|
||||
|
||||
static DECLFR(MCopyFamiReadIRQ) {
|
||||
if (regs[CTRL] & CVIRQ)
|
||||
return def_read_ram(0x3FFE + (A & 1));
|
||||
else
|
||||
return def_read_rom(A);
|
||||
}
|
||||
|
||||
static void MCopyFamiMMC3Power(void) {
|
||||
regs[CTRL] = regs[USB] = 0;
|
||||
regs[STATUS] = SIRQ | SNMI | SVRAM;
|
||||
regs[BANK] = 0x08;
|
||||
#ifdef DEBUG_SERIAL
|
||||
debug_serial_data_pos = 0;
|
||||
#endif
|
||||
GenMMC3Power();
|
||||
Sync();
|
||||
|
||||
def_write_ram = GetWriteHandler(0x3FFC);
|
||||
SetWriteHandler(0x3FFC, 0x3FFF, MCopyFamiWriteReg);
|
||||
def_read_ram = GetReadHandler(0x3FFC);
|
||||
SetReadHandler(0x3FFC, 0x3FFF, MCopyFamiReadReg);
|
||||
|
||||
SetWriteHandler(0x8000, 0xFFF9, MCopyFamiMMC3Write);
|
||||
SetWriteHandler(0xFFFA, 0xFFFB, MCopyFamiMMC3WriteNMI);
|
||||
SetWriteHandler(0xFFFE, 0xFFFF, MCopyFamiMMC3WriteIRQ);
|
||||
|
||||
def_read_rom = GetReadHandler(0xFFFA);
|
||||
SetReadHandler(0xFFFA, 0xFFFB, MCopyFamiReadNMI);
|
||||
SetReadHandler(0xFFFE, 0xFFFF, MCopyFamiReadIRQ);
|
||||
}
|
||||
|
||||
static void MCopyFamiMMC3Reset(void) {
|
||||
regs[CTRL] = regs[USB] = 0;
|
||||
regs[STATUS] = SIRQ | SNMI | SVRAM;
|
||||
regs[BANK] = 0x08;
|
||||
#ifdef DEBUG_SERIAL
|
||||
debug_serial_data_pos = 0;
|
||||
#endif
|
||||
MMC3RegReset();
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void MCopyFamiClose(void) {
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM = NULL;
|
||||
SerialClose();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void MapperCopyFamiMMC3_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 512, 8, 0);
|
||||
|
||||
cwrap = MCopyFamiMMC3CW;
|
||||
pwrap = MCopyFamiMMC3PW;
|
||||
mwrap = MCopyFamiMMC3MW;
|
||||
|
||||
info->Reset = MCopyFamiMMC3Reset;
|
||||
info->Power = MCopyFamiMMC3Power;
|
||||
info->Close = MCopyFamiClose;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
CHRRAMSIZE = 8192;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
|
||||
#ifndef DEBUG_SERIAL
|
||||
FCEU_printf("WAITING FOR PORT...\n");
|
||||
|
||||
while (!SerialOpen(20, 921600)) {
|
||||
}
|
||||
|
||||
FCEU_printf("PORT READY.\n");
|
||||
#endif
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifdef COPYFAMI
|
||||
|
||||
#include "__serial.h"
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
/* #define DEBUG_SERIAL */
|
||||
|
||||
/* *** COPY FAMICOM EMULATION *** */
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* $0000-$1FFF
|
||||
* $2000-$200F PPU
|
||||
* $2010-$3FFB
|
||||
* $3FFC-$3FFF
|
||||
* $4000-$7FFF APU /
|
||||
* $8000-$FFF9 CART/ROM
|
||||
* $FFFA-$FFFB CART/ NMI
|
||||
* $FFFE-$FFFF CART/ IRQ
|
||||
*
|
||||
*
|
||||
*
|
||||
* CTRL R/W $3FFC ---aenic ($00 at reset)
|
||||
*
|
||||
* c -
|
||||
* 0 -
|
||||
* 1 -
|
||||
* i - IRQ
|
||||
* 0 -
|
||||
* 1 -
|
||||
* n - NMI
|
||||
* 0 -
|
||||
* 1 -
|
||||
* e - NMI
|
||||
* 0 -
|
||||
* 1 -
|
||||
* a - AROM
|
||||
* 0 -
|
||||
* 1 -
|
||||
*
|
||||
* BANK R/W $3FFD ---mbbbb
|
||||
*
|
||||
* b -
|
||||
* m - ROM
|
||||
*
|
||||
* USBDATA R/W $3FFE dddddddd
|
||||
*
|
||||
* d - /
|
||||
*
|
||||
* STATUS R $3FFF vmnicptr
|
||||
*
|
||||
* r - USB
|
||||
* 0 -
|
||||
* 1 -
|
||||
* t - USB
|
||||
* 0 -
|
||||
* 1 -
|
||||
* p - USB
|
||||
* 0 -
|
||||
* 1 -
|
||||
* c -
|
||||
* 0 -
|
||||
* 1 -
|
||||
* i - IRQ
|
||||
* 0 -
|
||||
* 1 -
|
||||
* n - NMI
|
||||
* 0 -
|
||||
* 1 -
|
||||
* m - 10 VRAM ()
|
||||
* v - VRAM
|
||||
* 0 -
|
||||
* 1 -
|
||||
*
|
||||
* AROM
|
||||
*
|
||||
* VRAM
|
||||
* 8000-FFFF
|
||||
*/
|
||||
|
||||
#define CTRL 0x00
|
||||
#define CCART 0x01
|
||||
#define CVIRQ 0x02
|
||||
#define CVNMI 0x04
|
||||
#define CDNMI 0x08
|
||||
#define CAROM 0x10
|
||||
#define BANK 0x01
|
||||
#define BMIRR 0x10
|
||||
#define USB 0x02
|
||||
#define STATUS 0x03
|
||||
#define SRX 0x01
|
||||
#define STX 0x02
|
||||
#define SPEN 0x04
|
||||
#define SCART 0x08
|
||||
#define SIRQ 0x10
|
||||
#define SNMI 0x20
|
||||
#define SA10 0x40
|
||||
#define SVRAM 0x80
|
||||
|
||||
#ifdef DEBUG_SERIAL
|
||||
static uint8 debug_serial_data[] = {
|
||||
0xDE, 0xAD, 0xBE, 0xEF, 0x00,
|
||||
0xDE, 0xAD, 0xBE, 0xEF, 0x01,
|
||||
|
||||
0x02,
|
||||
|
||||
0x14, 0x50, 0xB0,
|
||||
|
||||
0x02,
|
||||
|
||||
0x14, 0x50, 0xB0,
|
||||
|
||||
0x02,
|
||||
};
|
||||
static uint32 debug_serial_data_size = sizeof(debug_serial_data);
|
||||
static uint32 debug_serial_data_pos;
|
||||
#endif
|
||||
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static uint8 regs[4];
|
||||
|
||||
static readfunc def_read_ram, def_read_rom;
|
||||
static writefunc def_write_ram;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 4, "CREGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync() {
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void MCopyFamiMMC3PW(uint32 A, uint8 V) {
|
||||
if (regs[CTRL] & CCART)
|
||||
setprg8(A, V);
|
||||
else
|
||||
setprg32r(1, 0x8000, (regs[BANK] & 0x0F) ^ 0x08);
|
||||
}
|
||||
|
||||
static void MCopyFamiMMC3CW(uint32 A, uint8 V) {
|
||||
if ((regs[STATUS] & SCART) && (regs[CTRL] & CAROM))
|
||||
setchr8r(0x10, 0);
|
||||
else
|
||||
setchr1r(0, A, V);
|
||||
}
|
||||
|
||||
static void MCopyFamiMMC3MW(uint8 V) {
|
||||
if (regs[CTRL] & CAROM) {
|
||||
setmirror(MI_0 + ((regs[BANK] >> 4) & 1));
|
||||
} else {
|
||||
A000B = V;
|
||||
setmirror((V & 1) ^ 1);
|
||||
}
|
||||
}
|
||||
|
||||
static uint32 direction = 0xffffffff;
|
||||
static uint32 bytes_count = 0;
|
||||
|
||||
static DECLFW(MCopyFamiWriteReg) {
|
||||
if (((A & 3) == USB) && !fceuindbg) {
|
||||
if (direction != 0) {
|
||||
direction = 0;
|
||||
bytes_count = 0;
|
||||
FCEU_printf(" >");
|
||||
}
|
||||
#ifndef DEBUG_SERIAL
|
||||
while (!SerialSendChar(V)) {
|
||||
}
|
||||
;
|
||||
#endif
|
||||
bytes_count++;
|
||||
/* FCEU_printf(" %02X",V); */
|
||||
} else {
|
||||
regs[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(MCopyFamiReadReg) {
|
||||
#ifdef DEBUG_SERIAL
|
||||
if (debug_serial_data_pos == debug_serial_data_size)
|
||||
regs[STATUS] |= SRX;
|
||||
else
|
||||
regs[STATUS] &= ~SRX;
|
||||
#endif
|
||||
if (!fceuindbg) {
|
||||
#ifndef DEBUG_SERIAL
|
||||
if ((A & 3) == STATUS) {
|
||||
int data;
|
||||
if ((data = SerialGetChar()) == EOF)
|
||||
regs[STATUS] |= SRX;
|
||||
else
|
||||
regs[STATUS] &= ~SRX;
|
||||
regs[USB] = data & 0xff;
|
||||
} else
|
||||
#endif
|
||||
if ((A & 3) == USB) {
|
||||
#ifdef DEBUG_SERIAL
|
||||
regs[USB] = debug_serial_data[debug_serial_data_pos++];
|
||||
#endif
|
||||
if (direction != 1) {
|
||||
if (direction != 0xffffffff) FCEU_printf(" bytes sent: %08x", bytes_count);
|
||||
direction = 1;
|
||||
bytes_count = 0;
|
||||
FCEU_printf("\n<");
|
||||
}
|
||||
FCEU_printf(" %02X", regs[USB]);
|
||||
}
|
||||
}
|
||||
return regs[A & 3];
|
||||
}
|
||||
|
||||
static DECLFW(MCopyFamiMMC3Write) {
|
||||
if (regs[CTRL] & CAROM) {
|
||||
regs[BANK] = V & 0x1F;
|
||||
Sync();
|
||||
} else {
|
||||
if (A >= 0xC000)
|
||||
MMC3_IRQWrite(A, V);
|
||||
else
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(MCopyFamiMMC3WriteNMI) {
|
||||
if (regs[CTRL] & CVNMI)
|
||||
def_write_ram(0x3FFC + (A & 1), V);
|
||||
else
|
||||
MCopyFamiMMC3Write(A, V);
|
||||
}
|
||||
|
||||
static DECLFW(MCopyFamiMMC3WriteIRQ) {
|
||||
if (regs[CTRL] & CVIRQ)
|
||||
def_write_ram(0x3FFE + (A & 1), V);
|
||||
else
|
||||
MCopyFamiMMC3Write(A, V);
|
||||
}
|
||||
|
||||
static DECLFR(MCopyFamiReadNMI) {
|
||||
if (regs[CTRL] & CVNMI)
|
||||
return def_read_ram(0x3FFC + (A & 1));
|
||||
else
|
||||
return def_read_rom(A);
|
||||
}
|
||||
|
||||
static DECLFR(MCopyFamiReadIRQ) {
|
||||
if (regs[CTRL] & CVIRQ)
|
||||
return def_read_ram(0x3FFE + (A & 1));
|
||||
else
|
||||
return def_read_rom(A);
|
||||
}
|
||||
|
||||
static void MCopyFamiMMC3Power(void) {
|
||||
regs[CTRL] = regs[USB] = 0;
|
||||
regs[STATUS] = SIRQ | SNMI | SVRAM;
|
||||
regs[BANK] = 0x08;
|
||||
#ifdef DEBUG_SERIAL
|
||||
debug_serial_data_pos = 0;
|
||||
#endif
|
||||
GenMMC3Power();
|
||||
Sync();
|
||||
|
||||
def_write_ram = GetWriteHandler(0x3FFC);
|
||||
SetWriteHandler(0x3FFC, 0x3FFF, MCopyFamiWriteReg);
|
||||
def_read_ram = GetReadHandler(0x3FFC);
|
||||
SetReadHandler(0x3FFC, 0x3FFF, MCopyFamiReadReg);
|
||||
|
||||
SetWriteHandler(0x8000, 0xFFF9, MCopyFamiMMC3Write);
|
||||
SetWriteHandler(0xFFFA, 0xFFFB, MCopyFamiMMC3WriteNMI);
|
||||
SetWriteHandler(0xFFFE, 0xFFFF, MCopyFamiMMC3WriteIRQ);
|
||||
|
||||
def_read_rom = GetReadHandler(0xFFFA);
|
||||
SetReadHandler(0xFFFA, 0xFFFB, MCopyFamiReadNMI);
|
||||
SetReadHandler(0xFFFE, 0xFFFF, MCopyFamiReadIRQ);
|
||||
}
|
||||
|
||||
static void MCopyFamiMMC3Reset(void) {
|
||||
regs[CTRL] = regs[USB] = 0;
|
||||
regs[STATUS] = SIRQ | SNMI | SVRAM;
|
||||
regs[BANK] = 0x08;
|
||||
#ifdef DEBUG_SERIAL
|
||||
debug_serial_data_pos = 0;
|
||||
#endif
|
||||
MMC3RegReset();
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void MCopyFamiClose(void) {
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM = NULL;
|
||||
SerialClose();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void MapperCopyFamiMMC3_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 512, 8, 0);
|
||||
|
||||
cwrap = MCopyFamiMMC3CW;
|
||||
pwrap = MCopyFamiMMC3PW;
|
||||
mwrap = MCopyFamiMMC3MW;
|
||||
|
||||
info->Reset = MCopyFamiMMC3Reset;
|
||||
info->Power = MCopyFamiMMC3Power;
|
||||
info->Close = MCopyFamiClose;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
CHRRAMSIZE = 8192;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
|
||||
#ifndef DEBUG_SERIAL
|
||||
FCEU_printf("WAITING FOR PORT...\n");
|
||||
|
||||
while (!SerialOpen(20, 921600)) {
|
||||
}
|
||||
|
||||
FCEU_printf("PORT READY.\n");
|
||||
#endif
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,113 +1,113 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Dance 2000 12-in-1
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prg, mode;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint32 lastnt = 0;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &prg, 1, "REGS" },
|
||||
{ &mode, 1, "MODE" },
|
||||
{ &lastnt, 4, "LSNT" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror((mode ^ 1) & 1);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setchr4(0x0000, lastnt);
|
||||
setchr4(0x1000, 1);
|
||||
if (mode & 4)
|
||||
setprg32(0x8000, prg & 7);
|
||||
else {
|
||||
setprg16(0x8000, prg & 0x0f);
|
||||
setprg16(0xC000, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(UNLD2000Write) {
|
||||
switch (A) {
|
||||
case 0x5000: prg = V; Sync(); break;
|
||||
case 0x5200: mode = V; if (mode & 4) Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(UNLD2000Read) {
|
||||
if (prg & 0x40)
|
||||
return X.DB;
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static void UNLD2000Power(void) {
|
||||
prg = mode = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, UNLD2000Read);
|
||||
SetWriteHandler(0x5000, 0x5FFF, UNLD2000Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) UNL2000Hook(uint32 A) {
|
||||
if (mode & 2) {
|
||||
if ((A & 0x3000) == 0x2000) {
|
||||
uint32 curnt = A & 0x800;
|
||||
if (curnt != lastnt) {
|
||||
setchr4(0x0000, curnt >> 11);
|
||||
lastnt = curnt;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lastnt = 0;
|
||||
setchr4(0x0000, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLD2000Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLD2000_Init(CartInfo *info) {
|
||||
info->Power = UNLD2000Power;
|
||||
info->Close = UNLD2000Close;
|
||||
PPU_hook = UNL2000Hook;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2007 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Dance 2000 12-in-1
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prg, mode;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint32 lastnt = 0;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &prg, 1, "REGS" },
|
||||
{ &mode, 1, "MODE" },
|
||||
{ &lastnt, 4, "LSNT" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setmirror((mode ^ 1) & 1);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setchr4(0x0000, lastnt);
|
||||
setchr4(0x1000, 1);
|
||||
if (mode & 4)
|
||||
setprg32(0x8000, prg & 7);
|
||||
else {
|
||||
setprg16(0x8000, prg & 0x0f);
|
||||
setprg16(0xC000, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(UNLD2000Write) {
|
||||
switch (A) {
|
||||
case 0x5000: prg = V; Sync(); break;
|
||||
case 0x5200: mode = V; if (mode & 4) Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(UNLD2000Read) {
|
||||
if (prg & 0x40)
|
||||
return X.DB;
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static void UNLD2000Power(void) {
|
||||
prg = mode = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, UNLD2000Read);
|
||||
SetWriteHandler(0x5000, 0x5FFF, UNLD2000Write);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) UNL2000Hook(uint32 A) {
|
||||
if (mode & 2) {
|
||||
if ((A & 0x3000) == 0x2000) {
|
||||
uint32 curnt = A & 0x800;
|
||||
if (curnt != lastnt) {
|
||||
setchr4(0x0000, curnt >> 11);
|
||||
lastnt = curnt;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lastnt = 0;
|
||||
setchr4(0x0000, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLD2000Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLD2000_Init(CartInfo *info) {
|
||||
info->Power = UNLD2000Power;
|
||||
info->Close = UNLD2000Close;
|
||||
PPU_hook = UNL2000Hook;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,51 +1,51 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 latche;
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, latche);
|
||||
setprg16(0xC000, 8);
|
||||
}
|
||||
|
||||
static DECLFW(DREAMWrite) {
|
||||
latche = V & 7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void DREAMPower(void) {
|
||||
latche = 0;
|
||||
Sync();
|
||||
setchr8(0);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x5020, 0x5020, DREAMWrite);
|
||||
}
|
||||
|
||||
static void Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void DreamTech01_Init(CartInfo *info) {
|
||||
GameStateRestore = Restore;
|
||||
info->Power = DREAMPower;
|
||||
AddExState(&latche, 1, 0, "LATC");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 latche;
|
||||
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, latche);
|
||||
setprg16(0xC000, 8);
|
||||
}
|
||||
|
||||
static DECLFW(DREAMWrite) {
|
||||
latche = V & 7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void DREAMPower(void) {
|
||||
latche = 0;
|
||||
Sync();
|
||||
setchr8(0);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x5020, 0x5020, DREAMWrite);
|
||||
}
|
||||
|
||||
static void Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void DreamTech01_Init(CartInfo *info) {
|
||||
GameStateRestore = Restore;
|
||||
info->Power = DREAMPower;
|
||||
AddExState(&latche, 1, 0, "LATC");
|
||||
}
|
||||
|
||||
@@ -1,78 +1,78 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint8 reg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, (reg & 0xC0) >> 6);
|
||||
setprg32(0x8000, reg & 0x1F);
|
||||
/* setmirror(((reg&0x20)>>5)); */
|
||||
}
|
||||
|
||||
static DECLFW(UNLEDU2000HiWrite) {
|
||||
/* FCEU_printf("%04x:%02x\n",A,V); */
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLEDU2000Power(void) {
|
||||
setmirror(MI_0);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLEDU2000HiWrite);
|
||||
FCEU_CheatAddRAM(32, 0x6000, WRAM);
|
||||
reg = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLEDU2000Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void UNLEDU2000Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLEDU2000_Init(CartInfo *info) {
|
||||
info->Power = UNLEDU2000Power;
|
||||
info->Close = UNLEDU2000Close;
|
||||
GameStateRestore = UNLEDU2000Restore;
|
||||
WRAM = (uint8*)FCEU_gmalloc(32768);
|
||||
SetupCartPRGMapping(0x10, WRAM, 32768, 1);
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 32768;
|
||||
}
|
||||
AddExState(WRAM, 32768, 0, "WRAM");
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint8 reg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, (reg & 0xC0) >> 6);
|
||||
setprg32(0x8000, reg & 0x1F);
|
||||
/* setmirror(((reg&0x20)>>5)); */
|
||||
}
|
||||
|
||||
static DECLFW(UNLEDU2000HiWrite) {
|
||||
/* FCEU_printf("%04x:%02x\n",A,V); */
|
||||
reg = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLEDU2000Power(void) {
|
||||
setmirror(MI_0);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, CartBW);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLEDU2000HiWrite);
|
||||
FCEU_CheatAddRAM(32, 0x6000, WRAM);
|
||||
reg = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLEDU2000Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void UNLEDU2000Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLEDU2000_Init(CartInfo *info) {
|
||||
info->Power = UNLEDU2000Power;
|
||||
info->Close = UNLEDU2000Close;
|
||||
GameStateRestore = UNLEDU2000Restore;
|
||||
WRAM = (uint8*)FCEU_gmalloc(32768);
|
||||
SetupCartPRGMapping(0x10, WRAM, 32768, 1);
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 32768;
|
||||
}
|
||||
AddExState(WRAM, 32768, 0, "WRAM");
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,120 +1,120 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 regs[8];
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg2r(0x10, 0x0800, 0);
|
||||
setprg2r(0x10, 0x1000, 1);
|
||||
setprg2r(0x10, 0x1800, 2);
|
||||
setprg8r(0x10, 0x6000, 1);
|
||||
setprg16(0x8000, 0);
|
||||
setprg16(0xC000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static DECLFW(SSSNROMWrite)
|
||||
{
|
||||
CartBW(A,V);
|
||||
}
|
||||
#endif
|
||||
|
||||
static DECLFW(SSSNROMWrite) {
|
||||
#if 0
|
||||
FCEU_printf("write %04x %02x\n",A,V);
|
||||
regs[A&7] = V;
|
||||
#endif
|
||||
}
|
||||
|
||||
static DECLFR(SSSNROMRead) {
|
||||
/* FCEU_printf("read %04x\n",A); */
|
||||
switch (A & 7) {
|
||||
case 0: return regs[0] = 0xff; /* clear all exceptions */
|
||||
case 2: return 0xc0; /* DIP selftest + freeplay */
|
||||
case 3: return 0x00; /* 0, 1 - attract
|
||||
* 2
|
||||
* 4 - menu
|
||||
* 8 - self check and game casette check
|
||||
* 10 - lock?
|
||||
* 20 - game title & count display
|
||||
*/
|
||||
case 7: return 0x22; /* TV type, key not turned, relay B */
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void SSSNROMPower(void) {
|
||||
regs[0] = regs[1] = regs[2] = regs[3] = regs[4] = regs[5] = regs[6] = 0;
|
||||
regs[7] = 0xff;
|
||||
Sync();
|
||||
memset(WRAM, 0x00, WRAMSIZE);
|
||||
/* SetWriteHandler(0x0000,0x1FFF,SSSNROMRamWrite); */
|
||||
SetReadHandler(0x0800, 0x1FFF, CartBR);
|
||||
SetWriteHandler(0x0800, 0x1FFF, CartBW);
|
||||
SetReadHandler(0x5000, 0x5FFF, SSSNROMRead);
|
||||
SetWriteHandler(0x5000, 0x5FFF, SSSNROMWrite);
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void SSSNROMReset(void) {
|
||||
regs[1] = regs[2] = regs[3] = regs[4] = regs[5] = regs[6] = 0;
|
||||
}
|
||||
|
||||
static void SSSNROMClose(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void SSSNROMIRQHook(void) {
|
||||
/* X6502_IRQBegin(FCEU_IQEXT); */
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void SSSNROM_Init(CartInfo *info) {
|
||||
info->Reset = SSSNROMReset;
|
||||
info->Power = SSSNROMPower;
|
||||
info->Close = SSSNROMClose;
|
||||
GameHBIRQHook = SSSNROMIRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 16384;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
*
|
||||
* 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"
|
||||
|
||||
static uint8 regs[8];
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg2r(0x10, 0x0800, 0);
|
||||
setprg2r(0x10, 0x1000, 1);
|
||||
setprg2r(0x10, 0x1800, 2);
|
||||
setprg8r(0x10, 0x6000, 1);
|
||||
setprg16(0x8000, 0);
|
||||
setprg16(0xC000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static DECLFW(SSSNROMWrite)
|
||||
{
|
||||
CartBW(A,V);
|
||||
}
|
||||
#endif
|
||||
|
||||
static DECLFW(SSSNROMWrite) {
|
||||
#if 0
|
||||
FCEU_printf("write %04x %02x\n",A,V);
|
||||
regs[A&7] = V;
|
||||
#endif
|
||||
}
|
||||
|
||||
static DECLFR(SSSNROMRead) {
|
||||
/* FCEU_printf("read %04x\n",A); */
|
||||
switch (A & 7) {
|
||||
case 0: return regs[0] = 0xff; /* clear all exceptions */
|
||||
case 2: return 0xc0; /* DIP selftest + freeplay */
|
||||
case 3: return 0x00; /* 0, 1 - attract
|
||||
* 2
|
||||
* 4 - menu
|
||||
* 8 - self check and game casette check
|
||||
* 10 - lock?
|
||||
* 20 - game title & count display
|
||||
*/
|
||||
case 7: return 0x22; /* TV type, key not turned, relay B */
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void SSSNROMPower(void) {
|
||||
regs[0] = regs[1] = regs[2] = regs[3] = regs[4] = regs[5] = regs[6] = 0;
|
||||
regs[7] = 0xff;
|
||||
Sync();
|
||||
memset(WRAM, 0x00, WRAMSIZE);
|
||||
/* SetWriteHandler(0x0000,0x1FFF,SSSNROMRamWrite); */
|
||||
SetReadHandler(0x0800, 0x1FFF, CartBR);
|
||||
SetWriteHandler(0x0800, 0x1FFF, CartBW);
|
||||
SetReadHandler(0x5000, 0x5FFF, SSSNROMRead);
|
||||
SetWriteHandler(0x5000, 0x5FFF, SSSNROMWrite);
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void SSSNROMReset(void) {
|
||||
regs[1] = regs[2] = regs[3] = regs[4] = regs[5] = regs[6] = 0;
|
||||
}
|
||||
|
||||
static void SSSNROMClose(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void SSSNROMIRQHook(void) {
|
||||
/* X6502_IRQBegin(FCEU_IQEXT); */
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void SSSNROM_Init(CartInfo *info) {
|
||||
info->Reset = SSSNROMReset;
|
||||
info->Power = SSSNROMPower;
|
||||
info->Close = SSSNROMClose;
|
||||
GameHBIRQHook = SSSNROMIRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
WRAMSIZE = 16384;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user