All this mapper shit from FCEUMM enjoy ;)

This commit is contained in:
CaH4e3 2008-12-10 15:20:40 +00:00
parent 282cc53219
commit 6d1651dad7
66 changed files with 4657 additions and 1165 deletions

View File

@ -16,20 +16,26 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* TXC mappers
*/ */
#include "mapinc.h" #include "mapinc.h"
static uint8 reg[4]; static uint8 reg[4], cmd, is172, is173;
static SFORMAT StateRegs[]= static SFORMAT StateRegs[]=
{ {
{reg, 4, "REGS"}, {reg, 4, "REGS"},
{&cmd, 1, "CMD"},
{0} {0}
}; };
static void Sync(void) static void Sync(void)
{ {
setprg32(0x8000,(reg[2]>>2)&1); 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); setchr8(reg[2]&3);
} }
@ -42,15 +48,17 @@ static DECLFW(UNL22211WriteLo)
static DECLFW(UNL22211WriteHi) static DECLFW(UNL22211WriteHi)
{ {
// FCEU_printf("bs %04x %02x\n",A,V); // FCEU_printf("bs %04x %02x\n",A,V);
cmd=V;
Sync(); Sync();
} }
static DECLFR(UNL22211ReadLo) static DECLFR(UNL22211ReadLo)
{ {
if(reg[3]) return (reg[1]^reg[2])|(is173?0x01:0x40);
return reg[2]; // if(reg[3])
else // return reg[2];
return X.DB; // else
// return X.DB;
} }
static void UNL22211Power(void) static void UNL22211Power(void)
@ -69,6 +77,26 @@ static void StateRestore(int version)
void UNL22211_Init(CartInfo *info) void UNL22211_Init(CartInfo *info)
{ {
is172=0;
is173=0;
info->Power=UNL22211Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper172_Init(CartInfo *info)
{
is172=1;
is173=0;
info->Power=UNL22211Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper173_Init(CartInfo *info)
{
is172=0;
is173=1;
info->Power=UNL22211Power; info->Power=UNL22211Power;
GameStateRestore=StateRestore; GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);

115
src/boards/103.cpp Normal file
View File

@ -0,0 +1,115 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 reg0, reg1, reg2;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&reg0, 1, "REG0"},
{&reg1, 1, "REG1"},
{&reg2, 1, "REG2"},
{0}
};
static void Sync(void)
{
setchr8(0);
setprg8(0x8000,0xc);
setprg8(0xe000,0xf);
if(reg2&0x10)
{
setprg8(0x6000,reg0);
setprg8(0xa000,0xd);
setprg8(0xc000,0xe);
}
else
{
setprg8r(0x10,0x6000,0);
setprg4(0xa000,(0xd<<1));
setprg2(0xb000,(0xd<<2)+2);
setprg2r(0x10,0xb800,4);
setprg2r(0x10,0xc000,5);
setprg2r(0x10,0xc800,6);
setprg2r(0x10,0xd000,7);
setprg2(0xd800,(0xe<<2)+3);
}
setmirror(reg1);
}
static DECLFW(M103Write0)
{
reg0=V&0xf;
Sync();
}
static DECLFW(M103Write1)
{
reg1=(V>>3)&1;
Sync();
}
static DECLFW(M103Write2)
{
reg2=V;
Sync();
}
static void M103Power(void)
{
reg0=reg1=0; reg2=0;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0xB800,0xD7FF,CartBW);
SetWriteHandler(0x8000,0x8FFF,M103Write0);
SetWriteHandler(0xE000,0xEFFF,M103Write1);
SetWriteHandler(0xF000,0xFFFF,M103Write2);
}
static void M103Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper103_Init(CartInfo *info)
{
info->Power=M103Power;
info->Close=M103Close;
GameStateRestore=StateRestore;
WRAMSIZE=16384;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}

119
src/boards/106.cpp Normal file
View File

@ -0,0 +1,119 @@
/* 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 reg[16], IRQa;
static uint32 IRQCount;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&IRQa, 1, "IRQA"},
{&IRQCount, 4, "IRQCOUNT"},
{reg, 16, "REGS"},
{0}
};
static void Sync(void)
{
setchr1(0x0000,reg[0]&0xfe);
setchr1(0x0400,reg[1]|1);
setchr1(0x0800,reg[2]&0xfe);
setchr1(0x0c00,reg[3]|1);
setchr1(0x1000,reg[4]);
setchr1(0x1400,reg[5]);
setchr1(0x1800,reg[6]);
setchr1(0x1c00,reg[7]);
setprg8r(0x10,0x6000,0);
setprg8(0x8000,(reg[0x8]&0xf)|0x10);
setprg8(0xA000,(reg[0x9]&0x1f));
setprg8(0xC000,(reg[0xa]&0x1f));
setprg8(0xE000,(reg[0xb]&0xf)|0x10);
setmirror((reg[0xc]&1)^1);
}
static DECLFW(M106Write)
{
A&=0xF;
switch(A)
{
case 0xD: IRQa=0; IRQCount=0; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xE: IRQCount=(IRQCount&0xFF00)|V; break;
case 0xF: IRQCount=(IRQCount&0x00FF)|(V<<8); IRQa=1; break;
default: reg[A]=V; Sync(); break;
}
}
static void M106Power(void)
{
reg[8]=reg[9]=reg[0xa]=reg[0xb]=-1;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetWriteHandler(0x8000,0xFFFF,M106Write);
}
static void M106Reset(void)
{
}
static void M106Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
}
void M106CpuHook(int a)
{
if(IRQa)
{
IRQCount+=a;
if(IRQCount>0x10000)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
}
}
}
static void StateRestore(int version)
{
Sync();
}
void Mapper106_Init(CartInfo *info)
{
info->Reset=M106Reset;
info->Power=M106Power;
info->Close=M106Close;
MapIRQHook=M106CpuHook;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}

62
src/boards/108.cpp Normal file
View File

@ -0,0 +1,62 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 reg;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REG"},
{0}
};
static void Sync(void)
{
setprg8(0x6000,reg);
setprg32(0x8000,~0);
setchr8(0);
}
static DECLFW(M108Write)
{
reg=V;
Sync();
}
static void M108Power(void)
{
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8FFF,0x8FFF,M108Write);
}
static void StateRestore(int version)
{
Sync();
}
void Mapper108_Init(CartInfo *info)
{
info->Power=M108Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -16,18 +16,20 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* NTDEC, ASDER games
*/ */
#include "mapinc.h" #include "mapinc.h"
static uint8 reg[8]; static uint8 reg[8];
static uint8 mirror, cmd; static uint8 mirror, cmd, bank;
static uint8 *WRAM=NULL; static uint8 *WRAM=NULL;
static SFORMAT StateRegs[]= static SFORMAT StateRegs[]=
{ {
{&cmd, 1, "CMD"}, {&cmd, 1, "CMD"},
{&mirror, 1, "MIRR"}, {&mirror, 1, "MIRR"},
{&bank, 1, "BANK"},
{reg, 8, "REGS"}, {reg, 8, "REGS"},
{0} {0}
}; };
@ -37,23 +39,22 @@ static void Sync(void)
setmirror(mirror^1); setmirror(mirror^1);
setprg8(0x8000,reg[0]); setprg8(0x8000,reg[0]);
setprg8(0xA000,reg[1]); setprg8(0xA000,reg[1]);
setchr2(0x0000,reg[2]>>1); setchr2(0x0000,(reg[2]>>1));
setchr2(0x0800,reg[3]>>1); setchr2(0x0800,(reg[3]>>1));
setchr1(0x1000,reg[4]); setchr1(0x1000,((bank&0x10)<<4)|reg[4]);
setchr1(0x1400,reg[5]); setchr1(0x1400,((bank&0x20)<<3)|reg[5]);
setchr1(0x1800,reg[6]); setchr1(0x1800,((bank&0x40)<<2)|reg[6]);
setchr1(0x1C00,reg[7]); setchr1(0x1C00,((bank&0x80)<<1)|reg[7]);
} }
static DECLFW(M112Write) static DECLFW(M112Write)
{ {
// FCEU_printf("bs %04x %02x\n",A,V);
switch(A) switch(A)
{ {
case 0xe000: mirror=V&1; Sync(); ;break; case 0xe000: mirror=V&1; Sync(); ;break;
case 0x8000: cmd=V&7; break; case 0x8000: cmd=V&7; break;
case 0xa000: reg[cmd]=V; Sync(); break; case 0xa000: reg[cmd]=V; Sync(); break;
// default: FCEU_printf("bs %04x %02x\n",A,V); case 0xc000: bank=V; Sync(); break;
} }
} }
@ -66,6 +67,7 @@ static void M112Close(void)
static void M112Power(void) static void M112Power(void)
{ {
bank=0;
setprg16(0xC000,~0); setprg16(0xC000,~0);
setprg8r(0x10,0x6000,0); setprg8r(0x10,0x6000,0);
SetReadHandler(0x8000,0xFFFF,CartBR); SetReadHandler(0x8000,0xFFFF,CartBR);

View File

@ -20,7 +20,7 @@
#include "mapinc.h" #include "mapinc.h"
static uint8 prgreg[4], chrreg[8]; static uint8 prgreg[4], chrreg[8], mirror;
static uint8 IRQa, IRQCount, IRQLatch; static uint8 IRQa, IRQCount, IRQLatch;
static SFORMAT StateRegs[]= static SFORMAT StateRegs[]=
@ -30,6 +30,7 @@ static SFORMAT StateRegs[]=
{&IRQLatch, 1, "IRQL"}, {&IRQLatch, 1, "IRQL"},
{prgreg, 4, "PREGS"}, {prgreg, 4, "PREGS"},
{chrreg, 8, "CREGS"}, {chrreg, 8, "CREGS"},
{&mirror, 1, "MREG"},
{0} {0}
}; };
@ -42,6 +43,7 @@ static void Sync(void)
setprg8(0xe000,prgreg[3]); setprg8(0xe000,prgreg[3]);
for(i=0; i<8; i++) for(i=0; i<8; i++)
setchr1(i<<10,chrreg[i]); setchr1(i<<10,chrreg[i]);
setmirror(mirror^1);
} }
static DECLFW(M117Write) static DECLFW(M117Write)
@ -62,6 +64,7 @@ static DECLFW(M117Write)
case 0xc003: IRQCount=IRQLatch; IRQa|=2; break; case 0xc003: IRQCount=IRQLatch; IRQa|=2; break;
case 0xe000: IRQa&=~1; IRQa|=V&1; X6502_IRQEnd(FCEU_IQEXT); break; case 0xe000: IRQa&=~1; IRQa|=V&1; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xc002: X6502_IRQEnd(FCEU_IQEXT); break; case 0xc002: X6502_IRQEnd(FCEU_IQEXT); break;
case 0xd000: mirror=V&1;
} }
} }

66
src/boards/120.cpp Normal file
View File

@ -0,0 +1,66 @@
/* 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 reg;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REG"},
{0}
};
static void Sync(void)
{
setprg8(0x6000,reg);
setprg32(0x8000,2);
setchr8(0);
}
static DECLFW(M120Write)
{
if(A==0x41FF)
{
reg=V&7;
Sync();
}
}
static void M120Power(void)
{
reg=0;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4100,0x5FFF,M120Write);
}
static void StateRestore(int version)
{
Sync();
}
void Mapper120_Init(CartInfo *info)
{
info->Power=M120Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

91
src/boards/121.cpp Normal file
View File

@ -0,0 +1,91 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007-2008 Mad Dumper, CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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
*/
#include "mapinc.h"
#include "mmc3.h"
static uint8 readbyte = 0;
static DECLFW(M121Write)
{
FCEU_printf("write: %04x:%04x\n",A&0xE003,V);
if((A&0xF003)==0x8003)
{
// 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);
}
}
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)
FCEU_printf("write: %04x:%04x\n",A,V);
}
static DECLFR(M121Read)
{
FCEU_printf("read: %04x\n",A);
return EXPREGS[0];
}
static void M121Power(void)
{
GenMMC3Power();
// Write_IRQFM(0x4017,0x40);
SetReadHandler(0x5000,0x5FFF,M121Read);
SetWriteHandler(0x5000,0x5FFF,M121LoWrite);
SetWriteHandler(0x8000,0x9FFF,M121Write);
}
void Mapper121_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 256, 8, 0);
info->Power=M121Power;
AddExState(EXPREGS, 2, 0, "EXPR");
}

119
src/boards/15.cpp Normal file
View File

@ -0,0 +1,119 @@
/* 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"
static uint16 latchea;
static uint8 latched;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&latchea, 2, "LATCHEA"},
{&latched, 1, "LATCHED"},
{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 DECLFW(M15Write)
{
latchea=A;
latched=V;
Sync();
}
static void StateRestore(int version)
{
Sync();
}
static void M15Power(void)
{
latchea=0x8000;
latched=0;
setchr8(0);
setprg8r(0x10,0x6000,0);
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetWriteHandler(0x8000,0xFFFF,M15Write);
SetReadHandler(0x8000,0xFFFF,CartBR);
Sync();
}
static void M15Reset(void)
{
latchea=0x8000;
latched=0;
Sync();
}
static void M15Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
}
void Mapper15_Init(CartInfo *info)
{
info->Power=M15Power;
info->Reset=M15Reset;
info->Close=M15Close;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}

87
src/boards/177.cpp Normal file
View File

@ -0,0 +1,87 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 reg;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REG"},
{0}
};
static void Sync(void)
{
setchr8(0);
setprg8r(0x10,0x6000,0);
setprg32(0x8000,reg&0x1f);
setmirror(((reg&0x20)>>5)^1);
}
static DECLFW(M177Write)
{
reg=V;
Sync();
}
static void M177Power(void)
{
reg=0;
Sync();
SetReadHandler(0x6000,0x7fff,CartBR);
SetWriteHandler(0x6000,0x7fff,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,M177Write);
}
static void M177Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper177_Init(CartInfo *info)
{
info->Power=M177Power;
info->Close=M177Close;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(&StateRegs, ~0, 0, 0);
}

101
src/boards/178.cpp Normal file
View File

@ -0,0 +1,101 @@
/* 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 reg[3];
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{reg, 3, "REGS"},
{0}
};
static void Sync(void)
{
setmirror(reg[0]);
setprg8r(0x10,0x6000,0);
setchr8(0);
setprg32(0x8000,(reg[1]+reg[2])&0xf);
}
static DECLFW(M178Write0)
{
reg[0]=(V&1)^1;
Sync();
}
static DECLFW(M178Write1)
{
reg[1]=(V>>1)&0xf;
Sync();
}
static DECLFW(M178Write2)
{
reg[2]=(V<<2)&0xf;
Sync();
}
static void M178Power(void)
{
reg[0]=1; reg[1]=0; reg[2]=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);
}
static void M178Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper178_Init(CartInfo *info)
{
info->Power=M178Power;
info->Close=M178Close;
GameStateRestore=StateRestore;
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);
}

94
src/boards/179.cpp Normal file
View File

@ -0,0 +1,94 @@
/* 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 reg[2];
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{reg, 2, "REG"},
{0}
};
static void Sync(void)
{
setchr8(0);
setprg8r(0x10,0x6000,0);
setprg32(0x8000,reg[1]>>1);
setmirror((reg[0]&1)^1);
}
static DECLFW(M179Write)
{
if(A==0xa000) reg[0]=V;
Sync();
}
static DECLFW(M179WriteLo)
{
if(A==0x5ff1) reg[1]=V;
Sync();
}
static void M179Power(void)
{
reg[0]=reg[1]=0;
Sync();
SetWriteHandler(0x4020,0x5fff,M179WriteLo);
SetReadHandler(0x6000,0x7fff,CartBR);
SetWriteHandler(0x6000,0x7fff,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,M179Write);
}
static void M179Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper179_Init(CartInfo *info)
{
info->Power=M179Power;
info->Close=M179Close;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* Gimmick Bootleg * Gimmick Bootleg (VRC4 mapper)
*/ */
#include "mapinc.h" #include "mapinc.h"

View File

@ -20,7 +20,6 @@
#include "mapinc.h" #include "mapinc.h"
#include "mmc3.h" #include "mmc3.h"
#include "../sound.h"
static void M187CW(uint32 A, uint8 V) static void M187CW(uint32 A, uint8 V)
{ {
@ -87,7 +86,7 @@ static void M187Power(void)
{ {
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=0; EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=0;
GenMMC3Power(); GenMMC3Power();
Write_IRQFM(0x4017,0x40); // Write_IRQFM(0x4017,0x40);
SetReadHandler(0x5000,0x5FFF,M187Read); SetReadHandler(0x5000,0x5FFF,M187Read);
SetWriteHandler(0x5000,0x5FFF,M187WriteLo); SetWriteHandler(0x5000,0x5FFF,M187WriteLo);
SetWriteHandler(0x8000,0x8000,M187Write8000); SetWriteHandler(0x8000,0x8000,M187Write8000);

View File

@ -16,13 +16,12 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* * (VRC4 mapper)
*/ */
#include "mapinc.h" #include "mapinc.h"
static uint8 IRQCount; static uint8 IRQCount;
//static uint8 IRQPre;
static uint8 IRQa; static uint8 IRQa;
static uint8 prg_reg[2]; static uint8 prg_reg[2];
static uint8 chr_reg[8]; static uint8 chr_reg[8];
@ -43,19 +42,19 @@ static void M222IRQ(void)
if(IRQa) if(IRQa)
{ {
IRQCount++; IRQCount++;
if(IRQCount>=240) if(IRQCount>=238)
{ {
X6502_IRQBegin(FCEU_IQEXT); X6502_IRQBegin(FCEU_IQEXT);
IRQa=0; // IRQa=0;
} }
} }
} }
static void Sync(void) static void Sync(void)
{ {
int i;
setprg8(0x8000,prg_reg[0]); setprg8(0x8000,prg_reg[0]);
setprg8(0xA000,prg_reg[1]); setprg8(0xA000,prg_reg[1]);
int i;
for(i=0; i<8; i++) for(i=0; i<8; i++)
setchr1(i<<10,chr_reg[i]); setchr1(i<<10,chr_reg[i]);
setmirror(mirr^1); setmirror(mirr^1);
@ -81,7 +80,7 @@ static DECLFW(M222Write)
// case 0xF002: FCEU_printf("%04x:%02x %d\n",A,V,scanline); 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 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; // case 0xC001: IRQPre=16; FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
case 0xF000: IRQCount=V; IRQa=V; X6502_IRQEnd(FCEU_IQEXT); break; case 0xF000: IRQa=IRQCount=V; if(scanline<240) IRQCount-=8; else IRQCount+=4; X6502_IRQEnd(FCEU_IQEXT); break;
} }
Sync(); Sync();
} }

208
src/boards/23.cpp Normal file
View File

