mirror of
https://github.com/dborth/fceugx.git
synced 2024-12-04 22:34:14 +01:00
sync to FCEUX r2788
This commit is contained in:
parent
e458c51d93
commit
256f3647ea
@ -15,7 +15,7 @@ int Assemble(unsigned char *output, int addr, char *str) {
|
||||
//unsigned char opcode[3] = { 0,0,0 };
|
||||
output[0] = output[1] = output[2] = 0;
|
||||
char astr[128],ins[4];
|
||||
int len = strlen(str);
|
||||
int len = strlen(str);
|
||||
if ((!len) || (len > 0x127)) return 1;
|
||||
|
||||
strcpy(astr,str);
|
||||
@ -40,7 +40,7 @@ int Assemble(unsigned char *output, int addr, char *str) {
|
||||
// 1) Sets opcode[0] on success, else returns 1.
|
||||
// 2) Parses text in *astr to build the rest of the assembled
|
||||
// data in 'opcode', else returns 1 on error.
|
||||
|
||||
|
||||
if (!strlen(astr)) {
|
||||
//Implied instructions
|
||||
if (!strcmp(ins,"BRK")) output[0] = 0x00;
|
||||
@ -517,6 +517,6 @@ char *Disassemble(int addr, uint8 *opcode) {
|
||||
default: strcpy(str,"ERROR"); break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return str;
|
||||
}
|
||||
|
@ -15,89 +15,95 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* TXC mappers
|
||||
* 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[]=
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{reg, 4, "REGS"},
|
||||
{&cmd, 1, "CMD"},
|
||||
{0}
|
||||
{ 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 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(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 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(reg[3])
|
||||
// return reg[2];
|
||||
// else
|
||||
// return X.DB;
|
||||
static DECLFR(UNL22211ReadLo) {
|
||||
return (reg[1] ^ reg[2]) | (is173 ? 0x01 : 0x40);
|
||||
// if(reg[3])
|
||||
// return reg[2];
|
||||
// else
|
||||
// return X.DB;
|
||||
}
|
||||
|
||||
static void UNL22211Power(void)
|
||||
{
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetReadHandler(0x4100,0x4100,UNL22211ReadLo);
|
||||
SetWriteHandler(0x4100,0x4103,UNL22211WriteLo);
|
||||
SetWriteHandler(0x8000,0xFFFF,UNL22211WriteHi);
|
||||
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();
|
||||
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 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 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);
|
||||
void Mapper173_Init(CartInfo *info) {
|
||||
is172 = 0;
|
||||
is173 = 1;
|
||||
info->Power = UNL22211Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
|
67
source/fceultra/boards/09-034a.cpp
Normal file
67
source/fceultra/boards/09-034a.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
/* 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 2 J alt version 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.
|
||||
*
|
||||
* PCB for this mapper is "09-034A"
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prg;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &prg, 1, "PRG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8r(1, 0x6000, prg);
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(UNLSMB2JWrite) {
|
||||
prg = V & 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNLSMB2JPower(void) {
|
||||
prg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4027, 0x4027, UNLSMB2JWrite);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLSMB2J_Init(CartInfo *info) {
|
||||
info->Power = UNLSMB2JPower;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -28,7 +28,7 @@ static uint32 WRAMSIZE;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{&IRQCount, 4, "IRQCOUNT"},
|
||||
{&IRQCount, 4, "IRQC"},
|
||||
{reg, 16, "REGS"},
|
||||
{0}
|
||||
};
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -37,8 +37,8 @@ static void Sync(void)
|
||||
|
||||
static DECLFW(M108Write)
|
||||
{
|
||||
reg=V;
|
||||
Sync();
|
||||
reg=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M108Power(void)
|
||||
@ -46,7 +46,8 @@ static void M108Power(void)
|
||||
Sync();
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8FFF,0x8FFF,M108Write);
|
||||
SetWriteHandler(0x8000,0x8FFF,M108Write); // regular 108
|
||||
SetWriteHandler(0xF000,0xFFFF,M108Write); // simplified Kaiser BB Hack
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
* NTDEC, ASDER games
|
||||
*/
|
||||
|
||||
|
358
source/fceultra/boards/116.cpp
Normal file
358
source/fceultra/boards/116.cpp
Normal file
@ -0,0 +1,358 @@
|
||||
/* 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)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
// printf("%04X:%02X\n",A,V);
|
||||
if(A==0xA123)
|
||||
{
|
||||
int zzz=9;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
void Mapper116_Init(CartInfo *info)
|
||||
{
|
||||
UNLSL12_Init(info);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -28,8 +28,8 @@ static SFORMAT StateRegs[]=
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{&IRQCount, 1, "IRQC"},
|
||||
{&IRQLatch, 1, "IRQL"},
|
||||
{prgreg, 4, "PREGS"},
|
||||
{chrreg, 8, "CREGS"},
|
||||
{prgreg, 4, "PREG"},
|
||||
{chrreg, 8, "CREG"},
|
||||
{&mirror, 1, "MREG"},
|
||||
{0}
|
||||
};
|
||||
@ -37,13 +37,13 @@ static SFORMAT StateRegs[]=
|
||||
static void Sync(void)
|
||||
{
|
||||
int i;
|
||||
setprg8(0x8000,prgreg[0]);
|
||||
setprg8(0xa000,prgreg[1]);
|
||||
setprg8(0xc000,prgreg[2]);
|
||||
setprg8(0x8000,prgreg[0]);
|
||||
setprg8(0xa000,prgreg[1]);
|
||||
setprg8(0xc000,prgreg[2]);
|
||||
setprg8(0xe000,prgreg[3]);
|
||||
for(i=0; i<8; i++)
|
||||
setchr1(i<<10,chrreg[i]);
|
||||
setmirror(mirror^1);
|
||||
setchr1(i<<10,chrreg[i]);
|
||||
setmirror(mirror^1);
|
||||
}
|
||||
|
||||
static DECLFW(M117Write)
|
||||
@ -52,7 +52,7 @@ static DECLFW(M117Write)
|
||||
{
|
||||
prgreg[A&3]=V;
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
else if((A>=0xA000)&&(A<=0xA007))
|
||||
{
|
||||
chrreg[A&7]=V;
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -48,8 +48,7 @@ static void M120Power(void)
|
||||
{
|
||||
reg=0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x4100,0x5FFF,M120Write);
|
||||
}
|
||||
|
||||
|
@ -15,69 +15,119 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Panda prince pirate.
|
||||
* MK4, MK6, A9711 board, MAPPER 187 the same!
|
||||
* UNL6035052_Init seems to be the same too, but with prot array in reverse
|
||||
* 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 uint8 readbyte = 0;
|
||||
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);
|
||||
if((A&0xF003)==0x8003)
|
||||
switch(A&0xE003)
|
||||
{
|
||||
// FCEU_printf(" prot write");
|
||||
// FCEU_printf("write: %04x:%04x\n",A,V);
|
||||
if (V==0xAB) setprg8(0xE000,7);
|
||||
else if(V==0x26) setprg8(0xE000,8);
|
||||
// else if(V==0x26) setprg8(0xE000,1); // MK3
|
||||
// else if(V==0x26) setprg8(0xE000,0x15); // sonic 3D blast, 8003 - command (0x26), 8001 - data 0x2A (<<1 = 0x15)
|
||||
else if(V==0xFF) setprg8(0xE000,9);
|
||||
else if(V==0x28) setprg8(0xC000,0xC);
|
||||
else if(V==0xEC) setprg8(0xE000,0xD);
|
||||
// else if(V==0xEC) setprg8(0xE000,0xC);//MK3
|
||||
else if(V==0xEF) setprg8(0xE000,0xD); // damn mess, need real hardware to figure out bankswitching
|
||||
else if(V==0x2A) setprg8(0xA000,0x0E);
|
||||
// else if(V==0x2A) setprg8(0xE000,0x0C); // MK3
|
||||
else if(V==0x20) setprg8(0xE000,0x13);
|
||||
else if(V==0x29) setprg8(0xE000,0x1B);
|
||||
else
|
||||
{
|
||||
// FCEU_printf(" unknown");
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
MMC3_CMDWrite(A,V);
|
||||
}
|
||||
// FCEU_printf("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// FixMMC3PRG(MMC3_cmd);
|
||||
MMC3_CMDWrite(A,V);
|
||||
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[0] = prot_array[V&3]; // 0x100 bit in address seems to be switch arrays 0, 2, 2, 3 (Contra Fighter)
|
||||
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);
|
||||
return EXPREGS[0];
|
||||
{
|
||||
// FCEU_printf("read: %04x->\n",A,EXPREGS[0]);
|
||||
return EXPREGS[4];
|
||||
}
|
||||
|
||||
static void M121Power(void)
|
||||
{
|
||||
EXPREGS[3] = 0x80;
|
||||
EXPREGS[5] = 0;
|
||||
GenMMC3Power();
|
||||
// Write_IRQFM(0x4017,0x40);
|
||||
SetReadHandler(0x5000,0x5FFF,M121Read);
|
||||
SetWriteHandler(0x5000,0x5FFF,M121LoWrite);
|
||||
SetWriteHandler(0x8000,0x9FFF,M121Write);
|
||||
@ -86,6 +136,8 @@ static void M121Power(void)
|
||||
void Mapper121_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 128, 256, 8, 0);
|
||||
pwrap=M121PW;
|
||||
cwrap=M121CW;
|
||||
info->Power=M121Power;
|
||||
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||
AddExState(EXPREGS, 8, 0, "EXPR");
|
||||
}
|
||||
|
77
source/fceultra/boards/12in1.cpp
Normal file
77
source/fceultra/boards/12in1.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
/* 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 reg[4];
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{reg, 4, "REGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
uint8 bank = (reg[3]&3)<<3;
|
||||
setchr4(0x0000, (reg[1]>>3)|(bank<<2));
|
||||
setchr4(0x1000, (reg[2]>>3)|(bank<<2));
|
||||
if(reg[3]&8)
|
||||
{
|
||||
setprg32(0x8000,((reg[2]&7)>>1)|bank);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg16(0x8000, (reg[1]&7)|bank);
|
||||
setprg16(0xc000, 7|bank);
|
||||
}
|
||||
setmirror(((reg[3]&4)>>2)^1);
|
||||
}
|
||||
|
||||
static DECLFW(BMC12IN1Write)
|
||||
{
|
||||
switch(A)
|
||||
{
|
||||
case 0xafff: reg[0] = V; break;
|
||||
case 0xbfff: reg[1] = V; break;
|
||||
case 0xdfff: reg[2] = V; break;
|
||||
case 0xefff: reg[3] = V; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC12IN1Power(void)
|
||||
{
|
||||
reg[0]=reg[1]=reg[2]=reg[3]=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);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
@ -23,97 +23,87 @@
|
||||
|
||||
static uint16 latchea;
|
||||
static uint8 latched;
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static SFORMAT StateRegs[]=
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{&latchea, 2, "LATCHEA"},
|
||||
{&latched, 1, "LATCHED"},
|
||||
{0}
|
||||
{ &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))
|
||||
i=0x7F;
|
||||
setprg8(0x8000+(i<<13),(i&1)+((b<<1)^(latched>>7)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
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 DECLFW(M15Write) {
|
||||
latchea = A;
|
||||
latched = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M15Reset(void)
|
||||
{
|
||||
latchea=0x8000;
|
||||
latched=0;
|
||||
Sync();
|
||||
static void M15Reset(void) {
|
||||
latchea = 0x8000;
|
||||
latched = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M15Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM=NULL;
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
64
source/fceultra/boards/151.cpp
Normal file
64
source/fceultra/boards/151.cpp
Normal file
@ -0,0 +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 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);
|
||||
}
|
121
source/fceultra/boards/156.cpp
Normal file
121
source/fceultra/boards/156.cpp
Normal file
@ -0,0 +1,121 @@
|
||||
/* 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, 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);
|
||||
}
|
||||
|
||||
static void M156Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM=NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper156_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=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);
|
||||
}
|
@ -15,146 +15,237 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Actually, all this may be the same mapper with different switcheable banking modes, maybe it's just an subtypes
|
||||
* of the same one board with various modes locked just like SuperGame boards, based on 215 mapper
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 cmd, laststrobe, trigger;
|
||||
static uint8 DRegs[8];
|
||||
static uint8 laststrobe, trigger;
|
||||
static uint8 reg[8];
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static void(*WSync)(void);
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&cmd, 1, "CMD"},
|
||||
{&laststrobe, 1, "STB"},
|
||||
{&trigger, 1, "TRG"},
|
||||
{DRegs, 8, "DREG"},
|
||||
{0}
|
||||
{&laststrobe, 1, "STB"},
|
||||
{&trigger, 1, "TRG"},
|
||||
{reg, 8, "REGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000,(DRegs[0]<<4)|(DRegs[1]&0xF));
|
||||
setprg8r(0x10,0x6000,0);
|
||||
setprg32(0x8000,(reg[0]<<4)|(reg[1]&0xF));
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
WSync();
|
||||
}
|
||||
|
||||
static DECLFR(ReadLow)
|
||||
{
|
||||
switch (A&0x7700)
|
||||
{
|
||||
case 0x5100: return DRegs[2]; break;
|
||||
case 0x5500: if(trigger)
|
||||
return DRegs[2];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
switch (A&0x7300)
|
||||
{
|
||||
case 0x5100: DRegs[0]=V; Sync(); break;
|
||||
case 0x5000: DRegs[1]=V; Sync(); break;
|
||||
case 0x5300: DRegs[2]=V; break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Write2)
|
||||
{
|
||||
if(A==0x5101)
|
||||
{
|
||||
if(laststrobe&&!V)
|
||||
{
|
||||
trigger^=1;
|
||||
}
|
||||
laststrobe=V;
|
||||
}else if(A==0x5100&&V==6) //damn thoose protected games
|
||||
setprg32(0x8000,3);
|
||||
else
|
||||
switch (A&0x7300)
|
||||
{
|
||||
case 0x5200: DRegs[0]=V; Sync(); break;
|
||||
case 0x5000: DRegs[1]=V; Sync(); if(!(DRegs[1]&0x80)&&(scanline<128)) setchr8(0); break;
|
||||
case 0x5300: DRegs[2]=V; break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 WRAM[8192];
|
||||
static DECLFR(AWRAM)
|
||||
{
|
||||
return(WRAM[A-0x6000]);
|
||||
}
|
||||
|
||||
static DECLFW(BWRAM)
|
||||
{
|
||||
WRAM[A-0x6000]=V;
|
||||
}
|
||||
|
||||
static void Power(void)
|
||||
{
|
||||
memset(DRegs,0,8);
|
||||
DRegs[1]=0xFF;
|
||||
cmd=0;
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x4020,0x5FFF,Write);
|
||||
SetReadHandler(0x6000,0x7FFF,AWRAM);
|
||||
SetWriteHandler(0x6000,0x7FFF,BWRAM);
|
||||
setchr8(0);
|
||||
Sync();
|
||||
switch (A&0x7700)
|
||||
{
|
||||
case 0x5100:
|
||||
return reg[2]|reg[0]|reg[1]|reg[3]^0xff; break;
|
||||
case 0x5500:
|
||||
if(trigger)
|
||||
return reg[2]|reg[1]; // Lei Dian Huang Bi Ka Qiu Chuan Shuo (NJ046) may broke other games
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
static void M163HB(void)
|
||||
{
|
||||
if(DRegs[1]&0x80)
|
||||
{
|
||||
if(scanline==239)
|
||||
{
|
||||
setchr4(0x0000,0);
|
||||
setchr4(0x1000,0);
|
||||
}
|
||||
else if(scanline==127)
|
||||
{
|
||||
setchr4(0x0000,1);
|
||||
setchr4(0x1000,1);
|
||||
}
|
||||
}
|
||||
if(reg[1]&0x80)
|
||||
{
|
||||
if(scanline==239)
|
||||
{
|
||||
setchr4(0x0000,0);
|
||||
setchr4(0x1000,0);
|
||||
}
|
||||
else if(scanline==127)
|
||||
{
|
||||
setchr4(0x0000,1);
|
||||
setchr4(0x1000,1);
|
||||
}
|
||||
/*
|
||||
if(scanline>=127) // Hu Lu Jin Gang (NJ039) (Ch) [!] don't like it
|
||||
{
|
||||
setchr4(0x0000,1);
|
||||
setchr4(0x1000,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setchr4(0x0000,0);
|
||||
setchr4(0x1000,0);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
static void Power2(void)
|
||||
static DECLFW(Write)
|
||||
{
|
||||
memset(DRegs,0,8);
|
||||
DRegs[1]=0xFF;
|
||||
laststrobe=1;
|
||||
cmd=0;
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x4020,0x5FFF,Write2);
|
||||
SetReadHandler(0x6000,0x7FFF,AWRAM);
|
||||
SetWriteHandler(0x6000,0x7FFF,BWRAM);
|
||||
SetReadHandler(0x5000,0x5FFF,ReadLow);
|
||||
setchr8(0);
|
||||
Sync();
|
||||
switch (A&0x7300)
|
||||
{
|
||||
case 0x5100: reg[0]=V; WSync(); break;
|
||||
case 0x5000: reg[1]=V; WSync(); break;
|
||||
case 0x5300: reg[2]=V; break;
|
||||
case 0x5200: reg[3]=V; WSync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(void)
|
||||
{
|
||||
memset(reg,0,8);
|
||||
reg[1]=0xFF;
|
||||
SetWriteHandler(0x5000,0x5FFF,Write);
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM=NULL;
|
||||
}
|
||||
|
||||
void Mapper164_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
AddExState(WRAM, 8192, 0, "WRAM");
|
||||
info->SaveGame[0]=WRAM;
|
||||
info->SaveGameLen[0]=8192;
|
||||
info->Power=Power;
|
||||
info->Close=Close;
|
||||
WSync = Sync;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static DECLFW(Write2)
|
||||
{
|
||||
if(A==0x5101)
|
||||
{
|
||||
if(laststrobe&&!V)
|
||||
trigger^=1;
|
||||
laststrobe=V;
|
||||
}else if(A==0x5100&&V==6) //damn thoose protected games
|
||||
setprg32(0x8000,3);
|
||||
else
|
||||
switch (A&0x7300)
|
||||
{
|
||||
case 0x5200: reg[0]=V; WSync(); break;
|
||||
case 0x5000: reg[1]=V; WSync(); if(!(reg[1]&0x80)&&(scanline<128)) setchr8(0); /* setchr8(0); */ break;
|
||||
case 0x5300: reg[2]=V; break;
|
||||
case 0x5100: reg[3]=V; WSync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power2(void)
|
||||
{
|
||||
memset(reg,0,8);
|
||||
laststrobe=1;
|
||||
SetReadHandler(0x5000,0x5FFF,ReadLow);
|
||||
SetWriteHandler(0x5000,0x5FFF,Write2);
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
WSync();
|
||||
}
|
||||
|
||||
void Mapper163_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=Power2;
|
||||
GameHBIRQHook=M163HB;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
AddExState(WRAM, 8192, 0, "WRAM");
|
||||
info->Power=Power2;
|
||||
info->Close=Close;
|
||||
WSync = Sync;
|
||||
GameHBIRQHook=M163HB;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static void Sync3(void)
|
||||
{
|
||||
setchr8(0);
|
||||
setprg8r(0x10,0x6000,0);
|
||||
switch(reg[3]&7){
|
||||
case 0:
|
||||
case 2: setprg32(0x8000,(reg[0]&0xc)|(reg[1]&2)|((reg[2]&0xf)<<4)); break;
|
||||
case 1:
|
||||
case 3: setprg32(0x8000,(reg[0]&0xc)|(reg[2]&0xf)<<4); break;
|
||||
case 4:
|
||||
case 6: setprg32(0x8000,(reg[0]&0xe)|((reg[1]>>1)&1)|((reg[2]&0xf)<<4)); break;
|
||||
case 5:
|
||||
case 7: setprg32(0x8000,(reg[0]&0xf)|((reg[2]&0xf)<<4)); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Write3)
|
||||
{
|
||||
reg[(A>>8)&3]=V;
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void Power3(void)
|
||||
{
|
||||
reg[0]=3;
|
||||
reg[1]=0;
|
||||
reg[2]=0;
|
||||
reg[3]=7;
|
||||
SetWriteHandler(0x5000,0x5FFF,Write3);
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
WSync();
|
||||
}
|
||||
|
||||
void UNLFS304_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=Power3;
|
||||
info->Close=Close;
|
||||
WSync = Sync3;
|
||||
|
||||
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);
|
||||
}
|
||||
|
86
source/fceultra/boards/168.cpp
Normal file
86
source/fceultra/boards/168.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
/* 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 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 MNNNClose(void)
|
||||
{
|
||||
if(CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM=NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper168_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M168Power;
|
||||
info->Close=MNNNClose;
|
||||
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");
|
||||
|
||||
}
|
119
source/fceultra/boards/17.cpp
Normal file
119
source/fceultra/boards/17.cpp
Normal file
@ -0,0 +1,119 @@
|
||||
/* 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 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]);
|
||||
setprg8(0x8000,preg[0]);
|
||||
setprg8(0xA000,preg[1]);
|
||||
setprg8(0xC000,preg[2]);
|
||||
setprg8(0xE000,preg[3]);
|
||||
switch(mirr) {
|
||||
case 0: setmirror(MI_0); break;
|
||||
case 1: setmirror(MI_1); break;
|
||||
case 2: setmirror(MI_H); break;
|
||||
case 3: setmirror(MI_V); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M17WriteMirr)
|
||||
{
|
||||
mirr = ((A << 1) & 2)|((V >> 4) & 1);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M17WriteIRQ)
|
||||
{
|
||||
switch(A) {
|
||||
case 0x4501: IRQa=0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0x4502: IRQCount&=0xFF00; IRQCount|=V; break;
|
||||
case 0x4503: IRQCount&=0x00FF; IRQCount|=V<<8; IRQa=1; break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M17WritePrg)
|
||||
{
|
||||
preg[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M17WriteChr)
|
||||
{
|
||||
creg[A & 7] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M17Power(void)
|
||||
{
|
||||
preg[3] = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x42FE,0x42FF,M17WriteMirr);
|
||||
SetWriteHandler(0x4500,0x4503,M17WriteIRQ);
|
||||
SetWriteHandler(0x4504,0x4507,M17WritePrg);
|
||||
SetWriteHandler(0x4510,0x4517,M17WriteChr);
|
||||
}
|
||||
|
||||
static void M17IRQHook(int a)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
IRQCount+=a;
|
||||
if(IRQCount>=0x10000)
|
||||
{
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa=0;
|
||||
IRQCount=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper17_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M17Power;
|
||||
MapIRQHook=M17IRQHook;
|
||||
GameStateRestore=StateRestore;
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
68
source/fceultra/boards/170.cpp
Normal file
68
source/fceultra/boards/170.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
/* 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);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -71,7 +71,7 @@ static void M175Power(void)
|
||||
SetReadHandler(0x8000,0xFFFF,M175Read);
|
||||
SetWriteHandler(0x8000,0x8000,M175Write1);
|
||||
SetWriteHandler(0xA000,0xA000,M175Write2);
|
||||
Sync();
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -115,7 +115,7 @@ static void M176Power(void)
|
||||
SetWriteHandler(0x5011,0x5011,M176Write_5011);
|
||||
SetWriteHandler(0x5ff1,0x5ff1,M176Write_5FF1);
|
||||
SetWriteHandler(0x5ff2,0x5ff2,M176Write_5FF2);
|
||||
|
||||
|
||||
we_sram = 0;
|
||||
sbw = 0;
|
||||
prg[0] = 0;
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -48,7 +48,7 @@ static DECLFW(M177Write)
|
||||
static void M177Power(void)
|
||||
{
|
||||
reg=0;
|
||||
Sync();
|
||||
Sync();
|
||||
SetReadHandler(0x6000,0x7fff,CartBR);
|
||||
SetWriteHandler(0x6000,0x7fff,CartBW);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
|
@ -15,57 +15,56 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[3];
|
||||
static uint8 reg[4];
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{reg, 3, "REGS"},
|
||||
{reg, 4, "REGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setmirror(reg[0]);
|
||||
uint8 bank = (reg[2]&3)<<3;
|
||||
setmirror((reg[0]&1)^1);
|
||||
setprg8r(0x10,0x6000,0);
|
||||
setchr8(0);
|
||||
setprg32(0x8000,(reg[1]+reg[2])&0xf);
|
||||
if(reg[0]&2)
|
||||
{
|
||||
setprg16(0x8000,(reg[1]&7)|bank);
|
||||
setprg16(0xC000,((~0)&7)|bank);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,(reg[1]&6)|bank);
|
||||
setprg16(0xC000,(reg[1]&6)|bank|1);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M178Write0)
|
||||
static DECLFW(M178Write)
|
||||
{
|
||||
reg[0]=(V&1)^1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M178Write1)
|
||||
{
|
||||
reg[1]=(V>>1)&0xf;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M178Write2)
|
||||
{
|
||||
reg[2]=(V<<2)&0xf;
|
||||
reg[A&3]=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M178Power(void)
|
||||
{
|
||||
reg[0]=1; reg[1]=0; reg[2]=0;
|
||||
reg[0]=1;
|
||||
reg[1]=0;
|
||||
reg[2]=0;
|
||||
reg[3]=0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x4800,0x4800,M178Write0);
|
||||
SetWriteHandler(0x4801,0x4801,M178Write1);
|
||||
SetWriteHandler(0x4802,0x4802,M178Write2);
|
||||
SetWriteHandler(0x4800,0x4803,M178Write);
|
||||
}
|
||||
|
||||
static void M178Close(void)
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -54,7 +54,7 @@ static DECLFW(M179WriteLo)
|
||||
static void M179Power(void)
|
||||
{
|
||||
reg[0]=reg[1]=0;
|
||||
Sync();
|
||||
Sync();
|
||||
SetWriteHandler(0x4020,0x5fff,M179WriteLo);
|
||||
SetReadHandler(0x6000,0x7fff,CartBR);
|
||||
SetWriteHandler(0x6000,0x7fff,CartBW);
|
||||
|
121
source/fceultra/boards/18.cpp
Normal file
121
source/fceultra/boards/18.cpp
Normal file
@ -0,0 +1,121 @@
|
||||
/* 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 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]);
|
||||
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)
|
||||
{
|
||||
preg[0] = 0;
|
||||
preg[1] = 1;
|
||||
preg[2] = ~1;
|
||||
preg[3] = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0x9FFF,M18WritePrg);
|
||||
SetWriteHandler(0xA000,0xDFFF,M18WriteChr);
|
||||
SetWriteHandler(0xE000,0xFFFF,M18WriteIRQ);
|
||||
}
|
||||
|
||||
static void M18IRQHook(int a)
|
||||
{
|
||||
if(IRQa && IRQCount)
|
||||
{
|
||||
IRQCount-=a;
|
||||
if(IRQCount<=0)
|
||||
{
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount=0;
|
||||
IRQa=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper18_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M18Power;
|
||||
MapIRQHook=M18IRQHook;
|
||||
GameStateRestore=StateRestore;
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Gimmick Bootleg (VRC4 mapper)
|
||||
*/
|
||||
@ -32,8 +32,8 @@ static SFORMAT StateRegs[]=
|
||||
{
|
||||
{prg, 4, "PRG"},
|
||||
{chr, 8, "CHR"},
|
||||
{&IRQCount, 1, "IRQCOUNT"},
|
||||
{&IRQPre, 1, "IRQPRE"},
|
||||
{&IRQCount, 1, "IRQC"},
|
||||
{&IRQPre, 1, "IRQP"},
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{0}
|
||||
};
|
||||
@ -64,7 +64,7 @@ static DECLFW(M183Write)
|
||||
{
|
||||
if(((A&0xF80C)>=0xB000)&&((A&0xF80C)<=0xE00C))
|
||||
{
|
||||
uint8 index=(((A>>11)-6)|(A>>3))&7;
|
||||
int index=(((A>>11)-6)|(A>>3))&7;
|
||||
chr[index]=(chr[index]&(0xF0>>(A&4)))|((V&0x0F)<<(A&4));
|
||||
SyncChr();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Family Study Box by Fukutake Shoten
|
||||
*/
|
||||
@ -29,7 +29,7 @@ static uint8 regs[4];
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{regs, 4, "DREG"},
|
||||
{SWRAM, 2816, "SWRAM"},
|
||||
{SWRAM, 2816, "SWRM"},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -35,7 +35,12 @@ static void M187PW(uint32 A, uint8 V)
|
||||
{
|
||||
uint8 bank=EXPREGS[0]&0x1F;
|
||||
if(EXPREGS[0]&0x20)
|
||||
setprg32(0x8000,bank>>2);
|
||||
{
|
||||
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);
|
||||
@ -48,28 +53,19 @@ static void M187PW(uint32 A, uint8 V)
|
||||
|
||||
static DECLFW(M187Write8000)
|
||||
{
|
||||
EXPREGS[2]=1;
|
||||
EXPREGS[1]=1;
|
||||
MMC3_CMDWrite(A,V);
|
||||
}
|
||||
|
||||
static DECLFW(M187Write8001)
|
||||
{
|
||||
if(EXPREGS[2])
|
||||
if(EXPREGS[1])
|
||||
MMC3_CMDWrite(A,V);
|
||||
}
|
||||
|
||||
static DECLFW(M187Write8003)
|
||||
{
|
||||
EXPREGS[2]=0;
|
||||
if(V==0x28)setprg8(0xC000,0x17);
|
||||
else if(V==0x2A)setprg8(0xA000,0x0F);
|
||||
}
|
||||
|
||||
|
||||
static DECLFW(M187WriteLo)
|
||||
{
|
||||
EXPREGS[1]=V;
|
||||
if(A==0x5000)
|
||||
if((A==0x5000)||(A==0x6000))
|
||||
{
|
||||
EXPREGS[0]=V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
@ -84,13 +80,12 @@ static DECLFR(M187Read)
|
||||
|
||||
static void M187Power(void)
|
||||
{
|
||||
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=0;
|
||||
EXPREGS[0]=EXPREGS[1]=0;
|
||||
GenMMC3Power();
|
||||
SetReadHandler(0x5000,0x5FFF,M187Read);
|
||||
SetWriteHandler(0x5000,0x5FFF,M187WriteLo);
|
||||
SetWriteHandler(0x5000,0x6FFF,M187WriteLo);
|
||||
SetWriteHandler(0x8000,0x8000,M187Write8000);
|
||||
SetWriteHandler(0x8001,0x8001,M187Write8001);
|
||||
SetWriteHandler(0x8003,0x8003,M187Write8003);
|
||||
}
|
||||
|
||||
void Mapper187_Init(CartInfo *info)
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
static void M189PW(uint32 A, uint8 V)
|
||||
{
|
||||
setprg32(0x8000,EXPREGS[0]&3);
|
||||
setprg32(0x8000,EXPREGS[0]&7);
|
||||
}
|
||||
|
||||
static DECLFW(M189Write)
|
||||
|
@ -1,82 +1,77 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 cmd;
|
||||
static uint8 DRegs[8];
|
||||
|
||||
static SFORMAT DEI_StateRegs[]=
|
||||
{
|
||||
{&cmd, 1, "CMD"},
|
||||
{DRegs, 8, "DREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int x;
|
||||
setchr2(0x0000,DRegs[0]);
|
||||
setchr2(0x0800,DRegs[1]);
|
||||
for(x=0;x<4;x++)
|
||||
setchr1(0x1000+(x<<10),DRegs[2+x]);
|
||||
setprg8(0x8000,DRegs[6]);
|
||||
setprg8(0xa000,DRegs[7]);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(DEIWrite)
|
||||
{
|
||||
switch(A&0x8001)
|
||||
{
|
||||
case 0x8000: cmd=V&0x07; break;
|
||||
case 0x8001: if(cmd<=0x05)
|
||||
V&=0x3F;
|
||||
else
|
||||
V&=0x0F;
|
||||
if(cmd<=0x01) V>>=1;
|
||||
DRegs[cmd&0x07]=V;
|
||||
Sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void DEIPower(void)
|
||||
{
|
||||
setprg8(0xc000,0xE);
|
||||
setprg8(0xe000,0xF);
|
||||
cmd=0;
|
||||
memset(DRegs,0,8);
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,DEIWrite);
|
||||
}
|
||||
|
||||
|
||||
void DEIROM_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=DEIPower;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&DEI_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 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);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* 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)
|
||||
@ -26,7 +26,8 @@
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 *CHRRAM=NULL; // and here too
|
||||
static uint8 *CHRRAM=NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static void M199PW(uint32 A, uint8 V)
|
||||
{
|
||||
@ -60,12 +61,11 @@ static DECLFW(M199Write)
|
||||
{
|
||||
if((A==0x8001)&&(MMC3_cmd&8))
|
||||
{
|
||||
// FCEU_printf("%02x=>%02x\n",MMC3_cmd,V);
|
||||
EXPREGS[MMC3_cmd&3]=V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
else
|
||||
else
|
||||
if(A<0xC000)
|
||||
MMC3_CMDWrite(A,V);
|
||||
else
|
||||
@ -82,16 +82,26 @@ static void M199Power(void)
|
||||
SetWriteHandler(0x8000,0xFFFF,M199Write);
|
||||
}
|
||||
|
||||
static void M199Close(void)
|
||||
{
|
||||
if(CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM=NULL;
|
||||
}
|
||||
|
||||
void Mapper199_Init(CartInfo *info)
|
||||
{
|
||||
int CHRRAMSize=1024*8;
|
||||
GenMMC3_Init(info, 512, 256, 8, info->battery);
|
||||
cwrap=M199CW;
|
||||
pwrap=M199PW;
|
||||
mwrap=M199MW;
|
||||
info->Power=M199Power;
|
||||
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
|
||||
AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
|
||||
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");
|
||||
}
|
||||
|
77
source/fceultra/boards/206.cpp
Normal file
77
source/fceultra/boards/206.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* 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 cmd;
|
||||
static uint8 DRegs[8];
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &cmd, 1, "CMD" },
|
||||
{ DRegs, 8, "DREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setchr2(0x0000, DRegs[0]);
|
||||
setchr2(0x0800, DRegs[1]);
|
||||
int x;
|
||||
for (x = 0; x < 4; x++)
|
||||
setchr1(0x1000 + (x << 10), DRegs[2 + x]);
|
||||
setprg8(0x8000, DRegs[6]);
|
||||
setprg8(0xa000, DRegs[7]);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M206Write) {
|
||||
switch (A & 0x8001) {
|
||||
case 0x8000: cmd = V & 0x07; break;
|
||||
case 0x8001:
|
||||
if (cmd <= 0x05)
|
||||
V &= 0x3F;
|
||||
else
|
||||
V &= 0x0F;
|
||||
if (cmd <= 0x01) V >>= 1;
|
||||
DRegs[cmd & 0x07] = V;
|
||||
Sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M206Power(void) {
|
||||
setprg8(0xc000, 0xE);
|
||||
setprg8(0xe000, 0xF);
|
||||
cmd = 0;
|
||||
memset(DRegs, 0, 8);
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M206Write);
|
||||
}
|
||||
|
||||
|
||||
void Mapper206_Init(CartInfo *info) {
|
||||
info->Power = M206Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
@ -15,29 +15,29 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* 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
|
||||
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)
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
* (VRC4 mapper)
|
||||
*/
|
||||
|
||||
@ -76,7 +76,7 @@ static DECLFW(M222Write)
|
||||
case 0xE000: chr_reg[6]=V; break;
|
||||
case 0xE002: chr_reg[7]=V; break;
|
||||
// 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 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;
|
||||
|
96
source/fceultra/boards/225.cpp
Normal file
96
source/fceultra/boards/225.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
/* 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 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
84
source/fceultra/boards/228.cpp
Normal file
84
source/fceultra/boards/228.cpp
Normal file
@ -0,0 +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 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;
|
||||
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);
|
||||
}
|
@ -1,208 +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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 is23;
|
||||
static uint16 IRQCount;
|
||||
static uint8 IRQLatch,IRQa;
|
||||
static uint8 prgreg[2];
|
||||
static uint8 chrreg[8];
|
||||
static uint8 regcmd, irqcmd, mirr, big_bank;
|
||||
static uint16 acount=0;
|
||||
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{prgreg, 2, "PRGREGS"},
|
||||
{chrreg, 8, "CHRREGS"},
|
||||
{®cmd, 1, "REGCMD"},
|
||||
{&irqcmd, 1, "IRQCMD"},
|
||||
{&mirr, 1, "MIRR"},
|
||||
{&big_bank, 1, "MIRR"},
|
||||
{&IRQCount, 2, "IRQC"},
|
||||
{&IRQLatch, 1, "IRQL"},
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
if(regcmd&2)
|
||||
{
|
||||
setprg8(0xC000,prgreg[0]|big_bank);
|
||||
setprg8(0x8000,((~1)&0x1F)|big_bank);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000,prgreg[0]|big_bank);
|
||||
setprg8(0xC000,((~1)&0x1F)|big_bank);
|
||||
}
|
||||
setprg8(0xA000,prgreg[1]|big_bank);
|
||||
setprg8(0xE000,((~0)&0x1F)|big_bank);
|
||||
if(UNIFchrrama)
|
||||
setchr8(0);
|
||||
else
|
||||
{
|
||||
uint8 i;
|
||||
for(i=0; i<8; i++)
|
||||
setchr1(i<<10, chrreg[i]);
|
||||
}
|
||||
switch(mirr&0x3)
|
||||
{
|
||||
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(M23Write)
|
||||
{
|
||||
// FCEU_printf("%04x:%04x\n",A,V);
|
||||
A|=((A>>2)&0x3)|((A>>4)&0x3)|((A>>6)&0x3); // actually there is many-in-one mapper source, some pirate or
|
||||
// licensed games use various address bits for registers
|
||||
A&=0xF003;
|
||||
if((A>=0xB000)&&(A<=0xE003))
|
||||
{
|
||||
if(UNIFchrrama)
|
||||
big_bank=(V&8)<<2; // my personally many-in-one feature ;) just for support pirate cart 2-in-1
|
||||
else
|
||||
{
|
||||
uint16 i=((A>>1)&1)|((A-0xB000)>>11);
|
||||
chrreg[i]&=(0xF0)>>((A&1)<<2);
|
||||
chrreg[i]|=(V&0xF)<<((A&1)<<2);
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
else
|
||||
switch(A&0xF003)
|
||||
{
|
||||
case 0x8000:
|
||||
case 0x8001:
|
||||
case 0x8002:
|
||||
case 0x8003: if(is23)
|
||||
prgreg[0]=V&0x1F;
|
||||
Sync();
|
||||
break;
|
||||
case 0xA000:
|
||||
case 0xA001:
|
||||
case 0xA002:
|
||||
case 0xA003: if(is23)
|
||||
prgreg[1]=V&0x1F;
|
||||
else
|
||||
{
|
||||
prgreg[0]=(V<<1)&0x1F;
|
||||
prgreg[1]=((V<<1)&0x1F)|1;
|
||||
}
|
||||
Sync();
|
||||
break;
|
||||
case 0x9000:
|
||||
case 0x9001: if(V!=0xFF) mirr=V; Sync(); break;
|
||||
case 0x9002:
|
||||
case 0x9003: regcmd=V; Sync(); break;
|
||||
case 0xF000: X6502_IRQEnd(FCEU_IQEXT); IRQLatch&=0xF0; IRQLatch|=V&0xF; break;
|
||||
case 0xF001: X6502_IRQEnd(FCEU_IQEXT); IRQLatch&=0x0F; IRQLatch|=V<<4; break;
|
||||
case 0xF002: X6502_IRQEnd(FCEU_IQEXT); acount=0; IRQCount=IRQLatch; IRQa=V&2; irqcmd=V&1; break;
|
||||
case 0xF003: X6502_IRQEnd(FCEU_IQEXT); IRQa=irqcmd; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M23Power(void)
|
||||
{
|
||||
big_bank=0x20;
|
||||
Sync();
|
||||
setprg8r(0x10,0x6000,0); // another many-in-one code, WRAM actually contain only WaiWaiWorld game
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M23Write);
|
||||
}
|
||||
|
||||
static void M23Reset(void)
|
||||
{
|
||||
}
|
||||
|
||||
void M23IRQHook(int a)
|
||||
{
|
||||
#define LCYCS 341
|
||||
if(IRQa)
|
||||
{
|
||||
acount+=a*3;
|
||||
if(acount>=LCYCS)
|
||||
{
|
||||
while(acount>=LCYCS)
|
||||
{
|
||||
acount-=LCYCS;
|
||||
IRQCount++;
|
||||
if(IRQCount&0x100)
|
||||
{
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount=IRQLatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M23Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
}
|
||||
|
||||
void Mapper23_Init(CartInfo *info)
|
||||
{
|
||||
is23=1;
|
||||
info->Power=M23Power;
|
||||
info->Close=M23Close;
|
||||
MapIRQHook=M23IRQHook;
|
||||
GameStateRestore=StateRestore;
|
||||
|
||||
WRAMSIZE=8192;
|
||||
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void UNLT230_Init(CartInfo *info)
|
||||
{
|
||||
is23=0;
|
||||
info->Power=M23Power;
|
||||
info->Close=M23Close;
|
||||
MapIRQHook=M23IRQHook;
|
||||
GameStateRestore=StateRestore;
|
||||
|
||||
WRAMSIZE=8192;
|
||||
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
78
source/fceultra/boards/230.cpp
Normal file
78
source/fceultra/boards/230.cpp
Normal file
@ -0,0 +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;
|
||||
}
|
68
source/fceultra/boards/232.cpp
Normal file
68
source/fceultra/boards/232.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
/* 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;
|
||||
}
|
79
source/fceultra/boards/234.cpp
Normal file
79
source/fceultra/boards/234.cpp
Normal file
@ -0,0 +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;
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -23,7 +23,7 @@
|
||||
static uint16 cmdreg;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&cmdreg, 2, "CMDREG"},
|
||||
{&cmdreg, 2, "CREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
77
source/fceultra/boards/244.cpp
Normal file
77
source/fceultra/boards/244.cpp
Normal file
@ -0,0 +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;
|
||||
}
|
86
source/fceultra/boards/246.cpp
Normal file
86
source/fceultra/boards/246.cpp
Normal file
@ -0,0 +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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
134
source/fceultra/boards/252.cpp
Normal file
134
source/fceultra/boards/252.cpp
Normal file
@ -0,0 +1,134 @@
|
||||
/* 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
@ -15,161 +15,136 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* 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 int32 IRQa, IRQCount, IRQLatch, IRQClock;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 *CHRRAM=NULL;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{chrlo, 8, "CHRLO"},
|
||||
{chrhi, 8, "CHRHI"},
|
||||
{prg, 2, "PRGR"},
|
||||
{&mirr, 1, "MIRR"},
|
||||
{&vlock, 1, "VLOCK"},
|
||||
{&IRQa, 4, "IRQA"},
|
||||
{&IRQCount, 4, "IRQC"},
|
||||
{&IRQLatch, 4, "IRQL"},
|
||||
{&IRQClock, 4, "IRQCL"},
|
||||
{0}
|
||||
{ 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]==0xc8)
|
||||
{
|
||||
vlock = 0;
|
||||
continue;
|
||||
}
|
||||
else if(chrlo[i]==0x88)
|
||||
{
|
||||
vlock = 1;
|
||||
continue;
|
||||
}
|
||||
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 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] == 0xc8) {
|
||||
vlock = 0;
|
||||
continue;
|
||||
} else if (chrlo[i] == 0x88) {
|
||||
vlock = 1;
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
chrlo[ind]=(chrlo[ind]&(0xF0>>sar))|((V&0x0F)<<sar);
|
||||
if(A&4)
|
||||
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: IRQLatch = (IRQLatch & 0xF0) | (V & 0x0F); break;
|
||||
case 0xF004: IRQLatch = (IRQLatch & 0x0F) | (V << 4); break;
|
||||
case 0xF008:
|
||||
IRQa = V&3;
|
||||
if(IRQa&2)
|
||||
{
|
||||
IRQCount = IRQLatch;
|
||||
IRQClock = 0;
|
||||
}
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
break;
|
||||
}
|
||||
static DECLFW(M253Write) {
|
||||
if ((A >= 0xB000) && (A <= 0xE00C)) {
|
||||
uint8 ind = ((((A & 8) | (A >> 8)) >> 3) + 2) & 7;
|
||||
uint8 sar = A & 4;
|
||||
chrlo[ind] = (chrlo[ind] & (0xF0 >> sar)) | ((V & 0x0F) << sar);
|
||||
if (A & 4)
|
||||
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)
|
||||
{
|
||||
Sync();
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M253Write);
|
||||
static void M253Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M253Write);
|
||||
}
|
||||
|
||||
static void M253Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if(CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
WRAM=CHRRAM=NULL;
|
||||
static void M253Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
WRAM = CHRRAM = NULL;
|
||||
}
|
||||
|
||||
static void M253IRQ(int cycles)
|
||||
{
|
||||
if(IRQa&2)
|
||||
{
|
||||
if((IRQClock+=cycles)>=0x72)
|
||||
{
|
||||
IRQClock -= 0x72;
|
||||
if(IRQCount==0xFF)
|
||||
{
|
||||
IRQCount = IRQLatch;
|
||||
IRQa = IRQa|((IRQa&1)<<1);
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
else
|
||||
IRQCount++;
|
||||
}
|
||||
}
|
||||
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();
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper253_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M253Power;
|
||||
info->Close=M253Close;
|
||||
MapIRQHook=M253IRQ;
|
||||
GameStateRestore=StateRestore;
|
||||
void Mapper253_Init(CartInfo *info) {
|
||||
info->Power = M253Power;
|
||||
info->Close = M253Close;
|
||||
MapIRQHook = M253IRQ;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
CHRRAMSIZE=4096;
|
||||
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10,CHRRAM,CHRRAMSIZE,1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
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;
|
||||
}
|
||||
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);
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
217
source/fceultra/boards/28.cpp
Normal file
217
source/fceultra/boards/28.cpp
Normal file
@ -0,0 +1,217 @@
|
||||
/*
|
||||
Copyright (C) 2012 FCEUX team
|
||||
|
||||
This file 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 file 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 the this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
// http://wiki.nesdev.com/w/index.php/INES_Mapper_028
|
||||
|
||||
//config
|
||||
static int prg_mask_16k;
|
||||
|
||||
// state
|
||||
uint8 reg;
|
||||
uint8 chr;
|
||||
uint8 prg;
|
||||
uint8 mode;
|
||||
uint8 outer;
|
||||
|
||||
void SyncMirror()
|
||||
{
|
||||
switch (mode & 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;
|
||||
}
|
||||
}
|
||||
|
||||
void Mirror(uint8 value)
|
||||
{
|
||||
if ((mode & 2) == 0)
|
||||
{
|
||||
mode &= 0xfe;
|
||||
mode |= value >> 4 & 1;
|
||||
}
|
||||
SyncMirror();
|
||||
}
|
||||
|
||||
|
||||
static void Sync()
|
||||
{
|
||||
int prglo;
|
||||
int prghi;
|
||||
|
||||
int outb = outer << 1;
|
||||
//this can probably be rolled up, but i have no motivation to do so
|
||||
//until it's been tested
|
||||
switch (mode & 0x3c)
|
||||
{
|
||||
//32K modes
|
||||
case 0x00:
|
||||
case 0x04:
|
||||
prglo = outb;
|
||||
prghi = outb | 1;
|
||||
break;
|
||||
case 0x10:
|
||||
case 0x14:
|
||||
prglo = outb & ~2 | prg << 1 & 2;
|
||||
prghi = outb & ~2 | prg << 1 & 2 | 1;
|
||||
break;
|
||||
case 0x20:
|
||||
case 0x24:
|
||||
prglo = outb & ~6 | prg << 1 & 6;
|
||||
prghi = outb & ~6 | prg << 1 & 6 | 1;
|
||||
break;
|
||||
case 0x30:
|
||||
case 0x34:
|
||||
prglo = outb & ~14 | prg << 1 & 14;
|
||||
prghi = outb & ~14 | prg << 1 & 14 | 1;
|
||||
break;
|
||||
//bottom fixed modes
|
||||
case 0x08:
|
||||
prglo = outb;
|
||||
prghi = outb | prg & 1;
|
||||
break;
|
||||
case 0x18:
|
||||
prglo = outb;
|
||||
prghi = outb & ~2 | prg & 3;
|
||||
break;
|
||||
case 0x28:
|
||||
prglo = outb;
|
||||
prghi = outb & ~6 | prg & 7;
|
||||
break;
|
||||
case 0x38:
|
||||
prglo = outb;
|
||||
prghi = outb & ~14 | prg & 15;
|
||||
break;
|
||||
//top fixed modes
|
||||
case 0x0c:
|
||||
prglo = outb | prg & 1;
|
||||
prghi = outb | 1;
|
||||
break;
|
||||
case 0x1c:
|
||||
prglo = outb & ~2 | prg & 3;
|
||||
prghi = outb | 1;
|
||||
break;
|
||||
case 0x2c:
|
||||
prglo = outb & ~6 | prg & 7;
|
||||
prghi = outb | 1;
|
||||
break;
|
||||
case 0x3c:
|
||||
prglo = outb & ~14 | prg & 15;
|
||||
prghi = outb | 1;
|
||||
break;
|
||||
}
|
||||
prglo &= prg_mask_16k;
|
||||
prghi &= prg_mask_16k;
|
||||
|
||||
setprg16(0x8000, prglo);
|
||||
setprg16(0xC000, prghi);
|
||||
setchr8(chr);
|
||||
}
|
||||
|
||||
static DECLFW(WriteEXP)
|
||||
{
|
||||
uint32 addr = A;
|
||||
uint8 value = V;
|
||||
if (addr >= 05000)
|
||||
reg = value & 0x81;
|
||||
}
|
||||
|
||||
static DECLFW(WritePRG)
|
||||
{
|
||||
uint32 addr = A;
|
||||
uint8 value = V;
|
||||
switch (reg)
|
||||
{
|
||||
case 0x00:
|
||||
chr = value & 3;
|
||||
Mirror(value);
|
||||
break;
|
||||
case 0x01:
|
||||
prg = value & 15;
|
||||
Mirror(value);
|
||||
Sync();
|
||||
break;
|
||||
case 0x80:
|
||||
mode = value & 63;
|
||||
SyncMirror();
|
||||
Sync();
|
||||
break;
|
||||
case 0x81:
|
||||
outer = value & 63;
|
||||
Sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void M28Reset(void)
|
||||
{
|
||||
outer = 63;
|
||||
prg = 15;
|
||||
Sync();
|
||||
}
|
||||
|
||||
|
||||
static void M28Power(void)
|
||||
{
|
||||
prg_mask_16k = PRGsize[0] - 1;
|
||||
|
||||
//EXP
|
||||
SetWriteHandler(0x4020,0x5FFF,WriteEXP);
|
||||
|
||||
//PRG
|
||||
SetWriteHandler(0x8000,0xFFFF,WritePRG);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
|
||||
//WRAM
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
|
||||
M28Reset();
|
||||
}
|
||||
|
||||
static void M28Close(void)
|
||||
{
|
||||
}
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{®, 1, "REG"},
|
||||
{&chr, 1, "CHR"},
|
||||
{&prg, 1, "PRG"},
|
||||
{&mode, 1, "MODE"},
|
||||
{&outer, 1, "OUTR"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper28_Init(CartInfo* info)
|
||||
{
|
||||
info->Power=M28Power;
|
||||
info->Reset=M28Reset;
|
||||
info->Close=M28Close;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
102
source/fceultra/boards/32.cpp
Normal file
102
source/fceultra/boards/32.cpp
Normal file
@ -0,0 +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) {
|
||||
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);
|
||||
uint8 i;
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
117
source/fceultra/boards/33.cpp
Normal file
117
source/fceultra/boards/33.cpp
Normal file
@ -0,0 +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);
|
||||
}
|
||||
|
92
source/fceultra/boards/34.cpp
Normal file
92
source/fceultra/boards/34.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
/* 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
63
source/fceultra/boards/36.cpp
Normal file
63
source/fceultra/boards/36.cpp
Normal file
@ -0,0 +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);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -54,7 +54,7 @@ static DECLFW(UNL3DBlockWrite)
|
||||
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)
|
||||
@ -87,7 +87,7 @@ static void UNL3DBlockIRQHook(int a)
|
||||
}
|
||||
else
|
||||
{
|
||||
IRQCount=Count;
|
||||
IRQCount=Count;
|
||||
IRQPause=Pause;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
}
|
||||
|
85
source/fceultra/boards/40.cpp
Normal file
85
source/fceultra/boards/40.cpp
Normal file
@ -0,0 +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 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);
|
||||
}
|
69
source/fceultra/boards/41.cpp
Normal file
69
source/fceultra/boards/41.cpp
Normal file
@ -0,0 +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 mainreg, chrreg, mirror;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &mainreg, 1, "MREG" },
|
||||
{ &chrreg, 1, "CREG" },
|
||||
{ &mirror, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, mainreg & 7);
|
||||
setchr8(chrreg);
|
||||
setmirror(mirror);
|
||||
}
|
||||
|
||||
static DECLFW(M41Write0) {
|
||||
mainreg = A & 0xFF;
|
||||
mirror = ((A >> 5) & 1) ^ 1;
|
||||
chrreg = (chrreg & 3) | ((A >> 1) & 0xC);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M41Write1) {
|
||||
if (mainreg & 0x4) {
|
||||
chrreg = (chrreg & 0xC) | (A & 3);
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void M41Power(void) {
|
||||
mainreg = chrreg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x67FF, M41Write0);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M41Write1);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper41_Init(CartInfo *info) {
|
||||
info->Power = M41Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// actually cart ID is 811120-C, sorry ;) K-3094 - another ID
|
||||
|
83
source/fceultra/boards/42.cpp
Normal file
83
source/fceultra/boards/42.cpp
Normal file
@ -0,0 +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 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);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//ccording to nestopia, BTL_SMB2_C, otherwise known as UNL-SMB2J
|
||||
@ -23,72 +23,63 @@
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
static uint8 IRQa;
|
||||
static uint32 IRQCount;
|
||||
static uint32 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{&IRQCount, 4, "IRQC"},
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{®, 1, "REG"},
|
||||
{0}
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 4, "IRQA" },
|
||||
{ ®, 1, "REG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg4(0x5000,16);
|
||||
setprg8(0x6000,2);
|
||||
setprg8(0x8000,1);
|
||||
setprg8(0xa000,0);
|
||||
setprg8(0xc000,reg);
|
||||
setprg8(0xe000,9);
|
||||
setchr8(0);
|
||||
static void Sync(void) {
|
||||
setprg4(0x5000, 16); // Only YS-612 advdnced version
|
||||
setprg8(0x6000, 2);
|
||||
setprg8(0x8000, 1);
|
||||
setprg8(0xa000, 0);
|
||||
setprg8(0xc000, reg);
|
||||
setprg8(0xe000, 9);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M43Write)
|
||||
{
|
||||
int transo[8]={4,3,4,4,4,7,5,6};
|
||||
switch(A&0xf1ff)
|
||||
{
|
||||
case 0x4022: reg=transo[V&7]; Sync(); break;
|
||||
case 0x8122: IRQa=V&1; IRQCount=0; break;
|
||||
}
|
||||
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 0x8122: // hacked version
|
||||
case 0x4122: IRQa = V & 1; X6502_IRQEnd(FCEU_IQEXT); IRQCount = 0; break; // original version
|
||||
}
|
||||
}
|
||||
|
||||
static void M43Power(void)
|
||||
{
|
||||
reg=0;
|
||||
Sync();
|
||||
// SetReadHandler(0x5000,0x5fff,CartBR);
|
||||
SetReadHandler(0x5000,0xffff,CartBR);
|
||||
SetWriteHandler(0x4020,0xffff,M43Write);
|
||||
static void M43Power(void) {
|
||||
reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x5000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x4020, 0xffff, M43Write);
|
||||
}
|
||||
|
||||
static void M43Reset(void)
|
||||
{
|
||||
static void M43Reset(void) {
|
||||
}
|
||||
|
||||
static void M43IRQHook(int a)
|
||||
{
|
||||
IRQCount+=a;
|
||||
if(IRQa)
|
||||
if(IRQCount>=4096)
|
||||
{
|
||||
IRQa=0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
static void M43IRQHook(int a) {
|
||||
IRQCount += a;
|
||||
if (IRQa)
|
||||
if (IRQCount >= 4096) {
|
||||
IRQa = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
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);
|
||||
void Mapper43_Init(CartInfo *info) {
|
||||
info->Reset = M43Reset;
|
||||
info->Power = M43Power;
|
||||
MapIRQHook = M43IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
69
source/fceultra/boards/46.cpp
Normal file
69
source/fceultra/boards/46.cpp
Normal file
@ -0,0 +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 reg0, reg1;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ ®0, 1, "REG0" },
|
||||
{ ®1, 1, "REG1" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg32(0x8000, (reg1 & 1) + ((reg0 & 0xF) << 1));
|
||||
setchr8(((reg1 >> 4) & 7) + ((reg0 & 0xF0) >> 1));
|
||||
}
|
||||
|
||||
static DECLFW(M46Write0) {
|
||||
reg0 = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M46Write1) {
|
||||
reg1 = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M46Power(void) {
|
||||
reg0 = reg1 = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, M46Write0);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M46Write1);
|
||||
}
|
||||
|
||||
static void M46Reset(void) {
|
||||
reg0 = reg1 = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper46_Init(CartInfo *info) {
|
||||
info->Power = M46Power;
|
||||
info->Reset = M46Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
84
source/fceultra/boards/50.cpp
Normal file
84
source/fceultra/boards/50.cpp
Normal file
@ -0,0 +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 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);
|
||||
}
|
84
source/fceultra/boards/51.cpp
Normal file
84
source/fceultra/boards/51.cpp
Normal file
@ -0,0 +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;
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
@ -27,7 +27,7 @@ static uint8 hrd_flag;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&hrd_flag, 1, "DIPSW"},
|
||||
{&hrd_flag, 1, "DPSW"},
|
||||
{&prg_reg, 1, "PRG"},
|
||||
{&chr_reg, 1, "CHR"},
|
||||
{0}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -25,7 +25,7 @@ static uint8 lut[4] = { 0x00, 0x02, 0x02, 0x03 };
|
||||
|
||||
static DECLFW(UNL6035052ProtWrite)
|
||||
{
|
||||
EXPREGS[0]=lut[V&3];
|
||||
EXPREGS[0]=lut[V&3];
|
||||
}
|
||||
|
||||
static DECLFR(UNL6035052ProtRead)
|
||||
|
69
source/fceultra/boards/62.cpp
Normal file
69
source/fceultra/boards/62.cpp
Normal file
@ -0,0 +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;
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -32,8 +32,8 @@ static SFORMAT StateRegs[]=
|
||||
{&nt2, 1, "NT2"},
|
||||
{&mirr, 1, "MIRR"},
|
||||
{&prg_reg, 1, "PRG"},
|
||||
{&kogame, 1, "KOGAME"},
|
||||
{&count, 4, "COUNT"},
|
||||
{&kogame, 1, "KGME"},
|
||||
{&count, 4, "CNT"},
|
||||
{chr_reg, 4, "CHR"},
|
||||
{0}
|
||||
};
|
||||
@ -92,7 +92,7 @@ static DECLFR(M68Read)
|
||||
static DECLFW(M68WriteLo)
|
||||
{
|
||||
if(!V)
|
||||
{
|
||||
{
|
||||
count = 0;
|
||||
setprg16r((PRGptr[1])?kogame:0,0x8000,prg_reg);
|
||||
}
|
||||
@ -106,13 +106,13 @@ static DECLFW(M68WriteCHR)
|
||||
|
||||
static DECLFW(M68WriteNT1)
|
||||
{
|
||||
nt1 = V;
|
||||
nt1 = V;
|
||||
M68NTfix();
|
||||
}
|
||||
|
||||
static DECLFW(M68WriteNT2)
|
||||
{
|
||||
nt2 = V;
|
||||
nt2 = V;
|
||||
M68NTfix();
|
||||
}
|
||||
|
||||
|
64
source/fceultra/boards/71.cpp
Normal file
64
source/fceultra/boards/71.cpp
Normal file
@ -0,0 +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);
|
||||
}
|
64
source/fceultra/boards/72.cpp
Normal file
64
source/fceultra/boards/72.cpp
Normal file
@ -0,0 +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);
|
||||
}
|
75
source/fceultra/boards/77.cpp
Normal file
75
source/fceultra/boards/77.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
/* 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);
|
||||
}
|
60
source/fceultra/boards/79.cpp
Normal file
60
source/fceultra/boards/79.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
/* 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 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;
|
||||
}
|
192
source/fceultra/boards/80.cpp
Normal file
192
source/fceultra/boards/80.cpp
Normal file
@ -0,0 +1,192 @@
|
||||
/* 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[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 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);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -24,8 +24,8 @@ static uint16 cmdreg;
|
||||
static uint8 invalid_data;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&invalid_data, 1, "INVD"},
|
||||
{&cmdreg, 2, "CMDREG"},
|
||||
{&invalid_data, 1, "INVD"},
|
||||
{&cmdreg, 2, "CREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
102
source/fceultra/boards/82.cpp
Normal file
102
source/fceultra/boards/82.cpp
Normal file
@ -0,0 +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 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
|
||||
}
|
||||
|
||||
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->Power=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);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Super Game (Sugar Softec) protected mapper
|
||||
* Pocahontas 2 (Unl) [U][!], etc.
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
static uint8 cmdin;
|
||||
|
||||
static uint8 regperm[8][8] =
|
||||
static uint8 regperm[8][8] =
|
||||
{
|
||||
{0, 1, 2, 3, 4, 5, 6, 7},
|
||||
{0, 2, 6, 1, 7, 3, 4, 5},
|
||||
@ -39,7 +39,7 @@ static uint8 regperm[8][8] =
|
||||
{0, 1, 2, 3, 4, 5, 6, 7}, // empty
|
||||
};
|
||||
|
||||
static uint8 adrperm[8][8] =
|
||||
static uint8 adrperm[8][8] =
|
||||
{
|
||||
{0, 1, 2, 3, 4, 5, 6, 7},
|
||||
{3, 2, 0, 4, 1, 5, 6, 7},
|
||||
@ -151,7 +151,7 @@ static DECLFW(UNL8237Write)
|
||||
dat = (dat & 0xC0)|(regperm[EXPREGS[2]][dat & 7]);
|
||||
MMC3_CMDWrite(addr,dat);
|
||||
}
|
||||
else
|
||||
else
|
||||
MMC3_IRQWrite(addr,dat);
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ void UNL8237_Init(CartInfo *info)
|
||||
pwrap=UNL8237PW;
|
||||
info->Power=UNL8237Power;
|
||||
AddExState(EXPREGS, 3, 0, "EXPR");
|
||||
AddExState(&cmdin, 1, 0, "CMDIN");
|
||||
AddExState(&cmdin, 1, 0, "CMDI");
|
||||
}
|
||||
|
||||
void UNL8237A_Init(CartInfo *info)
|
||||
@ -191,5 +191,5 @@ void UNL8237A_Init(CartInfo *info)
|
||||
pwrap=UNL8237APW;
|
||||
info->Power=UNL8237Power;
|
||||
AddExState(EXPREGS, 3, 0, "EXPR");
|
||||
AddExState(&cmdin, 1, 0, "CMDIN");
|
||||
AddExState(&cmdin, 1, 0, "CMDI");
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// M-022 MMC3 based 830118C T-106 4M + 4M
|
||||
@ -23,8 +23,6 @@
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 reset_flag = 0;
|
||||
|
||||
static void BMC830118CCW(uint32 A, uint8 V)
|
||||
{
|
||||
setchr1(A,(V&0x7F)|((EXPREGS[0]&0x0c)<<5));
|
||||
@ -32,8 +30,8 @@ static void BMC830118CCW(uint32 A, uint8 V)
|
||||
|
||||
static void BMC830118CPW(uint32 A, uint8 V)
|
||||
{
|
||||
if((EXPREGS[0]&0x0C)==0x0C)
|
||||
{
|
||||
if((EXPREGS[0]&0x0C)==0x0C)
|
||||
{
|
||||
if(A==0x8000)
|
||||
{
|
||||
setprg8(A,(V&0x0F)|((EXPREGS[0]&0x0c)<<2));
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -23,65 +23,58 @@
|
||||
static uint8 reg[8];
|
||||
static uint8 mirror, cmd, is154;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{&cmd, 1, "CMD"},
|
||||
{&mirror, 1, "MIRR"},
|
||||
{reg, 8, "REGS"},
|
||||
{0}
|
||||
{ &cmd, 1, "CMD" },
|
||||
{ &mirror, 1, "MIRR" },
|
||||
{ reg, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr2(0x0000,reg[0]>>1);
|
||||
setchr2(0x0800,reg[1]>>1);
|
||||
setchr1(0x1000,reg[2]|0x40);
|
||||
setchr1(0x1400,reg[3]|0x40);
|
||||
setchr1(0x1800,reg[4]|0x40);
|
||||
setchr1(0x1C00,reg[5]|0x40);
|
||||
setprg8(0x8000,reg[6]);
|
||||
setprg8(0xA000,reg[7]);
|
||||
static void Sync(void) {
|
||||
setchr2(0x0000, reg[0] >> 1);
|
||||
setchr2(0x0800, reg[1] >> 1);
|
||||
setchr1(0x1000, reg[2] | 0x40);
|
||||
setchr1(0x1400, reg[3] | 0x40);
|
||||
setchr1(0x1800, reg[4] | 0x40);
|
||||
setchr1(0x1C00, reg[5] | 0x40);
|
||||
setprg8(0x8000, reg[6]);
|
||||
setprg8(0xA000, reg[7]);
|
||||
setprg8(0xC000, ~1);
|
||||
setprg8(0xE000, ~0);
|
||||
}
|
||||
|
||||
static void MSync(void)
|
||||
{
|
||||
if(is154)setmirror(MI_0+(mirror&1));
|
||||
static void MSync(void) {
|
||||
if (is154) setmirror(MI_0 + (mirror & 1));
|
||||
}
|
||||
|
||||
static DECLFW(M88Write)
|
||||
{
|
||||
switch(A&0x8001)
|
||||
{
|
||||
case 0x8000: cmd=V&7; mirror=V>>6; MSync(); break;
|
||||
case 0x8001: reg[cmd]=V; Sync(); break;
|
||||
}
|
||||
static DECLFW(M88Write) {
|
||||
switch (A & 0x8001) {
|
||||
case 0x8000: cmd = V & 7; mirror = V >> 6; MSync(); break;
|
||||
case 0x8001: reg[cmd] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M88Power(void)
|
||||
{
|
||||
setprg16(0xC000,~0);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M88Write);
|
||||
static void M88Power(void) {
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M88Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
MSync();
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
MSync();
|
||||
}
|
||||
|
||||
void Mapper88_Init(CartInfo *info)
|
||||
{
|
||||
is154=0;
|
||||
info->Power=M88Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
void Mapper88_Init(CartInfo *info) {
|
||||
is154 = 0;
|
||||
info->Power = M88Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper154_Init(CartInfo *info)
|
||||
{
|
||||
is154=1;
|
||||
info->Power=M88Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
void Mapper154_Init(CartInfo *info) {
|
||||
is154 = 1;
|
||||
info->Power = M88Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -26,7 +26,7 @@
|
||||
// Mapper 209 much compicated hardware with decribed above features disabled by default and switchable by command
|
||||
// Mapper 211 the same mapper 209 but with forced nametable control
|
||||
|
||||
static int is209;
|
||||
static int is209;
|
||||
static int is211;
|
||||
|
||||
static uint8 IRQMode; // from $c001
|
||||
@ -50,17 +50,17 @@ static uint16 names[4];
|
||||
static uint8 tekker;
|
||||
|
||||
static SFORMAT Tek_StateRegs[]={
|
||||
{&IRQMode, 1, "IRQMODE"},
|
||||
{&IRQPre, 1, "IRQPRE"},
|
||||
{&IRQPreSize, 1, "IRQPRESIZE"},
|
||||
{&IRQMode, 1, "IRQM"},
|
||||
{&IRQPre, 1, "IRQP"},
|
||||
{&IRQPreSize, 1, "IRQR"},
|
||||
{&IRQCount, 1, "IRQC"},
|
||||
{&IRQXOR, 1, "IRQXOR"},
|
||||
{&IRQa, 1, "IRQa"},
|
||||
{&IRQXOR, 1, "IRQX"},
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{mul, 2, "MUL"},
|
||||
{®ie, 1, "REGI"},
|
||||
{tkcom, 4, "TKCO"},
|
||||
{prgb, 4, "PRGB"},
|
||||
{chr, 2, "CHRLATCH"},
|
||||
{chr, 2, "CLTC"},
|
||||
{chrlow, 4, "CHRL"},
|
||||
{chrhigh, 8, "CHRH"},
|
||||
{&names[0], 2|FCEUSTATE_RLSB, "NMS0"},
|
||||
@ -287,7 +287,7 @@ static DECLFW(M90ModeWrite)
|
||||
tekprom();
|
||||
tekvrom();
|
||||
mira();
|
||||
|
||||
|
||||
#ifdef DEBUG90
|
||||
switch (A&3)
|
||||
{
|
||||
@ -390,7 +390,7 @@ static void M90PPU(uint32 A)
|
||||
}
|
||||
lastread=A;
|
||||
}
|
||||
|
||||
|
||||
if(is209)
|
||||
{
|
||||
uint8 l,h;
|
||||
|
95
source/fceultra/boards/91.cpp
Normal file
95
source/fceultra/boards/91.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
/* 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);
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "../ines.h"
|
||||
|
||||
static uint8 lastA;
|
||||
static uint8 DRegs[8];
|
||||
static uint8 cmd;
|
||||
static uint8 MirCache[8];
|
||||
|
||||
static SFORMAT DB_StateRegs[]={
|
||||
{DRegs, 8, "DREG"},
|
||||
{&cmd, 1, "CMD"},
|
||||
{&lastA, 1, "LAST"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void toot(void)
|
||||
{
|
||||
int x;
|
||||
|
||||
MirCache[0]=MirCache[1]=(DRegs[0]>>4)&1;
|
||||
MirCache[2]=MirCache[3]=(DRegs[1]>>4)&1;
|
||||
|
||||
for(x=0;x<4;x++)
|
||||
MirCache[4+x]=(DRegs[2+x]>>5)&1;
|
||||
onemir(MirCache[lastA]);
|
||||
}
|
||||
|
||||
static void Sync()
|
||||
{
|
||||
setchr2(0x0000,DRegs[0]&0x1F);
|
||||
setchr2(0x0800,DRegs[1]&0x1F);
|
||||
setchr1(0x1000,DRegs[2]&0x1F);
|
||||
setchr1(0x1400,DRegs[3]&0x1F);
|
||||
setchr1(0x1800,DRegs[4]&0x1F);
|
||||
setchr1(0x1C00,DRegs[5]&0x1F);
|
||||
setprg8(0x8000,DRegs[6]&0x1F);
|
||||
setprg8(0xa000,DRegs[7]&0x1F);
|
||||
toot();
|
||||
}
|
||||
|
||||
static DECLFW(Mapper95_write)
|
||||
{
|
||||
switch(A&0xF001)
|
||||
{
|
||||
case 0x8000: cmd = V; break;
|
||||
case 0x8001:
|
||||
switch(cmd&0x07)
|
||||
{
|
||||
case 0: DRegs[0]=(V&0x3F)>>1; break;
|
||||
case 1: DRegs[1]=(V&0x3F)>>1; break;
|
||||
case 2: DRegs[2]=V&0x3F; break;
|
||||
case 3: DRegs[3]=V&0x3F; break;
|
||||
case 4: DRegs[4]=V&0x3F; break;
|
||||
case 5: DRegs[5]=V&0x3F; break;
|
||||
case 6: DRegs[6]=V&0x3F; break;
|
||||
case 7: DRegs[7]=V&0x3F; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void dragonbust_ppu(uint32 A)
|
||||
{
|
||||
static int last=-1;
|
||||
static uint8 z;
|
||||
|
||||
if(A>=0x2000) return;
|
||||
|
||||
A>>=10;
|
||||
lastA=A;
|
||||
z=MirCache[A];
|
||||
if(z!=last)
|
||||
{
|
||||
onemir(z);
|
||||
last=z;
|
||||
}
|
||||
}
|
||||
|
||||
static void DBPower(void)
|
||||
{
|
||||
memset(DRegs,0x3F,8);
|
||||
DRegs[0]=DRegs[1]=0x1F;
|
||||
|
||||
Sync();
|
||||
|
||||
setprg8(0xc000,0x3E);
|
||||
setprg8(0xe000,0x3F);
|
||||
|
||||
SetReadHandler(0x8000,0xffff,CartBR);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper95_write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper95_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=DBPower;
|
||||
AddExState(DB_StateRegs, ~0, 0, 0);
|
||||
PPU_hook=dragonbust_ppu;
|
||||
GameStateRestore=StateRestore;
|
||||
}
|
||||
|
77
source/fceultra/boards/96.cpp
Normal file
77
source/fceultra/boards/96.cpp
Normal file
@ -0,0 +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
|
||||
*/
|
||||
|
||||
#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 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);
|
||||
}
|
||||
|
65
source/fceultra/boards/99.cpp
Normal file
65
source/fceultra/boards/99.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
/* 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 writefunc old4016;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&latch, 1, "LATC"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr8((latch >> 2) & 1);
|
||||
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(0x8000,0xFFFF,CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper99_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M99Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2009 CaH4e3
|
||||
* 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
|
||||
@ -15,12 +15,14 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* 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;
|
||||
@ -28,76 +30,71 @@ static uint8 *CHRRAM=NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
*/
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{reg, 8, "REGS"},
|
||||
{0}
|
||||
{ reg, 8, "REGS" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 2, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
static void Sync(void) {
|
||||
}
|
||||
|
||||
static DECLFW(MNNNWrite)
|
||||
{
|
||||
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 MNNNPower(void) {
|
||||
// SetReadHandler(0x6000, 0x7fff, CartBR);
|
||||
// SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, MNNNWrite);
|
||||
}
|
||||
|
||||
static void MNNNReset(void)
|
||||
{
|
||||
static void MNNNReset(void) {
|
||||
}
|
||||
|
||||
/*
|
||||
static void MNNNClose(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if(CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
WRAM=CHRRAM=NULL;
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if (CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
WRAM = CHRRAM = NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
static void MNNNIRQHook(void)
|
||||
{
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
static void MNNNIRQHook() {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void MapperNNN_Init(CartInfo *info)
|
||||
{
|
||||
info->Reset=MNNNReset;
|
||||
info->Power=MNNNPower;
|
||||
// info->Close=MNNNClose;
|
||||
GameHBIRQHook=MNNNIRQHook;
|
||||
GameStateRestore=StateRestore;
|
||||
void MapperNNN_Init(CartInfo *info) {
|
||||
info->Reset = MNNNReset;
|
||||
info->Power = MNNNPower;
|
||||
// info->Close = MNNNClose;
|
||||
GameHBIRQHook = MNNNIRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
/*
|
||||
CHRRAMSIZE=8192;
|
||||
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10,CHRRAM,CHRRAMSIZE,1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
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;
|
||||
}
|
||||
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);
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -31,14 +31,14 @@ static void UNLA9711PW(uint32 A, uint8 V)
|
||||
setprg8(0xA000, 0x13);
|
||||
setprg8(0xC000, 0x13);
|
||||
setprg8(0xE000, 0x0);
|
||||
// uint8 bank=EXPREGS[0]&0x1F;
|
||||
// if(EXPREGS[0]&0x20)
|
||||
// setprg32(0x8000,bank>>2);
|
||||
// else
|
||||
// {
|
||||
// setprg16(0x8000,bank);
|
||||
// setprg16(0xC000,bank);
|
||||
// }
|
||||
// uint8 bank=EXPREGS[0]&0x1F;
|
||||
// if(EXPREGS[0]&0x20)
|
||||
// setprg32(0x8000,bank>>2);
|
||||
// else
|
||||
// {
|
||||
// setprg16(0x8000,bank);
|
||||
// setprg16(0xC000,bank);
|
||||
// }
|
||||
}
|
||||
else
|
||||
setprg8(A,V&0x3F);
|
||||
@ -46,12 +46,12 @@ static void UNLA9711PW(uint32 A, uint8 V)
|
||||
|
||||
//static DECLFW(UNLA9711Write8000)
|
||||
//{
|
||||
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||
// if(V&0x80)
|
||||
// MMC3_CMDWrite(A,V);
|
||||
// else
|
||||
// MMC3_CMDWrite(A,m_perm[V&7]);
|
||||
// if(V!=0x86) MMC3_CMDWrite(A,V);
|
||||
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||
// if(V&0x80)
|
||||
// MMC3_CMDWrite(A,V);
|
||||
// else
|
||||
// MMC3_CMDWrite(A,m_perm[V&7]);
|
||||
// if(V!=0x86) MMC3_CMDWrite(A,V);
|
||||
//}
|
||||
|
||||
static DECLFW(UNLA9711WriteLo)
|
||||
@ -66,7 +66,7 @@ static void UNLA9711Power(void)
|
||||
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x5000,0x5FFF,UNLA9711WriteLo);
|
||||
// SetWriteHandler(0x8000,0xbfff,UNLA9711Write8000);
|
||||
// SetWriteHandler(0x8000,0xbfff,UNLA9711Write8000);
|
||||
}
|
||||
|
||||
void UNLA9711_Init(CartInfo *info)
|
||||
|
@ -16,112 +16,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/*
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 chr_cmd, prg_cmd, mirror;
|
||||
static uint8 chr_reg[6], prg_reg[4];
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&chr_cmd, 1, "CHRCMD"},
|
||||
{&prg_cmd, 1, "PRGCMD"},
|
||||
{&mirror, 1, "MIRR"},
|
||||
{chr_reg, 6, "CREGS"},
|
||||
{prg_reg, 4, "PREGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg8(0x8000, prg_reg[0]);
|
||||
setprg8(0xA000, prg_reg[1]);
|
||||
setprg8(0xC000, prg_reg[2]);
|
||||
setprg8(0xE000, prg_reg[3]);
|
||||
|
||||
setchr2(0x0000, chr_reg[0]);
|
||||
setchr2(0x0800, chr_reg[1]);
|
||||
setchr1(0x1000, chr_reg[2]);
|
||||
setchr1(0x1400, chr_reg[3]);
|
||||
setchr1(0x1800, chr_reg[4]);
|
||||
setchr1(0x1c00, chr_reg[5]);
|
||||
|
||||
setmirror(mirror);
|
||||
}
|
||||
|
||||
static DECLFW(UNLA9746Write)
|
||||
{
|
||||
uint8 bits_rev;
|
||||
// FCEU_printf("write raw %04x:%02x\n",A,V);
|
||||
switch (A&0xE003)
|
||||
{
|
||||
// case 0xA000: mirror = V; break;
|
||||
case 0x8000: chr_cmd = V; prg_cmd = 0; break;
|
||||
case 0x8002: prg_cmd = V; chr_cmd = 0; break;
|
||||
case 0x8001: bits_rev = ((V&0x20)>>5)|((V&0x10)>>3)|((V&0x08)>>1)|((V&0x04)<<1);
|
||||
// if(prg_cmd>0x23)
|
||||
// prg_reg[(0x26-prg_cmd)&3] = bits_rev;
|
||||
switch(chr_cmd)
|
||||
{
|
||||
case 0x08: chr_reg[0] = (V << 3); break;
|
||||
case 0x09: chr_reg[0] = chr_reg[0]|(V >> 2); break;
|
||||
case 0x0e: chr_reg[1] = (V << 3); break;
|
||||
case 0x0d: chr_reg[1] = chr_reg[1]|(V >> 2); break;
|
||||
case 0x12: chr_reg[2] = (V << 4); break;
|
||||
case 0x11: chr_reg[2] = chr_reg[2]|(V >> 1); FCEU_printf("Sync CHR 0x1000:%02x\n",chr_reg[2]); break;
|
||||
case 0x16: chr_reg[3] = (V << 4); break;
|
||||
case 0x15: chr_reg[3] = chr_reg[3]|(V >> 1); break;
|
||||
case 0x1a: chr_reg[4] = (V << 4); break;
|
||||
case 0x19: chr_reg[4] = chr_reg[4]|(V >> 1); break;
|
||||
case 0x1e: chr_reg[5] = (V << 4); break;
|
||||
case 0x1d: chr_reg[5] = chr_reg[5]|(V >> 1); break;
|
||||
}
|
||||
Sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLA9746Power(void)
|
||||
{
|
||||
prg_reg[2]=~1;
|
||||
prg_reg[3]=~0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xbfff,UNLA9746Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNLA9746_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=UNLA9746Power;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -139,8 +34,8 @@ static DECLFW(UNLA9746Write)
|
||||
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 0x25: setprg8(0xA000, bits_rev); break;
|
||||
case 0x24: setprg8(0xC000, bits_rev); break;
|
||||
case 0x23: setprg8(0xE000, bits_rev); break;
|
||||
}
|
||||
switch(EXPREGS[1])
|
||||
@ -183,4 +78,4 @@ void UNLA9746_Init(CartInfo *info)
|
||||
info->Power=UNLA9746Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
}
|
||||
/**/
|
||||
|
||||
|
74
source/fceultra/boards/ac-08.cpp
Normal file
74
source/fceultra/boards/ac-08.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
/* 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, 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);
|
||||
}
|
@ -15,158 +15,503 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint16 latche, latcheinit;
|
||||
static uint16 addrreg0, addrreg1;
|
||||
static void(*WSync)(void);
|
||||
static uint8 dipswitch;
|
||||
static void (*WSync)(void);
|
||||
static readfunc defread;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static DECLFW(LatchWrite)
|
||||
{
|
||||
FCEU_printf("%04x:%02x\n",A,V);
|
||||
latche=A;
|
||||
WSync();
|
||||
static DECLFW(LatchWrite) {
|
||||
latche = A;
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void LatchReset(void)
|
||||
{
|
||||
latche=latcheinit;
|
||||
WSync();
|
||||
static void LatchReset(void) {
|
||||
latche = latcheinit;
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void LatchPower(void)
|
||||
{
|
||||
latche=latcheinit;
|
||||
WSync();
|
||||
SetReadHandler(0x8000,0xFFFF,defread);
|
||||
SetWriteHandler(addrreg0,addrreg1,LatchWrite);
|
||||
static void LatchPower(void) {
|
||||
latche = latcheinit;
|
||||
WSync();
|
||||
if (WRAM) {
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
} else
|
||||
SetReadHandler(0x6000, 0xFFFF, defread);
|
||||
SetWriteHandler(addrreg0, addrreg1, LatchWrite);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
WSync();
|
||||
static void LatchClose(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16 init, uint16 adr0, uint16 adr1)
|
||||
{
|
||||
latcheinit=init;
|
||||
addrreg0=adr0;
|
||||
addrreg1=adr1;
|
||||
WSync=proc;
|
||||
if(func)
|
||||
defread=func;
|
||||
else
|
||||
defread=CartBR;
|
||||
info->Power=LatchPower;
|
||||
info->Reset=LatchReset;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&latche, 2, 0, "LATC");
|
||||
static void StateRestore(int version) {
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16 linit, uint16 adr0, uint16 adr1, uint8 wram) {
|
||||
latcheinit = linit;
|
||||
addrreg0 = adr0;
|
||||
addrreg1 = adr1;
|
||||
WSync = proc;
|
||||
if (func != NULL)
|
||||
defread = func;
|
||||
else
|
||||
defread = CartBROB;
|
||||
info->Power = LatchPower;
|
||||
info->Reset = LatchReset;
|
||||
info->Close = LatchClose;
|
||||
if (wram) {
|
||||
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");
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&latche, 2, 0, "LATC");
|
||||
}
|
||||
|
||||
//------------------ UNLCC21 ---------------------------
|
||||
|
||||
static void UNLCC21Sync(void)
|
||||
{
|
||||
setprg32(0x8000,0);
|
||||
setchr8(latche&1);
|
||||
setmirror(MI_0+((latche&2)>>1));
|
||||
static void UNLCC21Sync(void) {
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(latche & 1);
|
||||
setmirror(MI_0 + ((latche & 2) >> 1));
|
||||
}
|
||||
|
||||
void UNLCC21_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, UNLCC21Sync, 0, 0, 0x8000, 0xFFFF);
|
||||
void UNLCC21_Init(CartInfo *info) {
|
||||
Latch_Init(info, UNLCC21Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ BMCD1038 ---------------------------
|
||||
|
||||
static uint8 dipswitch;
|
||||
static void BMCD1038Sync(void)
|
||||
{
|
||||
if(latche&0x80)
|
||||
{
|
||||
setprg16(0x8000,(latche&0x70)>>4);
|
||||
setprg16(0xC000,(latche&0x70)>>4);
|
||||
}
|
||||
else
|
||||
setprg32(0x8000,(latche&0x60)>>5);
|
||||
setchr8(latche&7);
|
||||
setmirror(((latche&8)>>3)^1);
|
||||
static void BMCD1038Sync(void) {
|
||||
if (latche & 0x80) {
|
||||
setprg16(0x8000, (latche & 0x70) >> 4);
|
||||
setprg16(0xC000, (latche & 0x70) >> 4);
|
||||
} else
|
||||
setprg32(0x8000, (latche & 0x60) >> 5);
|
||||
setchr8(latche & 7);
|
||||
setmirror(((latche & 8) >> 3) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFR(BMCD1038Read)
|
||||
{
|
||||
if(latche&0x100)
|
||||
return dipswitch;
|
||||
else
|
||||
return CartBR(A);
|
||||
static DECLFR(BMCD1038Read) {
|
||||
if (latche & 0x100)
|
||||
return dipswitch;
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static void BMCD1038Reset(void)
|
||||
{
|
||||
dipswitch++;
|
||||
dipswitch&=3;
|
||||
static void BMCD1038Reset(void) {
|
||||
dipswitch++;
|
||||
dipswitch &= 3;
|
||||
}
|
||||
|
||||
void BMCD1038_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, BMCD1038Sync, BMCD1038Read, 0, 0x8000, 0xFFFF);
|
||||
info->Reset=BMCD1038Reset;
|
||||
AddExState(&dipswitch, 1, 0, "DIPSW");
|
||||
void BMCD1038_Init(CartInfo *info) {
|
||||
Latch_Init(info, BMCD1038Sync, BMCD1038Read, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
info->Reset = BMCD1038Reset;
|
||||
AddExState(&dipswitch, 1, 0, "DIPSW");
|
||||
}
|
||||
|
||||
//------------------ UNL43272 ---------------------------
|
||||
// mapper much complex, including 16K bankswitching
|
||||
static void UNL43272Sync(void) {
|
||||
if ((latche & 0x81) == 0x81) {
|
||||
setprg32(0x8000, (latche & 0x38) >> 3);
|
||||
} else
|
||||
FCEU_printf("unrecognized command %04!\n", latche);
|
||||
setchr8(0);
|
||||
setmirror(0);
|
||||
}
|
||||
|
||||
static DECLFR(UNL43272Read) {
|
||||
if (latche & 0x400)
|
||||
return CartBR(A & 0xFE);
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static void UNL43272Reset(void) {
|
||||
latche = 0;
|
||||
UNL43272Sync();
|
||||
}
|
||||
|
||||
void UNL43272_Init(CartInfo *info) {
|
||||
Latch_Init(info, UNL43272Sync, UNL43272Read, 0x0081, 0x8000, 0xFFFF, 0);
|
||||
info->Reset = UNL43272Reset;
|
||||
AddExState(&dipswitch, 1, 0, "DIPSW");
|
||||
}
|
||||
|
||||
//------------------ Map 058 ---------------------------
|
||||
|
||||
static void BMCGK192Sync(void)
|
||||
{
|
||||
if(latche&0x40)
|
||||
{
|
||||
setprg16(0x8000,latche&7);
|
||||
setprg16(0xC000,latche&7);
|
||||
}
|
||||
else
|
||||
setprg32(0x8000,(latche>>1)&3);
|
||||
setchr8((latche>>3)&7);
|
||||
setmirror(((latche&0x80)>>7)^1);
|
||||
static void BMCGK192Sync(void) {
|
||||
if (latche & 0x40) {
|
||||
setprg16(0x8000, latche & 7);
|
||||
setprg16(0xC000, latche & 7);
|
||||
} else
|
||||
setprg32(0x8000, (latche >> 1) & 3);
|
||||
setchr8((latche >> 3) & 7);
|
||||
setmirror(((latche & 0x80) >> 7) ^ 1);
|
||||
}
|
||||
|
||||
void BMCGK192_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, BMCGK192Sync, 0, 0, 0x8000, 0xFFFF);
|
||||
void BMCGK192_Init(CartInfo *info) {
|
||||
Latch_Init(info, BMCGK192Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 059 ---------------------------
|
||||
// One more forgotten mapper
|
||||
static void M59Sync(void) {
|
||||
setprg32(0x8000, (latche >> 4) & 7);
|
||||
setchr8(latche & 0x7);
|
||||
setmirror((latche >> 3) & 1);
|
||||
}
|
||||
|
||||
static DECLFR(M59Read) {
|
||||
if (latche & 0x100)
|
||||
return 0;
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
void Mapper59_Init(CartInfo *info) {
|
||||
Latch_Init(info, M59Sync, M59Read, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 061 ---------------------------
|
||||
static void M61Sync(void) {
|
||||
if (((latche & 0x10) << 1) ^ (latche & 0x20)) {
|
||||
setprg16(0x8000, ((latche & 0xF) << 1) | (((latche & 0x20) >> 4)));
|
||||
setprg16(0xC000, ((latche & 0xF) << 1) | (((latche & 0x20) >> 4)));
|
||||
} else
|
||||
setprg32(0x8000, latche & 0xF);
|
||||
setchr8(0);
|
||||
setmirror(((latche >> 7) & 1) ^ 1);
|
||||
}
|
||||
|
||||
void Mapper61_Init(CartInfo *info) {
|
||||
Latch_Init(info, M61Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 092 ---------------------------
|
||||
// Another two-in-one mapper, two Jaleco carts uses similar
|
||||
// hardware, but with different wiring.
|
||||
// Original code provided by LULU
|
||||
// Additionally, PCB contains DSP extra sound chip, used for voice samples (unemulated)
|
||||
|
||||
static void M92Sync(void) {
|
||||
uint8 reg = latche & 0xF0;
|
||||
setprg16(0x8000, 0);
|
||||
if (latche >= 0x9000) {
|
||||
switch (reg) {
|
||||
case 0xD0: setprg16(0xc000, latche & 15); break;
|
||||
case 0xE0: setchr8(latche & 15); break;
|
||||
}
|
||||
} else {
|
||||
switch (reg) {
|
||||
case 0xB0: setprg16(0xc000, latche & 15); break;
|
||||
case 0x70: setchr8(latche & 15); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mapper92_Init(CartInfo *info) {
|
||||
Latch_Init(info, M92Sync, NULL, 0x80B0, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 200 ---------------------------
|
||||
|
||||
static void M200Sync(void)
|
||||
{
|
||||
// FCEU_printf("A\n");
|
||||
setprg16(0x8000,latche&7);
|
||||
setprg16(0xC000,latche&7);
|
||||
setchr8(latche&7);
|
||||
setmirror((latche&8)>>3);
|
||||
static void M200Sync(void) {
|
||||
setprg16(0x8000, latche & 7);
|
||||
setprg16(0xC000, latche & 7);
|
||||
setchr8(latche & 7);
|
||||
setmirror((latche & 8) >> 3);
|
||||
}
|
||||
|
||||
void Mapper200_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M200Sync, 0, 0xff, 0x8000, 0xFFFF);
|
||||
void Mapper200_Init(CartInfo *info) {
|
||||
Latch_Init(info, M200Sync, NULL, 0xFFFF, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 201 ---------------------------
|
||||
|
||||
static void M201Sync(void) {
|
||||
if(latche & 8) {
|
||||
setprg32(0x8000, latche & 3);
|
||||
setchr8(latche & 3);
|
||||
} else {
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Mapper201_Init(CartInfo *info) {
|
||||
Latch_Init(info, M201Sync, NULL, 0xFFFF, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 202 ---------------------------
|
||||
|
||||
static void M202Sync(void) {
|
||||
// According to more carefull hardware tests and PCB study
|
||||
int32 mirror = latche & 1;
|
||||
int32 bank = (latche >> 1) & 0x7;
|
||||
int32 select = (mirror & (bank >> 2));
|
||||
setprg16(0x8000, select ? (bank & 6) | 0 : bank);
|
||||
setprg16(0xc000, select ? (bank & 6) | 1 : bank);
|
||||
setmirror(mirror ^ 1);
|
||||
setchr8(bank);
|
||||
}
|
||||
|
||||
void Mapper202_Init(CartInfo *info) {
|
||||
Latch_Init(info, M202Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 204 ---------------------------
|
||||
|
||||
static void M204Sync(void) {
|
||||
int32 tmp2 = latche & 0x6;
|
||||
int32 tmp1 = tmp2 + ((tmp2 == 0x6) ? 0 : (latche & 1));
|
||||
setprg16(0x8000, tmp1);
|
||||
setprg16(0xc000, tmp2 + ((tmp2 == 0x6) ? 1 : (latche & 1)));
|
||||
setchr8(tmp1);
|
||||
setmirror(((latche >> 4) & 1) ^ 1);
|
||||
}
|
||||
|
||||
void Mapper204_Init(CartInfo *info) {
|
||||
Latch_Init(info, M204Sync, NULL, 0xFFFF, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 212 ---------------------------
|
||||
|
||||
static DECLFR(M212Read) {
|
||||
uint8 ret = CartBROB(A);
|
||||
if ((A & 0xE010) == 0x6000)
|
||||
ret |= 0x80;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void M212Sync(void) {
|
||||
if(latche & 0x4000) {
|
||||
setprg32(0x8000, (latche >> 1) & 3);
|
||||
} else {
|
||||
setprg16(0x8000, latche & 7);
|
||||
setprg16(0xC000, latche & 7);
|
||||
}
|
||||
setchr8(latche & 7);
|
||||
setmirror(((latche >> 3) & 1)^1);
|
||||
}
|
||||
|
||||
void Mapper212_Init(CartInfo *info) {
|
||||
Latch_Init(info, M212Sync, M212Read, 0xFFFF, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 213 ---------------------------
|
||||
|
||||
static void M213Sync(void) {
|
||||
setprg32(0x8000, (latche >> 1) & 3);
|
||||
setchr8((latche >> 3) & 7);
|
||||
}
|
||||
|
||||
void Mapper213_Init(CartInfo *info) {
|
||||
Latch_Init(info, M213Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 214 ---------------------------
|
||||
|
||||
static void M214Sync(void) {
|
||||
setprg16(0x8000, (latche >> 2) & 3);
|
||||
setprg16(0xC000, (latche >> 2) & 3);
|
||||
setchr8(latche & 3);
|
||||
}
|
||||
|
||||
void Mapper214_Init(CartInfo *info) {
|
||||
Latch_Init(info, M214Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 217 ---------------------------
|
||||
|
||||
static void M217Sync(void) {
|
||||
setprg32(0x8000, (latche >> 2) & 3);
|
||||
setchr8(latche & 7);
|
||||
}
|
||||
|
||||
void Mapper217_Init(CartInfo *info) {
|
||||
Latch_Init(info, M217Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 227 ---------------------------
|
||||
|
||||
static void M227Sync(void) {
|
||||
uint32 S = latche & 1;
|
||||
uint32 p = ((latche >> 2) & 0x1F) + ((latche & 0x100) >> 3);
|
||||
uint32 L = (latche >> 9) & 1;
|
||||
|
||||
if ((latche >> 7) & 1) {
|
||||
if (S) {
|
||||
setprg32(0x8000, p >> 1);
|
||||
} else {
|
||||
setprg16(0x8000, p);
|
||||
setprg16(0xC000, p);
|
||||
}
|
||||
} else {
|
||||
if (S) {
|
||||
if (L) {
|
||||
setprg16(0x8000, p & 0x3E);
|
||||
setprg16(0xC000, p | 7);
|
||||
} else {
|
||||
setprg16(0x8000, p & 0x3E);
|
||||
setprg16(0xC000, p & 0x38);
|
||||
}
|
||||
} else {
|
||||
if (L) {
|
||||
setprg16(0x8000, p);
|
||||
setprg16(0xC000, p | 7);
|
||||
} else {
|
||||
setprg16(0x8000, p);
|
||||
setprg16(0xC000, p & 0x38);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setmirror(((latche >> 1) & 1)^1);
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
}
|
||||
|
||||
void Mapper227_Init(CartInfo *info) {
|
||||
Latch_Init(info, M227Sync, NULL, 0x0000, 0x8000, 0xFFFF, 1);
|
||||
}
|
||||
|
||||
//------------------ Map 229 ---------------------------
|
||||
|
||||
static void M229Sync(void) {
|
||||
setchr8(latche);
|
||||
if(!(latche & 0x1e))
|
||||
setprg32(0x8000, 0);
|
||||
else {
|
||||
setprg16(0x8000, latche & 0x1F);
|
||||
setprg16(0xC000, latche & 0x1F);
|
||||
}
|
||||
setmirror(((latche >> 5) & 1)^1);
|
||||
}
|
||||
|
||||
void Mapper229_Init(CartInfo *info) {
|
||||
Latch_Init(info, M229Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 231 ---------------------------
|
||||
|
||||
static void M231Sync(void) {
|
||||
setchr8(0);
|
||||
if(latche & 0x20)
|
||||
setprg32(0x8000, (latche >> 1) & 0x0F);
|
||||
else {
|
||||
setprg16(0x8000, latche & 0x1E);
|
||||
setprg16(0xC000, latche & 0x1E);
|
||||
}
|
||||
setmirror(((latche >> 7) & 1)^1);
|
||||
}
|
||||
|
||||
void Mapper231_Init(CartInfo *info) {
|
||||
Latch_Init(info, M231Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 242 ---------------------------
|
||||
|
||||
static void M242Sync(void) {
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, (latche >> 3) & 0xf);
|
||||
setmirror(((latche >> 1) & 1) ^ 1);
|
||||
}
|
||||
|
||||
void Mapper242_Init(CartInfo *info) {
|
||||
Latch_Init(info, M242Sync, NULL, 0x0000, 0x8000, 0xFFFF, 1);
|
||||
}
|
||||
|
||||
//------------------ 190in1 ---------------------------
|
||||
|
||||
static void BMC190in1Sync(void)
|
||||
{
|
||||
setprg16(0x8000,(latche>>2)&0x07);
|
||||
setprg16(0xC000,(latche>>2)&0x07);
|
||||
setchr8((latche>>2)&0x07);
|
||||
setmirror((latche&1)^1);
|
||||
static void BMC190in1Sync(void) {
|
||||
setprg16(0x8000, (latche >> 2) & 7);
|
||||
setprg16(0xC000, (latche >> 2) & 7);
|
||||
setchr8((latche >> 2) & 7);
|
||||
setmirror((latche & 1) ^ 1);
|
||||
}
|
||||
|
||||
void BMC190in1_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, BMC190in1Sync, 0, 0, 0x8000, 0xFFFF);
|
||||
void BMC190in1_Init(CartInfo *info) {
|
||||
Latch_Init(info, BMC190in1Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//-------------- BMC810544-C-A1 ------------------------
|
||||
|
||||
static void BMC810544CA1Sync(void) {
|
||||
uint32 bank = latche >> 7;
|
||||
if (latche & 0x40)
|
||||
setprg32(0x8000, bank);
|
||||
else{
|
||||
setprg16(0x8000, (bank << 1) | ((latche >> 5) & 1));
|
||||
setprg16(0xC000, (bank << 1) | ((latche >> 5) & 1));
|
||||
}
|
||||
setchr8(latche & 0x0f);
|
||||
setmirror(((latche >> 4) & 1) ^ 1);
|
||||
}
|
||||
|
||||
void BMC810544CA1_Init(CartInfo *info) {
|
||||
Latch_Init(info, BMC810544CA1Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//-------------- BMCNTD-03 ------------------------
|
||||
|
||||
static void BMCNTD03Sync(void) {
|
||||
// 1PPP Pmcc spxx xccc
|
||||
// 1000 0000 0000 0000 v
|
||||
// 1001 1100 0000 0100 h
|
||||
// 1011 1010 1100 0100
|
||||
uint32 prg = ((latche >> 10) & 0x1e);
|
||||
uint32 chr = ((latche & 0x0300) >> 5) | (latche & 7);
|
||||
if (latche & 0x80) {
|
||||
setprg16(0x8000, prg | ((latche >> 6) & 1));
|
||||
setprg16(0xC000, prg | ((latche >> 6) & 1));
|
||||
} else
|
||||
setprg32(0x8000, prg >> 1);
|
||||
setchr8(chr);
|
||||
setmirror(((latche >> 10) & 1) ^ 1);
|
||||
}
|
||||
|
||||
void BMCNTD03_Init(CartInfo *info) {
|
||||
Latch_Init(info, BMCNTD03Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//-------------- BMCG-146 ------------------------
|
||||
|
||||
static void BMCG146Sync(void) {
|
||||
setchr8(0);
|
||||
if (latche & 0x800) { // UNROM mode
|
||||
setprg16(0x8000, (latche & 0x1F) | (latche & ((latche & 0x40) >> 6)));
|
||||
setprg16(0xC000, (latche & 0x18) | 7);
|
||||
} else {
|
||||
if (latche & 0x40) { // 16K mode
|
||||
setprg16(0x8000, latche & 0x1F);
|
||||
setprg16(0xC000, latche & 0x1F);
|
||||
} else {
|
||||
setprg32(0x8000, (latche >> 1) & 0x0F);
|
||||
}
|
||||
}
|
||||
setmirror(((latche & 0x80) >> 7) ^ 1);
|
||||
}
|
||||
|
||||
void BMCG146_Init(CartInfo *info) {
|
||||
Latch_Init(info, BMCG146Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Super Bros. Pocker Mali (VRC4 mapper)
|
||||
*/
|
||||
@ -60,8 +60,8 @@ static void Sync(void)
|
||||
setprg8(0xC000,~1);
|
||||
setprg8(0xE000,~0);
|
||||
for(i=0; i<8; i++)
|
||||
setchr1(i<<10,chr_reg[i]);
|
||||
setmirror(mirr^1);
|
||||
setchr1(i<<10,chr_reg[i]);
|
||||
setmirror(mirr^1);
|
||||
}
|
||||
|
||||
static DECLFW(UNLAX5705Write)
|
||||
@ -73,7 +73,7 @@ static DECLFW(UNLAX5705Write)
|
||||
// chr_reg[ind]=(chr_reg[ind]&(0xF0>>sar))|((V&0x0F)<<sar);
|
||||
// SyncChr();
|
||||
// }
|
||||
// else
|
||||
// else
|
||||
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
|
||||
|
@ -16,14 +16,14 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Bandai mappers
|
||||
*
|
||||
*/
|
||||
|
||||
//Famicom Jump 2 should get transformed to m153
|
||||
//All other games are not supporting EEPROM saving right now.
|
||||
//All other games are not supporting EEPROM saving right now.
|
||||
//We may need to distinguish between 16 and 159 in order to know the EEPROM configuration.
|
||||
//Until then, we just return 0x00 from the EEPROM read
|
||||
|
||||
@ -102,17 +102,25 @@ static DECLFW(BandaiWrite)
|
||||
}
|
||||
}
|
||||
|
||||
DECLFR(BandaiRead)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void BandaiPower(void)
|
||||
{
|
||||
BandaiSync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x6000,0xFFFF,BandaiWrite);
|
||||
SetReadHandler(0x6000,0x7FFF,BandaiRead);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
BandaiSync();
|
||||
}
|
||||
|
||||
void Mapper16_Init(CartInfo *info)
|
||||
{
|
||||
is153=0;
|
||||
info->Power=BandaiPower;
|
||||
MapIRQHook=BandaiIRQHook;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
static void M153Power(void)
|
||||
@ -133,26 +141,6 @@ static void M153Close(void)
|
||||
WRAM=NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
BandaiSync();
|
||||
}
|
||||
|
||||
void Mapper16_Init(CartInfo *info)
|
||||
{
|
||||
is153=0;
|
||||
info->Power=BandaiPower;
|
||||
MapIRQHook=BandaiIRQHook;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper159_Init(CartInfo *info)
|
||||
{
|
||||
Mapper16_Init(info);
|
||||
}
|
||||
|
||||
|
||||
void Mapper153_Init(CartInfo *info)
|
||||
{
|
||||
is153=1;
|
||||
@ -174,3 +162,190 @@ void Mapper153_Init(CartInfo *info)
|
||||
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 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)
|
||||
{
|
||||
BarcodeData[0]=0xFF;
|
||||
BarcodeReadPos=0;
|
||||
BarcodeOut=0;
|
||||
BarcodeCycleCount=0;
|
||||
|
||||
BandaiSync();
|
||||
|
||||
SetWriteHandler(0x6000,0xFFFF,BandaiWrite);
|
||||
SetReadHandler(0x6000,0x7FFF,BarcodeRead);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
}
|
||||
|
||||
void Mapper157_Init(CartInfo *info)
|
||||
{
|
||||
is153=0;
|
||||
info->Power=M157Power;
|
||||
MapIRQHook=BarcodeIRQHook;
|
||||
|
||||
GameInfo->cspecial = SIS_DATACH;
|
||||
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
68
source/fceultra/boards/bb.cpp
Normal file
68
source/fceultra/boards/bb.cpp
Normal file
@ -0,0 +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
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* BMC 42-in-1 reset switch
|
||||
*/
|
||||
@ -32,7 +32,7 @@ static SFORMAT StateRegs[]=
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
FCEU_printf("%02x: %02x %02x\n", bank_mode, bank_value, prgb[0]);
|
||||
FCEU_printf("%02x: %02x %02x\n", bank_mode, bank_value, prgb[0]);
|
||||
switch(bank_mode&7)
|
||||
{
|
||||
case 0:
|
||||
|
@ -16,61 +16,71 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* BMC 42-in-1
|
||||
* it seems now, mapper not reset-based,
|
||||
* tested on real hardware and it does menus switch by pressing just Select, not Reset
|
||||
* new registers behaviour proven this too
|
||||
* BMC 42-in-1 "reset switch" + "select switch"
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latche[2];
|
||||
static SFORMAT StateRegs[]=
|
||||
static uint8 isresetbased = 0;
|
||||
static uint8 latche[2], reset;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{&latche, sizeof(latche), "LATCHE"},
|
||||
{0}
|
||||
{ &reset, 1, "RST" },
|
||||
{ latche, 2, "LATC" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
uint8 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 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 DECLFW(M226Write) {
|
||||
latche[A & 1] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M226Power(void)
|
||||
{
|
||||
latche[0] = latche[1] = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000,0xFFFF,M226Write);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
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();
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper226_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M226Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore=StateRestore;
|
||||
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;
|
||||
}
|
||||
|
@ -15,9 +15,9 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* BMC 42-in-1 reset switch
|
||||
* BMC 42-in-1 "reset switch" type
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -29,7 +29,7 @@ static uint8 mirroring;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&large_bank, 1, "LB"},
|
||||
{&hw_switch, 1, "DIPSW"},
|
||||
{&hw_switch, 1, "DPSW"},
|
||||
{&prg_bank, 1, "PRG"},
|
||||
{&chr_bank, 1, "CHR"},
|
||||
{&bank_mode, 1, "BM"},
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -81,7 +81,7 @@ byte_8CC6: .BYTE 0,$78, 0, 0,$12
|
||||
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 };
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 };
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -26,8 +26,8 @@ static uint8 dip_switch;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{reg_prg, 4, "PREGS"},
|
||||
{reg_chr, 4, "CREGS"},
|
||||
{reg_prg, 4, "PREG"},
|
||||
{reg_chr, 4, "CREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
@ -64,14 +64,14 @@ static void MBS5Reset(void)
|
||||
{
|
||||
dip_switch++;
|
||||
dip_switch&=3;
|
||||
reg_prg[0]=reg_prg[1]=reg_prg[2]=reg_prg[3]=~0;
|
||||
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;
|
||||
reg_prg[0]=reg_prg[1]=reg_prg[2]=reg_prg[3]=~0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,MBS5Write);
|
||||
|
124
source/fceultra/boards/cityfighter.cpp
Normal file
124
source/fceultra/boards/cityfighter.cpp
Normal file
@ -0,0 +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) {
|
||||
setprg32(0x8000, prg_reg >> 2);
|
||||
if (!prg_mode)
|
||||
setprg8(0xC000, prg_reg);
|
||||
int i;
|
||||
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);
|
||||
}
|
108
source/fceultra/boards/dance2000.cpp
Normal file
108
source/fceultra/boards/dance2000.cpp
Normal file
@ -0,0 +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 prg, mirr, prgmode;
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&prg, 1, "REGS"},
|
||||
{&mirr, 1, "MIRR"},
|
||||
{&prgmode, 1, "MIRR"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setmirror(mirr);
|
||||
setprg8r(0x10,0x6000,0);
|
||||
setchr8(0);
|
||||
if(prgmode)
|
||||
setprg32(0x8000,prg&7);
|
||||
else {
|
||||
setprg16(0x8000,prg&0x0f);
|
||||
setprg16(0xC000,0);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(UNLD2000Write)
|
||||
{
|
||||
// FCEU_printf("write %04x:%04x\n",A,V);
|
||||
switch(A) {
|
||||
case 0x5000: prg = V; Sync(); break;
|
||||
case 0x5200: mirr = (V & 1)^1; prgmode = V & 4; Sync(); break;
|
||||
// default: FCEU_printf("write %04x:%04x\n",A,V);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(UNLD2000Read)
|
||||
{
|
||||
if(prg & 0x40)
|
||||
return X.DB;
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static void UNLD2000Power(void)
|
||||
{
|
||||
prg = prgmode = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
SetReadHandler(0x8000,0xFFFF,UNLD2000Read);
|
||||
SetWriteHandler(0x4020,0x5FFF,UNLD2000Write);
|
||||
}
|
||||
|
||||
static void UNLAX5705IRQ(void)
|
||||
{
|
||||
if(scanline > 174) setchr4(0x0000,1);
|
||||
else 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;
|
||||
GameHBIRQHook=UNLAX5705IRQ;
|
||||
GameStateRestore=StateRestore;
|
||||
|
||||
WRAMSIZE=8192;
|
||||
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
@ -15,362 +15,431 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "../ines.h"
|
||||
|
||||
static uint8 latche, latcheinit, bus_conflict;
|
||||
static uint16 addrreg0, addrreg1;
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static void(*WSync)(void);
|
||||
static void (*WSync)(void);
|
||||
|
||||
static DECLFW(LatchWrite)
|
||||
{
|
||||
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||
if(bus_conflict)
|
||||
latche=V&CartBR(A);
|
||||
else
|
||||
latche=V;
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void LatchPower(void)
|
||||
{
|
||||
latche=latcheinit;
|
||||
WSync();
|
||||
if(WRAM)
|
||||
{
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
}
|
||||
static DECLFW(LatchWrite) {
|
||||
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||
if (bus_conflict)
|
||||
latche = V & CartBR(A);
|
||||
else
|
||||
{
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
latche = V;
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void LatchPower(void) {
|
||||
latche = latcheinit;
|
||||
WSync();
|
||||
if (WRAM) {
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
} else {
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
SetWriteHandler(addrreg0,addrreg1,LatchWrite);
|
||||
SetWriteHandler(addrreg0, addrreg1, LatchWrite);
|
||||
}
|
||||
|
||||
static void LatchClose(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM=NULL;
|
||||
static void LatchClose(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
WSync();
|
||||
static void StateRestore(int version) {
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 adr0, uint16 adr1, uint8 wram, uint8 busc)
|
||||
{
|
||||
bus_conflict = busc;
|
||||
latcheinit=init;
|
||||
addrreg0=adr0;
|
||||
addrreg1=adr1;
|
||||
WSync=proc;
|
||||
info->Power=LatchPower;
|
||||
info->Close=LatchClose;
|
||||
GameStateRestore=StateRestore;
|
||||
if(wram)
|
||||
{
|
||||
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(&latche, 1, 0, "LATC");
|
||||
static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 adr0, uint16 adr1, uint8 wram, uint8 busc) {
|
||||
bus_conflict = busc;
|
||||
latcheinit = init;
|
||||
addrreg0 = adr0;
|
||||
addrreg1 = adr1;
|
||||
WSync = proc;
|
||||
info->Power = LatchPower;
|
||||
info->Close = LatchClose;
|
||||
GameStateRestore = StateRestore;
|
||||
if (wram) {
|
||||
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(&latche, 1, 0, "LATC");
|
||||
AddExState(&bus_conflict, 1, 0, "BUSC");
|
||||
}
|
||||
|
||||
//------------------ CPROM ---------------------------
|
||||
//------------------ Map 0 ---------------------------
|
||||
|
||||
static void CPROMSync(void)
|
||||
{
|
||||
setchr4(0x0000,0);
|
||||
setchr4(0x1000,latche&3);
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,1);
|
||||
#ifdef DEBUG_MAPPER
|
||||
static DECLFW(NROMWrite) {
|
||||
FCEU_printf("bs %04x %02x\n", A, V);
|
||||
CartBW(A, V);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void NROMPower(void) {
|
||||
setprg8r(0x10, 0x6000, 0); // Famili BASIC (v3.0) need it (uses only 4KB), FP-BASIC uses 8KB
|
||||
setprg16(0x8000, 0);
|
||||
setprg16(0xC000, ~0);
|
||||
setchr8(0);
|
||||
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
#ifdef DEBUG_MAPPER
|
||||
SetWriteHandler(0x4020, 0xFFFF, NROMWrite);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CPROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, CPROMSync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
void NROM_Init(CartInfo *info) {
|
||||
info->Power = NROMPower;
|
||||
info->Close = LatchClose;
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
//------------------ Map 184 ---------------------------
|
||||
//------------------ Map 2 ---------------------------
|
||||
|
||||
static void M184Sync(void)
|
||||
{
|
||||
setchr4(0x0000,latche);
|
||||
setchr4(0x1000,latche>>4);
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,1);
|
||||
static void UNROMSync(void) {
|
||||
static uint32 mirror_in_use = 0;
|
||||
if (PRGsize[0] <= 128 * 1024) {
|
||||
setprg16(0x8000, latche & 0x7);
|
||||
if (latche & 8) mirror_in_use = 1;
|
||||
if (mirror_in_use)
|
||||
setmirror(((latche >> 3) & 1) ^ 1); // Higway Star Hacked mapper
|
||||
} else
|
||||
setprg16(0x8000, latche & 0xf);
|
||||
setprg16(0xc000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
void Mapper184_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M184Sync, 0, 0x6000, 0x7FFF, 0, 0);
|
||||
void UNROM_Init(CartInfo *info) {
|
||||
Latch_Init(info, UNROMSync, 0, 0x8000, 0xFFFF, 0, 1);
|
||||
}
|
||||
|
||||
//------------------ CNROM ---------------------------
|
||||
//------------------ Map 3 ---------------------------
|
||||
|
||||
static void CNROMSync(void)
|
||||
{
|
||||
//mbg 8/10/08 - fixed this so that large homebrew roms would work.
|
||||
//setchr8(latche&3);
|
||||
static void CNROMSync(void) {
|
||||
setchr8(latche);
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,1);
|
||||
setprg8r(0x10,0x6000,0); // Hayauchy IGO uses 2Kb or RAM
|
||||
setprg32(0x8000, 0);
|
||||
setprg8r(0x10, 0x6000, 0); // Hayauchy IGO uses 2Kb or RAM
|
||||
}
|
||||
|
||||
void CNROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, CNROMSync, 0, 0x8000, 0xFFFF, 1, 1);
|
||||
void CNROM_Init(CartInfo *info) {
|
||||
Latch_Init(info, CNROMSync, 0, 0x8000, 0xFFFF, 1, 1);
|
||||
}
|
||||
|
||||
//------------------ ANROM ---------------------------
|
||||
//------------------ Map 7 ---------------------------
|
||||
|
||||
static void ANROMSync()
|
||||
{
|
||||
setprg32(0x8000,latche&0xf);
|
||||
setmirror(MI_0+((latche>>4)&1));
|
||||
setchr8(0);
|
||||
static void ANROMSync() {
|
||||
setprg32(0x8000, latche & 0xF);
|
||||
setmirror(MI_0 + ((latche >> 4) & 1));
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
void ANROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, ANROMSync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
void ANROM_Init(CartInfo *info) {
|
||||
Latch_Init(info, ANROMSync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 70 ---------------------------
|
||||
//------------------ Map 8 ---------------------------
|
||||
|
||||
static void M70Sync()
|
||||
{
|
||||
setprg16(0x8000,latche>>4);
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(latche&0xf);
|
||||
static void M8Sync() {
|
||||
setprg16(0x8000, latche >> 3);
|
||||
setprg16(0xc000, 1);
|
||||
setchr8(latche & 3);
|
||||
}
|
||||
|
||||
void Mapper70_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M70Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 152 ---------------------------
|
||||
|
||||
static void M152Sync()
|
||||
{
|
||||
setprg16(0x8000,(latche>>4)&7);
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(latche&0xf);
|
||||
setmirror(MI_0+((latche>>7)&1)); /* Saint Seiya...hmm. */
|
||||
}
|
||||
|
||||
void Mapper152_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M152Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 78 ---------------------------
|
||||
/* Should be two separate emulation functions for this "mapper". Sigh. URGE TO KILL RISING. */
|
||||
static void M78Sync()
|
||||
{
|
||||
setprg16(0x8000,(latche&7));
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(latche>>4);
|
||||
setmirror(MI_0+((latche>>3)&1));
|
||||
}
|
||||
|
||||
void Mapper78_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M78Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ MHROM ---------------------------
|
||||
|
||||
static void MHROMSync(void)
|
||||
{
|
||||
setprg32(0x8000,latche>>4);
|
||||
setchr8(latche&0xf);
|
||||
}
|
||||
|
||||
void MHROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, MHROMSync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper140_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, MHROMSync, 0, 0x6000, 0x7FFF, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper240_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, MHROMSync, 0, 0x4020, 0x5FFF, 0, 0);
|
||||
// need SRAM.
|
||||
}
|
||||
|
||||
//------------------ Map 87 ---------------------------
|
||||
|
||||
static void M87Sync(void)
|
||||
{
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,1);
|
||||
setchr8(((latche>>1)&1)|((latche<<1)&2));
|
||||
// setchr8(latche);
|
||||
}
|
||||
|
||||
void Mapper87_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M87Sync, ~0, 0x6000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 101 ---------------------------
|
||||
|
||||
static void M101Sync(void)
|
||||
{
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,1);
|
||||
setchr8(latche);
|
||||
}
|
||||
|
||||
void Mapper101_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M101Sync, ~0, 0x6000, 0x7FFF, 0, 0);
|
||||
void Mapper8_Init(CartInfo *info) {
|
||||
Latch_Init(info, M8Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 11 ---------------------------
|
||||
|
||||
static void M11Sync(void)
|
||||
{
|
||||
setprg32(0x8000,latche&0xf);
|
||||
setchr8(latche>>4);
|
||||
static void M11Sync(void) {
|
||||
setprg32(0x8000, latche & 0xF);
|
||||
setchr8(latche >> 4);
|
||||
}
|
||||
|
||||
void Mapper11_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M11Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
void Mapper11_Init(CartInfo *info) {
|
||||
Latch_Init(info, M11Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper144_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M11Sync, 0, 0x8001, 0xFFFF, 0, 0);
|
||||
void Mapper144_Init(CartInfo *info) {
|
||||
Latch_Init(info, M11Sync, 0, 0x8001, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 13 ---------------------------
|
||||
|
||||
static void CPROMSync(void) {
|
||||
setchr4(0x0000, 0);
|
||||
setchr4(0x1000, latche & 3);
|
||||
setprg32(0x8000, 0);
|
||||
}
|
||||
|
||||
void CPROM_Init(CartInfo *info) {
|
||||
Latch_Init(info, CPROMSync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 38 ---------------------------
|
||||
|
||||
static void M38Sync(void)
|
||||
{
|
||||
setprg32(0x8000,latche&3);
|
||||
setchr8(latche>>2);
|
||||
static void M38Sync(void) {
|
||||
setprg32(0x8000, latche & 3);
|
||||
setchr8(latche >> 2);
|
||||
}
|
||||
|
||||
void Mapper38_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M38Sync, 0, 0x7000, 0x7FFF, 0, 0);
|
||||
void Mapper38_Init(CartInfo *info) {
|
||||
Latch_Init(info, M38Sync, 0, 0x7000, 0x7FFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 36 ---------------------------
|
||||
//------------------ Map 66 ---------------------------
|
||||
|
||||
static void M36Sync(void)
|
||||
{
|
||||
setprg32(0x8000,latche>>4);
|
||||
setchr8((latche)&0xF);
|
||||
static void MHROMSync(void) {
|
||||
|
||||
setprg32(0x8000, latche >> 4);
|
||||
setchr8(latche & 0xF);
|
||||
}
|
||||
|
||||
void Mapper36_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M36Sync, 0, 0x8400, 0xfffe, 0, 0);
|
||||
}
|
||||
//------------------ UNROM ---------------------------
|
||||
|
||||
static void UNROMSync(void)
|
||||
{
|
||||
setprg16(0x8000,latche);
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(0);
|
||||
void MHROM_Init(CartInfo *info) {
|
||||
Latch_Init(info, MHROMSync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
void UNROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, UNROMSync, 0, 0x8000, 0xFFFF, 0, 1);
|
||||
//------------------ Map 70 ---------------------------
|
||||
|
||||
static void M70Sync() {
|
||||
setprg16(0x8000, latche >> 4);
|
||||
setprg16(0xc000, ~0);
|
||||
setchr8(latche & 0xf);
|
||||
}
|
||||
|
||||
void Mapper70_Init(CartInfo *info) {
|
||||
Latch_Init(info, M70Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 78 ---------------------------
|
||||
/* Should be two separate emulation functions for this "mapper". Sigh. URGE TO KILL RISING. */
|
||||
static void M78Sync() {
|
||||
setprg16(0x8000, (latche & 7));
|
||||
setprg16(0xc000, ~0);
|
||||
setchr8(latche >> 4);
|
||||
setmirror(MI_0 + ((latche >> 3) & 1));
|
||||
}
|
||||
|
||||
void Mapper78_Init(CartInfo *info) {
|
||||
Latch_Init(info, M78Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 86 ---------------------------
|
||||
|
||||
static void M86Sync(void) {
|
||||
setprg32(0x8000, (latche >> 4) & 3);
|
||||
setchr8((latche & 3) | ((latche >> 4) & 4));
|
||||
}
|
||||
|
||||
void Mapper86_Init(CartInfo *info) {
|
||||
Latch_Init(info, M86Sync, ~0, 0x6000, 0x6FFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 87 ---------------------------
|
||||
|
||||
static void M87Sync(void) {
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(((latche >> 1) & 1) | ((latche << 1) & 2));
|
||||
}
|
||||
|
||||
void Mapper87_Init(CartInfo *info) {
|
||||
Latch_Init(info, M87Sync, ~0, 0x6000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 89 ---------------------------
|
||||
|
||||
static void M89Sync(void) {
|
||||
setprg16(0x8000, (latche >> 4) & 7);
|
||||
setprg16(0xc000, ~0);
|
||||
setchr8((latche & 7) | ((latche >> 4) & 8));
|
||||
setmirror(MI_0 + ((latche >> 3) & 1));
|
||||
}
|
||||
|
||||
void Mapper89_Init(CartInfo *info) {
|
||||
Latch_Init(info, M89Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 93 ---------------------------
|
||||
|
||||
static void SSUNROMSync(void)
|
||||
{
|
||||
setprg16(0x8000,latche>>4);
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(0);
|
||||
static void SSUNROMSync(void) {
|
||||
setprg16(0x8000, latche >> 4);
|
||||
setprg16(0xc000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
void SUNSOFT_UNROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, SSUNROMSync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
void SUNSOFT_UNROM_Init(CartInfo *info) {
|
||||
Latch_Init(info, SSUNROMSync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 94 ---------------------------
|
||||
|
||||
static void M94Sync(void)
|
||||
{
|
||||
setprg16(0x8000,latche>>2);
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(0);
|
||||
static void M94Sync(void) {
|
||||
setprg16(0x8000, latche >> 2);
|
||||
setprg16(0xc000, ~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
void Mapper94_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M94Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
void Mapper94_Init(CartInfo *info) {
|
||||
Latch_Init(info, M94Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 180 ---------------------------
|
||||
//------------------ Map 97 ---------------------------
|
||||
|
||||
static void M180Sync(void)
|
||||
{
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xc000,latche);
|
||||
setchr8(0);
|
||||
static void M97Sync(void) {
|
||||
setchr8(0);
|
||||
setprg16(0x8000, ~0);
|
||||
setprg16(0xc000, latche & 15);
|
||||
switch (latche >> 6) {
|
||||
case 0: break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_V); break;
|
||||
case 3: break;
|
||||
}
|
||||
setchr8(((latche >> 1) & 1) | ((latche << 1) & 2));
|
||||
}
|
||||
|
||||
void Mapper180_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M180Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
void Mapper97_Init(CartInfo *info) {
|
||||
Latch_Init(info, M97Sync, ~0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 101 ---------------------------
|
||||
|
||||
static void M101Sync(void) {
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(latche);
|
||||
}
|
||||
|
||||
void Mapper101_Init(CartInfo *info) {
|
||||
Latch_Init(info, M101Sync, ~0, 0x6000, 0x7FFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 107 ---------------------------
|
||||
|
||||
static void M107Sync(void)
|
||||
{
|
||||
setprg32(0x8000,(latche>>1)&3);
|
||||
setchr8(latche&7);
|
||||
static void M107Sync(void) {
|
||||
setprg32(0x8000, (latche >> 1) & 3);
|
||||
setchr8(latche & 7);
|
||||
}
|
||||
|
||||
void Mapper107_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M107Sync, ~0, 0x8000, 0xFFFF, 0, 0);
|
||||
void Mapper107_Init(CartInfo *info) {
|
||||
Latch_Init(info, M107Sync, ~0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 113 ---------------------------
|
||||
|
||||
static void M113Sync(void)
|
||||
{
|
||||
setprg32(0x8000,(latche>>3)&7);
|
||||
setchr8(((latche>>3)&8)|(latche&7));
|
||||
// setmirror(latche>>7); // only for HES 6in1
|
||||
static void M113Sync(void) {
|
||||
setprg32(0x8000, (latche >> 3) & 7);
|
||||
setchr8(((latche >> 3) & 8) | (latche & 7));
|
||||
// setmirror(latche>>7); // only for HES 6in1
|
||||
}
|
||||
|
||||
void Mapper113_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M113Sync, 0, 0x4100, 0x7FFF, 0, 0);
|
||||
void Mapper113_Init(CartInfo *info) {
|
||||
Latch_Init(info, M113Sync, 0, 0x4100, 0x7FFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 140 ---------------------------
|
||||
|
||||
void Mapper140_Init(CartInfo *info) {
|
||||
Latch_Init(info, MHROMSync, 0, 0x6000, 0x7FFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 152 ---------------------------
|
||||
|
||||
static void M152Sync() {
|
||||
setprg16(0x8000, (latche >> 4) & 7);
|
||||
setprg16(0xc000, ~0);
|
||||
setchr8(latche & 0xf);
|
||||
setmirror(MI_0 + ((latche >> 7) & 1)); /* Saint Seiya...hmm. */
|
||||
}
|
||||
|
||||
void Mapper152_Init(CartInfo *info) {
|
||||
Latch_Init(info, M152Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 180 ---------------------------
|
||||
|
||||
static void M180Sync(void) {
|
||||
setprg16(0x8000, 0);
|
||||
setprg16(0xc000, latche);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
void Mapper180_Init(CartInfo *info) {
|
||||
Latch_Init(info, M180Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 184 ---------------------------
|
||||
|
||||
static void M184Sync(void) {
|
||||
setchr4(0x0000, latche);
|
||||
setchr4(0x1000, latche >> 4);
|
||||
setprg32(0x8000, 0);
|
||||
}
|
||||
|
||||
void Mapper184_Init(CartInfo *info) {
|
||||
Latch_Init(info, M184Sync, 0, 0x6000, 0x7FFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 203 ---------------------------
|
||||
|
||||
static void M203Sync(void) {
|
||||
setprg16(0x8000, (latche >> 2) & 3);
|
||||
setprg16(0xC000, (latche >> 2) & 3);
|
||||
setchr8(latche & 3);
|
||||
}
|
||||
|
||||
void Mapper203_Init(CartInfo *info) {
|
||||
Latch_Init(info, M203Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 240 ---------------------------
|
||||
|
||||
static void M240Sync(void) {
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, latche >> 4);
|
||||
setchr8(latche & 0xF);
|
||||
}
|
||||
|
||||
void Mapper240_Init(CartInfo *info) {
|
||||
Latch_Init(info, M240Sync, 0, 0x4020, 0x5FFF, 1, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 241 ---------------------------
|
||||
// Mapper 7 mostly, but with SRAM or maybe prot circuit
|
||||
// figure out, which games do need 5xxx area reading
|
||||
|
||||
static void M241Sync(void) {
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, latche);
|
||||
}
|
||||
|
||||
void Mapper241_Init(CartInfo *info) {
|
||||
Latch_Init(info, M241Sync, 0, 0x8000, 0xFFFF, 1, 0);
|
||||
}
|
||||
|
||||
//------------------ A65AS ---------------------------
|
||||
@ -380,65 +449,34 @@ void Mapper113_Init(CartInfo *info)
|
||||
// 16 bankswitching mode and normal mirroring... But there is no any
|
||||
// correlations between modes and they can be used in one mapper code.
|
||||
|
||||
static void BMCA65ASSync(void)
|
||||
{
|
||||
if(latche&0x40)
|
||||
setprg32(0x8000,(latche>>1)&0x0F);
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,((latche&0x30)>>1)|(latche&7));
|
||||
setprg16(0xC000,((latche&0x30)>>1)|7);
|
||||
}
|
||||
setchr8(0);
|
||||
if(latche&0x80)
|
||||
setmirror(MI_0+(((latche>>5)&1)));
|
||||
else
|
||||
setmirror(((latche>>3)&1)^1);
|
||||
static void BMCA65ASSync(void) {
|
||||
if (latche & 0x40)
|
||||
setprg32(0x8000, (latche >> 1) & 0x0F);
|
||||
else{
|
||||
setprg16(0x8000, ((latche & 0x30) >> 1) | (latche & 7));
|
||||
setprg16(0xC000, ((latche & 0x30) >> 1) | 7);
|
||||
}
|
||||
setchr8(0);
|
||||
if (latche & 0x80)
|
||||
setmirror(MI_0 + (((latche >> 5) & 1)));
|
||||
else
|
||||
setmirror(((latche >> 3) & 1) ^ 1);
|
||||
}
|
||||
|
||||
void BMCA65AS_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, BMCA65ASSync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
void BMCA65AS_Init(CartInfo *info) {
|
||||
Latch_Init(info, BMCA65ASSync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ NROM ---------------------------
|
||||
//------------------ BMC-11160 ---------------------------
|
||||
// Simple BMC discrete mapper by TXC
|
||||
|
||||
#ifdef DEBUG_MAPPER
|
||||
static DECLFW(WriteHandler)
|
||||
{
|
||||
FCEU_printf("bs %04x %02x\n",A,V);
|
||||
CartBW(A,V);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void NROMPower(void)
|
||||
{
|
||||
setprg8r(0x10,0x6000,0); // Famili BASIC (v3.0) need it (uses only 4KB), FP-BASIC uses 8KB
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,~0);
|
||||
setchr8(0);
|
||||
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
|
||||
#ifdef DEBUG_MAPPER
|
||||
SetWriteHandler(0x4020,0xFFFF,WriteHandler);
|
||||
#endif
|
||||
static void BMC11160Sync(void) {
|
||||
uint32 bank = (latche >> 4) & 7;
|
||||
setprg32(0x8000, bank);
|
||||
setchr8((bank << 2) | (latche & 3));
|
||||
setmirror((latche >> 7) & 1);
|
||||
}
|
||||
|
||||
void NROM_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=NROMPower;
|
||||
info->Close=LatchClose;
|
||||
|
||||
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");
|
||||
void BMC11160_Init(CartInfo *info) {
|
||||
Latch_Init(info, BMC11160Sync, 0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
@ -52,5 +52,5 @@ void DreamTech01_Init(CartInfo *info)
|
||||
{
|
||||
GameStateRestore=Restore;
|
||||
info->Power=DREAMPower;
|
||||
AddExState(&latche, 1, 0, "LATCH");
|
||||
AddExState(&latche, 1, 0, "LATC");
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
@ -76,8 +76,8 @@ void UNLEDU2000_Init(CartInfo *info)
|
||||
SetupCartPRGMapping(0x10,WRAM,32768,1);
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0]=WRAM;
|
||||
info->SaveGameLen[0]=32768;
|
||||
info->SaveGame[0]=WRAM;
|
||||
info->SaveGameLen[0]=32768;
|
||||
}
|
||||
AddExState(WRAM, 32768, 0, "WRAM");
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
|
124
source/fceultra/boards/famicombox.cpp
Normal file
124
source/fceultra/boards/famicombox.cpp
Normal file
@ -0,0 +1,124 @@
|
||||
/* 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);
|
||||
}
|
||||
|
||||
//static DECLFW(SSSNROMWrite)
|
||||
//{
|
||||
// CartBW(A,V);
|
||||
//}
|
||||
|
||||
static DECLFW(SSSNROMWrite)
|
||||
{
|
||||
//FCEU_printf("write %04x %02x\n",A,V);
|
||||
//regs[A&7] = V;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
@ -1,156 +1,290 @@
|
||||
/* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 unromchr;
|
||||
static uint32 dipswitch;
|
||||
|
||||
static void BMCFK23CCW(uint32 A, uint8 V)
|
||||
{
|
||||
if(EXPREGS[0]&0x40)
|
||||
setchr8(EXPREGS[2]|unromchr);
|
||||
else
|
||||
{
|
||||
uint16 base=(EXPREGS[2]&0x7F)<<3;
|
||||
setchr1(A,V|base);
|
||||
if(EXPREGS[3]&2)
|
||||
{
|
||||
setchr1(0x0400,EXPREGS[6]|base);
|
||||
setchr1(0x0C00,EXPREGS[7]|base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//some games are wired differently, and this will need to be changed.
|
||||
//for instance, WAIXING176 needs prg_bonus=1, and cah4e3's 4-in-1's need prg_bonus=0
|
||||
static int prg_bonus = 0;
|
||||
static int prg_mask = 0x7F>>(prg_bonus);
|
||||
|
||||
//PRG wrapper
|
||||
static void BMCFK23CPW(uint32 A, uint8 V)
|
||||
{
|
||||
if((EXPREGS[0]&7)==4)
|
||||
setprg32(0x8000,EXPREGS[1]>>1);
|
||||
else if ((EXPREGS[0]&7)==3)
|
||||
{
|
||||
setprg16(0x8000,EXPREGS[1]);
|
||||
setprg16(0xC000,EXPREGS[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(EXPREGS[0]&3)
|
||||
{
|
||||
uint32 blocksize = (6+prg_bonus)-(EXPREGS[0]&3);
|
||||
uint32 mask = (1<<blocksize)-1;
|
||||
V &= mask;
|
||||
V &= 63;
|
||||
V |= (EXPREGS[1]<<1);
|
||||
setprg8(A,V);
|
||||
}
|
||||
else
|
||||
setprg8(A,V & prg_mask);
|
||||
|
||||
if(EXPREGS[3]&2)
|
||||
{
|
||||
setprg8(0xC000,EXPREGS[4]);
|
||||
setprg8(0xE000,EXPREGS[5]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//PRG handler ($8000-$FFFF)
|
||||
static DECLFW(BMCFK23CHiWrite)
|
||||
{
|
||||
if(EXPREGS[0]&0x40)
|
||||
{
|
||||
if(EXPREGS[0]&0x30)
|
||||
unromchr=0;
|
||||
else
|
||||
{
|
||||
unromchr=V&3;
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if((A==0x8001)&&(EXPREGS[3]&2&&MMC3_cmd&8))
|
||||
{
|
||||
EXPREGS[4|(MMC3_cmd&3)]=V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
else
|
||||
if(A<0xC000)
|
||||
MMC3_CMDWrite(A,V);
|
||||
else
|
||||
MMC3_IRQWrite(A,V);
|
||||
}
|
||||
}
|
||||
|
||||
//EXP handler ($5000-$5FFF)
|
||||
static DECLFW(BMCFK23CWrite)
|
||||
{
|
||||
printf("%04X = $%02X\n",A,V);
|
||||
if(A&(1<<(dipswitch+4)))
|
||||
{
|
||||
EXPREGS[A&3]=V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
static void BMCFK23CReset(void)
|
||||
{
|
||||
//this little hack makes sure that we try all the dip switch settings eventually, if we reset enough
|
||||
dipswitch++;
|
||||
dipswitch&=7;
|
||||
|
||||
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
|
||||
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
|
||||
MMC3RegReset();
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void BMCFK23CPower(void)
|
||||
{
|
||||
GenMMC3Power();
|
||||
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
|
||||
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x5000,0x5fff,BMCFK23CWrite);
|
||||
SetWriteHandler(0x8000,0xFFFF,BMCFK23CHiWrite);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
void BMCFK23C_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 512, 256, 8, 0);
|
||||
cwrap=BMCFK23CCW;
|
||||
pwrap=BMCFK23CPW;
|
||||
info->Power=BMCFK23CPower;
|
||||
info->Reset=BMCFK23CReset;
|
||||
AddExState(EXPREGS, 8, 0, "EXPR");
|
||||
AddExState(&unromchr, 1, 0, "UNCHR");
|
||||
AddExState(&dipswitch, 1, 0, "DIPSW");
|
||||
}
|
||||
/* 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"
|
||||
#include "mmc3.h"
|
||||
#include "../ines.h"
|
||||
|
||||
static bool is_BMCFK23CA;
|
||||
static uint8 unromchr;
|
||||
static uint32 dipswitch;
|
||||
static uint8 *CHRRAM=NULL;
|
||||
static uint32 CHRRAMSize;
|
||||
|
||||
static void BMCFK23CCW(uint32 A, uint8 V)
|
||||
{
|
||||
if(EXPREGS[0]&0x40)
|
||||
setchr8(EXPREGS[2]|unromchr);
|
||||
else if(EXPREGS[0]&0x20) {
|
||||
setchr1r(0x10, A, V);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16 base=(EXPREGS[2]&0x7F)<<3;
|
||||
if(EXPREGS[3]&2)
|
||||
{
|
||||
int cbase=(MMC3_cmd&0x80)<<5;
|
||||
setchr1(A,V|base);
|
||||
setchr1(0x0000^cbase,DRegBuf[0]|base);
|
||||
setchr1(0x0400^cbase,EXPREGS[6]|base);
|
||||
setchr1(0x0800^cbase,DRegBuf[1]|base);
|
||||
setchr1(0x0c00^cbase,EXPREGS[7]|base);
|
||||
}
|
||||
else
|
||||
setchr1(A,V|base);
|
||||
}
|
||||
}
|
||||
|
||||
//some games are wired differently, and this will need to be changed.
|
||||
//all the WXN games require prg_bonus = 1, and cah4e3's multicarts require prg_bonus = 0
|
||||
//we'll populate this from a game database
|
||||
static int prg_bonus;
|
||||
static int prg_mask;
|
||||
|
||||
//prg_bonus = 0
|
||||
//4-in-1 (FK23C8021)[p1][!].nes
|
||||
//4-in-1 (FK23C8033)[p1][!].nes
|
||||
//4-in-1 (FK23C8043)[p1][!].nes
|
||||
//4-in-1 (FK23Cxxxx, S-0210A PCB)[p1][!].nes
|
||||
|
||||
//prg_bonus = 1
|
||||
//[m176]大富翁2-上海大亨.wxn.nes
|
||||
//[m176]宠物翡翠.fix.nes
|
||||
//[m176]格兰帝亚.wxn.nes
|
||||
//[m176]梦幻之星.wxn.nes
|
||||
//[m176]水浒神兽.fix.nes
|
||||
//[m176]西楚霸王.fix.nes
|
||||
//[m176]超级大富翁.wxn.nes
|
||||
//[m176]雄霸天下.wxn.nes
|
||||
|
||||
//works as-is under virtuanes m176
|
||||
//[m176]三侠五义.wxn.nes
|
||||
//[m176]口袋金.fix.nes
|
||||
//[m176]爆笑三国.fix.nes
|
||||
|
||||
//needs other tweaks
|
||||
//[m176]三国忠烈传.wxn.nes
|
||||
//[m176]破釜沉舟.fix.nes
|
||||
|
||||
//PRG wrapper
|
||||
static void BMCFK23CPW(uint32 A, uint8 V)
|
||||
{
|
||||
uint32 bank = (EXPREGS[1] & 0x1F);
|
||||
uint32 hiblock = ((EXPREGS[0] & 8) << 4)|((EXPREGS[0] & 0x80) << 1)|(UNIFchrrama?((EXPREGS[2] & 0x40)<<3):0);
|
||||
uint32 block = (EXPREGS[1] & 0x60) | hiblock;
|
||||
uint32 extra = (EXPREGS[3] & 2);
|
||||
|
||||
if((EXPREGS[0]&7)==4)
|
||||
setprg32(0x8000,EXPREGS[1]>>1);
|
||||
else if ((EXPREGS[0]&7)==3)
|
||||
{
|
||||
setprg16(0x8000,EXPREGS[1]);
|
||||
setprg16(0xC000,EXPREGS[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(EXPREGS[0]&3)
|
||||
{
|
||||
uint32 blocksize = (6)-(EXPREGS[0]&3);
|
||||
uint32 mask = (1<<blocksize)-1;
|
||||
V &= mask;
|
||||
//V &= 63; //? is this a good idea?
|
||||
V |= (EXPREGS[1]<<1);
|
||||
setprg8(A,V);
|
||||
}
|
||||
else
|
||||
setprg8(A,V & prg_mask);
|
||||
|
||||
if(EXPREGS[3]&2)
|
||||
{
|
||||
setprg8(0xC000,EXPREGS[4]);
|
||||
setprg8(0xE000,EXPREGS[5]);
|
||||
}
|
||||
}
|
||||
setprg8r(0x10,0x6000,A001B&3);
|
||||
}
|
||||
|
||||
//PRG handler ($8000-$FFFF)
|
||||
static DECLFW(BMCFK23CHiWrite)
|
||||
{
|
||||
if(EXPREGS[0]&0x40)
|
||||
{
|
||||
if(EXPREGS[0]&0x30)
|
||||
unromchr=0;
|
||||
else
|
||||
{
|
||||
unromchr=V&3;
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if((A==0x8001)&&(EXPREGS[3]&2&&MMC3_cmd&8))
|
||||
{
|
||||
EXPREGS[4|(MMC3_cmd&3)]=V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
else
|
||||
if(A<0xC000) {
|
||||
if(UNIFchrrama) { // hacky... strange behaviour, must be bit scramble due to pcb layot restrictions
|
||||
// check if it not interfer with other dumps
|
||||
if((A==0x8000)&&(V==0x46))
|
||||
V=0x47;
|
||||
else if((A==0x8000)&&(V==0x47))
|
||||
V=0x46;
|
||||
}
|
||||
MMC3_CMDWrite(A,V);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
else
|
||||
MMC3_IRQWrite(A,V);
|
||||
}
|
||||
}
|
||||
|
||||
//EXP handler ($5000-$5FFF)
|
||||
static DECLFW(BMCFK23CWrite)
|
||||
{
|
||||
if(A&(1<<(dipswitch+4)))
|
||||
{
|
||||
//printf("+ ");
|
||||
EXPREGS[A&3]=V;
|
||||
|
||||
bool remap = false;
|
||||
|
||||
//sometimes writing to reg0 causes remappings to occur. we think the 2 signifies this.
|
||||
//if not, 0x24 is a value that is known to work
|
||||
//however, the low 4 bits are known to control the mapping mode, so 0x20 is more likely to be the immediate remap flag
|
||||
remap |= ((EXPREGS[0]&0xF0)==0x20);
|
||||
|
||||
//this is an actual mapping reg. i think reg0 controls what happens when reg1 is written. anyway, we have to immediately remap these
|
||||
remap |= (A&3)==1;
|
||||
//this too.
|
||||
remap |= (A&3)==2;
|
||||
|
||||
if(remap)
|
||||
{
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
if(is_BMCFK23CA)
|
||||
{
|
||||
if(EXPREGS[3]&2)
|
||||
EXPREGS[0] &= ~7; // hacky hacky! if someone wants extra banking, then for sure doesn't want mode 4 for it! (allow to run A version boards on normal mapper)
|
||||
}
|
||||
|
||||
//printf("%04X = $%02X\n",A,V);
|
||||
//printf("%02X %02X %02X %02X\n",EXPREGS[0],EXPREGS[1],EXPREGS[2],EXPREGS[3]);
|
||||
}
|
||||
|
||||
static void BMCFK23CReset(void)
|
||||
{
|
||||
//NOT NECESSARY ANYMORE
|
||||
//this little hack makes sure that we try all the dip switch settings eventually, if we reset enough
|
||||
// dipswitch++;
|
||||
// dipswitch&=7;
|
||||
//printf("BMCFK23C dipswitch set to %d\n",dipswitch);
|
||||
|
||||
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
|
||||
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
|
||||
MMC3RegReset();
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void BMCFK23CPower(void)
|
||||
{
|
||||
dipswitch = 0;
|
||||
GenMMC3Power();
|
||||
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
|
||||
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x5000,0x5fff,BMCFK23CWrite);
|
||||
SetWriteHandler(0x8000,0xFFFF,BMCFK23CHiWrite);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void BMCFK23CAPower(void)
|
||||
{
|
||||
GenMMC3Power();
|
||||
dipswitch = 0;
|
||||
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
|
||||
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
|
||||
SetWriteHandler(0x5000,0x5fff,BMCFK23CWrite);
|
||||
SetWriteHandler(0x8000,0xFFFF,BMCFK23CHiWrite);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void BMCFK23CAClose(void)
|
||||
{
|
||||
if(CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM=NULL;
|
||||
}
|
||||
|
||||
void BMCFK23C_Init(CartInfo *info)
|
||||
{
|
||||
is_BMCFK23CA = false;
|
||||
|
||||
GenMMC3_Init(info, 512, 256, 8, 0);
|
||||
cwrap=BMCFK23CCW;
|
||||
pwrap=BMCFK23CPW;
|
||||
info->Power=BMCFK23CPower;
|
||||
info->Reset=BMCFK23CReset;
|
||||
AddExState(EXPREGS, 8, 0, "EXPR");
|
||||
AddExState(&unromchr, 1, 0, "UCHR");
|
||||
AddExState(&dipswitch, 1, 0, "DPSW");
|
||||
|
||||
prg_bonus = 1;
|
||||
if(MasterRomInfoParams.find("bonus") != MasterRomInfoParams.end())
|
||||
prg_bonus = atoi(MasterRomInfoParams["bonus"].c_str());
|
||||
|
||||
prg_mask = 0x7F>>(prg_bonus);
|
||||
}
|
||||
|
||||
void BMCFK23CA_Init(CartInfo *info)
|
||||
{
|
||||
is_BMCFK23CA = true;
|
||||
|
||||
GenMMC3_Init(info, 512, 256, 8, 0);
|
||||
cwrap=BMCFK23CCW;
|
||||
pwrap=BMCFK23CPW;
|
||||
info->Power=BMCFK23CAPower;
|
||||
info->Reset=BMCFK23CReset;
|
||||
info->Close=BMCFK23CAClose;
|
||||
|
||||
CHRRAMSize=8192;
|
||||
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
|
||||
AddExState(CHRRAM, CHRRAMSize, 0, "CRAM");
|
||||
|
||||
AddExState(EXPREGS, 8, 0, "EXPR");
|
||||
AddExState(&unromchr, 1, 0, "UCHR");
|
||||
AddExState(&dipswitch, 1, 0, "DPSW");
|
||||
|
||||
prg_bonus = 1;
|
||||
if(MasterRomInfoParams.find("bonus") != MasterRomInfoParams.end())
|
||||
prg_bonus = atoi(MasterRomInfoParams["bonus"].c_str());
|
||||
prg_mask = 0x7F>>(prg_bonus);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user