@ -0,0 +1,208 @@
/* 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"},
{&regcmd, 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);
}

110
src/boards/3d-block.cpp Normal file
View File

@ -0,0 +1,110 @@
/* 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 reg[4], IRQa;
static int16 IRQCount, IRQPause;
static int16 Count = 0x0000;
static SFORMAT StateRegs[]=
{
{reg, 4, "REGS"},
{&IRQa, 1, "IRQA"},
{&IRQCount, 2, "IRQC"},
{0}
};
static void Sync(void)
{
setprg32(0x8000,0);
setchr8(0);
}
//#define Count 0x1800
#define Pause 0x010
static DECLFW(UNL3DBlockWrite)
{
switch(A)
{
//4800 32
//4900 37
//4a00 01
//4e00 18
case 0x4800: reg[0]=V; break;
case 0x4900: reg[1]=V; break;
case 0x4a00: reg[2]=V; break;
case 0x4e00: reg[3]=V; IRQCount=Count; IRQPause=Pause; IRQa=1; X6502_IRQEnd(FCEU_IQEXT); break;
}
}
static void UNL3DBlockPower(void)
{
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4800,0x4E00,UNL3DBlockWrite);
}
static void UNL3DBlockReset(void)
{
Count+=0x10;
FCEU_printf("Count=%04x\n",Count);
}
static void UNL3DBlockIRQHook(int a)
{
if(IRQa)
{
if(IRQCount>0)
{
IRQCount-=a;
}
else
{
if(IRQPause>0)
{
IRQPause-=a;
X6502_IRQBegin(FCEU_IQEXT);
}
else
{
IRQCount=Count;
IRQPause=Pause;
X6502_IRQEnd(FCEU_IQEXT);
}
}
}
}
static void StateRestore(int version)
{
Sync();
}
void UNL3DBlock_Init(CartInfo *info)
{
info->Power=UNL3DBlockPower;
info->Reset=UNL3DBlockReset;
MapIRQHook=UNL3DBlockIRQHook;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

70
src/boards/411120-c.cpp Normal file
View File

@ -0,0 +1,70 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2008 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// actually cart ID is 811120-C, sorry ;) K-3094 - another ID
#include "mapinc.h"
#include "mmc3.h"
static uint8 reset_flag = 0;
static void BMC411120CCW(uint32 A, uint8 V)
{
setchr1(A,V|((EXPREGS[0]&3)<<7));
}
static void BMC411120CPW(uint32 A, uint8 V)
{
if(EXPREGS[0]&(8|reset_flag))
setprg32(0x8000,((EXPREGS[0]>>4)&3)|(0x0C));
else
setprg8(A,(V&0x0F)|((EXPREGS[0]&3)<<4));
}
static DECLFW(BMC411120CLoWrite)
{
EXPREGS[0] = A;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void BMC411120CReset(void)
{
EXPREGS[0]=0;
reset_flag ^=4;
MMC3RegReset();
}
static void BMC411120CPower(void)
{
EXPREGS[0] = 0;
GenMMC3Power();
SetWriteHandler(0x6000,0x7FFF,BMC411120CLoWrite);
}
void BMC411120C_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 128, 8, 0);
pwrap=BMC411120CPW;
cwrap=BMC411120CCW;
info->Power=BMC411120CPower;
info->Reset=BMC411120CReset;
AddExState(EXPREGS, 1, 0, "EXPR");
}

178
src/boards/68.cpp Normal file
View File

@ -0,0 +1,178 @@
/* 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"
static uint8 chr_reg[4];
static uint8 kogame, prg_reg, nt1, nt2, mirr;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE, count;
static SFORMAT StateRegs[]=
{
{&nt1, 1, "NT1"},
{&nt2, 1, "NT2"},
{&mirr, 1, "MIRR"},
{&prg_reg, 1, "PRG"},
{&kogame, 1, "KOGAME"},
{&count, 4, "COUNT"},
{chr_reg, 4, "CHR"},
{0}
};
static void M68NTfix(void)
{
if((!UNIFchrrama)&&(mirr&0x10))
{
PPUNTARAM = 0;
switch(mirr&3)
{
case 0: vnapage[0]=vnapage[2]=CHRptr[0]+(((nt1|128)&CHRmask1[0])<<10);
vnapage[1]=vnapage[3]=CHRptr[0]+(((nt2|128)&CHRmask1[0])<<10);
break;
case 1: vnapage[0]=vnapage[1]=CHRptr[0]+(((nt1|128)&CHRmask1[0])<<10);
vnapage[2]=vnapage[3]=CHRptr[0]+(((nt2|128)&CHRmask1[0])<<10);
break;
case 2: vnapage[0]=vnapage[1]=vnapage[2]=vnapage[3]=CHRptr[0]+(((nt1|128)&CHRmask1[0])<<10);
break;
case 3: vnapage[0]=vnapage[1]=vnapage[2]=vnapage[3]=CHRptr[0]+(((nt2|128)&CHRmask1[0])<<10);
break;
}
}
else
switch(mirr&3)
{
case 0: setmirror(MI_V); break;
case 1: setmirror(MI_H); break;
case 2: setmirror(MI_0); break;
case 3: setmirror(MI_1); break;
}
}
static void Sync(void)
{
setchr2(0x0000,chr_reg[0]);
setchr2(0x0800,chr_reg[1]);
setchr2(0x1000,chr_reg[2]);
setchr2(0x1800,chr_reg[3]);
setprg8r(0x10,0x6000,0);
setprg16r((PRGptr[1])?kogame:0,0x8000,prg_reg);
setprg16(0xC000,~0);
}
static DECLFR(M68Read)
{
if(!(kogame&8))
{
count++;
if(count==1784)
setprg16r(0,0x8000,prg_reg);
}
return CartBR(A);
}
static DECLFW(M68WriteLo)
{
if(!V)
{
count = 0;
setprg16r((PRGptr[1])?kogame:0,0x8000,prg_reg);
}
}
static DECLFW(M68WriteCHR)
{
chr_reg[(A>>12)&3]=V;
Sync();
}
static DECLFW(M68WriteNT1)
{
nt1 = V;
M68NTfix();
}
static DECLFW(M68WriteNT2)
{
nt2 = V;
M68NTfix();
}
static DECLFW(M68WriteMIR)
{
mirr = V;
M68NTfix();
}
static DECLFW(M68WriteROM)
{
prg_reg = V&7;
kogame = ((V>>3)&1)^1;
Sync();
}
static void M68Power(void)
{
prg_reg = 0;
kogame = 0;
Sync();
M68NTfix();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xBFFF,M68Read);
SetReadHandler(0xC000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xBFFF,M68WriteCHR);
SetWriteHandler(0xC000,0xCFFF,M68WriteNT1);
SetWriteHandler(0xD000,0xDFFF,M68WriteNT2);
SetWriteHandler(0xE000,0xEFFF,M68WriteMIR);
SetWriteHandler(0xF000,0xFFFF,M68WriteROM);
SetWriteHandler(0x6000,0x6000,M68WriteLo);
SetWriteHandler(0x6001,0x7FFF,CartBW);
}
static void M68Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
M68NTfix();
}
void Mapper68_Init(CartInfo *info)
{
info->Power=M68Power;
info->Close=M68Close;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}

82
src/boards/830118C.cpp Normal file
View File

@ -0,0 +1,82 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2008 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// M-022 MMC3 based 830118C T-106 4M + 4M
#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));
}
static void BMC830118CPW(uint32 A, uint8 V)
{
if((EXPREGS[0]&0x0C)==0x0C)
{
if(A==0x8000)
{
setprg8(A,(V&0x0F)|((EXPREGS[0]&0x0c)<<2));
setprg8(0xC000,(V&0x0F)|0x32);
}
else if(A==0xA000)
{
setprg8(A,(V&0x0F)|((EXPREGS[0]&0x0c)<<2));
setprg8(0xE000,(V&0x0F)|0x32);
}
}
else
{
setprg8(A,(V&0x0F)|((EXPREGS[0]&0x0c)<<2));
}
}
static DECLFW(BMC830118CLoWrite)
{
EXPREGS[0] = V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void BMC830118CReset(void)
{
EXPREGS[0]=0;
MMC3RegReset();
}
static void BMC830118CPower(void)
{
EXPREGS[0] = 0;
GenMMC3Power();
SetWriteHandler(0x6800,0x68FF,BMC830118CLoWrite);
}
void BMC830118C_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 128, 8, 0);
pwrap=BMC830118CPW;
cwrap=BMC830118CCW;
info->Power=BMC830118CPower;
info->Reset=BMC830118CReset;
AddExState(EXPREGS, 1, 0, "EXPR");
}

View File

@ -1,7 +1,7 @@
/* FCE Ultra - NES/Famicom Emulator /* FCE Ultra - NES/Famicom Emulator
* *
* Copyright notice for this file: * Copyright notice for this file:
* Copyright (C) 2006 CaH4e3 * Copyright (C) 2006-2007 CaH4e3
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -91,6 +91,11 @@ void MapperNNN_Init(CartInfo *info)
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM"); 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);
} }

186
src/boards/a9746.cpp Normal file
View File

@ -0,0 +1,186 @@
/* 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 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
*/
#include "mapinc.h"
#include "mmc3.h"
static DECLFW(UNLA9746Write)
{
// FCEU_printf("write raw %04x:%02x\n",A,V);
switch (A&0xE003)
{
case 0x8000: EXPREGS[1]=V; EXPREGS[0]=0; break;
case 0x8002: EXPREGS[0]=V; EXPREGS[1]=0; break;
case 0x8001: {
uint8 bits_rev = ((V&0x20)>>5)|((V&0x10)>>3)|((V&0x08)>>1)|((V&0x04)<<1);
switch(EXPREGS[0])
{
case 0x26: setprg8(0x8000, bits_rev); break;
case 0x25: setprg8(0xA000, bits_rev); break;
case 0x24: setprg8(0xC000, bits_rev); break;
case 0x23: setprg8(0xE000, bits_rev); break;
}
switch(EXPREGS[1])
{
case 0x0a:
case 0x08: EXPREGS[2] = (V << 4); break;
case 0x09: setchr1(0x0000, EXPREGS[2]|(V >> 1)); break;
case 0x0b: setchr1(0x0400, EXPREGS[2]|(V >> 1)|1); break;
case 0x0c:
case 0x0e: EXPREGS[2] = (V << 4); break;
case 0x0d: setchr1(0x0800, EXPREGS[2]|(V >> 1)); break;
case 0x0f: setchr1(0x0c00, EXPREGS[2]|(V >> 1)|1); break;
case 0x10:
case 0x12: EXPREGS[2] = (V << 4); break;
case 0x11: setchr1(0x1000, EXPREGS[2]|(V >> 1)); break;
case 0x14:
case 0x16: EXPREGS[2] = (V << 4); break;
case 0x15: setchr1(0x1400, EXPREGS[2]|(V >> 1)); break;
case 0x18:
case 0x1a: EXPREGS[2] = (V << 4); break;
case 0x19: setchr1(0x1800, EXPREGS[2]|(V >> 1)); break;
case 0x1c:
case 0x1e: EXPREGS[2] = (V << 4); break;
case 0x1d: setchr1(0x1c00, EXPREGS[2]|(V >> 1)); break;
}
}
break;
}
}
static void UNLA9746Power(void)
{
GenMMC3Power();
SetWriteHandler(0x8000,0xbfff,UNLA9746Write);
}
void UNLA9746_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 256, 0, 0);
info->Power=UNLA9746Power;
AddExState(EXPREGS, 6, 0, "EXPR");
}
/**/

View File

@ -27,11 +27,17 @@ static readfunc defread;
static DECLFW(LatchWrite) static DECLFW(LatchWrite)
{ {
// FCEU_printf("%04x:%02x\n",A,V); FCEU_printf("%04x:%02x\n",A,V);
latche=A; latche=A;
WSync(); WSync();
} }
static void LatchReset(void)
{
latche=latcheinit;
WSync();
}
static void LatchPower(void) static void LatchPower(void)
{ {
latche=latcheinit; latche=latcheinit;
@ -56,6 +62,7 @@ static void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16
else else
defread=CartBR; defread=CartBR;
info->Power=LatchPower; info->Power=LatchPower;
info->Reset=LatchReset;
GameStateRestore=StateRestore; GameStateRestore=StateRestore;
AddExState(&latche, 2, 0, "LATC"); AddExState(&latche, 2, 0, "LATC");
} }
@ -67,7 +74,6 @@ static void UNLCC21Sync(void)
setprg32(0x8000,0); setprg32(0x8000,0);
setchr8(latche&1); setchr8(latche&1);
setmirror(MI_0+((latche&2)>>1)); setmirror(MI_0+((latche&2)>>1));
} }
void UNLCC21_Init(CartInfo *info) void UNLCC21_Init(CartInfo *info)
@ -149,3 +155,18 @@ void Mapper200_Init(CartInfo *info)
Latch_Init(info, M200Sync, 0, 0xff, 0x8000, 0xFFFF); Latch_Init(info, M200Sync, 0, 0xff, 0x8000, 0xFFFF);
} }
//------------------ 190in1 ---------------------------
static void BMC190in1Sync(void)
{
setprg16(0x8000,(latche>>2)&0x07);
setprg16(0xC000,(latche>>2)&0x07);
setchr8((latche>>2)&0x07);
setmirror((latche&1)^1);
}
void BMC190in1_Init(CartInfo *info)
{
Latch_Init(info, BMC190in1Sync, 0, 0, 0x8000, 0xFFFF);
}

122
src/boards/ax5705.cpp Normal file
View File

@ -0,0 +1,122 @@
/* 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
*
* Super Bros. Pocker Mali (VRC4 mapper)
*/
#include "mapinc.h"
static uint8 IRQCount;//, IRQPre;
static uint8 IRQa;
static uint8 prg_reg[2];
static uint8 chr_reg[8];
static uint8 mirr;
static SFORMAT StateRegs[]=
{
{&IRQCount, 1, "IRQC"},
{&IRQa, 1, "IRQA"},
{prg_reg, 2, "PRG"},
{chr_reg, 8, "CHR"},
{&mirr, 1, "MIRR"},
{0}
};
/*
static void UNLAX5705IRQ(void)
{
if(IRQa)
{
IRQCount++;
if(IRQCount>=238)
{
X6502_IRQBegin(FCEU_IQEXT);
// IRQa=0;
}
}
}*/
static void Sync(void)
{
int i;
setprg8(0x8000,prg_reg[0]);
setprg8(0xA000,prg_reg[1]);
setprg8(0xC000,~1);
setprg8(0xE000,~0);
for(i=0; i<8; i++)
setchr1(i<<10,chr_reg[i]);
setmirror(mirr^1);
}
static DECLFW(UNLAX5705Write)
{
// if((A>=0xA008)&&(A<=0xE003))
// {
// int ind=(((A>>11)-6)|(A&1))&7;
// int sar=((A&2)<<1);
// chr_reg[ind]=(chr_reg[ind]&(0xF0>>sar))|((V&0x0F)<<sar);
// SyncChr();
// }
// else
switch(A&0xF00F)
{
case 0x8000: prg_reg[0]=((V&2)<<2)|((V&8)>>2)|(V&5); break; // EPROM dump have mixed PRG and CHR banks, data lines to mapper seems to be mixed
case 0x8008: mirr=V&1; break;
case 0xA000: prg_reg[1]=((V&2)<<2)|((V&8)>>2)|(V&5); break;
case 0xA008: chr_reg[0]=(chr_reg[0]&0xF0)|(V&0x0F); break;
case 0xA009: chr_reg[0]=(chr_reg[0]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xA00A: chr_reg[1]=(chr_reg[1]&0xF0)|(V&0x0F); break;
case 0xA00B: chr_reg[1]=(chr_reg[1]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xC000: chr_reg[2]=(chr_reg[2]&0xF0)|(V&0x0F); break;
case 0xC001: chr_reg[2]=(chr_reg[2]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xC002: chr_reg[3]=(chr_reg[3]&0xF0)|(V&0x0F); break;
case 0xC003: chr_reg[3]=(chr_reg[3]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xC008: chr_reg[4]=(chr_reg[4]&0xF0)|(V&0x0F); break;
case 0xC009: chr_reg[4]=(chr_reg[4]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xC00A: chr_reg[5]=(chr_reg[5]&0xF0)|(V&0x0F); break;
case 0xC00B: chr_reg[5]=(chr_reg[5]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xE000: chr_reg[6]=(chr_reg[6]&0xF0)|(V&0x0F); break;
case 0xE001: chr_reg[6]=(chr_reg[6]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xE002: chr_reg[7]=(chr_reg[7]&0xF0)|(V&0x0F); break;
case 0xE003: chr_reg[7]=(chr_reg[7]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
// case 0x800A: X6502_IRQEnd(FCEU_IQEXT); IRQa=0; break;
// case 0xE00B: X6502_IRQEnd(FCEU_IQEXT); IRQa=IRQCount=V; /*if(scanline<240) IRQCount-=8; else IRQCount+=4;*/ break;
}
Sync();
}
static void UNLAX5705Power(void)
{
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,UNLAX5705Write);
}
static void StateRestore(int version)
{
Sync();
}
void UNLAX5705_Init(CartInfo *info)
{
info->Power=UNLAX5705Power;
// GameHBIRQHook=UNLAX5705IRQ;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

164
src/boards/bandai.cpp Normal file
View File

@ -0,0 +1,164 @@
/* 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
*
* Bandai mappers
*
*/
#include "mapinc.h"
static uint8 reg[16], is153;
static uint8 IRQa;
static uint16 IRQCount, IRQLatch;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{reg, 16, "REGS"},
{&IRQa, 1, "IRQA"},
{&IRQCount, 2, "IRQC"},
{&IRQLatch, 2, "IRQL"},
{0}
};
static void BandaiIRQHook(int a)
{
if(IRQa)
{
IRQCount -= a;
if(IRQCount<0)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa = 0;
IRQCount = 0xFFFF;
}
}
}
static void BandaiSync(void)
{
if(is153)
{
int base=(reg[0]&1)<<4;
if(!UNIFchrrama) // SD Gundam Gaiden - Knight Gundam Monogatari 2 - Hikari no Kishi (J) uses WRAM but have CHRROM too
{
int i;
for(i=0; i<8; i++) setchr1(i<<10,reg[i]);
}
else
setchr8(0);
setprg16(0x8000,(reg[8]&0x0F)|base);
setprg16(0xC000,0x0F|base);
}
else
{
int i;
for(i=0; i<8; i++) setchr1(i<<10,reg[i]);
setprg16(0x8000,reg[8]);
setprg16(0xC000,~0);
}
switch(reg[9])
{
case 0: setmirror(MI_V); break;
case 1: setmirror(MI_H); break;
case 2: setmirror(MI_0); break;
case 3: setmirror(MI_1); break;
}
}
static DECLFW(BandaiWrite)
{
A&=0x0F;
if(A<0x0A)
{
reg[A&0x0F]=V;
BandaiSync();
}
else
switch(A)
{
case 0x0A: X6502_IRQEnd(FCEU_IQEXT); IRQa=V&1; IRQCount=IRQLatch; break;
case 0x0B: IRQLatch&=0xFF00; IRQLatch|=V; break;
case 0x0C: IRQLatch&=0xFF; IRQLatch|=V<<8; break;
case 0x0D: break;// Serial EEPROM control port
}
}
static void BandaiPower(void)
{
BandaiSync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0xFFFF,BandaiWrite);
}
static void M153Power(void)
{
BandaiSync();
setprg8r(0x10,0x6000,0);
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,BandaiWrite);
}
static void M153Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
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 Mapper153_Init(CartInfo *info)
{
is153=1;
info->Power=M153Power;
info->Close=M153Close;
MapIRQHook=BandaiIRQHook;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -24,10 +24,12 @@ static uint8 prg_reg;
static uint8 chr_reg; static uint8 chr_reg;
static uint8 sim0reg, sim0bit, sim0byte, sim0parity, sim0bcnt; static uint8 sim0reg, sim0bit, sim0byte, sim0parity, sim0bcnt;
static uint16 sim0data; static uint8 sim0bitw, sim0bytew, sim0parityw, sim0bcntw;
static uint16 sim0data, sim0dataw, sim0iswrite;
static uint8 sim0array[128] = static uint8 sim0array[128] =
{ {
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x14, 0x55, 0x45, 0xd3, 0x18, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
@ -36,6 +38,7 @@ static uint8 sim0array[128] =
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xAA, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xAA,
}; };
static uint8 sim0cmd[16];
static SFORMAT StateRegs[]= static SFORMAT StateRegs[]=
{ {
@ -65,25 +68,64 @@ static DECLFW(M216WriteHi)
static DECLFW(M216Write5000) static DECLFW(M216Write5000)
{ {
// FCEU_printf("WRITE: %04x:%04x\n",A,V);
sim0reg=V; sim0reg=V;
if(!sim0reg) if(!sim0reg)
{ {
sim0bit=sim0byte=sim0parity=0; sim0bit=sim0byte=sim0parity=0;
sim0bitw=sim0bytew=sim0parityw=0;
sim0data=sim0array[0]; sim0data=sim0array[0];
sim0bcnt=0x80; sim0bcnt=0x7F;
} }
else if(sim0reg&0x20) if(sim0reg&0x20)
{ {
sim0bcnt=0x20; sim0bcnt=0x1E;
sim0bcntw=4;
} }
if(sim0reg&0x08)
{
uint8 sim0in=0;
sim0iswrite=0x2C;
if(sim0bitw<8)
{
sim0in=(V&0x10)>>4;
sim0parityw+=sim0in;
sim0dataw|=sim0in<<7;
sim0dataw>>=1;
sim0bitw++;
}
else if(sim0bitw==8)
{
sim0bitw++;
}
else if(sim0bitw==9)
{
sim0parityw=0;
sim0bitw=0;
if(sim0bytew==sim0bcntw)
{
sim0reg=0x60;
sim0iswrite=0;
}
else
{
sim0cmd[sim0bytew++]=sim0dataw;
sim0dataw=0;
}
}
}
FCEU_printf("WRITE: %04x:%04x (PC=%02x cnt=%02x)\n",A,V,X.PC,sim0bcnt);
} }
static DECLFR(M216Read5000) static DECLFR(M216Read5000)
{ {
if(sim0reg&0x60) if(sim0reg&0x60)
{ {
if(sim0iswrite)
sim0iswrite--;
else
sim0reg=(sim0reg^(sim0reg<<1))&0x40; sim0reg=(sim0reg^(sim0reg<<1))&0x40;
FCEU_printf("READ: %04x PC=%04x reg=%02x\n",A,X.PC,sim0reg);
return sim0reg; return sim0reg;
} }
else else
@ -91,30 +133,33 @@ static DECLFR(M216Read5000)
uint8 sim0out=0; uint8 sim0out=0;
if(sim0bit<8) if(sim0bit<8)
{ {
// sim0data=((sim0array[sim0byte]<<(sim0bit))&0x80)>>1; sim0out=(sim0data&0x80)>>7;
sim0out=(sim0data&1)<<6; sim0parity+=sim0out;
sim0data>>=1; sim0out<<=6;
sim0data<<=1;
sim0bit++; sim0bit++;
sim0parity+=sim0data;
} }
else if(sim0bit==8) else if(sim0bit==8)
{ {
sim0bit++; sim0bit++;
sim0out=sim0parity&1; sim0out=(sim0parity&1)<<6;
} }
else if(sim0bit==9) else if(sim0bit==9)
{ {
sim0parity=0;
sim0bit=0;
if(sim0byte==sim0bcnt) if(sim0byte==sim0bcnt)
{
sim0reg=0x40;
sim0out=0x60; sim0out=0x60;
}
else else
{ {
sim0bit=0;
sim0byte++;
sim0data=sim0array[sim0byte];
sim0out=0; sim0out=0;
sim0data=sim0array[sim0byte++];
} }
} }
// FCEU_printf("READ: %04x (%04x-%02x,%04x)\n",A,X.PC,sim0out,sim0byte); FCEU_printf("READ: %04x PC=%04x out=%02x byte=%02x cnt=%02x bit=%02x\n",A,X.PC,sim0out,sim0byte,sim0bcnt,sim0bit);
return sim0out; return sim0out;
} }
} }

91
src/boards/bs-5.cpp Normal file
View File

@ -0,0 +1,91 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 reg_prg[4];
static uint8 reg_chr[4];
static uint8 dip_switch;
static SFORMAT StateRegs[]=
{
{reg_prg, 4, "PREGS"},
{reg_chr, 4, "CREGS"},
{0}
};
static void Sync(void)
{
setprg8(0x8000,reg_prg[0]);
setprg8(0xa000,reg_prg[1]);
setprg8(0xc000,reg_prg[2]);
setprg8(0xe000,reg_prg[3]);
setchr2(0x0000,reg_chr[0]);
setchr2(0x0800,reg_chr[1]);
setchr2(0x1000,reg_chr[2]);
setchr2(0x1800,reg_chr[3]);
setmirror(MI_V);
}
static DECLFW(MBS5Write)
{
int bank_sel = (A&0xC00)>>10;
switch (A&0xF000)
{
case 0x8000:
reg_chr[bank_sel]=A&0x1F;
break;
case 0xA000:
if(A&(1<<(dip_switch+4)))
reg_prg[bank_sel]=A&0x0F;
break;
}
Sync();
}
static void MBS5Reset(void)
{
dip_switch++;
dip_switch&=3;
reg_prg[0]=reg_prg[1]=reg_prg[2]=reg_prg[3]=~0;
Sync();
}
static void MBS5Power(void)
{
dip_switch=0;
reg_prg[0]=reg_prg[1]=reg_prg[2]=reg_prg[3]=~0;
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,MBS5Write);
}
static void StateRestore(int version)
{
Sync();
}
void BMCBS5_Init(CartInfo *info)
{
info->Power=MBS5Power;
info->Reset=MBS5Reset;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -0,0 +1,147 @@
/* 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
*/
/*
0000 - 1FFF - RAM
2000 - 23FF - PPU
2400 - 27FF - Write: "PAG" / Read: --
2800 - 2BFF - Write: "BNK" / Read: "STS"
2C00 - 2FFF - Write: "UWR" / Read: "URD"
3000 - 3FFF - Small Flash Page (â ðåãèñòðå BNK)
4000 - 7FFF - Free
8000 - FFFF - Cart/Big Flash Page (ñìîòðè ðåãèñòð PAG)
Áèòû:
Ðåãèñòð [PAG], ïî ñáðîñó äîëæåí áûòü = $00.
D3-D0 - Big Page High Address (D3,D2,D1,D0,A14,A13,A12,A11,A10,A9,A8,A7,A6,A5,A4,A3,A2,A1,A0)
D4 - VMD áèò. Åñëè =0, òî ê PPU ïîäêëþ÷åíî âíóòðåíåå ÎÇó íà 8Êá, åñëè =1 - òî êàðòðèäæ.
D5 - STR áèò. Åñëè =0, òî âìåñòî êàðòà ïî àäðåñàì 8000-FFFF âíóòðåííÿÿ ôëýø, =1 - êàðò.
Ðåãèñòð [BNK], íå ïðåäóñòàíàâëèâàåòñÿ
D6-D0 - Small Page High Address (D6,D5,D4,D3,D2,D1,D0,A11,A10,A9,A8,A7,A6,A5,A4,A3,A2,A1,A0)
D7 - S/W áèò. Óïðàâëÿåò USB ìîñòîì, â ýìóëå ðåàëèçîâûâàòü íå íàäî.
Ðåãèñòðû [UWR]/[URD], íå ïðåäóñòàíàâëèâàþòñÿ, â ýìóëå ðåàëèçîâûâàòü íå íàäî.
[UWR] - Ðåãèñòð çàïèñè äàííûõ â USB ìîñò.
[URD] - Ðåãèñòð ÷òåíèÿ èç USB ìîñòà.
*/
#include "mapinc.h"
#include "mmc3.h"
static uint8 reg[3];
static uint8 *CHRRAM=NULL;
static uint32 CHRRAMSIZE;
static SFORMAT StateRegs[]=
{
{reg, 3, "REGS"},
{0}
};
static void Sync(void)
{
setprg4r(1,0x3000,reg[1]&0x7F);
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void MCopyFamiMMC3PW(uint32 A, uint8 V)
{
if(reg[0]&0x20)
setprg8r(0,A,V);
else
setprg32r(1,0x8000,reg[0]&0x0F);
}
static void MCopyFamiMMC3CW(uint32 A, uint8 V)
{
if(reg[0]&0x20)
setchr1r(0,A,V);
else
setchr8r(0x10,0);
}
static DECLFW(MCopyFamiMMC3WritePAG)
{
reg[0]=V;
Sync();
}
static DECLFW(MCopyFamiMMC3WriteBNK)
{
reg[1]=V;
Sync();
}
static DECLFW(MCopyFamiMMC3WriteUSB)
{
reg[2]=V;
}
static void MCopyFamiMMC3Power(void)
{
reg[0] = 0;
GenMMC3Power();
Sync();
SetReadHandler(0x3000,0x3FFF,CartBR);
SetWriteHandler(0x3000,0x3FFF,CartBW);
SetWriteHandler(0x2400,0x27FF,MCopyFamiMMC3WritePAG);
SetWriteHandler(0x2800,0x2BFF,MCopyFamiMMC3WriteBNK);
SetWriteHandler(0x2C00,0x2FFF,MCopyFamiMMC3WriteUSB);
}
static void MCopyFamiMMC3Reset(void)
{
reg[0] = 0;
MMC3RegReset();
Sync();
}
static void MCopyFamiMMC3Close(void)
{
if(CHRRAM)
FCEU_gfree(CHRRAM);
CHRRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void MapperCopyFamiMMC3_Init(CartInfo *info)
{
GenMMC3_Init(info, 512, 512, 0, 0);
cwrap=MCopyFamiMMC3CW;
pwrap=MCopyFamiMMC3PW;
info->Reset=MCopyFamiMMC3Reset;
info->Power=MCopyFamiMMC3Power;
info->Close=MCopyFamiMMC3Close;
GameStateRestore=StateRestore;
CHRRAMSIZE=8192;
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartPRGMapping(0x10,CHRRAM,CHRRAMSIZE,1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "SRAM");
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -189,7 +189,8 @@ static void M87Sync(void)
{ {
setprg16(0x8000,0); setprg16(0x8000,0);
setprg16(0xC000,1); setprg16(0xC000,1);
setchr8(latche>>1); setchr8(((latche>>1)&1)|((latche<<1)&2));
// setchr8(latche);
} }
void Mapper87_Init(CartInfo *info) void Mapper87_Init(CartInfo *info)
@ -197,6 +198,20 @@ void Mapper87_Init(CartInfo *info)
Latch_Init(info, M87Sync, ~0, 0x6000, 0xFFFF); Latch_Init(info, M87Sync, ~0, 0x6000, 0xFFFF);
} }
//------------------ 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);
}
//------------------ Map 11 --------------------------- //------------------ Map 11 ---------------------------
static void M11Sync(void) static void M11Sync(void)
@ -215,6 +230,31 @@ void Mapper144_Init(CartInfo *info)
Latch_Init(info, M11Sync, 0, 0x8001, 0xFFFF); Latch_Init(info, M11Sync, 0, 0x8001, 0xFFFF);
} }
//------------------ Map 38 ---------------------------
static void M38Sync(void)
{
setprg32(0x8000,latche&3);
setchr8(latche>>2);
}
void Mapper38_Init(CartInfo *info)
{
Latch_Init(info, M38Sync, 0, 0x7000, 0x7FFF);
}
//------------------ Map 36 ---------------------------
static void M36Sync(void)
{
setprg32(0x8000,latche>>4);
setchr8((latche)&0xF);
}
void Mapper36_Init(CartInfo *info)
{
Latch_Init(info, M36Sync, 0, 0x8400, 0xfffe);
}
//------------------ UNROM --------------------------- //------------------ UNROM ---------------------------
static void UNROMSync(void) static void UNROMSync(void)

View File

@ -74,8 +74,11 @@ void UNLEDU2000_Init(CartInfo *info)
GameStateRestore=UNLEDU2000Restore; GameStateRestore=UNLEDU2000Restore;
WRAM=(uint8*)FCEU_gmalloc(32768); WRAM=(uint8*)FCEU_gmalloc(32768);
SetupCartPRGMapping(0x10,WRAM,32768,1); SetupCartPRGMapping(0x10,WRAM,32768,1);
if(info->battery)
{
info->SaveGame[0]=WRAM; info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=32768; info->SaveGameLen[0]=32768;
}
AddExState(WRAM, 32768, 0, "WRAM"); AddExState(WRAM, 32768, 0, "WRAM");
AddExState(StateRegs, ~0, 0, 0); AddExState(StateRegs, ~0, 0, 0);
} }

View File

@ -22,7 +22,7 @@
#include "mmc3.h" #include "mmc3.h"
static uint8 unromchr; static uint8 unromchr;
static uint8 dipswitch; static uint32 dipswitch;
static void BMCFK23CCW(uint32 A, uint8 V) static void BMCFK23CCW(uint32 A, uint8 V)
{ {
@ -42,11 +42,16 @@ static void BMCFK23CCW(uint32 A, uint8 V)
static void BMCFK23CPW(uint32 A, uint8 V) static void BMCFK23CPW(uint32 A, uint8 V)
{ {
if(EXPREGS[0]&4) if((EXPREGS[0]&7)==4)
setprg32(0x8000,EXPREGS[1]>>1); setprg32(0x8000,EXPREGS[1]>>1);
else if ((EXPREGS[0]&7)==3)
{
setprg16(0x8000,EXPREGS[1]);
setprg16(0xC000,EXPREGS[1]);
}
else else
{ {
if(EXPREGS[0]&2) if(EXPREGS[0]&3)
setprg8(A,(V&(0x3F>>(EXPREGS[0]&3)))|(EXPREGS[1]<<1)); setprg8(A,(V&(0x3F>>(EXPREGS[0]&3)))|(EXPREGS[1]<<1));
else else
setprg8(A,V); setprg8(A,V);
@ -62,7 +67,7 @@ static DECLFW(BMCFK23CHiWrite)
{ {
if(EXPREGS[0]&0x40) if(EXPREGS[0]&0x40)
{ {
if(EXPREGS[0]&0x20) if(EXPREGS[0]&0x30)
unromchr=0; unromchr=0;
else else
{ {
@ -99,7 +104,7 @@ static DECLFW(BMCFK23CWrite)
static void BMCFK23CReset(void) static void BMCFK23CReset(void)
{ {
dipswitch++; dipswitch++;
dipswitch&=3; dipswitch&=7;
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0; EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF; EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
MMC3RegReset(); MMC3RegReset();
@ -110,7 +115,7 @@ static void BMCFK23CPower(void)
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0; EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF; EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
GenMMC3Power(); GenMMC3Power();
SetWriteHandler(0x5001,0x5fff,BMCFK23CWrite); SetWriteHandler(0x5000,0x5fff,BMCFK23CWrite);
SetWriteHandler(0x8000,0xFFFF,BMCFK23CHiWrite); SetWriteHandler(0x8000,0xFFFF,BMCFK23CHiWrite);
} }

View File

@ -0,0 +1,106 @@
/* 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
* 63in1 ghostbusters
*/
#include "mapinc.h"
static uint8 reg[2], bank;
static uint8 banks[4] = {0, 0, 1, 2};
static uint8 *CHRROM=NULL;
static uint32 CHRROMSIZE;
static SFORMAT StateRegs[]=
{
{reg, 2, "REGS"},
{&bank, 1, "BANK"},
{0}
};
static void Sync(void)
{
if(reg[0]&0x20)
{
setprg16r(banks[bank],0x8000,reg[0]&0x1F);
setprg16r(banks[bank],0xC000,reg[0]&0x1F);
}
else
setprg32r(banks[bank],0x8000,(reg[0]>>1)&0x0F);
if(reg[1]&2)
setchr8r(0x10,0);
else
setchr8(0);
setmirror((reg[0]&0x40)>>6);
}
static DECLFW(BMCGhostbusters63in1Write)
{
reg[A&1]=V;
bank=((reg[0]&0x80)>>7)|((reg[1]&1)<<1);
// FCEU_printf("reg[0]=%02x, reg[1]=%02x, bank=%02x\n",reg[0],reg[1],bank);
Sync();
}
static DECLFR(BMCGhostbusters63in1Read)
{
if(bank==1)
return X.DB;
else
return CartBR(A);
}
static void BMCGhostbusters63in1Power(void)
{
reg[0]=reg[1]=0;
Sync();
SetReadHandler(0x8000,0xFFFF,BMCGhostbusters63in1Read);
SetWriteHandler(0x8000,0xFFFF,BMCGhostbusters63in1Write);
}
static void BMCGhostbusters63in1Reset(void)
{
reg[0]=reg[1]=0;
}
static void StateRestore(int version)
{
Sync();
}
static void BMCGhostbusters63in1Close(void)
{
if(CHRROM)
FCEU_gfree(CHRROM);
CHRROM=NULL;
}
void BMCGhostbusters63in1_Init(CartInfo *info)
{
info->Reset=BMCGhostbusters63in1Reset;
info->Power=BMCGhostbusters63in1Power;
info->Close=BMCGhostbusters63in1Close;
CHRROMSIZE=8192; // dummy CHRROM, VRAM disable
CHRROM=(uint8*)FCEU_gmalloc(CHRROMSIZE);
SetupCartPRGMapping(0x10,CHRROM,CHRROMSIZE,0);
AddExState(CHRROM, CHRROMSIZE, 0, "CHRROM");
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

69
src/boards/gs-2004.cpp Normal file
View File

@ -0,0 +1,69 @@
/* 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 reg, mirr;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REGS"},
{&mirr, 1, "MIRR"},
{0}
};
static void Sync(void)
{
setprg8r(1,0x6000,0);
setprg32(0x8000,reg);
setchr8(0);
}
static DECLFW(BMCGS2004Write)
{
reg=V;
Sync();
}
static void BMCGS2004Power(void)
{
reg=~0;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,BMCGS2004Write);
}
static void BMCGS2004Reset(void)
{
reg=~0;
}
static void StateRestore(int version)
{
Sync();
}
void BMCGS2004_Init(CartInfo *info)
{
info->Reset=BMCGS2004Reset;
info->Power=BMCGS2004Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

69
src/boards/gs-2013.cpp Normal file
View File

@ -0,0 +1,69 @@
/* 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 reg, mirr;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REGS"},
{&mirr, 1, "MIRR"},
{0}
};
static void Sync(void)
{
setprg8r(0,0x6000,~0);
setprg32r((reg&8)>>3,0x8000,reg);
setchr8(0);
}
static DECLFW(BMCGS2013Write)
{
reg=V;
Sync();
}
static void BMCGS2013Power(void)
{
reg=~0;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,BMCGS2013Write);
}
static void BMCGS2013Reset(void)
{
reg=~0;
}
static void StateRestore(int version)
{
Sync();
}
void BMCGS2013_Init(CartInfo *info)
{
info->Reset=BMCGS2013Reset;
info->Power=BMCGS2013Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -1,7 +1,7 @@
/* FCE Ultra - NES/Famicom Emulator /* FCE Ultra - NES/Famicom Emulator
* *
* Copyright notice for this file: * Copyright notice for this file:
* Copyright (C) 2005 CaH4e3 * Copyright (C) 2005-2008 CaH4e3
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -22,80 +22,178 @@
#include "mapinc.h" #include "mapinc.h"
static uint8 QTAINTRAM[2048];
static writefunc old2007wrap;
static uint16 CHRSIZE = 8192;
static uint16 WRAMSIZE = 8192 + 4096;
static uint8 *CHRRAM=NULL; static uint8 *CHRRAM=NULL;
static uint8 SWRAM[4096]; static uint8 *WRAM = NULL;
static uint8 IRQa, K4IRQ;
static uint32 IRQLatch, IRQCount;
static uint8 regs[16]; static uint8 regs[16];
static uint8 WRAM[4096]; //static uint8 test[8];
static SFORMAT StateRegs[]= static SFORMAT StateRegs[]=
{ {
{&regs, 16, "REGS"}, {&IRQCount, 1, "IRQC"},
{WRAM, 4096, "WRAM"}, {&IRQLatch, 1, "IRQL"},
{&IRQa, 1, "IRQA"},
{&K4IRQ, 1, "K4IRQ"},
{regs, 16, "REGS"},
{0} {0}
}; };
static void chrSync(void)
{
setchr4r(0x10,0x0000,regs[5]&1);
setchr4r(0x10,0x1000,0);
}
static void Sync(void) static void Sync(void)
{ {
if(regs[5]&0x40) chrSync();
{ // if(regs[0xA]&0x10)
setchr4r(0,0x1000,regs[5]&0x3F); // {
} /* setchr1r(0x10,0x0000,(((regs[5]&1))<<2)+0);
setchr1r(0x10,0x0400,(((regs[5]&1))<<2)+1);
setchr1r(0x10,0x0800,(((regs[5]&1))<<2)+2);
setchr1r(0x10,0x0c00,(((regs[5]&1))<<2)+3);
setchr1r(0x10,0x1000,0);
setchr1r(0x10,0x1400,1);
setchr1r(0x10,0x1800,2);
setchr1r(0x10,0x1c00,3);*/
/* setchr1r(0x10,0x0000,(((regs[5]&1))<<2)+0);
setchr1r(0x10,0x0400,(((regs[5]&1))<<2)+1);
setchr1r(0x10,0x0800,(((regs[5]&1))<<2)+2);
setchr1r(0x10,0x0c00,(((regs[5]&1))<<2)+3);
setchr1r(0x10,0x1000,(((regs[5]&1)^1)<<2)+4);
setchr1r(0x10,0x1400,(((regs[5]&1)^1)<<2)+5);
setchr1r(0x10,0x1800,(((regs[5]&1)^1)<<2)+6);
setchr1r(0x10,0x1c00,(((regs[5]&1)^1)<<2)+7);
*/
// }
// else
// {
/*
setchr1r(0x10,0x0000,(((regs[5]&1)^1)<<2)+0);
setchr1r(0x10,0x0400,(((regs[5]&1)^1)<<2)+1);
setchr1r(0x10,0x0800,(((regs[5]&1)^1)<<2)+2);
setchr1r(0x10,0x0c00,(((regs[5]&1)^1)<<2)+3);
setchr1r(0x10,0x1000,(((regs[5]&1))<<2)+4);
setchr1r(0x10,0x1400,(((regs[5]&1))<<2)+5);
setchr1r(0x10,0x1800,(((regs[5]&1))<<2)+6);
setchr1r(0x10,0x1c00,(((regs[5]&1))<<2)+7);
// }
//*/
/* setchr1r(1,0x0000,test[0]);
setchr1r(1,0x0400,test[1]);
setchr1r(1,0x0800,test[2]);
setchr1r(1,0x0c00,test[3]);
setchr1r(1,0x1000,test[4]);
setchr1r(1,0x1400,test[5]);
setchr1r(1,0x1800,test[6]);
setchr1r(1,0x1c00,test[7]);
*/
setprg4r(0x10,0x6000,regs[0]&1);
if(regs[2]>=0x40)
setprg8r(1,0x8000,(regs[2]-0x40));
else else
{ setprg8r(0,0x8000,(regs[2]&0x3F));
setchr4r(0x10,0x0000,regs[5]); if(regs[3]>=0x40)
setchr4r(0x10,0x1000,regs[5]^1); setprg8r(1,0xA000,(regs[3]-0x40));
} else
setprg8r((regs[2]>>6)&1,0x8000,(regs[2]&0x3F)); setprg8r(0,0xA000,(regs[3]&0x3F));
setprg8r((regs[3]>>6)&1,0xA000,(regs[3]&0x3F)); if(regs[4]>=0x40)
setprg8r((regs[4]>>6)&1,0xC000,(regs[4]&0x3F)); setprg8r(1,0xC000,(regs[4]-0x40));
else
setprg8r(0,0xC000,(regs[4]&0x3F));
setprg8r(1,0xE000,~0); setprg8r(1,0xE000,~0);
setmirror((regs[0xA]&3)); setmirror(MI_V);
} }
/*static DECLFW(TestWrite)
{
test[A&7] = V;
Sync();
}*/
static DECLFW(M190Write) static DECLFW(M190Write)
{ {
// FCEU_printf("write %04x:%04x %d, %d\n",A,V,scanline,timestamp); // FCEU_printf("write %04x:%04x %d, %d\n",A,V,scanline,timestamp);
regs[(A&0x0F00)>>8]=V; regs[(A&0x0F00)>>8]=V;
switch(A)
{
case 0xd600:IRQLatch&=0xFF00;IRQLatch|=V;break;
case 0xd700:IRQLatch&=0x00FF;IRQLatch|=V<<8;break;
case 0xd900:IRQCount=IRQLatch;IRQa=V&2;K4IRQ=V&1;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xd800:IRQa=K4IRQ;X6502_IRQEnd(FCEU_IQEXT);break;
}
Sync(); Sync();
} }
static DECLFR(M190Read) static DECLFR(M190Read)
{ {
// FCEU_printf("read %04x:%04x %d, %d\n",A,regs[(A&0x0F00)>>8],scanline,timestamp); // FCEU_printf("read %04x:%04x %d, %d\n",A,regs[(A&0x0F00)>>8],scanline,timestamp);
return regs[(A&0x0F00)>>8]; return regs[(A&0x0F00)>>8]+regs[0x0B];
}
static void VRC5IRQ(int a)
{
if(IRQa)
{
IRQCount+=a;
if(IRQCount&0x10000)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQCount=IRQLatch;
}
}
} }
static DECLFR(AWRAM) static void Mapper190_PPU(uint32 A)
{ {
return(WRAM[A-0x7000]); if(A<0x2000)
} setchr4r(0x10,0x1000,QTAINTRAM[A&0x1FFF]&1);
static DECLFW(BWRAM) // else
{ // chrSync();
WRAM[A-0x7000]=V;
} }
static DECLFR(ASWRAM) static DECLFW(M1902007Wrap)
{ {
return(SWRAM[A-0x6000]); if(A>=0x2000)
} {
static DECLFW(BSWRAM) if(regs[0xA]&1)
{ QTAINTRAM[A&0x1FFF]=V;
SWRAM[A-0x6000]=V; else
old2007wrap(A,V);
}
} }
static void M190Power(void) static void M190Power(void)
{ {
setvram8(CHRRAM); /* test[0]=0;
SetReadHandler(0x8000,0xFFFF,CartBR); test[1]=1;
test[2]=2;
test[3]=3;
test[4]=4;
test[5]=5;
test[6]=6;
test[7]=7;
*/
setprg4r(0x10,0x7000,2);
old2007wrap=GetWriteHandler(0x2007);
SetWriteHandler(0x2007,0x2007,M1902007Wrap);
SetReadHandler(0x6000,0xFFFF,CartBR);
// SetWriteHandler(0x5000,0x5007,TestWrite);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetWriteHandler(0x8000,0xFFFF,M190Write); SetWriteHandler(0x8000,0xFFFF,M190Write);
// SetReadHandler(0xDA00,0xDA00,M190Read);
// SetReadHandler(0xDB00,0xDB00,M190Read);
SetReadHandler(0xDC00,0xDC00,M190Read); SetReadHandler(0xDC00,0xDC00,M190Read);
SetReadHandler(0xDD00,0xDD00,M190Read); SetReadHandler(0xDD00,0xDD00,M190Read);
SetReadHandler(0x7000,0x7FFF,AWRAM);
SetWriteHandler(0x7000,0x7FFF,BWRAM);
SetReadHandler(0x6000,0x6FFF,ASWRAM);
SetWriteHandler(0x6000,0x6FFF,BSWRAM);
Sync(); Sync();
} }
@ -104,6 +202,9 @@ static void M190Close(void)
if(CHRRAM) if(CHRRAM)
FCEU_gfree(CHRRAM); FCEU_gfree(CHRRAM);
CHRRAM=NULL; CHRRAM=NULL;
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
} }
static void StateRestore(int version) static void StateRestore(int version)
@ -115,14 +216,24 @@ void Mapper190_Init(CartInfo *info)
{ {
info->Power=M190Power; info->Power=M190Power;
info->Close=M190Close; info->Close=M190Close;
GameStateRestore=StateRestore;
MapIRQHook=VRC5IRQ;
// PPU_hook=Mapper190_PPU;
CHRRAM=(uint8*)FCEU_gmalloc(CHRSIZE);
SetupCartCHRMapping(0x10,CHRRAM,CHRSIZE,1);
AddExState(CHRRAM, CHRSIZE, 0, "CHRRAM");
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery) if(info->battery)
{ {
info->SaveGame[0]=SWRAM; info->SaveGame[0] = WRAM;
info->SaveGameLen[0]=4096; info->SaveGameLen[0] = WRAMSIZE - 4096;
} }
GameStateRestore=StateRestore;
CHRRAM=(uint8*)FCEU_gmalloc(8192);
SetupCartCHRMapping(0x10,CHRRAM,8192,1);
AddExState(CHRRAM, 8192, 0, "CHRRAM");
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
} }

94
src/boards/ks7032.cpp Normal file
View File

@ -0,0 +1,94 @@
/* 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 reg[8], cmd, IRQa;
static int32 IRQCount;
static SFORMAT StateRegs[]=
{
{&cmd, 1, "CMD"},
{reg, 8, "REGS"},
{&IRQa, 1, "IRQA"},
{&IRQCount, 4, "IRQC"},
{0}
};
static void Sync(void)
{
setprg8(0x6000,reg[4]);
setprg8(0x8000,reg[1]);
setprg8(0xA000,reg[2]);
setprg8(0xC000,reg[3]);
setprg8(0xE000,~0);
setchr8(0);
}
static DECLFW(UNLKS7032Write)
{
// FCEU_printf("bs %04x %02x\n",A,V);
switch(A)
{
// case 0x8FFF: reg[4]=V; Sync(); break;
case 0x8000: X6502_IRQEnd(FCEU_IQEXT); IRQCount=(IRQCount&0x000F)|(V&0x0F); break;
case 0x9000: X6502_IRQEnd(FCEU_IQEXT); IRQCount=(IRQCount&0x00F0)|((V&0x0F)<<4); break;
case 0xA000: X6502_IRQEnd(FCEU_IQEXT); IRQCount=(IRQCount&0x0F00)|((V&0x0F)<<8); break;
case 0xB000: X6502_IRQEnd(FCEU_IQEXT); IRQCount=(IRQCount&0xF000)|(V<<12); break;
case 0xC000: X6502_IRQEnd(FCEU_IQEXT); IRQa=1; break;
case 0xE000: cmd=V&7; break;
case 0xF000: reg[cmd]=V; Sync(); break;
}
}
static void UNLSMB2JIRQHook(int a)
{
if(IRQa)
{
IRQCount+=a;
if(IRQCount>=0xFFFF)
{
IRQa=0;
IRQCount=0;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
static void UNLKS7032Power(void)
{
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0xFFFF,UNLKS7032Write);
}
static void StateRestore(int version)
{
Sync();
}
void UNLKS7032_Init(CartInfo *info)
{
info->Power=UNLKS7032Power;
MapIRQHook=UNLSMB2JIRQHook;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -28,6 +28,7 @@ static void MALEEPower(void)
SetReadHandler(0x8000,0xFFFF,CartBR); SetReadHandler(0x8000,0xFFFF,CartBR);
SetReadHandler(0x6000,0x67FF,CartBR); SetReadHandler(0x6000,0x67FF,CartBR);
SetReadHandler(0x7000,0x77FF,CartBR); SetReadHandler(0x7000,0x77FF,CartBR);
SetWriteHandler(0x7000,0x77FF,CartBW);
setprg2r(1,0x6000,0); setprg2r(1,0x6000,0);
setprg32(0x8000,0); setprg32(0x8000,0);
setchr8(0); setchr8(0);

View File

@ -34,7 +34,7 @@ static void (*MMC1PRGHook16)(uint32 A, uint8 V);
static uint8 *WRAM=NULL; static uint8 *WRAM=NULL;
static uint8 *CHRRAM=NULL; static uint8 *CHRRAM=NULL;
static int is155; static int is155, is171;
static DECLFW(MBWRAM) static DECLFW(MBWRAM)
{ {
@ -58,6 +58,7 @@ static void MMC1CHR(void)
else else
setprg8r(0x10,0x6000,(DRegs[1]>>3)&1); setprg8r(0x10,0x6000,(DRegs[1]>>3)&1);
} }
if(MMC1CHRHook4) if(MMC1CHRHook4)
{ {
if(DRegs[0]&0x10) if(DRegs[0]&0x10)
@ -103,7 +104,9 @@ static void MMC1PRG(void)
break; break;
} }
} }
else switch(DRegs[0]&0xC) else
{
switch(DRegs[0]&0xC)
{ {
case 0xC: setprg16(0x8000,(DRegs[3]+offs)); case 0xC: setprg16(0x8000,(DRegs[3]+offs));
setprg16(0xC000,0xF+offs); setprg16(0xC000,0xF+offs);
@ -118,9 +121,11 @@ static void MMC1PRG(void)
break; break;
} }
} }
}
static void MMC1MIRROR(void) static void MMC1MIRROR(void)
{ {
if(!is171)
switch(DRegs[0]&3) switch(DRegs[0]&3)
{ {
case 2: setmirror(MI_V); break; case 2: setmirror(MI_V); break;
@ -135,15 +140,18 @@ static DECLFW(MMC1_write)
{ {
int n=(A>>13)-4; int n=(A>>13)-4;
//FCEU_DispMessage("%016x",timestampbase+timestamp); //FCEU_DispMessage("%016x",timestampbase+timestamp);
//printf("$%04x:$%02x, $%04x\n",A,V,X.PC); // FCEU_printf("$%04x:$%02x, $%04x\n",A,V,X.PC);
//DumpMem("out",0xe000,0xffff); //DumpMem("out",0xe000,0xffff);
/* The MMC1 is busy so ignore the write. */ /* The MMC1 is busy so ignore the write. */
/* As of version FCE Ultra 0.81, the timestamp is only /* As of version FCE Ultra 0.81, the timestamp is only
increased before each instruction is executed(in other words increased before each instruction is executed(in other words
precision isn't that great), but this should still work to precision isn't that great), but this should still work to
deal with 2 writes in a row from a single RMW instruction. */ deal with 2 writes in a row from a single RMW instruction.
if((timestampbase+timestamp)<(lreset+2)) return; */
if((timestampbase+timestamp)<(lreset+2))
return;
// FCEU_printf("Write %04x:%02x\n",A,V);
if(V&0x80) if(V&0x80)
{ {
DRegs[0]|=0xC; DRegs[0]|=0xC;
@ -152,7 +160,9 @@ static DECLFW(MMC1_write)
lreset=timestampbase+timestamp; lreset=timestampbase+timestamp;
return; return;
} }
Buffer|=(V&1)<<(BufferShift++); Buffer|=(V&1)<<(BufferShift++);
if(BufferShift==5) if(BufferShift==5)
{ {
DRegs[n] = Buffer; DRegs[n] = Buffer;
@ -178,10 +188,12 @@ static void MMC1_Restore(int version)
static void MMC1CMReset(void) static void MMC1CMReset(void)
{ {
int i; int i;
for(i=0;i<4;i++) for(i=0;i<4;i++)
DRegs[i]=0; DRegs[i]=0;
Buffer = BufferShift = 0; Buffer = BufferShift = 0;
DRegs[0]=0x1F; DRegs[0]=0x1F;
DRegs[1]=0; DRegs[1]=0;
DRegs[2]=0; // Should this be something other than 0? DRegs[2]=0; // Should this be something other than 0?
DRegs[3]=0; DRegs[3]=0;
@ -233,6 +245,7 @@ static void NWCCHRHook(uint32 A, uint8 V)
NWCIRQCount=0; NWCIRQCount=0;
X6502_IRQEnd(FCEU_IQEXT); X6502_IRQEnd(FCEU_IQEXT);
} }
NWCRec=V; NWCRec=V;
if(V&0x08) if(V&0x08)
MMC1PRG(); MMC1PRG();
@ -311,7 +324,8 @@ static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int battery)
{ {
WRAM=(uint8*)FCEU_gmalloc(wram*1024); WRAM=(uint8*)FCEU_gmalloc(wram*1024);
//mbg 6/17/08 - this shouldve been cleared to re-initialize save ram //mbg 6/17/08 - this shouldve been cleared to re-initialize save ram
memset(WRAM,0,wram*1024); //ch4 10/12/08 - nope, this souldn't
//memset(WRAM,0,wram*1024);
mmc1opts|=1; mmc1opts|=1;
if(wram>8) mmc1opts|=4; if(wram>8) mmc1opts|=4;
SetupCartPRGMapping(0x10,WRAM,wram*1024,1); SetupCartPRGMapping(0x10,WRAM,wram*1024,1);
@ -351,6 +365,14 @@ void Mapper155_Init(CartInfo *info)
is155=1; is155=1;
} }
/* Same as mapper 1, with different (or without) mirroring control. */
/* Kaiser KS7058 board, KS203 custom chip */
void Mapper171_Init(CartInfo *info)
{
GenMMC1Init(info,32,32,0,0);
is171=1;
}
void SAROM_Init(CartInfo *info) void SAROM_Init(CartInfo *info)
{ {
GenMMC1Init(info, 128, 64, 8, info->battery); GenMMC1Init(info, 128, 64, 8, info->battery);

View File

@ -21,7 +21,7 @@
*/ */
/* Code for emulating iNES mappers 4,12,44,45,47,49,52,74,114,115,116,118, /* Code for emulating iNES mappers 4,12,44,45,47,49,52,74,114,115,116,118,
119,148,165,205,214,215,245,249,250,254 119,165,205,214,215,245,249,250,254
*/ */
#include "mapinc.h" #include "mapinc.h"
@ -128,7 +128,9 @@ DECLFW(MMC3_CMDWrite)
{ {
case 0x8000: case 0x8000:
if((V&0x40) != (MMC3_cmd&0x40)) if((V&0x40) != (MMC3_cmd&0x40))
{
FixMMC3PRG(V); FixMMC3PRG(V);
}
if((V&0x80) != (MMC3_cmd&0x80)) if((V&0x80) != (MMC3_cmd&0x80))
FixMMC3CHR(V); FixMMC3CHR(V);
MMC3_cmd = V; MMC3_cmd = V;
@ -170,7 +172,6 @@ DECLFW(MMC3_CMDWrite)
break; break;
case 0xA001: case 0xA001:
A001B=V; A001B=V;
Write_IRQFM(0x4017,0x40);
break; break;
} }
} }
@ -232,7 +233,8 @@ void GenMMC3Restore(int version)
static void GENCWRAP(uint32 A, uint8 V) static void GENCWRAP(uint32 A, uint8 V)
{ {
if(!UNIFchrrama) setchr1(A,V); // if(!UNIFchrrama) // Yong Zhe Dou E Long - Dragon Quest VI (As).nes NEEDS THIS
setchr1(A,V); // Business Wars NEEDS THIS
} }
static void GENPWRAP(uint32 A, uint8 V) static void GENPWRAP(uint32 A, uint8 V)
@ -535,8 +537,9 @@ static void M45CW(uint32 A, uint8 V)
uint32 NV=V; uint32 NV=V;
if(EXPREGS[2]&8) if(EXPREGS[2]&8)
NV&=(1<<((EXPREGS[2]&7)+1))-1; NV&=(1<<((EXPREGS[2]&7)+1))-1;
// else else
// NV&=0; if(EXPREGS[2])
NV&=0; // hack ;( don't know exactly how it should be
NV|=EXPREGS[0]|((EXPREGS[2]&0xF0)<<4); NV|=EXPREGS[0]|((EXPREGS[2]&0xF0)<<4);
setchr1(A,NV); setchr1(A,NV);
} }
@ -854,6 +857,8 @@ static void M115CW(uint32 A, uint8 V)
static DECLFW(M115Write) static DECLFW(M115Write)
{ {
// FCEU_printf("%04x:%04x\n",A,V);
if(A==0x5080) EXPREGS[2]=V;
if(A==0x6000) if(A==0x6000)
EXPREGS[0]=V; EXPREGS[0]=V;
else if(A==0x6001) else if(A==0x6001)
@ -861,11 +866,16 @@ static DECLFW(M115Write)
FixMMC3PRG(MMC3_cmd); FixMMC3PRG(MMC3_cmd);
} }
static DECLFR(M115Read)
{
return EXPREGS[2];
}
static void M115Power(void) static void M115Power(void)
{ {
GenMMC3Power(); GenMMC3Power();
SetWriteHandler(0x4100,0x7FFF,M115Write); SetWriteHandler(0x4100,0x7FFF,M115Write);
SetReadHandler(0x4100,0x7FFF,0); SetReadHandler(0x5000,0x5FFF,M115Read);
} }
void Mapper115_Init(CartInfo *info) void Mapper115_Init(CartInfo *info)
@ -956,6 +966,48 @@ void Mapper119_Init(CartInfo *info)
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
} }
// ---------------------------- Mapper 134 ------------------------------
static void M134PW(uint32 A, uint8 V)
{
setprg8(A,(V&0x1F)|((EXPREGS[0]&2)<<4));
}
static void M134CW(uint32 A, uint8 V)
{
setchr1(A,(V&0xFF)|((EXPREGS[0]&0x20)<<3));
}
static DECLFW(M134Write)
{
EXPREGS[0]=V;
FixMMC3CHR(MMC3_cmd);
FixMMC3PRG(MMC3_cmd);
}
static void M134Power(void)
{
EXPREGS[0]=0;
GenMMC3Power();
SetWriteHandler(0x6001,0x6001,M134Write);
}
static void M134Reset(void)
{
EXPREGS[0]=0;
MMC3RegReset();
}
void Mapper134_Init(CartInfo *info)
{
GenMMC3_Init(info, 256, 256, 0, 0);
pwrap=M134PW;
cwrap=M134CW;
info->Power=M134Power;
info->Reset=M134Reset;
AddExState(EXPREGS, 4, 0, "EXPR");
}
// ---------------------------- Mapper 165 ------------------------------ // ---------------------------- Mapper 165 ------------------------------
static void M165CW(uint32 A, uint8 V) static void M165CW(uint32 A, uint8 V)
@ -1159,6 +1211,29 @@ void Mapper195_Init(CartInfo *info)
AddExState(wramtw, wramsize, 0, "WRAMTW"); AddExState(wramtw, wramsize, 0, "WRAMTW");
} }
// ---------------------------- Mapper 196 -------------------------------
static DECLFW(Mapper196Write)
{
A=(A&0xFFFE)|((A>>2)&1)|((A>>3)&1)|((A>>1)&1);
if(A >= 0xC000)
MMC3_IRQWrite(A,V);
else
MMC3_CMDWrite(A,V);
}
static void Mapper196Power(void)
{
GenMMC3Power();
SetWriteHandler(0x8000,0xFFFF,Mapper196Write);
}
void Mapper196_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 128, 0, 0);
info->Power=Mapper196Power;
}
// ---------------------------- Mapper 197 ------------------------------- // ---------------------------- Mapper 197 -------------------------------
static void M197CW(uint32 A, uint8 V) static void M197CW(uint32 A, uint8 V)
@ -1560,6 +1635,11 @@ void Mapper254_Init(CartInfo *info)
// ---------------------------- UNIF Boards ----------------------------- // ---------------------------- UNIF Boards -----------------------------
void TBROM_Init(CartInfo *info)
{
GenMMC3_Init(info, 64, 64, 0, 0);
}
void TEROM_Init(CartInfo *info) void TEROM_Init(CartInfo *info)
{ {
GenMMC3_Init(info, 32, 32, 0, 0); GenMMC3_Init(info, 32, 32, 0, 0);

View File

@ -133,33 +133,28 @@ uint8 mmc5_PPURead(uint32 A) {
// ETROM seems to have 16KB of WRAM, ELROM seems to have 8KB // ETROM seems to have 16KB of WRAM, ELROM seems to have 8KB
// EWROM seems to have 32KB of WRAM // EWROM seems to have 32KB of WRAM
#define MMC5_NOCARTS 14
cartdata MMC5CartList[MMC5_NOCARTS]= cartdata MMC5CartList[]=
{ {
{0x9c18762b,2}, /* L'Empereur */ {0x9c18762b,2}, /* L'Empereur */
{0x26533405,2}, {0x26533405,2},
{0x6396b988,2}, {0x6396b988,2},
{0xaca15643,2}, /* Uncharted Waters */ {0xaca15643,2}, /* Uncharted Waters */
{0xfe3488d1,2}, /* Dai Koukai Jidai */ {0xfe3488d1,2}, /* Dai Koukai Jidai */
{0x15fe6d0f,2}, /* BKAC */ {0x15fe6d0f,2}, /* BKAC */
{0x39f2ce4b,2}, /* Suikoden */ {0x39f2ce4b,2}, /* Suikoden */
{0x8ce478db,2}, /* Nobunaga's Ambition 2 */ {0x8ce478db,2}, /* Nobunaga's Ambition 2 */
{0xeee9a682,2}, {0xeee9a682,2},
{0xf9b4240f,2},
{0x1ced086f,2}, /* Ishin no Arashi */ {0x1ced086f,2}, /* Ishin no Arashi */
{0xf540677b,4}, /* Nobunaga...Bushou Fuuun Roku */ {0xf540677b,4}, /* Nobunaga...Bushou Fuuun Roku */
{0x6f4e4312,4}, /* Aoki Ookami..Genchou */ {0x6f4e4312,4}, /* Aoki Ookami..Genchou */
{0xf011e490,4}, /* Romance of the 3 Kingdoms 2 */ {0xf011e490,4}, /* Romance of the 3 Kingdoms 2 */
{0x184c2124,4}, /* Sangokushi 2 */ {0x184c2124,4}, /* Sangokushi 2 */
{0xee8e6553,4},
}; };
#define MMC5_NOCARTS (sizeof(MMC5CartList)/sizeof(MMC5CartList[0]))
int DetectMMC5WRAMSize(uint32 crc32) int DetectMMC5WRAMSize(uint32 crc32)
{ {
int x; int x;
@ -172,7 +167,9 @@ int DetectMMC5WRAMSize(uint32 crc32)
//mbg 8/4/08 - previously, this was returning 8KB //mbg 8/4/08 - previously, this was returning 8KB
//but I changed it to return 64 because unlisted carts are probably homebrews, and they should probably use 64 (why not use it all?) //but I changed it to return 64 because unlisted carts are probably homebrews, and they should probably use 64 (why not use it all?)
return 64; //ch4 10/12/08 - then f***ng for what all this shit above? let's give em all this 64k shit! Damn
// homebrew must use it's own emulators or standart features.
return 8;
} }
static void BuildWRAMSizeTable(void) static void BuildWRAMSizeTable(void)
@ -395,10 +392,7 @@ static DECLFW(Mapper5_write)
break; break;
case 0x5102: WRAMMaskEnable[0]=V;break; case 0x5102: WRAMMaskEnable[0]=V;break;
case 0x5103: WRAMMaskEnable[1]=V;break; case 0x5103: WRAMMaskEnable[1]=V;break;
case 0x5104: case 0x5104: CHRMode=V;MMC5HackCHRMode=V&3;break;
CHRMode=V;
MMC5HackCHRMode=V&3;
break;
case 0x5106: if(V!=NTFill) case 0x5106: if(V!=NTFill)
{ {
uint32 t; uint32 t;

View File

@ -16,16 +16,10 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ * Mortal Kombat 2 YOKO */
#include "mapinc.h" #include "mapinc.h"
//mbg merge 7/17/06 - TODO CaH4e3 / does it make sense to #include mmc3.h here? it uses some vars from it..
//also, CaH4e3, discuss with me whether this implies that 0xA000 and 0xE000 can have their own 8k banks (
#include "mmc3.h" #include "mmc3.h"
//mbg merge 7/17/06 we get these externs from mmc3.h
//uint8 IRQCount,IRQLatch,IRQa;
//uint8 IRQReload;
static uint8 reg[8]; static uint8 reg[8];
@ -54,7 +48,7 @@ static void Sync(void)
static DECLFW(MCN22MWrite) static DECLFW(MCN22MWrite)
{ {
FCEU_printf("bs %04x %02x\n",A,V); //FCEU_printf("bs %04x %02x\n",A,V);
switch(A) switch(A)
{ {
case 0x8c00: case 0x8c00:
@ -70,6 +64,7 @@ FCEU_printf("bs %04x %02x\n",A,V);
static void MCN22MPower(void) static void MCN22MPower(void)
{ {
reg[0]=reg[1]=reg[2]=0;
Sync(); Sync();
SetReadHandler(0x8000,0xFFFF,CartBR); SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,MCN22MWrite); SetWriteHandler(0x8000,0xFFFF,MCN22MWrite);

View File

@ -443,7 +443,7 @@ void Mapper19_Init(CartInfo *info)
Mapper19_ESI(); Mapper19_ESI();
AddExState(WRAM, 8192, 0, "WRAM"); AddExState(WRAM, 8192, 0, "WRAM");
AddExState(IRAM, 128, 0, "WRAM"); AddExState(IRAM, 128, 0, "IRAM");
AddExState(N106_StateRegs, ~0, 0, 0); AddExState(N106_StateRegs, ~0, 0, 0);
if(info->battery) if(info->battery)

97
src/boards/n625092.cpp Normal file
View File

@ -0,0 +1,97 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2006 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* 700in1 and 400in1 carts
*/
#include "mapinc.h"
static uint16 cmd, bank;
static SFORMAT StateRegs[]=
{
{&cmd, 2, "CMD"},
{&bank, 2, "BANK"},
{0}
};
static void Sync(void)
{
setmirror((cmd&1)^1);
setchr8(0);
if(cmd&2)
{
if(cmd&0x100)
{
setprg16(0x8000,((cmd&0xe0)>>2)|bank);
setprg16(0xC000,((cmd&0xe0)>>2)|7);
}
else
{
setprg16(0x8000,((cmd&0xe0)>>2)|(bank&6));
setprg16(0xC000,((cmd&0xe0)>>2)|((bank&6)|1));
}
}
else
{
setprg16(0x8000,((cmd&0xe0)>>2)|bank);
setprg16(0xC000,((cmd&0xe0)>>2)|bank);
}
}
static DECLFW(UNLN625092WriteCommand)
{
cmd=A;
Sync();
}
static DECLFW(UNLN625092WriteBank)
{
bank=A&7;
Sync();
}
static void UNLN625092Power(void)
{
cmd=0;
bank=0;
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xBFFF,UNLN625092WriteCommand);
SetWriteHandler(0xC000,0xFFFF,UNLN625092WriteBank);
}
static void UNLN625092Reset(void)
{
cmd=0;
bank=0;
}
static void StateRestore(int version)
{
Sync();
}
void UNLN625092_Init(CartInfo *info)
{
info->Reset=UNLN625092Reset;
info->Power=UNLN625092Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -20,7 +20,7 @@
#include "mapinc.h" #include "mapinc.h"
static uint8 cmd; static uint8 cmd, dip;
static uint8 latch[8]; static uint8 latch[8];
static void S74LS374MSync(uint8 mirr) static void S74LS374MSync(uint8 mirr)
@ -65,7 +65,7 @@ static DECLFR(S74LS374NRead)
uint8 ret; uint8 ret;
if((A&0x4100)==0x4100) if((A&0x4100)==0x4100)
// ret=(X.DB&0xC0)|((~cmd)&0x3F); // ret=(X.DB&0xC0)|((~cmd)&0x3F);
ret=~cmd&0x3F; ret=((~cmd)&0x3F)^dip;
else else
ret=X.DB; ret=X.DB;
return ret; return ret;
@ -73,6 +73,7 @@ static DECLFR(S74LS374NRead)
static void S74LS374NPower(void) static void S74LS374NPower(void)
{ {
dip=0;
latch[0]=latch[1]=latch[2]=latch[3]=latch[4]=0; latch[0]=latch[1]=latch[2]=latch[3]=latch[4]=0;
S74LS374NSynco(); S74LS374NSynco();
SetReadHandler(0x8000,0xFFFF,CartBR); SetReadHandler(0x8000,0xFFFF,CartBR);
@ -80,6 +81,13 @@ static void S74LS374NPower(void)
SetReadHandler(0x4100,0x5fff,S74LS374NRead); SetReadHandler(0x4100,0x5fff,S74LS374NRead);
} }
static void S74LS374NReset(void)
{
dip^=1;
latch[0]=latch[1]=latch[2]=latch[3]=latch[4]=0;
S74LS374NSynco();
}
static void S74LS374NRestore(int version) static void S74LS374NRestore(int version)
{ {
S74LS374NSynco(); S74LS374NSynco();
@ -88,9 +96,11 @@ static void S74LS374NRestore(int version)
void S74LS374N_Init(CartInfo *info) void S74LS374N_Init(CartInfo *info)
{ {
info->Power=S74LS374NPower; info->Power=S74LS374NPower;
info->Reset=S74LS374NReset;
GameStateRestore=S74LS374NRestore; GameStateRestore=S74LS374NRestore;
AddExState(latch, 5, 0, "LATC"); AddExState(latch, 5, 0, "LATC");
AddExState(&cmd, 1, 0, "CMD"); AddExState(&cmd, 1, 0, "CMD");
AddExState(&dip, 1, 0, "DIP");
} }
static void S74LS374NASynco(void) static void S74LS374NASynco(void)
@ -292,6 +302,12 @@ static void SA72007Synco()
setchr8(latch[0]>>7); setchr8(latch[0]>>7);
} }
static void SA009Synco()
{
setprg32(0x8000,0);
setchr8(latch[0]&1);
}
static void SA72008Synco() static void SA72008Synco()
{ {
setprg32(0x8000,(latch[0]>>2)&1); setprg32(0x8000,(latch[0]>>2)&1);
@ -322,6 +338,14 @@ void SA72008_Init(CartInfo *info)
AddExState(&latch[0], 1, 0, "LATC"); AddExState(&latch[0], 1, 0, "LATC");
} }
void SA009_Init(CartInfo *info)
{
WSync=SA009Synco;
GameStateRestore=SARestore;
info->Power=SAPower;
AddExState(&latch[0], 1, 0, "LATC");
}
void SA0036_Init(CartInfo *info) void SA0036_Init(CartInfo *info)
{ {
WSync=SA72007Synco; WSync=SA72007Synco;
@ -338,13 +362,15 @@ void SA0037_Init(CartInfo *info)
AddExState(&latch[0], 1, 0, "LATC"); AddExState(&latch[0], 1, 0, "LATC");
} }
// -----------------------------------------------
static void TCU01Synco() static void TCU01Synco()
{ {
setprg32(0x8000,(latch[0]>>2)&1); setprg32(0x8000,((latch[0]&0x80)>>6)|((latch[0]>>2)&1));
setchr8((latch[0]>>3)&0xF); setchr8((latch[0]>>3)&0xF);
} }
static DECLFW(TCWrite) static DECLFW(TCU01Write)
{ {
if((A&0x103)==0x102) if((A&0x103)==0x102)
{ {
@ -353,11 +379,11 @@ static DECLFW(TCWrite)
} }
} }
static void TCU01Reset(void) static void TCU01Power(void)
{ {
latch[0]=0; latch[0]=0;
SetReadHandler(0x8000,0xFFFF,CartBR); SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4100,0xFFFF,TCWrite); SetWriteHandler(0x4100,0xFFFF,TCU01Write);
TCU01Synco(); TCU01Synco();
} }
@ -369,10 +395,55 @@ static void TCU01Restore(int version)
void TCU01_Init(CartInfo *info) void TCU01_Init(CartInfo *info)
{ {
GameStateRestore=TCU01Restore; GameStateRestore=TCU01Restore;
info->Power=TCU01Reset; info->Power=TCU01Power;
AddExState(&latch[0], 1, 0, "LATC"); AddExState(&latch[0], 1, 0, "LATC");
} }
//-----------------------------------------------
static void TCU02Synco()
{
setprg32(0x8000,0);
setchr8(latch[0]&3);
}
static DECLFW(TCU02Write)
{
if((A&0x103)==0x102)
{
latch[0]=V+3;
TCU02Synco();
}
}
static DECLFR(TCU02Read)
{
return (latch[0]&0x3F)|(X.DB&0xC0);
}
static void TCU02Power(void)
{
latch[0]=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetReadHandler(0x4100,0x4100,TCU02Read);
SetWriteHandler(0x4100,0xFFFF,TCU02Write);
TCU02Synco();
}
static void TCU02Restore(int version)
{
TCU02Synco();
}
void TCU02_Init(CartInfo *info)
{
GameStateRestore=TCU02Restore;
info->Power=TCU02Power;
AddExState(&latch[0], 1, 0, "LATC");
}
// ---------------------------------------------
static DECLFR(TCA01Read) static DECLFR(TCA01Read)
{ {
uint8 ret; uint8 ret;
@ -383,7 +454,7 @@ static DECLFR(TCA01Read)
return ret; return ret;
} }
static void TCA01Reset(void) static void TCA01Power(void)
{ {
setprg16(0x8000,0); setprg16(0x8000,0);
setprg16(0xC000,1); setprg16(0xC000,1);
@ -394,6 +465,6 @@ static void TCA01Reset(void)
void TCA01_Init(CartInfo *info) void TCA01_Init(CartInfo *info)
{ {
info->Power=TCA01Reset; info->Power=TCA01Power;
} }

View File

@ -21,8 +21,7 @@
#include "mapinc.h" #include "mapinc.h"
#include "mmc3.h" #include "mmc3.h"
//mbg 7/23/06 todo CaH4e3 - should this have been declared here? its in mmc3.cpp also static uint8 *CHRRAM;
//static uint8 *CHRRAM;
static uint8 tekker; static uint8 tekker;
static void MSHCW(uint32 A, uint8 V) static void MSHCW(uint32 A, uint8 V)

View File

@ -22,7 +22,7 @@
#include "mmc3.h" #include "mmc3.h"
// brk is a system call in *nix, and is an illegal variable name - soules // brk is a system call in *nix, and is an illegal variable name - soules
static uint8 chrcmd[8], prg0, prg1, bbrk, latc, mirr; static uint8 chrcmd[8], prg0, prg1, bbrk, mirr, swap;
static SFORMAT StateRegs[]= static SFORMAT StateRegs[]=
{ {
{chrcmd, 8, "CHRCMD"}, {chrcmd, 8, "CHRCMD"},
@ -30,16 +30,17 @@ static SFORMAT StateRegs[]=
{&prg1, 1, "PRG1"}, {&prg1, 1, "PRG1"},
{&bbrk, 1, "BRK"}, {&bbrk, 1, "BRK"},
{&mirr, 1, "MIRR"}, {&mirr, 1, "MIRR"},
{&swap, 1, "SWAP"},
{0} {0}
}; };
static void Sync(void) static void Sync(void)
{ {
int i;
setprg8(0x8000,prg0); setprg8(0x8000,prg0);
setprg8(0xA000,prg1); setprg8(0xA000,prg1);
setprg8(0xC000,~1); setprg8(0xC000,~1);
setprg8(0xE000,~0); setprg8(0xE000,~0);
int i;
for(i=0; i<8; i++) for(i=0; i<8; i++)
setchr1(i<<10,chrcmd[i]); setchr1(i<<10,chrcmd[i]);
setmirror(mirr^1); setmirror(mirr^1);
@ -63,19 +64,16 @@ static void UNLSL1632CW(uint32 A, uint8 V)
static DECLFW(UNLSL1632CMDWrite) static DECLFW(UNLSL1632CMDWrite)
{ {
if((A&0xA131)==0xA131) if(A==0xA131)
{ {
bbrk=V; bbrk=V;
latc = bbrk;
} }
if(bbrk&2) if(bbrk&2)
{ {
FixMMC3PRG(MMC3_cmd); FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd); FixMMC3CHR(MMC3_cmd);
if(A<0xC000) if(A<0xC000)
{
MMC3_CMDWrite(A,V); MMC3_CMDWrite(A,V);
}
else else
MMC3_IRQWrite(A,V); MMC3_IRQWrite(A,V);
} }
@ -113,7 +111,7 @@ static void UNLSL1632Power(void)
{ {
GenMMC3Power(); GenMMC3Power();
SetReadHandler(0x8000,0xFFFF,CartBR); SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,UNLSL1632CMDWrite); SetWriteHandler(0x4100,0xFFFF,UNLSL1632CMDWrite);
} }
void UNLSL1632_Init(CartInfo *info) void UNLSL1632_Init(CartInfo *info)

96
src/boards/smb2j.cpp Normal file
View File

@ -0,0 +1,96 @@
/* 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
* Super Mario Bros 2 J alt version
* as well as "Voleyball" FDS conversion, bank layot is similar but no bankswitching and CHR ROM present
*/
#include "mapinc.h"
static uint8 prg, IRQa;
static uint16 IRQCount;
static SFORMAT StateRegs[]=
{
{&prg, 1, "PRG"},
{&IRQa, 1, "IRQA"},
{&IRQCount, 2, "IRQC"},
{0}
};
static void Sync(void)
{
setprg4r(1,0x5000,1);
setprg8r(1,0x6000,1);
setprg32(0x8000,prg);
setchr8(0);
}
static DECLFW(UNLSMB2JWrite)
{
if(A==0x4022)
{
prg=V&1;
Sync();
}
if(A==0x4122)
{
IRQa=V;
IRQCount=0;
X6502_IRQEnd(FCEU_IQEXT);
}
}
static void UNLSMB2JPower(void)
{
prg=~0;
Sync();
SetReadHandler(0x5000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0xffff,UNLSMB2JWrite);
}
static void UNLSMB2JReset(void)
{
prg=~0;
Sync();
}
static void UNLSMB2JIRQHook(int a)
{
if(IRQa)
{
IRQCount+=a*3;
if((IRQCount>>12)==IRQa)
X6502_IRQBegin(FCEU_IQEXT);
}
}
static void StateRestore(int version)
{
Sync();
}
void UNLSMB2J_Init(CartInfo *info)
{
info->Reset=UNLSMB2JReset;
info->Power=UNLSMB2JPower;
MapIRQHook=UNLSMB2JIRQHook;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -21,8 +21,7 @@
#include "mapinc.h" #include "mapinc.h"
#include "mmc3.h" #include "mmc3.h"
//mbg 7/23/06 todo CaH4e3 - should this have been declared here? its in mmc3.cpp also static uint8 *CHRRAM = NULL;
//static uint8 *CHRRAM = NULL;
static int masko8[8]={63,31,15,1,3,0,0,0}; static int masko8[8]={63,31,15,1,3,0,0,0};
static void Super24PW(uint32 A, uint8 V) static void Super24PW(uint32 A, uint8 V)

116
src/boards/t-227-1.cpp Normal file
View File

@ -0,0 +1,116 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2008 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// T-227-1, 820632, MMC3 based, multimenu, 60000in1 (0010) dip switches
#include "mapinc.h"
#include "mmc3.h"
static uint8 reset_flag = 0x07;
static void BMCT2271CW(uint32 A, uint8 V)
{
uint32 va = V;
if(EXPREGS[0]&0x20)
{
va|=0x200;
va|=(EXPREGS[0]&0x10)<<4;
}
else
{
va&=0x7F;
va|=(EXPREGS[0]&0x18)<<4;
}
setchr1(A,va);
}
static void BMCT2271PW(uint32 A, uint8 V)
{
uint32 va = V & 0x3F;
if(EXPREGS[0]&0x20)
{
va&=0x1F;
va|=0x40;
va|=(EXPREGS[0]&0x10)<<1;
}
else
{
va&=0x0F;
va|=(EXPREGS[0]&0x18)<<1;
}
switch(EXPREGS[0]&3)
{
case 0x00: setprg8(A,va); break;
case 0x02:
{
va=(va&0xFD)|((EXPREGS[0]&4)>>1);
if(A<0xC000)
{
setprg16(0x8000,va >> 1);
setprg16(0xC000,va >> 1);
}
break;
}
case 0x01:
case 0x03: if(A<0xC000) setprg32(0x8000,va >> 2); break;
}
}
static DECLFW(BMCT2271LoWrite)
{
if(!(EXPREGS[0]&0x80))
EXPREGS[0] = A & 0xFF;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static DECLFR(BMCT2271HiRead)
{
uint32 av = A;
if(EXPREGS[0]&0x40) av = (av & 0xFFF0)|reset_flag;
return CartBR(av);
}
static void BMCT2271Reset(void)
{
EXPREGS[0] = 0x00;
reset_flag++;
reset_flag&=0x0F;
MMC3RegReset();
}
static void BMCT2271Power(void)
{
EXPREGS[0] = 0x00;
GenMMC3Power();
SetWriteHandler(0x6000,0x7FFF,BMCT2271LoWrite);
SetReadHandler(0x8000,0xFFFF,BMCT2271HiRead);
}
void BMCT2271_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 128, 8, 0);
pwrap=BMCT2271PW;
cwrap=BMCT2271CW;
info->Power=BMCT2271Power;
info->Reset=BMCT2271Reset;
AddExState(EXPREGS, 1, 0, "EXPR");
}

124
src/boards/tf-1201.cpp Normal file
View File

@ -0,0 +1,124 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Lethal Weapon (VRC4 mapper)
*/
#include "mapinc.h"
static uint8 prg0, prg1, mirr, swap;
static uint8 chr[8];
static uint8 IRQCount;
static uint8 IRQPre;
static uint8 IRQa;
static SFORMAT StateRegs[]=
{
{&prg0, 1, "PRG0"},
{&prg0, 1, "PRG1"},
{&mirr, 1, "MIRR"},
{&swap, 1, "SWAP"},
{chr, 8, "CHR"},
{&IRQCount, 1, "IRQCOUNT"},
{&IRQPre, 1, "IRQPRE"},
{&IRQa, 1, "IRQA"},
{0}
};
static void SyncPrg(void)
{
if(swap&3)
{
setprg8(0x8000,~1);
setprg8(0xC000,prg0);
}
else
{
setprg8(0x8000,prg0);
setprg8(0xC000,~1);
}
setprg8(0xA000,prg1);
setprg8(0xE000,~0);
}
static void SyncChr(void)
{
int i;
for(i=0; i<8; i++)
setchr1(i<<10,chr[i]);
setmirror(mirr^1);
}
static void StateRestore(int version)
{
SyncPrg();
SyncChr();
}
static DECLFW(UNLTF1201Write)
{
A=(A&0xF003)|((A&0xC)>>2);
if((A>=0xB000)&&(A<=0xE003))
{
int ind=(((A>>11)-6)|(A&1))&7;
int sar=((A&2)<<1);
chr[ind]=(chr[ind]&(0xF0>>sar))|((V&0x0F)<<sar);
SyncChr();
}
else switch (A&0xF003)
{
case 0x8000: prg0=V; SyncPrg(); break;
case 0xA000: prg1=V; SyncPrg(); break;
case 0x9000: mirr=V&1; SyncChr(); break;
case 0x9001: swap=V&3; SyncPrg(); break;
case 0xF000: IRQCount=((IRQCount&0xF0)|(V&0xF)); break;
case 0xF002: IRQCount=((IRQCount&0x0F)|((V&0xF)<<4)); break;
case 0xF001:
case 0xF003: IRQa=V&2; X6502_IRQEnd(FCEU_IQEXT); if(scanline<240) IRQCount-=8; break;
}
}
static void UNLTF1201IRQCounter(void)
{
if(IRQa)
{
IRQCount++;
if(IRQCount==237)
{
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
static void UNLTF1201Power(void)
{
IRQPre=IRQCount=IRQa=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,UNLTF1201Write);
SyncPrg();
SyncChr();
}
void UNLTF1201_Init(CartInfo *info)
{
info->Power=UNLTF1201Power;
GameHBIRQHook=UNLTF1201IRQCounter;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

23
src/drivers/win/afxres.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef _AFXRES_H
#define _AFXRES_H
#if __GNUC__ >= 3
#pragma GCC system_header
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _WINDOWS_H
#include <windows.h>
#endif
/* IDC_STATIC is documented in winuser.h, but not defined. */
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -798,9 +798,9 @@ void FCEUI_SetGameGenie(bool a)
FSettings.GameGenie = a; FSettings.GameGenie = a;
} }
void FCEUI_SetSnapName(bool a) void FCEUI_SetSnapName(int a)
{ {
FSettings.SnapName= a; FSettings.SnapName = a;
} }
int32 FCEUI_GetDesiredFPS(void) int32 FCEUI_GetDesiredFPS(void)

View File

@ -87,7 +87,7 @@ typedef struct {
int UsrFirstSLine[2]; int UsrFirstSLine[2];
int UsrLastSLine[2]; int UsrLastSLine[2];
bool SnapName; int SnapName;
uint32 SndRate; uint32 SndRate;
int soundq; int soundq;
int lowpass; int lowpass;

View File

@ -1,7 +1,12 @@
{0x9cbadc25,5,8}, /* JustBreed */ {0x9cbadc25,5,8}, /* JustBreed */
{0x6e68e31a,16,8}, /* Dragon Ball 3*/ {0x6e68e31a,16,8}, /* Dragon Ball 3*/
{0xbfc7a2e9,16,8},
{0x33b899c9,16,-1}, /* Dragon Ball - Dai Maou Fukkatsu (J) [!] */
{0x3f15d20d,153,8}, /* Famicom Jump 2 */ {0x3f15d20d,153,8}, /* Famicom Jump 2 */
// {0xb049a8c4,153,-1}, /* SD Gundam Gaiden - Knight Gundam Monogatari 2 - Hikari no Kishi (J) [!] */
// NOT 16, since uses WRAM but 8000-FFFF address range for bankswitching,
{0x983d8175,157,8}, /* Datach Battle Rush */ {0x983d8175,157,8}, /* Datach Battle Rush */
{0x894efdbc,157,8}, /* Datach Crayon Shin Chan */ {0x894efdbc,157,8}, /* Datach Crayon Shin Chan */
{0x19e81461,157,8}, /* Datach DBZ */ {0x19e81461,157,8}, /* Datach DBZ */
@ -17,16 +22,17 @@
{0x063b1151,209,-1}, /* Power Rangers 4 */ {0x063b1151,209,-1}, /* Power Rangers 4 */
{0xdd8ced31,209,-1}, /* Power Rangers 3 */ {0xdd8ced31,209,-1}, /* Power Rangers 3 */
{0x0c47946d,210,-1}, /* Chibi Maruko Chan */ {0x0c47946d,210,1}, /* Chibi Maruko Chan */
{0xbd523011,210,-1}, /* Dream Master */ {0xbd523011,210,0}, /* Dream Master */
{0xc247cc80,210,-1}, /* Family Circuit '91 */ {0xc247cc80,210,1}, /* Family Circuit '91 */
{0x6ec51de5,210,-1}, /* Famista '92 */ {0x6ec51de5,210,1}, /* Famista '92 */
{0xadffd64f,210,-1}, /* Famista '93 */ {0xadffd64f,210,1}, /* Famista '93 */
{0x429103c9,210,-1}, /* Famista '94 */ {0x429103c9,210,1}, /* Famista '94 */
{0x81b7f1a8,210,-1}, /* Heisei Tensai Bakabon */ {0x81b7f1a8,210,1}, /* Heisei Tensai Bakabon */
{0x2447e03b,210,-1}, /* Top Striker */ {0x2447e03b,210,1}, /* Top Striker */
{0x1dc0f740,210,-1}, /* Wagyan Land 2 */ {0x1dc0f740,210,1}, /* Wagyan Land 2 */
{0xd323b806,210,-1}, /* Wagyan Land 3 */ {0xd323b806,210,1}, /* Wagyan Land 3 */
{0x07eb2c12,208,-1}, /* Street Fighter IV */ {0x07eb2c12,208,-1}, /* Street Fighter IV */
{0x96ce586e,189,8}, /* Street Fighter 2 YOKO */ {0x96ce586e,189,8}, /* Street Fighter 2 YOKO */
{0x7678f1d5,207,8}, /* Fudou Myouou Den */ {0x7678f1d5,207,8}, /* Fudou Myouou Den */
@ -90,9 +96,9 @@
{0xbb7c5f7a,89,8}, /* Mito Koumon or something similar */ {0xbb7c5f7a,89,8}, /* Mito Koumon or something similar */
/* Probably a Namco MMC3-workalike */ /* Probably a Namco MMC3-workalike */
{0xa5e6baf9,4,1|4}, /* Dragon Slayer 4 */ //{0xa5e6baf9,4,1|4}, /* Dragon Slayer 4 */
{0xe40b4973,4,1|4}, /* Metro Cross */ //{0xe40b4973,4,1|4}, /* Metro Cross */
{0xd97c31b0,4,1|4}, /* Rasaaru Ishii no Childs Quest */ //{0xd97c31b0,4,1|4}, /* Rasaaru Ishii no Childs Quest */
{0x84382231,9,0}, /* Punch Out (J) */ {0x84382231,9,0}, /* Punch Out (J) */
@ -163,6 +169,7 @@
{0xd26efd78,66,1}, /* SMB Duck Hunt */ {0xd26efd78,66,1}, /* SMB Duck Hunt */
{0x811f06d9,66,1}, /* Dragon Power */ {0x811f06d9,66,1}, /* Dragon Power */
{0x3293afea,140,1}, /* Mississippi Satsujin Jiken */ {0x3293afea,140,1}, /* Mississippi Satsujin Jiken */
{0xe46b1c5d,140,1}, /* Mississippi Satsujin Jiken */
{0xe84274c5,66,1}, /* "" "" */ {0xe84274c5,66,1}, /* "" "" */
{0x9552e8df,66,1}, /* Dragon Ball */ {0x9552e8df,66,1}, /* Dragon Ball */
@ -206,6 +213,8 @@
{0xd5224fde,195,-1},/* Crystalis (c) */ {0xd5224fde,195,-1},/* Crystalis (c) */
{0x1bc0be6c,195,-1},/* Captain Tsubasa Vol 2 - Super Striker (C) */ {0x1bc0be6c,195,-1},/* Captain Tsubasa Vol 2 - Super Striker (C) */
{0x33c5df92,195,-1}, {0x33c5df92,195,-1},
{0xb616885c,195,0}, /* CHaos WOrld (Ch)*/
{0x7f3dbf1b,195,0},
{0xdd431ba7,198,-1},/* Tenchi wo kurau 2 (c) */ {0xdd431ba7,198,-1},/* Tenchi wo kurau 2 (c) */
{0x28192599,198,-1}, {0x28192599,198,-1},
{0x700705f4,198,-1}, {0x700705f4,198,-1},
@ -216,7 +225,6 @@
{0xed481b7c,199,-1},/* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C) */ {0xed481b7c,199,-1},/* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C) */
{0x44c20420,199,-1},/* San Guo Zhi 2 (C) */ {0x44c20420,199,-1},/* San Guo Zhi 2 (C) */
{0x1f1326d4,218,-1},
{0xa1dc16c0,116,-1}, {0xa1dc16c0,116,-1},
{0xcc868d4e,149,-1}, /* 16 Mahjong [p1][!] */ {0xcc868d4e,149,-1}, /* 16 Mahjong [p1][!] */
@ -225,11 +233,20 @@
{0xa62b79e1,146,-1}, /* Side Winder (HES) [!] */ {0xa62b79e1,146,-1}, /* Side Winder (HES) [!] */
{0x73fb55ac,150,-1}, /* 2-in-1 Cosmo Cop + Cyber Monster (Sachen) [!] */ {0x73fb55ac,150,-1}, /* 2-in-1 Cosmo Cop + Cyber Monster (Sachen) [!] */
{0xddcbda16,150,-1}, /* 2-in-1 Tough Cop + Super Tough Cop (Sachen) [!] */ {0xddcbda16,150,-1}, /* 2-in-1 Tough Cop + Super Tough Cop (Sachen) [!] */
{0x47918d84,150,-1}, /* auto-upturn */
{0x29582ca1,150,-1}, {0x29582ca1,150,-1},
{0x40dbf7a2,150,-1}, {0x40dbf7a2,150,-1},
{0x5aefbc94,133,-1}, /* Jovial Race (Sachen) [a1][!] */ {0x5aefbc94,133,-1}, /* Jovial Race (Sachen) [a1][!] */
{0x58152b42,160,1}, /* Pipe 5 (Sachen) */
{0x22d6d5bd,4,1}, {0x22d6d5bd,4,1},
{0x6a03d3f3,114,-1}, {0x6a03d3f3,114,-1},
{0x02c41438,179,-1}, /* Xing He Zhan Shi (C) */
{0x0da5e32e,101,-1}, /* new Uruusey Yatsura */
{0x4f2f1846,-1,1}, /* Famista '89 - Kaimaku Han!! (J) */
{0x6c71feae,45,-1}, /* Kunio 8-in-1 */
// {0xbdbe3c96,238,-1}, /* Contra Fighter iNES version */
{0,-1,-1} {0,-1,-1}

View File

@ -547,6 +547,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
// ROM_size = head.ROM_size; // ROM_size = head.ROM_size;
VROM_size = head.VROM_size; VROM_size = head.VROM_size;
ROM_size=uppow2(ROM_size); ROM_size=uppow2(ROM_size);
if(VROM_size) if(VROM_size)
@ -620,9 +621,9 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
ResetExState(0,0); ResetExState(0,0);
SetupCartPRGMapping(0,ROM,ROM_size*0x4000,0); SetupCartPRGMapping(0,ROM,ROM_size*0x4000,0);
SetupCartPRGMapping(1,WRAM,8192,1); // SetupCartPRGMapping(1,WRAM,8192,1);
FCEU_fread(ROM,0x4000,head.ROM_size,fp); FCEU_fread(ROM,0x4000,ROM_size,fp);
if(VROM_size) if(VROM_size)
FCEU_fread(VROM,0x2000,head.VROM_size,fp); FCEU_fread(VROM,0x2000,head.VROM_size,fp);
@ -643,7 +644,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
iNESCart.CRC32=iNESGameCRC32; iNESCart.CRC32=iNESGameCRC32;
FCEU_printf(" PRG ROM: %3d x 16KiB\n CHR ROM: %3d x 8KiB\n ROM CRC32: 0x%08lx\n", FCEU_printf(" PRG ROM: %3d x 16KiB\n CHR ROM: %3d x 8KiB\n ROM CRC32: 0x%08lx\n",
head.ROM_size,head.VROM_size,iNESGameCRC32); ROM_size,head.VROM_size,iNESGameCRC32);
{ {
int x; int x;
@ -740,7 +741,7 @@ int iNesSave(){
fwrite(trainerpoo,512,1,fp); fwrite(trainerpoo,512,1,fp);
} }
fwrite(ROM,0x4000,head.ROM_size,fp); fwrite(ROM,0x4000,ROM_size,fp);
if(head.VROM_size)fwrite(VROM,0x2000,head.VROM_size,fp); if(head.VROM_size)fwrite(VROM,0x2000,head.VROM_size,fp);
fclose(fp); fclose(fp);
@ -888,15 +889,15 @@ void (*MapInitTab[256])(void)=
0, 0,
0, //Mapper13_init, 0, //Mapper13_init,
0, 0,
Mapper15_init, 0, //Mapper15_init,
Mapper16_init, 0, //Mapper16_init,
Mapper17_init, Mapper17_init,
Mapper18_init, Mapper18_init,
0, 0,
0, 0,
Mapper21_init, Mapper21_init,
Mapper22_init, Mapper22_init,
Mapper23_init, 0, //Mapper23_init,
Mapper24_init, Mapper24_init,
Mapper25_init, Mapper25_init,
Mapper26_init, Mapper26_init,
@ -941,7 +942,7 @@ void (*MapInitTab[256])(void)=
Mapper65_init, Mapper65_init,
0,//Mapper66_init, 0,//Mapper66_init,
Mapper67_init, Mapper67_init,
Mapper68_init, 0,//Mapper68_init,
Mapper69_init, Mapper69_init,
0,//Mapper70_init, 0,//Mapper70_init,
Mapper71_init, Mapper71_init,
@ -1026,7 +1027,7 @@ void (*MapInitTab[256])(void)=
0, 0,
Mapper151_init, Mapper151_init,
0, //Mapper152_init, 0, //Mapper152_init,
Mapper153_init, 0, //Mapper153_init,
0, //Mapper154_init, 0, //Mapper154_init,
0, 0,
Mapper156_init, Mapper156_init,
@ -1141,12 +1142,6 @@ static DECLFR(AWRAM)
return WRAM[A-0x6000]; return WRAM[A-0x6000];
} }
#ifdef DEBUG_MAPPER
static DECLFW(WriteHandler)
{
FCEU_printf("$%04x:$%02x\n",A,V);
}
#endif
void (*MapStateRestore)(int version); void (*MapStateRestore)(int version);
void iNESStateRestore(int version) void iNESStateRestore(int version)
@ -1186,21 +1181,18 @@ static void iNESPower(void)
MapStateRestore=0; MapStateRestore=0;
setprg8r(1,0x6000,0); setprg8r(1,0x6000,0);
SetReadHandler(0x6000,0x7FFF,AWRAM); SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x6000,0x7FFF,BWRAM); SetWriteHandler(0x6000,0x7FFF,BWRAM);
FCEU_CheatAddRAM(8,0x6000,WRAM); FCEU_CheatAddRAM(8,0x6000,WRAM);
/*
#ifdef DEBUG_MAPPER
if(type==0) SetWriteHandler(0x4020,0xFFFF,WriteHandler);
#endif
*/
/* This statement represents atrocious code. I need to rewrite /* This statement represents atrocious code. I need to rewrite
all of the iNES mapper code... */ all of the iNES mapper code... */
IRQCount=IRQLatch=IRQa=0; IRQCount=IRQLatch=IRQa=0;
if(head.ROM_type&2) if(head.ROM_type&2)
memset(GameMemBlock+8192,0,131072-8192); memset(GameMemBlock+8192,0,sizeof(GameMemBlock)-8192);
else else
memset(GameMemBlock,0,131072); memset(GameMemBlock,0,sizeof(GameMemBlock));
NONE_init(); NONE_init();
ResetExState(0,0); ResetExState(0,0);
@ -1209,7 +1201,6 @@ static void iNESPower(void)
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0); AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
AddExState(WRAM, 8192, 0, "WRAM"); AddExState(WRAM, 8192, 0, "WRAM");
if(type==19 || type==6 || type==69 || type==85 || type==96) if(type==19 || type==6 || type==69 || type==85 || type==96)
AddExState(MapperExRAM, 32768, 0, "MEXR"); AddExState(MapperExRAM, 32768, 0, "MEXR");
if((!VROM_size || type==6 || type==19) && (type!=13 && type!=96)) if((!VROM_size || type==6 || type==19) && (type!=13 && type!=96))
@ -1247,70 +1238,7 @@ typedef struct {
int number; int number;
void (*init)(CartInfo *); void (*init)(CartInfo *);
} BMAPPING; } BMAPPING;
/*
static BMAPPING bmap[] = {
{1, Mapper1_Init},
{2, UNROM_Init},
{3, CNROM_Init},
{4, Mapper4_Init},
{5, Mapper5_Init},
{12, Mapper12_Init},
{13, CPROM_Init},
{19, Mapper19_Init},
{44, Mapper44_Init},
{45, Mapper45_Init},
{47, Mapper47_Init},
{49, Mapper49_Init},
{52, Mapper52_Init},
{74, Mapper74_Init},
{90, Mapper90_Init},
{95, Mapper95_Init},
{105, Mapper105_Init},
{112, Mapper112_Init},
{114, Mapper114_Init},
{115, Mapper115_Init},
{116, Mapper116_Init},
{118, Mapper118_Init},
{119, Mapper119_Init},
{133, SA72008_Init},
{137, S8259D_Init},
{138, S8259B_Init},
{139, S8259C_Init},
{141, S8259A_Init},
{143, TCA01_Init},
{145, SA72007_Init},
{146, SA0161M_Init},
{147, TCU01_Init},
{148, SA0037_Init},
{149, SA0036_Init},
{150, S74LS374N_Init},
{155, Mapper155_Init},
{160, Mapper90_Init},
{163, Mapper163_Init},
{164, Mapper164_Init},
{165, Mapper165_Init},
{182, Mapper182_Init},
{183, Mapper183_Init},
{186, Mapper186_Init},
{187, Mapper187_Init},
{188, Mapper188_Init},
{191, Mapper191_Init},
{205, Mapper205_Init},
{206, DEIROM_Init},
{208, Mapper208_Init},
{209, Mapper209_Init},
{210, Mapper210_Init},
{215, Mapper215_Init},
{216, Mapper216_Init},
{217, Mapper217_Init},
{243, S74LS374NA_Init},
{245, Mapper245_Init},
{249, Mapper249_Init},
{250, Mapper250_Init},
{254, Mapper254_Init},
{ 0, 0}
};
*/
static BMAPPING bmap[] = { static BMAPPING bmap[] = {
{0, NROM_Init}, {0, NROM_Init},
{1, Mapper1_Init}, {1, Mapper1_Init},
@ -1322,8 +1250,13 @@ static BMAPPING bmap[] = {
{11, Mapper11_Init}, {11, Mapper11_Init},
{12, Mapper12_Init}, {12, Mapper12_Init},
{13, CPROM_Init}, {13, CPROM_Init},
{15, Mapper15_Init},
{16, Mapper16_Init},
{19, Mapper19_Init}, {19, Mapper19_Init},
{23, Mapper23_Init},
{36, Mapper36_Init}, // TXC Policeman
{37, Mapper37_Init}, {37, Mapper37_Init},
{38, Mapper38_Init}, // Bit Corp. Crime Busters
{43, Mapper43_Init}, {43, Mapper43_Init},
{44, Mapper44_Init}, {44, Mapper44_Init},
{45, Mapper45_Init}, {45, Mapper45_Init},
@ -1334,6 +1267,7 @@ static BMAPPING bmap[] = {
{58, BMCGK192_Init}, {58, BMCGK192_Init},
{60, BMCD1038_Init}, {60, BMCD1038_Init},
{66, MHROM_Init}, {66, MHROM_Init},
{68, Mapper68_Init},
{70, Mapper70_Init}, {70, Mapper70_Init},
{74, Mapper74_Init}, {74, Mapper74_Init},
{78, Mapper78_Init}, {78, Mapper78_Init},
@ -1343,23 +1277,34 @@ static BMAPPING bmap[] = {
{93, SUNSOFT_UNROM_Init}, {93, SUNSOFT_UNROM_Init},
{94, Mapper94_Init}, {94, Mapper94_Init},
{95, Mapper95_Init}, {95, Mapper95_Init},
{101, Mapper101_Init},
{103, Mapper103_Init},
{105, Mapper105_Init}, {105, Mapper105_Init},
{106, Mapper106_Init},
{107, Mapper107_Init}, {107, Mapper107_Init},
{108, Mapper108_Init},
{112, Mapper112_Init}, {112, Mapper112_Init},
{113, Mapper113_Init}, {113, Mapper113_Init},
{114, Mapper114_Init}, {114, Mapper114_Init},
{115, Mapper115_Init}, {115, Mapper115_Init},
{116, Mapper116_Init}, {116, Mapper116_Init},
// {116, UNLSL1632_Init},
{117, Mapper117_Init}, {117, Mapper117_Init},
{118, TKSROM_Init}, {118, TKSROM_Init},
{119, Mapper119_Init}, {119, Mapper119_Init},
{120, Mapper120_Init},
{121, Mapper121_Init},
{123, UNLH2288_Init},
{132, UNL22211_Init}, {132, UNL22211_Init},
{133, SA72008_Init}, {133, SA72008_Init},
{134, Mapper134_Init},
{136, TCU02_Init},
{137, S8259D_Init}, {137, S8259D_Init},
{138, S8259B_Init}, {138, S8259B_Init},
{139, S8259C_Init}, {139, S8259C_Init},
{140, Mapper140_Init}, {140, Mapper140_Init},
{141, S8259A_Init}, {141, S8259A_Init},
{142, UNLKS7032_Init},
{143, TCA01_Init}, {143, TCA01_Init},
{144, Mapper144_Init}, {144, Mapper144_Init},
{145, SA72007_Init}, {145, SA72007_Init},
@ -1369,12 +1314,20 @@ static BMAPPING bmap[] = {
{149, SA0036_Init}, {149, SA0036_Init},
{150, S74LS374N_Init}, {150, S74LS374N_Init},
{152, Mapper152_Init}, {152, Mapper152_Init},
{153, Mapper153_Init},
{154, Mapper154_Init}, {154, Mapper154_Init},
{155, Mapper155_Init}, {155, Mapper155_Init},
{160, Mapper90_Init}, {160, SA009_Init},
{163, Mapper163_Init}, {163, Mapper163_Init},
{164, Mapper164_Init}, {164, Mapper164_Init},
{165, Mapper165_Init}, {165, Mapper165_Init},
// {169, Mapper169_Init},
{171, Mapper171_Init},
{172, Mapper172_Init},
{173, Mapper173_Init},
{177, Mapper177_Init},
{178, Mapper178_Init},
{179, Mapper179_Init},
{180, Mapper180_Init}, {180, Mapper180_Init},
{181, Mapper181_Init}, {181, Mapper181_Init},
{182, Mapper182_Init}, {182, Mapper182_Init},
@ -1389,6 +1342,8 @@ static BMAPPING bmap[] = {
{192, Mapper192_Init}, {192, Mapper192_Init},
{194, Mapper194_Init}, {194, Mapper194_Init},
{195, Mapper195_Init}, {195, Mapper195_Init},
{196, Mapper196_Init},
{197, Mapper197_Init},
{198, Mapper198_Init}, {198, Mapper198_Init},
{199, Mapper199_Init}, {199, Mapper199_Init},
{200, Mapper200_Init}, {200, Mapper200_Init},
@ -1401,15 +1356,20 @@ static BMAPPING bmap[] = {
{215, Mapper215_Init}, {215, Mapper215_Init},
{216, Mapper216_Init}, {216, Mapper216_Init},
{217, Mapper217_Init}, {217, Mapper217_Init},
{219, UNLA9746_Init},
{218, UNLA9711_Init}, // {220, BMCFK23C_Init},
{219, UNLSL1632_Init}, // {220, UNL3DBlock_Init},
{220, UNLCN22M_Init}, // {220, UNLTF1201_Init},
{221, BMCFK23C_Init}, // {220, TCU02_Init},
// {220, UNLCN22M_Init},
{220, BMCT2271_Init},
{221, UNLN625092_Init},
{222, Mapper222_Init}, {222, Mapper222_Init},
{226, Mapper226_Init}, {226, Mapper226_Init},
{235, Mapper235_Init}, {235, Mapper235_Init},
{238, UNL6035052_Init},
{240, Mapper240_Init}, {240, Mapper240_Init},
{243, S74LS374NA_Init}, {243, S74LS374NA_Init},
{245, Mapper245_Init}, {245, Mapper245_Init},

View File

@ -142,15 +142,15 @@ void Mapper10_init(void);
void Mapper12_init(void); void Mapper12_init(void);
//void Mapper13_init(void); //void Mapper13_init(void);
void Mapper14_init(void); void Mapper14_init(void);
void Mapper15_init(void); //void Mapper15_init(void);
void Mapper16_init(void); //void Mapper16_init(void);
void Mapper17_init(void); void Mapper17_init(void);
void Mapper18_init(void); void Mapper18_init(void);
void Mapper19_init(void); void Mapper19_init(void);
void Mapper20_init(void); void Mapper20_init(void);
void Mapper21_init(void); void Mapper21_init(void);
void Mapper22_init(void); void Mapper22_init(void);
void Mapper23_init(void); //void Mapper23_init(void);
void Mapper24_init(void); void Mapper24_init(void);
void Mapper25_init(void); void Mapper25_init(void);
void Mapper26_init(void); void Mapper26_init(void);
@ -165,8 +165,8 @@ void Mapper34_init(void);
void Mapper35_init(void); void Mapper35_init(void);
void Mapper36_init(void); void Mapper36_init(void);
//void Mapper37_init(void); //void Mapper37_init(void);
void Mapper38_init(void); //void Mapper38_init(void);
void Mapper39_init(void); //void Mapper39_init(void);
void Mapper40_init(void); void Mapper40_init(void);
void Mapper41_init(void); void Mapper41_init(void);
void Mapper42_init(void); void Mapper42_init(void);
@ -192,7 +192,7 @@ void Mapper64_init(void);
void Mapper65_init(void); void Mapper65_init(void);
//void Mapper66_init(void); //void Mapper66_init(void);
void Mapper67_init(void); void Mapper67_init(void);
void Mapper68_init(void); //void Mapper68_init(void);
void Mapper69_init(void); void Mapper69_init(void);
//void Mapper70_init(void); //void Mapper70_init(void);
void Mapper71_init(void); void Mapper71_init(void);
@ -223,12 +223,12 @@ void Mapper97_init(void);
void Mapper98_init(void); void Mapper98_init(void);
void Mapper99_init(void); void Mapper99_init(void);
void Mapper100_init(void); void Mapper100_init(void);
void Mapper101_init(void); //void Mapper101_init(void);
void Mapper103_init(void); //void Mapper103_init(void);
void Mapper104_init(void); void Mapper104_init(void);
void Mapper106_init(void); //void Mapper106_init(void);
//void Mapper107_init(void); //void Mapper107_init(void);
void Mapper108_init(void); //void Mapper108_init(void);
void Mapper109_init(void); void Mapper109_init(void);
void Mapper110_init(void); void Mapper110_init(void);
void Mapper111_init(void); void Mapper111_init(void);
@ -236,8 +236,8 @@ void Mapper111_init(void);
void Mapper115_init(void); void Mapper115_init(void);
void Mapper116_init(void); void Mapper116_init(void);
//void Mapper117_init(void); //void Mapper117_init(void);
void Mapper120_init(void); //void Mapper120_init(void);
void Mapper121_init(void); //void Mapper121_init(void);
void Mapper122_init(void); void Mapper122_init(void);
void Mapper123_init(void); void Mapper123_init(void);
void Mapper124_init(void); void Mapper124_init(void);
@ -248,20 +248,20 @@ void Mapper129_init(void);
void Mapper130_init(void); void Mapper130_init(void);
void Mapper131_init(void); void Mapper131_init(void);
void Mapper132_init(void); void Mapper132_init(void);
void Mapper134_init(void); //void Mapper134_init(void);
void Mapper135_init(void); void Mapper135_init(void);
void Mapper136_init(void); void Mapper136_init(void);
void Mapper137_init(void); void Mapper137_init(void);
void Mapper139_init(void); void Mapper139_init(void);
//void Mapper140_init(void); //void Mapper140_init(void);
void Mapper141_init(void); void Mapper141_init(void);
void Mapper142_init(void); //void Mapper142_init(void);
void Mapper143_init(void); void Mapper143_init(void);
//void Mapper144_init(void); //void Mapper144_init(void);
void Mapper150_init(void); void Mapper150_init(void);
void Mapper151_init(void); void Mapper151_init(void);
//void Mapper152_init(void); //void Mapper152_init(void);
void Mapper153_init(void); //void Mapper153_init(void);
void Mapper154_init(void); void Mapper154_init(void);
void Mapper156_init(void); void Mapper156_init(void);
void Mapper157_init(void); void Mapper157_init(void);
@ -273,17 +273,17 @@ void Mapper162_init(void);
void Mapper166_init(void); void Mapper166_init(void);
void Mapper167_init(void); void Mapper167_init(void);
void Mapper168_init(void); void Mapper168_init(void);
void Mapper169_init(void); //void Mapper169_init(void);
void Mapper170_init(void); void Mapper170_init(void);
void Mapper171_init(void); //void Mapper171_init(void);
void Mapper172_init(void); //void Mapper172_init(void);
void Mapper173_init(void); //void Mapper173_init(void);
void Mapper174_init(void); void Mapper174_init(void);
void Mapper175_init(void); void Mapper175_init(void);
void Mapper176_init(void); void Mapper176_init(void);
void Mapper177_init(void); //void Mapper177_init(void);
void Mapper178_init(void); //void Mapper178_init(void);
void Mapper179_init(void); //void Mapper179_init(void);
//void Mapper180_init(void); //void Mapper180_init(void);
//void Mapper181_init(void); //void Mapper181_init(void);
//void Mapper184_init(void); //void Mapper184_init(void);
@ -293,8 +293,8 @@ void Mapper179_init(void);
void Mapper193_init(void); void Mapper193_init(void);
//void Mapper194_init(void); //void Mapper194_init(void);
//void Mapper195_init(void); //void Mapper195_init(void);
void Mapper196_init(void); //void Mapper196_init(void);
void Mapper197_init(void); //void Mapper197_init(void);
//void Mapper198_init(void); //void Mapper198_init(void);
void Mapper199_init(void); void Mapper199_init(void);
//void Mapper200_init(void); //void Mapper200_init(void);
@ -354,8 +354,13 @@ void Mapper4_Init(CartInfo *);
void Mapper5_Init(CartInfo *); void Mapper5_Init(CartInfo *);
void Mapper11_Init(CartInfo *); void Mapper11_Init(CartInfo *);
void Mapper12_Init(CartInfo *); void Mapper12_Init(CartInfo *);
void Mapper15_Init(CartInfo *);
void Mapper16_Init(CartInfo *);
void Mapper19_Init(CartInfo *); void Mapper19_Init(CartInfo *);
void Mapper23_Init(CartInfo *);
void Mapper36_Init(CartInfo *);
void Mapper37_Init(CartInfo *); void Mapper37_Init(CartInfo *);
void Mapper38_Init(CartInfo *);
void Mapper43_Init(CartInfo *); void Mapper43_Init(CartInfo *);
void Mapper44_Init(CartInfo *); void Mapper44_Init(CartInfo *);
void Mapper45_Init(CartInfo *); void Mapper45_Init(CartInfo *);
@ -364,6 +369,7 @@ void Mapper49_Init(CartInfo *);
void Mapper52_Init(CartInfo *); void Mapper52_Init(CartInfo *);
void Mapper57_Init(CartInfo *); void Mapper57_Init(CartInfo *);
//void Mapper58_Init(CartInfo *); //void Mapper58_Init(CartInfo *);
void Mapper68_Init(CartInfo *);
void Mapper70_Init(CartInfo *); void Mapper70_Init(CartInfo *);
void Mapper74_Init(CartInfo *); void Mapper74_Init(CartInfo *);
void Mapper78_Init(CartInfo *); void Mapper78_Init(CartInfo *);
@ -373,8 +379,12 @@ void Mapper90_Init(CartInfo *);
void Mapper93_Init(CartInfo *); void Mapper93_Init(CartInfo *);
void Mapper94_Init(CartInfo *); void Mapper94_Init(CartInfo *);
void Mapper95_Init(CartInfo *); void Mapper95_Init(CartInfo *);
void Mapper101_Init(CartInfo *);
void Mapper103_Init(CartInfo *);
void Mapper105_Init(CartInfo *); void Mapper105_Init(CartInfo *);
void Mapper106_Init(CartInfo *);
void Mapper107_Init(CartInfo *); void Mapper107_Init(CartInfo *);
void Mapper108_Init(CartInfo *);
void Mapper112_Init(CartInfo *); void Mapper112_Init(CartInfo *);
void Mapper113_Init(CartInfo *); void Mapper113_Init(CartInfo *);
void Mapper114_Init(CartInfo *); void Mapper114_Init(CartInfo *);
@ -383,15 +393,26 @@ void Mapper116_Init(CartInfo *);
void Mapper117_Init(CartInfo *); void Mapper117_Init(CartInfo *);
void Mapper118_Init(CartInfo *); void Mapper118_Init(CartInfo *);
void Mapper119_Init(CartInfo *); void Mapper119_Init(CartInfo *);
void Mapper120_Init(CartInfo *);
void Mapper121_Init(CartInfo *);
void Mapper125_Init(CartInfo *); void Mapper125_Init(CartInfo *);
void Mapper134_Init(CartInfo *);
void Mapper140_Init(CartInfo *); void Mapper140_Init(CartInfo *);
void Mapper144_Init(CartInfo *); void Mapper144_Init(CartInfo *);
void Mapper152_Init(CartInfo *); void Mapper152_Init(CartInfo *);
void Mapper153_Init(CartInfo *);
void Mapper154_Init(CartInfo *); void Mapper154_Init(CartInfo *);
void Mapper155_Init(CartInfo *); void Mapper155_Init(CartInfo *);
void Mapper163_Init(CartInfo *); void Mapper163_Init(CartInfo *);
void Mapper164_Init(CartInfo *); void Mapper164_Init(CartInfo *);
void Mapper165_Init(CartInfo *); void Mapper165_Init(CartInfo *);
//void Mapper169_Init(CartInfo *);
void Mapper171_Init(CartInfo *);
void Mapper172_Init(CartInfo *);
void Mapper173_Init(CartInfo *);
void Mapper177_Init(CartInfo *);
void Mapper178_Init(CartInfo *);
void Mapper179_Init(CartInfo *);
void Mapper180_Init(CartInfo *); void Mapper180_Init(CartInfo *);
void Mapper181_Init(CartInfo *); void Mapper181_Init(CartInfo *);
void Mapper182_Init(CartInfo *); void Mapper182_Init(CartInfo *);
@ -406,6 +427,8 @@ void Mapper191_Init(CartInfo *);
void Mapper192_Init(CartInfo *); void Mapper192_Init(CartInfo *);
void Mapper194_Init(CartInfo *); void Mapper194_Init(CartInfo *);
void Mapper195_Init(CartInfo *); void Mapper195_Init(CartInfo *);
void Mapper196_Init(CartInfo *);
void Mapper197_Init(CartInfo *);
void Mapper198_Init(CartInfo *); void Mapper198_Init(CartInfo *);
void Mapper199_Init(CartInfo *); void Mapper199_Init(CartInfo *);
void Mapper200_Init(CartInfo *); void Mapper200_Init(CartInfo *);

View File

@ -70,7 +70,7 @@ static DECLFW(Mapper16_write)
// of it a hack(I think the current PRG block would depend on whatever the // of it a hack(I think the current PRG block would depend on whatever the
// lowest bit of the CHR bank switching register that corresponds to the // lowest bit of the CHR bank switching register that corresponds to the
// last CHR address read). // last CHR address read).
/*
static void PRGO(void) static void PRGO(void)
{ {
uint32 base=(mapbyte1[0]&1)<<4; uint32 base=(mapbyte1[0]&1)<<4;
@ -110,21 +110,21 @@ static DECLFW(Mapper153_write)
IRQLatch|=V<<8; IRQLatch|=V<<8;
break; break;
} }
} }*/
void Mapper16_init(void) //void Mapper16_init(void)
{ //{
MapIRQHook=BandaiIRQHook; // MapIRQHook=BandaiIRQHook;
SetWriteHandler(0x6000,0xFFFF,Mapper16_write); //SetWriteHandler(0x6000,0xFFFF,Mapper16_write);
} //}
void Mapper153_init(void) //void Mapper153_init(void)
{ //{
MapIRQHook=BandaiIRQHook; // MapIRQHook=BandaiIRQHook;
SetWriteHandler(0x8000,0xFFFF,Mapper153_write); // SetWriteHandler(0x8000,0xFFFF,Mapper153_write);
/* This mapper/board seems to have WRAM at $6000-$7FFF, so I'll let the /* This mapper/board seems to have WRAM at $6000-$7FFF, so I'll let the
main ines code take care of that memory region. */ main ines code take care of that memory region. */
} //}
static uint8 BarcodeData[256]; static uint8 BarcodeData[256];

View File

@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* (VRC4 mapper)
*/ */
#include "mapinc.h" #include "mapinc.h"

View File

@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* (VRC4 mapper)
*/ */
#include "mapinc.h" #include "mapinc.h"

View File

@ -37,6 +37,7 @@ static DECLFW(Mapper33_write)
case 0x8001:ROM_BANK8(0xA000,V); break; case 0x8001:ROM_BANK8(0xA000,V); break;
case 0x8002:VROM_BANK2(0x0000,V);break; case 0x8002:VROM_BANK2(0x0000,V);break;
case 0x8003:VROM_BANK2(0x0800,V);break; case 0x8003:VROM_BANK2(0x0800,V);break;
case 0xe000:MIRROR_SET((V>>6)&1);break;
} }
} }
@ -73,7 +74,7 @@ void Mapper33_init(void)
void Mapper48_init(void) void Mapper48_init(void)
{ {
SetWriteHandler(0x8000,0xffff,Mapper33_write); SetWriteHandler(0x8000,0xbfff,Mapper33_write);
SetWriteHandler(0xc000,0xffff,Mapper48_HiWrite); SetWriteHandler(0xc000,0xffff,Mapper48_HiWrite);
GameHBIRQHook=heho; GameHBIRQHook=heho;
is48=1; is48=1;

View File

@ -52,8 +52,6 @@ static DECLFW(Mapper69_SWH)
int x; int x;
GameExpSound.Fill=AYSound; GameExpSound.Fill=AYSound;
GameExpSound.HiFill=AYSoundHQ; GameExpSound.HiFill=AYSoundHQ;
//mbg merge 7/17/06
//TODO cah4e3 - is this an error?
if(FSettings.SndRate) if(FSettings.SndRate)
switch(sunindex) switch(sunindex)
{ {

View File

@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* TXC mapper variation, F-15 City War
*/ */
#include "mapinc.h" #include "mapinc.h"

View File

@ -20,6 +20,7 @@
#include "mapinc.h" #include "mapinc.h"
static uint8 is2kbank, isnot2kbank, dipreg;
/*void Mapper83_init(void) /*void Mapper83_init(void)
{ {
@ -50,6 +51,11 @@ static DECLFR(rdlow)
return mapbyte4[A&3]; return mapbyte4[A&3];
} }
static DECLFR(rd5000)
{
return dipreg;
}
static void m83prg(void) static void m83prg(void)
{ {
ROM_BANK16(0x8000,(mapbyte1[0]&0x3F)); ROM_BANK16(0x8000,(mapbyte1[0]&0x3F));
@ -58,19 +64,19 @@ static void m83prg(void)
static void m83chr(void) static void m83chr(void)
{ {
// if(0) if(is2kbank&&!isnot2kbank)
// { {
// VROM_BANK2(0x0000,mapbyte2[0]); VROM_BANK2(0x0000,mapbyte2[0]);
// VROM_BANK2(0x0800,mapbyte2[1]); VROM_BANK2(0x0800,mapbyte2[1]);
// VROM_BANK2(0x1000,mapbyte2[6]); VROM_BANK2(0x1000,mapbyte2[6]);
// VROM_BANK2(0x1800,mapbyte2[7]); VROM_BANK2(0x1800,mapbyte2[7]);
// } }
// else else
// { {
int x; int x;
for(x=0;x<8;x++) for(x=0;x<8;x++)
VROM_BANK1(x*0x400,mapbyte2[x]|((mapbyte1[0]&0x30)<<4)); VROM_BANK1(x*0x400,mapbyte2[x]|((mapbyte1[0]&0x30)<<4));
// } }
} }
static DECLFW(Mapper83_write) static DECLFW(Mapper83_write)
@ -78,7 +84,7 @@ static DECLFW(Mapper83_write)
//printf("$%04x:$%02x\n",A,V); //printf("$%04x:$%02x\n",A,V);
switch(A) switch(A)
{ {
case 0x8000: case 0x8000: is2kbank = 1;
case 0xB000: case 0xB000:
case 0xB0FF: case 0xB0FF:
case 0xB1FF: case 0xB1FF:
@ -105,10 +111,10 @@ static DECLFW(Mapper83_write)
case 0x8302:ROM_BANK8(0xC000,V);break; case 0x8302:ROM_BANK8(0xC000,V);break;
case 0x8310:mapbyte2[0]=V;m83chr();break; case 0x8310:mapbyte2[0]=V;m83chr();break;
case 0x8311:mapbyte2[1]=V;m83chr();break; case 0x8311:mapbyte2[1]=V;m83chr();break;
case 0x8312:mapbyte2[2]=V;m83chr();break; case 0x8312:mapbyte2[2]=V;isnot2kbank = 1;m83chr();break; // 2 mappers in one :)
case 0x8313:mapbyte2[3]=V;m83chr();break; case 0x8313:mapbyte2[3]=V;isnot2kbank = 1;m83chr();break;
case 0x8314:mapbyte2[4]=V;m83chr();break; case 0x8314:mapbyte2[4]=V;isnot2kbank = 1;m83chr();break;
case 0x8315:mapbyte2[5]=V;m83chr();break; case 0x8315:mapbyte2[5]=V;isnot2kbank = 1;m83chr();break;
case 0x8316:mapbyte2[6]=V;m83chr();break; case 0x8316:mapbyte2[6]=V;m83chr();break;
case 0x8317:mapbyte2[7]=V;m83chr();break; case 0x8317:mapbyte2[7]=V;m83chr();break;
case 0x8318:mapbyte1[1]=V;m83prg();break; case 0x8318:mapbyte1[1]=V;m83prg();break;
@ -117,13 +123,23 @@ static DECLFW(Mapper83_write)
} }
static void m83Reset(void)
{
dipreg^=1;
}
void Mapper83_init(void) void Mapper83_init(void)
{ {
is2kbank = 0;
isnot2kbank = 0;
dipreg = 0;
ROM_BANK8(0xc000,0x1e); ROM_BANK8(0xc000,0x1e);
ROM_BANK8(0xe000,0x1f); ROM_BANK8(0xe000,0x1f);
MapIRQHook=m83IRQHook; MapIRQHook=m83IRQHook;
MapperReset=m83Reset;
SetReadHandler(0x5000,0x5000,rd5000); // title scren dip switch
SetReadHandler(0x5100,0x5103,rdlow); SetReadHandler(0x5100,0x5103,rdlow);
SetWriteHandler(0x5100,0x5103,wrlow); SetWriteHandler(0x5100,0x5103,wrlow);
SetWriteHandler(0x8000,0xffff,Mapper83_write); SetWriteHandler(0x8000,0xffff,Mapper83_write);

View File

@ -83,6 +83,10 @@ void Mapper96_init(void)
GameStateRestore=M96Sync; GameStateRestore=M96Sync;
} }
// DIS23C01 Open Soft, Korea
// Metal Force (K)
// Buzz and Waldog (K)
static DECLFW(M156Write) static DECLFW(M156Write)
{ {
if(A>=0xc000 && A<=0xC003) if(A>=0xc000 && A<=0xC003)

View File

@ -324,9 +324,11 @@ static BMAPPING bmap[] = {
{ "Sachen-8259D", S8259D_Init,0}, { "Sachen-8259D", S8259D_Init,0},
{ "Sachen-74LS374N", S74LS374N_Init,0}, { "Sachen-74LS374N", S74LS374N_Init,0},
{ "Sachen-74LS374NA", S74LS374NA_Init,0}, //seems to be custom mapper { "Sachen-74LS374NA", S74LS374NA_Init,0}, //seems to be custom mapper
{ "SA-002", TCU02_Init, 0},
{ "SA-016-1M", SA0161M_Init,0}, { "SA-016-1M", SA0161M_Init,0},
{ "SA-72007", SA72007_Init,0}, { "SA-72007", SA72007_Init,0},
{ "SA-72008", SA72008_Init,0}, { "SA-72008", SA72008_Init,0},
{ "SA-009", SA009_Init,0},
{ "SA-0036", SA0036_Init,0}, { "SA-0036", SA0036_Init,0},
{ "SA-0037", SA0037_Init,0}, { "SA-0037", SA0037_Init,0},
{ "SA-NROM", TCA01_Init,0}, { "SA-NROM", TCA01_Init,0},
@ -360,6 +362,7 @@ static BMAPPING bmap[] = {
{ "TGROM", TGROM_Init,0}, { "TGROM", TGROM_Init,0},
{ "TR1ROM", TFROM_Init,BMCFLAG_FORCE4}, { "TR1ROM", TFROM_Init,BMCFLAG_FORCE4},
{ "TBROM", TBROM_Init,0},
{ "TEROM", TEROM_Init,0}, { "TEROM", TEROM_Init,0},
{ "TFROM", TFROM_Init,0}, { "TFROM", TFROM_Init,0},
{ "TLROM", TLROM_Init,0}, { "TLROM", TLROM_Init,0},
@ -371,6 +374,8 @@ static BMAPPING bmap[] = {
{ "TQROM", TQROM_Init,0}, { "TQROM", TQROM_Init,0},
{ "TVROM", TLROM_Init,BMCFLAG_FORCE4}, { "TVROM", TLROM_Init,BMCFLAG_FORCE4},
{ "NTBROM", Mapper68_Init,0},
{ "CPROM", CPROM_Init,BMCFLAG_16KCHRR}, { "CPROM", CPROM_Init,BMCFLAG_16KCHRR},
{ "CNROM", CNROM_Init,0}, { "CNROM", CNROM_Init,0},
{ "NROM", NROM_Init,0 }, //NROM256_Init,0 }, { "NROM", NROM_Init,0 }, //NROM256_Init,0 },
@ -380,9 +385,12 @@ static BMAPPING bmap[] = {
{ "RROM-128", NROM_Init,0 }, //NROM128_Init,0 }, { "RROM-128", NROM_Init,0 }, //NROM128_Init,0 },
{ "MHROM", MHROM_Init,0}, { "MHROM", MHROM_Init,0},
{ "UNROM", UNROM_Init,0}, { "UNROM", UNROM_Init,0},
{ "UOROM", UNROM_Init,0},
{ "SUNSOFT_UNROM", SUNSOFT_UNROM_Init,0}, { "SUNSOFT_UNROM", SUNSOFT_UNROM_Init,0},
{ "MARIO1-MALEE2", MALEE_Init,0}, { "MARIO1-MALEE2", MALEE_Init,0},
{ "3D-BLOCK", UNL3DBlock_Init, 0},
{ "SMB2J", UNLSMB2J_Init, 0},
{ "AX5705", UNLAX5705_Init, 0},
{ "CC-21", UNLCC21_Init,0}, { "CC-21", UNLCC21_Init,0},
{ "H2288", UNLH2288_Init,0}, { "H2288", UNLH2288_Init,0},
@ -397,6 +405,7 @@ static BMAPPING bmap[] = {
{ "C-N22M", UNLCN22M_Init,0}, { "C-N22M", UNLCN22M_Init,0},
{ "EDU2000", UNLEDU2000_Init,0}, { "EDU2000", UNLEDU2000_Init,0},
{ "603-5052", UNL6035052_Init,0}, { "603-5052", UNL6035052_Init,0},
{ "N625092", UNLN625092_Init,0},
{ "Supervision16in1", Supervision16_Init,0}, { "Supervision16in1", Supervision16_Init,0},
{ "NovelDiamond9999999in1", Novel_Init,0}, { "NovelDiamond9999999in1", Novel_Init,0},
{ "Super24in1SC03", Super24_Init,0}, { "Super24in1SC03", Super24_Init,0},
@ -409,14 +418,28 @@ static BMAPPING bmap[] = {
{ "GK-192", BMCGK192_Init, 0}, { "GK-192", BMCGK192_Init, 0},
{ "SuperHIK8in1", Mapper45_Init,0}, { "SuperHIK8in1", Mapper45_Init,0},
{ "22211", UNL22211_Init,0}, { "22211", UNL22211_Init,0},
{ "TF1201", UNLTF1201_Init, 0},
{ "GS-2004", BMCGS2004_Init, 0},
{ "GS-2013", BMCGS2013_Init, 0},
{ "KS7032", UNLKS7032_Init, 0},
{ "T-230", UNLT230_Init, 0},
{ "190in1", BMC190in1_Init, 0},
{ "Ghostbusters63in1", BMCGhostbusters63in1_Init, 0},
{ "BS-5",BMCBS5_Init, 0},
{ "411120-C",BMC411120C_Init, 0},
{ "830118C",BMC830118C_Init, 0},
{ "T-227-1",BMCT2271_Init,0},
{ "DREAMTECH01", DreamTech01_Init,0}, { "DREAMTECH01", DreamTech01_Init,0},
{ "KONAMI-QTAI", Mapper190_Init,0}, { "KONAMI-QTAI", Mapper190_Init,0},
{ "TEK90", Mapper90_Init,0}, { "TEK90", Mapper90_Init,0},
{ "COPYFAMI_MMC3", MapperCopyFamiMMC3_Init,0},
{0,0,0} {0,0,0}
}; };
static BFMAPPING bfunc[] = { static BFMAPPING bfunc[] = {
{ "CTRL", CTRL }, { "CTRL", CTRL },
{ "TVCI", TVCI }, { "TVCI", TVCI },

View File

@ -46,7 +46,9 @@ void MALEE_Init(CartInfo *info);
void CNROM_Init(CartInfo *info); void CNROM_Init(CartInfo *info);
void CPROM_Init(CartInfo *info); void CPROM_Init(CartInfo *info);
void GNROM_Init(CartInfo *info); void GNROM_Init(CartInfo *info);
void UNL3DBlock_Init(CartInfo *info);
void TBROM_Init(CartInfo *info);
void TEROM_Init(CartInfo *info); void TEROM_Init(CartInfo *info);
void TFROM_Init(CartInfo *info); void TFROM_Init(CartInfo *info);
void TGROM_Init(CartInfo *info); void TGROM_Init(CartInfo *info);
@ -62,6 +64,7 @@ void DEIROM_Init(CartInfo *info);
void TCA01_Init(CartInfo *info); void TCA01_Init(CartInfo *info);
void TCU01_Init(CartInfo *info); void TCU01_Init(CartInfo *info);
void TCU02_Init(CartInfo *info);
void S8259A_Init(CartInfo *info); void S8259A_Init(CartInfo *info);
void S8259B_Init(CartInfo *info); void S8259B_Init(CartInfo *info);
void S8259C_Init(CartInfo *info); void S8259C_Init(CartInfo *info);
@ -72,6 +75,7 @@ void SA0161M_Init(CartInfo *info);
void SA72007_Init(CartInfo *info); void SA72007_Init(CartInfo *info);
void SA72008_Init(CartInfo *info); void SA72008_Init(CartInfo *info);
void SA009_Init(CartInfo *info);
void SA0036_Init(CartInfo *info); void SA0036_Init(CartInfo *info);
void SA0037_Init(CartInfo *info); void SA0037_Init(CartInfo *info);
@ -89,6 +93,11 @@ void BMCFK23C_Init(CartInfo *info);
void BMCD1038_Init(CartInfo *info); void BMCD1038_Init(CartInfo *info);
void BMCA65AS_Init(CartInfo *info); void BMCA65AS_Init(CartInfo *info);
void BMCGK192_Init(CartInfo *info); void BMCGK192_Init(CartInfo *info);
void BMCGS2004_Init(CartInfo *info);
void BMCGS2013_Init(CartInfo *info);
void BMC190in1_Init(CartInfo *info);
void BMCGhostbusters63in1_Init(CartInfo *info);
void BMCBS5_Init(CartInfo *info);
void DreamTech01_Init(CartInfo *info); void DreamTech01_Init(CartInfo *info);
void Mapper190_Init(CartInfo *info); void Mapper190_Init(CartInfo *info);
@ -96,15 +105,27 @@ void UNLCC21_Init(CartInfo *info);
void UNLCN22M_Init(CartInfo *info); void UNLCN22M_Init(CartInfo *info);
void UNLSL1632_Init(CartInfo *info); void UNLSL1632_Init(CartInfo *info);
void UNLKOF97_Init(CartInfo *info); void UNLKOF97_Init(CartInfo *info);
void UNLA9711_Init(CartInfo *info); void UNLA9746_Init(CartInfo *info);
void UNLSHeroes_Init(CartInfo *info); void UNLSHeroes_Init(CartInfo *info);
void UNLH2288_Init(CartInfo *info); void UNLH2288_Init(CartInfo *info);
void UNL8237_Init(CartInfo *info); void UNL8237_Init(CartInfo *info);
void UNL8157_Init(CartInfo *info); void UNL8157_Init(CartInfo *info);
void UNL22211_Init(CartInfo *info); void UNL22211_Init(CartInfo *info);
void UNLTF1201_Init(CartInfo *info);
void UNLKS7032_Init(CartInfo *info);
void UNLT230_Init(CartInfo *info);
void UNLAX5705_Init(CartInfo *info);
void UNLEDU2000_Init(CartInfo *info); void UNLEDU2000_Init(CartInfo *info);
void UNL6035052_Init(CartInfo *info); void UNL6035052_Init(CartInfo *info);
void UNLN625092_Init(CartInfo *info);
void UNLSMB2J_Init(CartInfo *info);
//void UNL09034A_Init(CartInfo *info);
void BMC411120C_Init(CartInfo *info);
void BMC830118C_Init(CartInfo *info);
void BMCT2271_Init(CartInfo *info);
void MapperCopyFamiMMC3_Init(CartInfo *info);
extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM
// bank switcherooing with certain boards... // bank switcherooing with certain boards...