+++ /dev/null
-CC = gcc
-TFLAGS = -no-fpic -DC80x86 -DNETWORK -DFPS `sdl-config --cflags` -mcpu=i686 -O2 -Izlib -fomit-frame-pointer -DLSB_FIRST -DSDL -DUNIX -DPSS_STYLE=1 -DZLIB
-RM = rm -f
-B = drivers/cli/
-
-all: fceu
-
-include zlib/Makefile
-
-OBJDRIVER = ${B}sdl.o ${B}main.o ${B}throttle.o ${B}sdl-netplay.o ${B}sdl-sound.o ${B}sdl-video.o ${B}sdl-joystick.o drivers/common/cheat.o drivers/common/config.o drivers/common/args.o drivers/common/vidblit.o ${UNZIPOBJS}
-LDRIVER = -static `sdl-config --libs` -lz -lSDL_net
-
-include Makefile.base
-
-${B}sdl-joystick.o: ${B}sdl-joystick.c
-${B}main.o: ${B}main.c ${B}main.h ${B}usage.h ${B}input.c ${B}keyscan.h
-${B}sdl.o: ${B}sdl.c ${B}sdl.h
-${B}sdl-video.o: ${B}sdl-video.c
-${B}sdl-sound.o: ${B}sdl-sound.c
-${B}sdl-netplay.o: ${B}sdl-netplay.c
-${B}throttle.o: ${B}throttle.c ${B}main.h ${B}throttle.h
-
-include Makefile.common
+++ /dev/null
-CC = gcc
-TFLAGS = -O2 -mcpu=i686 -Izlib -fomit-frame-pointer -DC80x86 -DLSB_FIRST -DDOS -DPSS_STYLE=2 -DZLIB -D_USE_LIBM_MATH_H
-RM = del
-B = drivers/cli/
-
-all: fceu
-
-include zlib/Makefile
-
-OBJDRIVER = ${B}main.o ${B}dos.o ${B}throttle.o ${B}dos-joystick.o ${B}dos-keyboard.o ${B}dos-mouse.o ${B}dos-sound.o ${B}dos-video.o drivers/common/cheat.o drivers/common/config.o drivers/common/args.o ${ZLIBOBJS} ${UNZIPOBJS}
-LDRIVER = -lm
-
-include Makefile.base
-
-${B}main.o: ${B}main.c ${B}main.h ${B}usage.h ${B}input.c
-${B}dos.o: ${B}dos.c ${B}dos.h
-${B}throttle.o: ${B}throttle.c ${B}main.h ${B}throttle.h
-${B}dos-joystick.o: ${B}dos-joystick.c ${B}dos.h ${B}dos-joystick.h
-${B}dos-keyboard.o: ${B}dos-keyboard.c ${B}keyscan.h
-${B}dos-mouse.o: ${B}dos-mouse.c
-${B}dos-sound.o: ${B}dos-sound.c ${B}dos.h ${B}dos-sound.h ${B}dos-joystick.h
-${B}dos-video.o: ${B}dos-video.c ${B}dos.h ${B}dos-video.h
-include Makefile.common
include Makefile.common
up: fceu
- cp -v fceu /mnt/gp2x/mnt/sd/emus/Gpfce_v02/gpfce
+ cp -v fceu /mnt/gp2x/mnt/sd/emus/gpfce/gpfce
# ----------- release -----------
ifneq ($(findstring rel,$(MAKECMDGOALS)),)
+++ /dev/null
-CC = gcc
-TFLAGS = -DFPS -mcpu=i686 -O2 -Izlib -fomit-frame-pointer -DC80x86 -DLSB_FIRST -DSVGALIB -DUNIX -DLINUX -DNETWORK -DPSS_STYLE=1 -DZLIB
-RM = rm -f
-B = drivers/cli/
-
-all: fceu
-
-include zlib/Makefile
-
-OBJDRIVER = ${B}svgalib.o ${B}main.o ${B}throttle.o ${B}svga-video.o ${B}unix-netplay.o ${B}lnx-joystick.o drivers/common/unixdsp.o drivers/common/cheat.o drivers/common/config.o drivers/common/args.o ${ZLIBOBJS} ${UNZIPOBJS}
-LDRIVER = -lm -lvga
-
-include Makefile.base
-
-${B}lnx-joystick.o: ${B}lnx-joystick.c
-${B}main.o: ${B}main.c ${B}main.h ${B}usage.h ${B}input.c
-${B}throttle.o: ${B}throttle.c ${B}main.h ${B}throttle.h
-${B}svgalib.o: ${B}svgalib.c ${B}svgalib.h
-${B}svga-video.o: ${B}svga-video.c ${B}svga-video.h ${B}vgatweak.c
-${B}unix-netplay.o: ${B}unix-netplay.c
-
-include Makefile.common
+++ /dev/null
-CC = gcc
-TFLAGS = -DNETWORK -DFPS `sdl-config --cflags` -mcpu=i686 -O2 -Izlib -fomit-frame-pointer -DC80x86 -DLSB_FIRST -DSDL -DUNIX -DPSS_STYLE=1 -DZLIB
-
-RM = rm -f
-B = drivers/cli/
-
-all: fceu
-
-include zlib/Makefile
-
-OBJDRIVER = ${B}sdl.o ${B}main.o ${B}throttle.o ${B}unix-netplay.o ${B}sdl-sound.o ${B}sdl-video.o ${B}sdl-joystick.o drivers/common/cheat.o drivers/common/config.o drivers/common/args.o drivers/common/vidblit.o ${UNZIPOBJS}
-LDRIVER = -lm `sdl-config --libs` -lz
-
-include Makefile.base
-
-${B}sdl-joystick.o: ${B}sdl-joystick.c
-${B}main.o: ${B}main.c ${B}main.h ${B}usage.h ${B}input.c ${B}keyscan.h
-${B}sdl.o: ${B}sdl.c ${B}sdl.h
-${B}sdl-video.o: ${B}sdl-video.c
-${B}sdl-sound.o: ${B}sdl-sound.c
-#${B}sdl-netplay.o: ${B}sdl-netplay.c
-${B}unix-netplay.o: ${B}unix-netplay.c
-${B}throttle.o: ${B}throttle.c ${B}main.h ${B}throttle.h
-
-include Makefile.common
+++ /dev/null
-CC = gcc
-TFLAGS = -mcpu=i686 -O2 -Izlib -fomit-frame-pointer -DNOSTDOUT -DC80x86 -DLSB_FIRST -DWINDOWS -DNETWORK -DPSS_STYLE=2 -DZLIB
-RM = del
-B = drivers/win/
-all: fceu
-
-include zlib/Makefile
-
-LDRIVER = -mwindows -lddraw -ldinput -ldsound -lgdi32 -ldxguid -lwinmm -lshell32 -lwsock32 -lcomdlg32 -lole32
-OBJDRIVER = ${B}main.o ${B}input.o ${B}joystick.o ${B}keyboard.o ${B}cheat.o ${B}res.o ${ZLIBOBJS} ${UNZIPOBJS} drivers/common/config.o
-
-include Makefile.base
-
-${B}main.o: ${B}main.c drivers/win/netplay.c ${B}config.c ${B}throttle.c ${B}video.c drivers/win/window.c drivers/win/sound.c drivers/win/wave.c
-${B}cheat.o: ${B}common.h ${B}cheat.h
-${B}input.o: ${B}common.h ${B}input.h ${B}joystick.h ${B}keyboard.h
-${B}joystick.o: ${B}common.h ${B}joystick.h ${B}input.h
-${B}keyboard.o: ${B}common.h ${B}keyboard.h ${B}input.h
-drivers/win/res.o: drivers/win/res.res
- windres -o drivers/win/res.o drivers/win/res.res
-
-include Makefile.common
static uint8 reg[8];
static uint8 mirror, cmd;
static uint8 *WRAM=NULL;
+
static SFORMAT StateRegs[]=
{
{&cmd, 1, "CMD"},
case 0x8000: cmd=V&7; break;
case 0xa000: reg[cmd]=V; Sync(); break;
}
+FCEU_printf("%04x:%04x %d\n",A,V,scanline);
}
static void M112Close(void)
static void M112Power(void)
{
- Sync();
setprg16(0xC000,~0);
setprg8r(0x10,0x6000,0);
SetReadHandler(0x8000,0xFFFF,CartBR);
--- /dev/null
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ * Copyright (C) 2002 Xodnizel
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "mapinc.h"
+
+static uint8 prgreg[4], chrreg[8];
+static uint8 IRQa, IRQCount, IRQLatch;
+
+static SFORMAT StateRegs[]=
+{
+ {&IRQa, 1, "IRQA"},
+ {&IRQCount, 1, "IRQC"},
+ {&IRQLatch, 1, "IRQL"},
+ {prgreg, 4, "PREGS"},
+ {chrreg, 8, "CREGS"},
+ {0}
+};
+
+static void Sync(void)
+{
+ setprg8(0x8000,prgreg[0]);
+ setprg8(0xa000,prgreg[1]);
+ setprg8(0xc000,prgreg[2]);
+ setprg8(0xe000,prgreg[3]);
+ int i;
+ for(i=0; i<8; i++)
+ setchr1(i<<10,chrreg[i]);
+}
+
+static DECLFW(M117Write)
+{
+ if(A<0x8004)
+ {
+ prgreg[A&3]=V;
+ Sync();
+ }
+ else if((A>=0xA000)&&(A<=0xA007))
+ {
+ chrreg[A&7]=V;
+ Sync();
+ }
+ else switch(A)
+ {
+ case 0xc001: IRQLatch=V; break;
+ case 0xc003: IRQCount=IRQLatch; IRQa|=2; break;
+ case 0xe000: IRQa&=~1; IRQa|=V&1; X6502_IRQEnd(FCEU_IQEXT); break;
+ case 0xc002: X6502_IRQEnd(FCEU_IQEXT); break;
+ }
+}
+
+static void M117Power(void)
+{
+ prgreg[0]=~3; prgreg[1]=~2; prgreg[2]=~1; prgreg[3]=~0;
+ Sync();
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xFFFF,M117Write);
+}
+
+static void M117IRQHook(void)
+{
+ if(IRQa==3&&IRQCount)
+ {
+ IRQCount--;
+ if(!IRQCount)
+ {
+ IRQa&=1;
+ X6502_IRQBegin(FCEU_IQEXT);
+ }
+ }
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+void Mapper117_Init(CartInfo *info)
+{
+ info->Power=M117Power;
+ GameHBIRQHook=M117IRQHook;
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
+
static uint8 cmd;
static uint8 DRegs[8];
-
static SFORMAT StateRegs[]=
{
{&cmd, 1, "CMD"},
static void Sync(void)
{
setprg32(0x8000,(DRegs[0]<<4)|(DRegs[1]&0xF));
+ setchr8(0);
}
static void StateRestore(int version)
{
memset(DRegs,0,8);
DRegs[1]=0xFF;
- setchr8(0);
cmd=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0xFFFF,Write);
Sync();
}
+static void M163HB(void)
+{
+ if(scanline==127&&DRegs[1]&0x80)
+ setchr4(0x0000,1);
+}
+
+
static void Power2(void)
{
memset(DRegs,0,8);
DRegs[1]=0xFF;
- setchr8(0);
cmd=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0xFFFF,Write2);
void Mapper163_Init(CartInfo *info)
{
info->Power=Power2;
+ GameHBIRQHook=M163HB;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 2005 CaH4e3\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * Gimmick Bootleg\r
- */\r
-\r
-#include "mapinc.h"\r
-\r
-static uint8 prg[4];\r
-static uint8 chr[8];\r
-static uint8 IRQCount;\r
-static uint8 IRQPre;\r
-static uint8 IRQa;\r
-\r
-static SFORMAT StateRegs[]=\r
-{\r
- {prg, 4, "PRG"},\r
- {chr, 8, "CHR"},\r
- {&IRQCount, 1, "IRQCOUNT"},\r
- {&IRQPre, 1, "IRQPRE"},\r
- {&IRQa, 1, "IRQA"},\r
- {0}\r
-};\r
-\r
-static void SyncPrg(void)\r
-{\r
- setprg8(0x6000,0);\r
- setprg8(0x8000,prg[0]);\r
- setprg8(0xA000,prg[1]);\r
- setprg8(0xC000,prg[2]);\r
- setprg8(0xE000,~0);\r
-}\r
-\r
-static void SyncChr(void)\r
-{\r
- int i;\r
- for(i=0; i<8; i++)\r
- setchr1(i<<10,chr[i]);\r
-}\r
-\r
-static void StateRestore(int version)\r
-{\r
- SyncPrg();\r
- SyncChr();\r
-}\r
-\r
-static DECLFW(M183Write)\r
-{\r
- if(((A&0xF80C)>=0xB000)&&((A&0xF80C)<=0xE00C))\r
- {\r
- uint8 index=(((A&0x7000)>>11)-6)|((A&8)>>3);\r
- chr[index]=(chr[index]&(0xF0>>(A&4)))|((V&0x0F)<<(A&4));\r
- SyncChr();\r
- }\r
- else switch (A&0xF80C)\r
- {\r
- case 0x8800: prg[0]=V; SyncPrg(); break;\r
- case 0xA800: prg[1]=V; SyncPrg(); break;\r
- case 0xA000: prg[2]=V; SyncPrg(); break;\r
- case 0x9800: switch (V&3)\r
- {\r
- case 0: setmirror(MI_V); break;\r
- case 1: setmirror(MI_H); break;\r
- case 2: setmirror(MI_0); break;\r
- case 3: setmirror(MI_1); break;\r
- }\r
- break;\r
- case 0xF000: IRQCount=((IRQCount&0xF0)|(V&0xF)); break;\r
- case 0xF004: IRQCount=((IRQCount&0x0F)|((V&0xF)<<4)); break;\r
- case 0xF008: IRQa=V; if(!V)IRQPre=0; X6502_IRQEnd(FCEU_IQEXT); break;\r
- case 0xF00C: IRQPre=16; break;\r
- }\r
-}\r
-\r
-static void M183IRQCounter(void)\r
-{\r
- if(IRQa)\r
- {\r
- IRQCount++;\r
- if((IRQCount-IRQPre)==238)\r
- X6502_IRQBegin(FCEU_IQEXT);\r
- }\r
-}\r
-\r
-static void M183Power(void)\r
-{\r
- IRQPre=IRQCount=IRQa=0;\r
- SetReadHandler(0x8000,0xFFFF,CartBR);\r
- SetWriteHandler(0x8000,0xFFFF,M183Write);\r
- SetReadHandler(0x6000,0x7FFF,CartBR);\r
- SyncPrg();\r
- SyncChr();\r
-}\r
-\r
-void Mapper183_Init(CartInfo *info)\r
-{\r
- info->Power=M183Power;\r
- GameHBIRQHook=M183IRQCounter;\r
- GameStateRestore=StateRestore;\r
- AddExState(&StateRegs, ~0, 0, 0);\r
-}\r
+/* 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
+ *
+ * Gimmick Bootleg
+ */
+
+#include "mapinc.h"
+
+static uint8 prg[4];
+static uint8 chr[8];
+static uint8 IRQCount;
+static uint8 IRQPre;
+static uint8 IRQa;
+
+static SFORMAT StateRegs[]=
+{
+ {prg, 4, "PRG"},
+ {chr, 8, "CHR"},
+ {&IRQCount, 1, "IRQCOUNT"},
+ {&IRQPre, 1, "IRQPRE"},
+ {&IRQa, 1, "IRQA"},
+ {0}
+};
+
+static void SyncPrg(void)
+{
+ setprg8(0x6000,0);
+ setprg8(0x8000,prg[0]);
+ setprg8(0xA000,prg[1]);
+ setprg8(0xC000,prg[2]);
+ setprg8(0xE000,~0);
+}
+
+static void SyncChr(void)
+{
+ int i;
+ for(i=0; i<8; i++)
+ setchr1(i<<10,chr[i]);
+}
+
+static void StateRestore(int version)
+{
+ SyncPrg();
+ SyncChr();
+}
+
+static DECLFW(M183Write)
+{
+ if(((A&0xF80C)>=0xB000)&&((A&0xF80C)<=0xE00C))
+ {
+ uint8 index=(((A&0x7000)>>11)-6)|((A&8)>>3);
+ chr[index]=(chr[index]&(0xF0>>(A&4)))|((V&0x0F)<<(A&4));
+ SyncChr();
+ }
+ else switch (A&0xF80C)
+ {
+ case 0x8800: prg[0]=V; SyncPrg(); break;
+ case 0xA800: prg[1]=V; SyncPrg(); break;
+ case 0xA000: prg[2]=V; SyncPrg(); break;
+ case 0x9800: switch (V&3)
+ {
+ case 0: setmirror(MI_V); break;
+ case 1: setmirror(MI_H); break;
+ case 2: setmirror(MI_0); break;
+ case 3: setmirror(MI_1); break;
+ }
+ break;
+ case 0xF000: IRQCount=((IRQCount&0xF0)|(V&0xF)); break;
+ case 0xF004: IRQCount=((IRQCount&0x0F)|((V&0xF)<<4)); break;
+ case 0xF008: IRQa=V; if(!V)IRQPre=0; X6502_IRQEnd(FCEU_IQEXT); break;
+ case 0xF00C: IRQPre=16; break;
+ }
+}
+
+static void M183IRQCounter(void)
+{
+ if(IRQa)
+ {
+ IRQCount++;
+ if((IRQCount-IRQPre)==238)
+ X6502_IRQBegin(FCEU_IQEXT);
+ }
+}
+
+static void M183Power(void)
+{
+ IRQPre=IRQCount=IRQa=0;
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xFFFF,M183Write);
+ SetReadHandler(0x6000,0x7FFF,CartBR);
+ SyncPrg();
+ SyncChr();
+}
+
+void Mapper183_Init(CartInfo *info)
+{
+ info->Power=M183Power;
+ GameHBIRQHook=M183IRQCounter;
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
--- /dev/null
+/* 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
+ *
+ * Family Study Box by Fukutake Shoten
+ */
+
+#include "mapinc.h"
+
+static uint8 *DummyCHR=NULL;
+static uint8 datareg;
+static void(*Sync)(void);
+
+
+static SFORMAT StateRegs[]=
+{
+ {&datareg, 1, "DREG"},
+ {0}
+};
+
+// on off
+//1 0x0F, 0xF0 - Bird Week
+//2 0x33, 0x00 - B-Wings
+//3 0x11, 0x00 - Mighty Bomb Jack
+//4 0x22, 0x20 - Sansuu 1 Nen, Sansuu 2 Nen
+//5 0xFF, 0x00 - Sansuu 3 Nen
+//6 0x21, 0x13 - Spy vs Spy
+//7 0x20, 0x21 - Seicross
+
+static void Sync185(void)
+{
+ // little dirty eh? ;_)
+ if((datareg&3)&&(datareg!=0x13)) // 1, 2, 3, 4, 5, 6
+ setchr8(0);
+ else
+ setchr8r(0x10,0);
+}
+
+static void Sync181(void)
+{
+ if(!(datareg&1)) // 7
+ setchr8(0);
+ else
+ setchr8r(0x10,0);
+}
+
+static DECLFW(MWrite)
+{
+ datareg=V;
+ Sync();
+}
+
+static void MPower(void)
+{
+ datareg=0;
+ Sync();
+ setprg16(0x8000,0);
+ setprg16(0xC000,~0);
+ SetWriteHandler(0x8000,0xFFFF,MWrite);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+}
+
+static void MClose(void)
+{
+ if(DummyCHR)
+ FCEU_gfree(DummyCHR);
+ DummyCHR=NULL;
+}
+
+static void MRestore(int version)
+{
+ Sync();
+}
+
+void Mapper185_Init(CartInfo *info)
+{
+ Sync=Sync185;
+ info->Power=MPower;
+ info->Close=MClose;
+ GameStateRestore=MRestore;
+ DummyCHR=(uint8*)FCEU_gmalloc(8192);
+ int x;
+ for(x=0;x<8192;x++)
+ DummyCHR[x]=0xff;
+ SetupCartCHRMapping(0x10,DummyCHR,8192,0);
+ AddExState(StateRegs, ~0, 0, 0);
+}
+
+void Mapper181_Init(CartInfo *info)
+{
+ Sync=Sync181;
+ info->Power=MPower;
+ info->Close=MClose;
+ GameStateRestore=MRestore;
+ DummyCHR=(uint8*)FCEU_gmalloc(8192);
+ int x;
+ for(x=0;x<8192;x++)
+ DummyCHR[x]=0xff;
+ SetupCartCHRMapping(0x10,DummyCHR,8192,0);
+ AddExState(StateRegs, ~0, 0, 0);
+}
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 2005 CaH4e3\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * Family Study Box by Fukutake Shoten\r
- */\r
-\r
-#include "mapinc.h"\r
-\r
-static uint8 SWRAM[2816];\r
-static uint8 *WRAM=NULL;\r
-static uint8 regs[4];\r
-\r
-static SFORMAT StateRegs[]=\r
-{\r
- {regs, 4, "DREG"},\r
- {SWRAM, 2816, "SWRAM"},\r
- {0}\r
-};\r
-\r
-static void Sync(void)\r
-{\r
- setprg8r(0x10,0x6000,regs[0]>>6);\r
- setprg16(0x8000,regs[1]);\r
- setprg16(0xc000,0);\r
-}\r
-\r
-static DECLFW(M186Write)\r
-{\r
- if(A&0x4203) regs[A&3]=V;\r
- Sync();\r
-}\r
-\r
-static DECLFR(M186Read)\r
-{\r
- switch(A)\r
- {\r
- case 0x4200: return 0x00; break;\r
- case 0x4201: return 0x00; break;\r
- case 0x4202: return 0x40; break;\r
- case 0x4203: return 0x00; break;\r
- }\r
- return 0xFF;\r
-}\r
-\r
-static DECLFR(ASWRAM)\r
-{\r
- return(SWRAM[A-0x4400]);\r
-}\r
-static DECLFW(BSWRAM)\r
-{\r
- SWRAM[A-0x4400]=V;\r
-}\r
-\r
-static void M186Power(void)\r
-{\r
- setchr8(0);\r
- SetReadHandler(0x6000,0xFFFF,CartBR);\r
- SetWriteHandler(0x6000,0xFFFF,CartBW);\r
- SetReadHandler(0x4200,0x43FF,M186Read);\r
- SetWriteHandler(0x4200,0x43FF,M186Write);\r
- SetReadHandler(0x4400,0x4EFF,ASWRAM);\r
- SetWriteHandler(0x4400,0x4EFF,BSWRAM);\r
- regs[0]=regs[1]=regs[2]=regs[3];\r
- Sync();\r
-}\r
-\r
-static void M186Close(void)\r
-{\r
- if(WRAM)\r
- FCEU_gfree(WRAM);\r
- WRAM=NULL;\r
-}\r
-\r
-static void M186Restore(int version)\r
-{\r
- Sync();\r
-}\r
-\r
-void Mapper186_Init(CartInfo *info)\r
-{\r
- info->Power=M186Power;\r
- info->Close=M186Close;\r
- GameStateRestore=M186Restore;\r
- WRAM=(uint8*)FCEU_gmalloc(32384);\r
- SetupCartPRGMapping(0x10,WRAM,32384,1);\r
- AddExState(WRAM, 32384, 0, "WRAM");\r
- AddExState(StateRegs, ~0, 0, 0);\r
-}\r
+/* 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
+ *
+ * Family Study Box by Fukutake Shoten
+ */
+
+#include "mapinc.h"
+
+static uint8 SWRAM[2816];
+static uint8 *WRAM=NULL;
+static uint8 regs[4];
+
+static SFORMAT StateRegs[]=
+{
+ {regs, 4, "DREG"},
+ {SWRAM, 2816, "SWRAM"},
+ {0}
+};
+
+static void Sync(void)
+{
+ setprg8r(0x10,0x6000,regs[0]>>6);
+ setprg16(0x8000,regs[1]);
+ setprg16(0xc000,0);
+}
+
+static DECLFW(M186Write)
+{
+ if(A&0x4203) regs[A&3]=V;
+ Sync();
+}
+
+static DECLFR(M186Read)
+{
+ switch(A)
+ {
+ case 0x4200: return 0x00; break;
+ case 0x4201: return 0x00; break;
+ case 0x4202: return 0x40; break;
+ case 0x4203: return 0x00; break;
+ }
+ return 0xFF;
+}
+
+static DECLFR(ASWRAM)
+{
+ return(SWRAM[A-0x4400]);
+}
+static DECLFW(BSWRAM)
+{
+ SWRAM[A-0x4400]=V;
+}
+
+static void M186Power(void)
+{
+ setchr8(0);
+ SetReadHandler(0x6000,0xFFFF,CartBR);
+ SetWriteHandler(0x6000,0xFFFF,CartBW);
+ SetReadHandler(0x4200,0x43FF,M186Read);
+ SetWriteHandler(0x4200,0x43FF,M186Write);
+ SetReadHandler(0x4400,0x4EFF,ASWRAM);
+ SetWriteHandler(0x4400,0x4EFF,BSWRAM);
+ regs[0]=regs[1]=regs[2]=regs[3];
+ Sync();
+}
+
+static void M186Close(void)
+{
+ if(WRAM)
+ FCEU_gfree(WRAM);
+ WRAM=NULL;
+}
+
+static void M186Restore(int version)
+{
+ Sync();
+}
+
+void Mapper186_Init(CartInfo *info)
+{
+ info->Power=M186Power;
+ info->Close=M186Close;
+ GameStateRestore=M186Restore;
+ WRAM=(uint8*)FCEU_gmalloc(32384);
+ SetupCartPRGMapping(0x10,WRAM,32384,1);
+ AddExState(WRAM, 32384, 0, "WRAM");
+ AddExState(StateRegs, ~0, 0, 0);
+}
--- /dev/null
+/* 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
+ */
+
+#include "mapinc.h"
+#include "mmc3.h"
+
+static void M187CW(uint32 A, uint8 V)
+{
+ if((A&0x1000)==((MMC3_cmd&0x80)<<5))
+ setchr1(A,V|0x100);
+ else
+ setchr1(A,V);
+}
+
+static void M187PW(uint32 A, uint8 V)
+{
+ if(EXPREGS[0]&0x80)
+ {
+ uint8 bank=EXPREGS[0]&0x1F;
+ if(EXPREGS[0]&0x20)
+ setprg32(0x8000,bank>>2);
+ else
+ {
+ setprg16(0x8000,bank);
+ setprg16(0xC000,bank);
+ }
+ }
+ else
+ setprg8(A,V&0x3F);
+}
+
+static DECLFW(M187Write8000)
+{
+ EXPREGS[2]=1;
+ MMC3_CMDWrite(A,V);
+}
+
+static DECLFW(M187Write8001)
+{
+ if(EXPREGS[2])
+ MMC3_CMDWrite(A,V);
+}
+
+static DECLFW(M187Write8003)
+{
+ EXPREGS[2]=0;
+ if(V==0x28)setprg8(0xC000,0x17);
+ else if(V==0x2A)setprg8(0xA000,0x0F);
+}
+
+
+static DECLFW(M187WriteLo)
+{
+ EXPREGS[1]=V;
+ if(A==0x5000)
+ {
+ EXPREGS[0]=V;
+ FixMMC3PRG(MMC3_cmd);
+ }
+}
+
+static uint8 prot_data[4] = { 0x83, 0x83, 0x42, 0x00 };
+static DECLFR(M187Read)
+{
+ return prot_data[EXPREGS[1]&3];
+}
+
+static void M187Power(void)
+{
+ EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=0;
+ GenMMC3Power();
+ Write_IRQFM(0x4017,0x40);
+ SetReadHandler(0x5000,0x5FFF,M187Read);
+ SetWriteHandler(0x5000,0x5FFF,M187WriteLo);
+ SetWriteHandler(0x8000,0x8000,M187Write8000);
+ SetWriteHandler(0x8001,0x8001,M187Write8001);
+ SetWriteHandler(0x8003,0x8003,M187Write8003);
+}
+
+void Mapper187_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 256, 256, 0, 0);
+ pwrap=M187PW;
+ cwrap=M187CW;
+ info->Power=M187Power;
+ AddExState(EXPREGS, 3, 0, "EXPR");
+}
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
- * Copyright (C) 2002 Xodnizel
+ * 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
*/
#include "mapinc.h"
+#include "mmc3.h"
+static void M189PW(uint32 A, uint8 V)
+{
+ setprg32(0x8000,EXPREGS[0]&3);
+}
+static DECLFW(M189Write)
+{
+ EXPREGS[0]=V|(V>>4); //actually, there is a two versions of 189 mapper with hi or lo bits bankswitching.
+ FixMMC3PRG(MMC3_cmd);
+}
-static DECLFW(Mapper57_write)
+static void M189Power(void)
{
- A&=0x8800;
- if(A==0x8800)
- {
- mapbyte1[0]=V;
- if(V&0x80)
- ROM_BANK32(2|(V>>6));
- else
- {
- ROM_BANK16(0x8000,(V>>5)&3);
- ROM_BANK16(0xc000,(V>>5)&3);
- }
- MIRROR_SET((V&0x8)>>3);
- }
- else
- mapbyte1[1]=V;
- VROM_BANK8((mapbyte1[1]&3)|(mapbyte1[0]&7)|((mapbyte1[0]&0x10)>>1));
- //printf("$%04x:$%02x\n",A,V);
+ EXPREGS[0]=EXPREGS[1]=0;
+ GenMMC3Power();
+ SetWriteHandler(0x4120,0x7FFF,M189Write);
}
-void Mapper57_init(void)
+void Mapper189_Init(CartInfo *info)
{
- SetWriteHandler(0x8000,0xffff,Mapper57_write);
+ GenMMC3_Init(info, 256, 256, 0, 0);
+ pwrap=M189PW;
+ info->Power=M189Power;
+ AddExState(EXPREGS, 2, 0, "EXPR");
}
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
- * Copyright (C) 2003 Xodnizel
+ * 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
*/
#include "mapinc.h"
+#include "mmc3.h"
-static uint8 PRGSel;
-static uint8 PBuf[4],PSel;
-static uint8 cmd;
-static uint8 DRegs[8];
-static uint32 count=0;
-static uint32 last=0;
-
-static DECLFW(M208Write1)
-{
- PRGSel=(V&0x1)|((V>>3)&0x2);
- setprg32(0x8000,PRGSel);
-}
-
-static DECLFW(M208Write2)
-{
- static uint8 lut[256]={
+static uint8 lut[256]={
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01,
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x11, 0x41, 0x51, 0x01, 0x11, 0x41, 0x51,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
- };
- if(A<=0x57FF) PSel=V;
- else
- PBuf[(A&0x03)]=V^lut[PSel];
-}
-
-static DECLFR(M208Read)
+static void M208PW(uint32 A, uint8 V)
{
- return(PBuf[(A&0x3)]);
+ setprg32(0x8000,EXPREGS[5]);
}
-static void Sync(void)
+static DECLFW(M208Write)
{
- int x;
-
- setchr2(0x0000,DRegs[0]>>1);
- setchr2(0x0800,DRegs[1]>>1);
- for(x=0;x<4;x++)
- setchr1(0x1000+x*0x400,DRegs[2+x]);
+ EXPREGS[5]=(V&0x1)|((V>>3)&0x2);
+ FixMMC3PRG(MMC3_cmd);
}
-static DECLFW(M208HWrite)
+static DECLFW(M208ProtWrite)
{
- switch(A&0xe001)
- {
- case 0xc000:IRQLatch=IRQCount=V;break;
- case 0xc001:IRQCount=IRQLatch;last=count=0;break;
- case 0xe000:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
- case 0xe001:IRQa=1;break;
- case 0x8000:cmd=V;break;
- case 0x8001:DRegs[cmd&7]=V;
- Sync();
- break;
-
- }
+ if(A<=0x57FF)
+ EXPREGS[4]=V;
+ else
+ EXPREGS[(A&0x03)]=V^lut[EXPREGS[4]];
}
-static void M208Power(void)
+static DECLFR(M208ProtRead)
{
- PRGSel=3;
- setprg32(0x8000,3);
- SetWriteHandler(0x4800,0x4FFF,M208Write1);
- SetWriteHandler(0x5000,0x5fff,M208Write2);
- SetWriteHandler(0x8000,0xFFFF,M208HWrite);
- SetReadHandler(0x5800,0x5FFF,M208Read);
- SetReadHandler(0x8000,0xffff,CartBR);
+ return(EXPREGS[(A&0x3)]);
}
-static void sl(void)
-{
- if(IRQa)
- {
- if(IRQCount>=0)
- {
- IRQCount--;
- if(IRQCount<0)
- {
- X6502_IRQBegin(FCEU_IQEXT);
- }
- }
- }
-}
-
-static void FP_FASTAPASS(1) foo(uint32 A)
+static void M208Power(void)
{
- if((A&0x2000) && !(last&0x2000))
- {
- count++;
- if(count==42)
- {
- sl();
- count=0;
- }
- }
- last=A;
+ EXPREGS[5]=3;
+ GenMMC3Power();
+ SetWriteHandler(0x4800,0x4FFF,M208Write);
+ SetWriteHandler(0x5000,0x5fff,M208ProtWrite);
+ SetReadHandler(0x5800,0x5FFF,M208ProtRead);
+ SetReadHandler(0x8000,0xffff,CartBR);
}
void Mapper208_Init(CartInfo *info)
{
- info->Power=M208Power;
- //GameHBIRQHook=sl;
- PPU_hook=foo;
+ GenMMC3_Init(info, 128, 256, 0, 0);
+ pwrap=M208PW;
+ info->Power=M208Power;
+ AddExState(EXPREGS, 6, 0, "EXPR");
}
-
--- /dev/null
+/* 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
+ *
+ */
+
+#include "mapinc.h"
+
+static uint16 IRQCount;
+static uint8 IRQa;
+static uint8 prg_reg[2];
+static uint8 chr_reg[8];
+
+static SFORMAT StateRegs[]=
+{
+ {&IRQCount, 2, "IRQC"},
+ {&IRQa, 2, "IRQA"},
+ {prg_reg, 2, "PRG"},
+ {chr_reg, 8, "CHR"},
+ {0}
+};
+
+static void M222IRQ(void)
+{
+ if(IRQa)
+ {
+ IRQCount++;
+ if(IRQCount>=240)
+ {
+ X6502_IRQBegin(FCEU_IQEXT);
+ IRQa=0;
+ }
+ }
+}
+
+static void Sync(void)
+{
+ setprg8(0x8000,prg_reg[0]);
+ setprg8(0xA000,prg_reg[1]);
+ int i;
+ for(i=0; i<8; i++)
+ setchr1(i<<10,chr_reg[i]);
+}
+
+static DECLFW(M222Write)
+{
+ switch(A&0xF003)
+ {
+ case 0x8000: prg_reg[0]=V; break;
+ case 0xA000: prg_reg[1]=V; break;
+ case 0xB000: chr_reg[0]=V; break;
+ case 0xB002: chr_reg[1]=V; break;
+ case 0xC000: chr_reg[2]=V; break;
+ case 0xC002: chr_reg[3]=V; break;
+ case 0xD000: chr_reg[4]=V; break;
+ case 0xD002: chr_reg[5]=V; break;
+ case 0xE000: chr_reg[6]=V; break;
+ case 0xE002: chr_reg[7]=V; break;
+ case 0xF000: IRQCount=IRQa=V;
+ X6502_IRQEnd(FCEU_IQEXT);
+ break;
+ }
+ Sync();
+}
+
+static void M222Power(void)
+{
+ setprg16(0xC000,~0);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xFFFF,M222Write);
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+void Mapper222_Init(CartInfo *info)
+{
+ info->Power=M222Power;
+ GameHBIRQHook=M222IRQ;
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
--- /dev/null
+/* 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
+ */
+
+#include "mapinc.h"
+
+static uint16 cmdreg;
+static SFORMAT StateRegs[]=
+{
+ {&cmdreg, 2, "CMDREG"},
+ {0}
+};
+
+static void Sync(void)
+{
+ if(cmdreg&0x400)
+ setmirror(MI_0);
+ else
+ setmirror(((cmdreg>>13)&1)^1);
+ if(cmdreg&0x800)
+ {
+ setprg16(0x8000,((cmdreg&0x300)>>3)|((cmdreg&0x1F)<<1)|((cmdreg>>12)&1));
+ setprg16(0xC000,((cmdreg&0x300)>>3)|((cmdreg&0x1F)<<1)|((cmdreg>>12)&1));
+ }
+ else
+ setprg32(0x8000,((cmdreg&0x300)>>4)|(cmdreg&0x1F));
+}
+
+static DECLFW(M235Write)
+{
+ cmdreg=A;
+ Sync();
+}
+
+static void M235Power(void)
+{
+ setchr8(0);
+ SetWriteHandler(0x8000,0xFFFF,M235Write);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ cmdreg=0;
+ Sync();
+}
+
+static void M235Restore(int version)
+{
+ Sync();
+}
+
+void Mapper235_Init(CartInfo *info)
+{
+ info->Power=M235Power;
+ GameStateRestore=M235Restore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
--- /dev/null
+/* 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
+ *
+ */
+
+#include "mapinc.h"
+
+static uint8 prg_reg;
+static uint8 chr_reg;
+static uint8 hrd_flag;
+
+static SFORMAT StateRegs[]=
+{
+ {&prg_reg, 1, "PRG"},
+ {&chr_reg, 1, "CHR"},
+ {0}
+};
+
+static void Sync(void)
+{
+ if(prg_reg&0x80)
+ setprg32(0x8000,prg_reg>>6);
+ else
+ {
+ setprg16(0x8000,(prg_reg>>5)&3);
+ setprg16(0xC000,(prg_reg>>5)&3);
+ }
+ setmirror((prg_reg&8)>>3);
+ setchr8((chr_reg&3)|(prg_reg&7)|((prg_reg&0x10)>>1));
+}
+
+static DECLFR(M57Read)
+{
+ return hrd_flag;
+}
+
+static DECLFW(M57Write)
+{
+ if((A&0x8800)==0x8800)
+ prg_reg=V;
+ else
+ chr_reg=V;
+ Sync();
+}
+
+static void M57Power(void)
+{
+ prg_reg=0;
+ chr_reg=0;
+ hrd_flag=0;
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xFFFF,M57Write);
+ SetReadHandler(0x6000,0x6000,M57Read);
+ Sync();
+}
+
+static void M57Reset()
+{
+ if(hrd_flag==3)
+ hrd_flag=0;
+ else
+ hrd_flag++;
+ FCEU_printf("Select Register = %02x\n",hrd_flag);
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+void Mapper57_Init(CartInfo *info)
+{
+ info->Power=M57Power;
+ info->Reset=M57Reset;
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 2005 CaH4e3\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-#include "mapinc.h"\r
-\r
-static uint16 cmdreg;\r
-static SFORMAT StateRegs[]=\r
-{\r
- {&cmdreg, 2, "CMDREG"},\r
- {0}\r
-};\r
-\r
-static void Sync(void)\r
-{\r
- setprg16r((cmdreg&0x060)>>5,0x8000,(cmdreg&0x01C)>>2);\r
- setprg16r((cmdreg&0x060)>>5,0xC000,(cmdreg&0x200)?(~0):0);\r
- setmirror(((cmdreg&2)>>1)^1);\r
-}\r
-\r
-static DECLFR(UNL8157Read)\r
-{\r
- if(cmdreg&0x100)\r
- return 0xFF;\r
- else\r
- return CartBR(A);\r
-}\r
-\r
-static DECLFW(UNL8157Write)\r
-{\r
- cmdreg=A;\r
- Sync();\r
-}\r
-\r
-static void UNL8157Power(void)\r
-{\r
- setchr8(0);\r
- SetWriteHandler(0x8000,0xFFFF,UNL8157Write);\r
- SetReadHandler(0x8000,0xFFFF,UNL8157Read);\r
- cmdreg=0;\r
- Sync();\r
-}\r
-\r
-static void UNL8157Reset(void)\r
-{\r
- cmdreg=0;\r
- Sync();\r
-}\r
-\r
-static void UNL8157Restore(int version)\r
-{\r
- Sync();\r
-}\r
-\r
-void UNL8157_Init(CartInfo *info)\r
-{\r
- info->Power=UNL8157Power;\r
- info->Reset=UNL8157Reset;\r
- GameStateRestore=UNL8157Restore;\r
- AddExState(&StateRegs, ~0, 0, 0);\r
-}\r
+/* 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
+ */
+
+#include "mapinc.h"
+
+static uint16 cmdreg;
+static uint8 invalid_data;
+static SFORMAT StateRegs[]=
+{
+ {&cmdreg, 2, "CMDREG"},
+ {0}
+};
+
+static void Sync(void)
+{
+ setprg16r((cmdreg&0x060)>>5,0x8000,(cmdreg&0x01C)>>2);
+ setprg16r((cmdreg&0x060)>>5,0xC000,(cmdreg&0x200)?(~0):0);
+ setmirror(((cmdreg&2)>>1)^1);
+}
+
+static DECLFR(UNL8157Read)
+{
+ if(invalid_data&&cmdreg&0x100)
+ return 0xFF;
+ else
+ return CartBR(A);
+}
+
+static DECLFW(UNL8157Write)
+{
+ cmdreg=A;
+ Sync();
+}
+
+static void UNL8157Power(void)
+{
+ setchr8(0);
+ SetWriteHandler(0x8000,0xFFFF,UNL8157Write);
+ SetReadHandler(0x8000,0xFFFF,UNL8157Read);
+ cmdreg=0x200;
+ invalid_data=1;
+ Sync();
+}
+
+static void UNL8157Reset(void)
+{
+ cmdreg=0;
+ invalid_data^=1;
+ Sync();
+}
+
+static void UNL8157Restore(int version)
+{
+ Sync();
+}
+
+void UNL8157_Init(CartInfo *info)
+{
+ info->Power=UNL8157Power;
+ info->Reset=UNL8157Reset;
+ GameStateRestore=UNL8157Restore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
--- /dev/null
+/* 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
+ */
+
+#include "mapinc.h"
+
+static uint8 reg[8];
+static uint8 mirror, cmd, is154;
+
+static SFORMAT StateRegs[]=
+{
+ {&cmd, 1, "CMD"},
+ {&mirror, 1, "MIRR"},
+ {reg, 8, "REGS"},
+ {0}
+};
+
+static void Sync(void)
+{
+ setchr2(0x0000,reg[0]>>1);
+ setchr2(0x0800,reg[1]>>1);
+ setchr1(0x1000,reg[2]|0x40);
+ setchr1(0x1400,reg[3]|0x40);
+ setchr1(0x1800,reg[4]|0x40);
+ setchr1(0x1C00,reg[5]|0x40);
+ setprg8(0x8000,reg[6]);
+ setprg8(0xA000,reg[7]);
+}
+
+static void MSync(void)
+{
+ if(is154)setmirror(MI_0+(mirror&1));
+}
+
+static DECLFW(M88Write)
+{
+ switch(A&0x8001)
+ {
+ case 0x8000: cmd=V&7; mirror=V>>6; MSync(); break;
+ case 0x8001: reg[cmd]=V; Sync(); break;
+ }
+}
+
+static void M88Power(void)
+{
+ setprg16(0xC000,~0);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xFFFF,M88Write);
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+ MSync();
+}
+
+void Mapper88_Init(CartInfo *info)
+{
+ is154=0;
+ info->Power=M88Power;
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
+
+void Mapper154_Init(CartInfo *info)
+{
+ is154=1;
+ info->Power=M88Power;
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
+ * 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
*/
#include "mapinc.h"
+//#define DEBUG90
static int is209;
+static int is211;
static uint8 IRQMode; // from $c001
static uint8 IRQPre; // from $c004
{0}
};
-static DECLFR(M90Read)
-{
- switch(A)
- {
- case 0x5800: return (mul[0]*mul[1]);
- case 0x5801: return((mul[0]*mul[1])>>8);
- case 0x5803: return (regie);
- default: return(tekker);
- }
-}
-
static void mira(void)
{
- if(tkcom[0]&0x20 && is209)
+ if((tkcom[0]&0x20&&is209)||is211)
{
int x;
if(tkcom[0]&0x40) // Name tables are ROM-only
{
for(x=0;x<4;x++)
{
- if((tkcom[2]&0x80)==(names[x]&0x80)) // RAM selected.
+ if((tkcom[1]&0x80)==(names[x]&0x80)) // RAM selected.
setntamem(NTARAM+((names[x]&0x1)<<10),1,x);
else
setntamem(CHRptr[0]+(((names[x])&CHRmask1[0])<<10),0,x);
static void tekprom(void)
{
uint32 bankmode=((tkcom[3]&6)<<5);
- switch(tkcom[0]&3)
+ switch(tkcom[0]&7)
{
- case 1: // 16 KB
- setprg16(0x8000,(prgb[0]&0x1F)|((tkcom[3]&6)<<4));
- setprg16(0xC000,(prgb[2]&0x1F)|((tkcom[3]&6)<<4));
- break;
- case 2: //2 = 8 KB ??
- if(tkcom[0]&0x4)
- {
- setprg8(0x8000,(prgb[0]&0x3F)|bankmode);
- setprg8(0xa000,(prgb[1]&0x3F)|bankmode);
- setprg8(0xc000,(prgb[2]&0x3F)|bankmode);
- setprg8(0xe000,(prgb[3]&0x3F)|bankmode);
- }
- else
- {
- if(tkcom[0]&0x80)
- setprg8(0x6000,(prgb[3]&0x3F)|bankmode);
- setprg8(0x8000,(prgb[0]&0x3F)|bankmode);
- setprg8(0xa000,(prgb[1]&0x3F)|bankmode);
- setprg8(0xc000,(prgb[2]&0x3F)|bankmode);
- setprg8(0xe000,((~0)&0x3F)|bankmode);
- }
- break;
- case 0:
- case 3:
- setprg8(0x8000,(prgb[0]&0x3F)|bankmode);
- setprg8(0xa000,(prgb[1]&0x3F)|bankmode);
- setprg8(0xc000,(prgb[2]&0x3F)|bankmode);
- setprg8(0xe000,(prgb[3]&0x3F)|bankmode);
- break;
+ case 00: if(tkcom[0]&0x80)
+ setprg8(0x6000,(((prgb[3]<<2)+3)&0x3F)|bankmode);
+ setprg32(0x8000,0x0F|((tkcom[3]&6)<<3));
+ break;
+ case 01: if(tkcom[0]&0x80)
+ setprg8(0x6000,(((prgb[3]<<1)+1)&0x3F)|bankmode);
+ setprg16(0x8000,(prgb[1]&0x1F)|((tkcom[3]&6)<<4));
+ setprg16(0xC000,0x1F|((tkcom[3]&6)<<4));
+ break;
+ case 03: // bit reversion
+ case 02: if(tkcom[0]&0x80)
+ setprg8(0x6000,(prgb[3]&0x3F)|bankmode);
+ setprg8(0x8000,(prgb[0]&0x3F)|bankmode);
+ setprg8(0xa000,(prgb[1]&0x3F)|bankmode);
+ setprg8(0xc000,(prgb[2]&0x3F)|bankmode);
+ setprg8(0xe000,0x3F|bankmode);
+ break;
+ case 04: if(tkcom[0]&0x80)
+ setprg8(0x6000,(((prgb[3]<<2)+3)&0x3F)|bankmode);
+ setprg32(0x8000,(prgb[3]&0x0F)|((tkcom[3]&6)<<3));
+ break;
+ case 05: if(tkcom[0]&0x80)
+ setprg8(0x6000,(((prgb[3]<<1)+1)&0x3F)|bankmode);
+ setprg16(0x8000,(prgb[1]&0x1F)|((tkcom[3]&6)<<4));
+ setprg16(0xC000,(prgb[3]&0x1F)|((tkcom[3]&6)<<4));
+ break;
+ case 07: // bit reversion
+ case 06: if(tkcom[0]&0x80)
+ setprg8(0x6000,(prgb[3]&0x3F)|bankmode);
+ setprg8(0x8000,(prgb[0]&0x3F)|bankmode);
+ setprg8(0xa000,(prgb[1]&0x3F)|bankmode);
+ setprg8(0xc000,(prgb[2]&0x3F)|bankmode);
+ setprg8(0xe000,(prgb[3]&0x3F)|bankmode);
+ break;
}
}
}
}
-static DECLFW(M90Write)
+static DECLFW(M90TekWrite)
{
- if(A==0x5800) mul[0]=V;
- else if(A==0x5801) mul[1]=V;
- else if(A==0x5803) regie=V;
-
- A&=0xF007;
- if(A>=0x8000 && A<=0x8003)
+ switch(A)
{
- prgb[A&3]=V;
- tekprom();
+ case 0x5800: mul[0]=V; break;
+ case 0x5801: mul[1]=V; break;
+ case 0x5803: regie=V; break;
}
- else if(A>=0x9000 && A<=0x9007)
+}
+
+static DECLFR(M90TekRead)
+{
+ switch(A)
{
- chrlow[A&7]=V;
- tekvrom();
+ case 0x5800: return (mul[0]*mul[1]);
+ case 0x5801: return((mul[0]*mul[1])>>8);
+ case 0x5803: return (regie);
}
- else if(A>=0xa000 && A<=0xa007)
+ return(tekker);
+}
+
+static DECLFW(M90PRGWrite)
+{
+ prgb[A&3]=V;
+ tekprom();
+}
+
+static DECLFW(M90CHRlowWrite)
+{
+ chrlow[A&7]=V;
+ tekvrom();
+}
+
+static DECLFW(M90CHRhiWrite)
+{
+ chrhigh[A&7]=V;
+ tekvrom();
+}
+
+static DECLFW(M90NTWrite)
+{
+ if(A&4)
{
- chrhigh[A&7]=V;
- tekvrom();
+ names[A&3]&=0x00FF;
+ names[A&3]|=V<<8;
}
- else if(A>=0xb000 && A<=0xb007)
+ else
{
- if(A&4)
- {
- names[A&3]&=0x00FF;
- names[A&3]|=V<<8;
- }
- else
- {
- names[A&3]&=0xFF00;
- names[A&3]|=V;
- }
- mira();
+ names[A&3]&=0xFF00;
+ names[A&3]|=V;
}
- else if(A>=0xd000 && A<=0xdfff)
+ mira();
+}
+
+static DECLFW(M90IRQWrite)
+{
+ switch(A&7)
{
+ case 00: //FCEU_printf("%s IRQ (C000)\n",V&1?"Enable":"Disable");
+ IRQa=V&1;if(!(V&1)) X6502_IRQEnd(FCEU_IQEXT);break;
+ case 02: //FCEU_printf("Disable IRQ (C002) scanline=%d\n", scanline);
+ IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
+ case 03: //FCEU_printf("Enable IRQ (C003) scanline=%d\n", scanline);
+ IRQa=1;break;
+ case 01: IRQMode=V;
+/* FCEU_printf("IRQ Count method: ");
+ switch (IRQMode&3)
+ {
+ case 00: FCEU_printf("M2 cycles\n");break;
+ case 01: FCEU_printf("PPU A12 toggles\n");break;
+ case 02: FCEU_printf("PPU reads\n");break;
+ case 03: FCEU_printf("Writes to CPU space\n");break;
+ }
+ FCEU_printf("Counter prescaler size: %s\n",(IRQMode&4)?"3 bits":"8 bits");
+ FCEU_printf("Counter prescaler size adjust: %s\n",(IRQMode&8)?"Used C007":"Normal Operation");
+ if((IRQMode>>6)==2) FCEU_printf("Counter Down\n");
+ else if((IRQMode>>6)==1) FCEU_printf("Counter Up\n");
+ else FCEU_printf("Counter Stopped\n");
+*/ break;
+ case 04: //FCEU_printf("Pre Counter Loaded and Xored wiht C006: %d\n",V^IRQXOR);
+ IRQPre=V^IRQXOR;break;
+ case 05: //FCEU_printf("Main Counter Loaded and Xored wiht C006: %d\n",V^IRQXOR);
+ IRQCount=V^IRQXOR;break;
+ case 06: //FCEU_printf("Xor Value: %d\n",V);
+ IRQXOR=V;break;
+ case 07: //if(!(IRQMode&8)) FCEU_printf("C001 is clear, no effect applied\n");
+ // else if(V==0xFF) FCEU_printf("Prescaler is changed for 12bits\n");
+ // else FCEU_printf("Counter Stopped\n");
+ IRQPreSize=V;break;
+ }
+}
+
+static DECLFW(M90ModeWrite)
+{
tkcom[A&3]=V;
tekprom();
tekvrom();
mira();
-/*
+
+#ifdef DEBUG90
switch (A&3)
{
case 00: FCEU_printf("Main Control Register:\n");
case 01: FCEU_printf("Mirroring mode: ");
switch (V&3)
{
- case 00: FCEU_printf("Vertical\n");break;
- case 01: FCEU_printf("Horizontal\n");break;
- case 02: FCEU_printf("Nametable 0 only\n");break;
- case 03: FCEU_printf("Nametable 1 only\n");break;
+ case 0: FCEU_printf("Vertical\n");break;
+ case 1: FCEU_printf("Horizontal\n");break;
+ case 2: FCEU_printf("Nametable 0 only\n");break;
+ case 3: FCEU_printf("Nametable 1 only\n");break;
}
FCEU_printf("Mirroring flag: %s\n",(V&0x80)?"On":"Off");
break;
FCEU_printf("512K PRG bank number: %d\n",(V&6)>>1);
FCEU_printf("CHR Bank mirroring: %s\n",(V&0x80)?"Swapped":"Normal operate");
}
-*/
- }
- else switch(A)
- {
- case 0xc000: //FCEU_printf("%s IRQ (C000)\n",V&1?"Enable":"Disable");
- IRQa=V&1;if(!(V&1)) X6502_IRQEnd(FCEU_IQEXT);break;
- case 0xc002: //FCEU_printf("Disable IRQ (C002) scanline=%d\n", scanline);
- IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
- case 0xc003: //FCEU_printf("Enable IRQ (C003) scanline=%d\n", scanline);
- IRQa=1;break;
- case 0xc001: IRQMode=V;
-/* FCEU_printf("IRQ Count method: ");
- switch (IRQMode&3)
- {
- case 00: FCEU_printf("M2 cycles\n");break;
- case 01: FCEU_printf("PPU A12 toggles\n");break;
- case 02: FCEU_printf("PPU reads\n");break;
- case 03: FCEU_printf("Writes to CPU space\n");break;
- }
- FCEU_printf("Counter prescaler size: %s\n",(IRQMode&4)?"3 bits":"8 bits");
- FCEU_printf("Counter prescaler size adjust: %s\n",(IRQMode&8)?"Used C007":"Normal Operation");
- if((IRQMode>>6)==2) FCEU_printf("Counter Down\n");
- else if((IRQMode>>6)==1) FCEU_printf("Counter Up\n");
- else FCEU_printf("Counter Stopped\n");
-*/ break;
- case 0xc004: //FCEU_printf("Pre Counter Loaded and Xored wiht C006: %d\n",V^IRQXOR);
- IRQPre=V^IRQXOR;break;
- case 0xc005: //FCEU_printf("Main Counter Loaded and Xored wiht C006: %d\n",V^IRQXOR);
- IRQCount=V^IRQXOR;break;
- case 0xc006: //FCEU_printf("Xor Value: %d\n",V);
- IRQXOR=V;break;
- case 0xc007: //if(!(IRQMode&8)) FCEU_printf("C001 is clear, no effect applied\n");
- // else if(V==0xFF) FCEU_printf("Prescaler is changed for 12bits\n");
- // else FCEU_printf("Counter Stopped\n");
- IRQPreSize=V;break;
- }
+#endif
}
static void CCL(void)
{
IRQCount++;
if((IRQCount == 0) && IRQa)
+ {
X6502_IRQBegin(FCEU_IQEXT);
+ }
}
else if((IRQMode>>6) == 2) // Count down
{
IRQCount--;
if((IRQCount == 0xFF) && IRQa)
+ {
X6502_IRQBegin(FCEU_IQEXT);
+ }
}
}
}
}
+void FP_FASTAPASS(1) CPUWrap(int a)
+{
+ int x;
+ if((IRQMode&3)==0) for(x=0;x<a;x++) ClockCounter();
+}
+
static void SLWrap(void)
{
int x;
- if((IRQMode&3)!=2) for(x=0;x<8;x++) ClockCounter();
+ if((IRQMode&3)==1) for(x=0;x<8;x++) ClockCounter();
}
static uint32 lastread;
static void FP_FASTAPASS(1) M90PPU(uint32 A)
{
- if(lastread!=A)
+ if((IRQMode&3)==2)
{
- lastread=A;
- if((IRQMode&3)==2)
+ if(lastread!=A)
{
ClockCounter();
ClockCounter();
}
+ lastread=A;
}
+// else
+// {
+// if((!lastread)&&(A&0x1000))
+// ClockCounter();
+// lastread=A&0x1000;
+// }
+
}
static void togglie()
tekker++;
tekker<<=6;
FCEU_printf("tekker=%04x\n",tekker);
- memset(tkcom,0xff,sizeof(tkcom));
+ memset(tkcom,0x00,sizeof(tkcom));
memset(prgb,0xff,sizeof(prgb));
tekprom();
tekvrom();
static void M90Power(void)
{
- SetWriteHandler(0x5000,0xffff,M90Write);
- SetReadHandler(0x5000,0x5fff,M90Read);
+ SetWriteHandler(0x5000,0x5fff,M90TekWrite);
+ SetWriteHandler(0x8000,0x8fff,M90PRGWrite);
+ SetWriteHandler(0x9000,0x9fff,M90CHRlowWrite);
+ SetWriteHandler(0xA000,0xAfff,M90CHRhiWrite);
+ SetWriteHandler(0xB000,0xBfff,M90NTWrite);
+ SetWriteHandler(0xC000,0xCfff,M90IRQWrite);
+ SetWriteHandler(0xD000,0xDfff,M90ModeWrite);
+
+ SetReadHandler(0x5000,0x5fff,M90TekRead);
SetReadHandler(0x6000,0xffff,CartBR);
mul[0]=mul[1]=regie=0xFF;
- memset(tkcom,0xff,sizeof(tkcom));
+ memset(tkcom,0x00,sizeof(tkcom));
memset(prgb,0xff,sizeof(prgb));
memset(chrlow,0xff,sizeof(chrlow));
memset(chrhigh,0xff,sizeof(chrhigh));
memset(names,0x00,sizeof(names));
- tekker=0;
+ if(is211)
+ tekker=0xC0;
+ else
+ tekker=0x00;
tekprom();
tekvrom();
void Mapper90_Init(CartInfo *info)
{
+ is211=0;
is209=0;
info->Reset=togglie;
info->Power=M90Power;
- PPU_hook = M90PPU;
- GameHBIRQHook2 = SLWrap;
+ PPU_hook=M90PPU;
+ GameHBIRQHook2=SLWrap;
+ MapIRQHook=CPUWrap;
GameStateRestore=M90Restore;
AddExState(Tek_StateRegs, ~0, 0, 0);
}
void Mapper209_Init(CartInfo *info)
{
+ is211=0;
is209=1;
info->Reset=togglie;
info->Power=M90Power;
- PPU_hook = M90PPU;
- GameHBIRQHook2 = SLWrap;
+ GameHBIRQHook2=SLWrap;
+ GameStateRestore=M90Restore;
+ AddExState(Tek_StateRegs, ~0, 0, 0);
+}
+
+void Mapper211_Init(CartInfo *info)
+{
+ is211=1;
+ info->Reset=togglie;
+ info->Power=M90Power;
+ GameHBIRQHook2=SLWrap;
GameStateRestore=M90Restore;
AddExState(Tek_StateRegs, ~0, 0, 0);
}
--- /dev/null
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ * Copyright (C) 2002 Xodnizel
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "mapinc.h"
+
+static uint8 lastA;
+static uint8 DRegs[8];
+static uint8 cmd;
+static uint8 MirCache[8];
+
+static SFORMAT DB_StateRegs[]={
+ {DRegs, 8, "DREG"},
+ {&cmd, 1, "CMD"},
+ {&lastA, 1, "LAST"},
+ {0}
+};
+
+static void toot(void)
+{
+ int x;
+
+ MirCache[0]=MirCache[1]=(DRegs[0]>>4)&1;
+ MirCache[2]=MirCache[3]=(DRegs[1]>>4)&1;
+
+ for(x=0;x<4;x++)
+ MirCache[4+x]=(DRegs[2+x]>>5)&1;
+ onemir(MirCache[lastA]);
+}
+
+static void Sync()
+{
+ setchr2(0x0000,DRegs[0]&0x1F);
+ setchr2(0x0800,DRegs[1]&0x1F);
+ setchr1(0x1000,DRegs[2]&0x1F);
+ setchr1(0x1400,DRegs[3]&0x1F);
+ setchr1(0x1800,DRegs[4]&0x1F);
+ setchr1(0x1C00,DRegs[5]&0x1F);
+ setprg8(0x8000,DRegs[6]&0x1F);
+ setprg8(0xa000,DRegs[7]&0x1F);
+ toot();
+}
+
+static DECLFW(Mapper95_write)
+{
+ switch(A&0xF001)
+ {
+ case 0x8000: cmd = V; break;
+ case 0x8001:
+ switch(cmd&0x07)
+ {
+ case 0: DRegs[0]=(V&0x3F)>>1; break;
+ case 1: DRegs[1]=(V&0x3F)>>1; break;
+ case 2: DRegs[2]=V&0x3F; break;
+ case 3: DRegs[3]=V&0x3F; break;
+ case 4: DRegs[4]=V&0x3F; break;
+ case 5: DRegs[5]=V&0x3F; break;
+ case 6: DRegs[6]=V&0x3F; break;
+ case 7: DRegs[7]=V&0x3F; break;
+ }
+ Sync();
+ }
+}
+
+static void FP_FASTAPASS(1) dragonbust_ppu(uint32 A)
+{
+ static int last=-1;
+ static uint8 z;
+
+ if(A>=0x2000) return;
+
+ A>>=10;
+ lastA=A;
+ z=MirCache[A];
+ if(z!=last)
+ {
+ onemir(z);
+ last=z;
+ }
+}
+
+static void DBPower(void)
+{
+ memset(DRegs,0x3F,8);
+ DRegs[0]=DRegs[1]=0x1F;
+
+ Sync();
+
+ setprg8(0xc000,0x3E);
+ setprg8(0xe000,0x3F);
+
+ SetReadHandler(0x8000,0xffff,CartBR);
+ SetWriteHandler(0x8000,0xffff,Mapper95_write);
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+void Mapper95_Init(CartInfo *info)
+{
+ info->Power=DBPower;
+ AddExState(DB_StateRegs, ~0, 0, 0);
+ PPU_hook=dragonbust_ppu;
+ GameStateRestore=StateRestore;
+}
+
-MUOBJS += boards/mmc5.o boards/mmc3.o boards/mmc1.o boards/tengen.o boards/bonza.o boards/deirom.o
-MUOBJS += boards/dream.o boards/konami-qtai.o boards/n106.o boards/karaoke.o boards/90.o boards/112.o
-MUOBJS += boards/164.o boards/183.o boards/186.o boards/8237.o boards/8157.o boards/addrlatch.o
-MUOBJS += boards/datalatch.o boards/h2288.o boards/malee.o boards/novel.o boards/sachen.o
-MUOBJS += boards/subor.o boards/super24.o boards/supervision.o
+B_C += boards/112.c
+B_C += boards/117.c
+B_C += boards/164.c
+B_C += boards/183.c
+B_C += boards/185.c
+B_C += boards/186.c
+B_C += boards/187.c
+B_C += boards/189.c
+B_C += boards/208.c
+B_C += boards/222.c
+B_C += boards/235.c
+B_C += boards/57.c
+B_C += boards/8157.c
+B_C += boards/8237.c
+B_C += boards/88.c
+B_C += boards/90.c
+B_C += boards/95.c
+B_C += boards/bmc13in1jy110.c
+B_C += boards/bmc42in1r.c
+B_C += boards/bmc64in1nr.c
+B_C += boards/bmc70in1.c
+B_C += boards/bmcgk192.c
+B_C += boards/bonza.c
+B_C += boards/cc21.c
+B_C += boards/datalatch.c
+B_C += boards/deirom.c
+B_C += boards/dream.c
+B_C += boards/fk23c.c
+B_C += boards/h2288.c
+B_C += boards/karaoke.c
+B_C += boards/kof97.c
+B_C += boards/konami-qtai.c
+B_C += boards/malee.c
+B_C += boards/mmc1.c
+B_C += boards/mmc3.c
+B_C += boards/mmc5.c
+B_C += boards/n106.c
+B_C += boards/novel.c
+B_C += boards/sachen.c
+B_C += boards/sheroes.c
+B_C += boards/sl1632.c
+B_C += boards/sonic5.c
+B_C += boards/subor.c
+B_C += boards/super24.c
+B_C += boards/supervision.c
+B_C += boards/t-262.c
+B_C += boards/tengen.c
+B_C += boards/__dummy_mapper.c
+
+MUOBJS += $(patsubst %.c,%.o,$(B_C))
--- /dev/null
+/* 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 reg[8];
+/*
+static uint8 *WRAM=NULL;
+static uint32 WRAMSIZE;
+static uint8 *CHRRAM=NULL;
+static uint32 CHRRAMSIZE;
+*/
+
+static SFORMAT StateRegs[]=
+{
+ {reg, 8, "REGS"},
+ {0}
+};
+
+static void Sync(void)
+{
+}
+
+static DECLFW(MNNNWrite)
+{
+}
+
+static void MNNNPower(void)
+{
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xFFFF,MNNNWrite);
+}
+
+static void MNNNReset(void)
+{
+}
+
+/*
+static void MNNNClose(void)
+{
+ if(WRAM)
+ FCEU_gfree(WRAM);
+ if(CHRRAM)
+ FCEU_gfree(CHRRAM);
+ WRAM=CHRRAM=NULL;
+}
+*/
+
+static void MNNNIRQHook(void)
+{
+ X6502_IRQBegin(FCEU_IQEXT);
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+void MapperNNN_Init(CartInfo *info)
+{
+ info->Reset=MNNNReset;
+ info->Power=MNNNPower;
+// info->Close=MNNNClose;
+ GameHBIRQHook=MNNNIRQHook;
+ GameStateRestore=StateRestore;
+/*
+ CHRRAMSIZE=8192;
+ CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE);
+ SetupCartPRGMapping(0x10,CHRRAM,CHRRAMSIZE,1);
+ AddExState(CHRRAM, CHRRAMSIZE, 0, "WRAM");
+*/
+/*
+ WRAMSIZE=8192;
+ WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
+ SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
+ AddExState(WRAM, WRAMSIZE, 0, "WRAM");
+*/
+ AddExState(&StateRegs, ~0, 0, 0);
+}
+
--- /dev/null
+/* 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
+ *
+ * BMC 42-in-1 reset switch
+ */
+
+#include "mapinc.h"
+
+static uint8 bank_mode;
+static uint8 bank_value;
+static uint8 prgb[4];
+static SFORMAT StateRegs[]=
+{
+ {0}
+};
+
+static void Sync(void)
+{
+ FCEU_printf("%02x: %02x %02x\n", bank_mode, bank_value, prgb[0]);
+ switch(bank_mode&7)
+ {
+ case 0:
+ setprg32(0x8000,bank_value&7); break;
+ case 1:
+ setprg16(0x8000,((8+(bank_value&7))>>1)+prgb[1]);
+ setprg16(0xC000,(bank_value&7)>>1);
+ case 4:
+ setprg32(0x8000,8+(bank_value&7)); break;
+ case 5:
+ setprg16(0x8000,((8+(bank_value&7))>>1)+prgb[1]);
+ setprg16(0xC000,((8+(bank_value&7))>>1)+prgb[3]);
+ case 2:
+ setprg8(0x8000,prgb[0]>>2);
+ setprg8(0xa000,prgb[1]);
+ setprg8(0xc000,prgb[2]);
+ setprg8(0xe000,~0);
+ break;
+ case 3:
+ setprg8(0x8000,prgb[0]);
+ setprg8(0xa000,prgb[1]);
+ setprg8(0xc000,prgb[2]);
+ setprg8(0xe000,prgb[3]);
+ break;
+ }
+}
+
+static DECLFW(BMC13in1JY110Write)
+{
+ FCEU_printf("%04x:%04x\n",A,V);
+ switch(A)
+ {
+ case 0x8000:
+ case 0x8001:
+ case 0x8002:
+ case 0x8003: prgb[A&3]=V; break;
+ case 0xD000: bank_mode=V; break;
+ case 0xD001: setmirror(V&3);
+ case 0xD002: break;
+ case 0xD003: bank_value=V; break;
+ }
+ Sync();
+}
+
+static void BMC13in1JY110Power(void)
+{
+ prgb[0]=prgb[1]=prgb[2]=prgb[3]=0;
+ bank_mode=0;
+ bank_value=0;
+ setprg32(0x8000,0);
+ setchr8(0);
+ SetWriteHandler(0x8000,0xFFFF,BMC13in1JY110Write);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+void BMC13in1JY110_Init(CartInfo *info)
+{
+ info->Power=BMC13in1JY110Power;
+ AddExState(&StateRegs, ~0, 0, 0);
+ GameStateRestore=StateRestore;
+}
+
+
--- /dev/null
+/* 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
+ *
+ * BMC 42-in-1 reset switch
+ */
+
+#include "mapinc.h"
+
+static uint8 hrd_sw;
+static uint8 latche;
+static SFORMAT StateRegs[]=
+{
+ {&latche, 1, "LATCHE"},
+ {&hrd_sw, 1, "HRDSW"},
+ {0}
+};
+
+static void Sync(void)
+{
+ if(!(latche&0x20))
+ setprg32r(hrd_sw,0x8000,(latche>>1)&0x0f);
+ else
+ {
+ setprg16r(hrd_sw,0x8000,latche&0x1f);
+ setprg16r(hrd_sw,0xC000,latche&0x1f);
+ }
+ switch((latche>>6)&3)
+ {
+ case 0: setmirrorw(0,0,0,1); break;
+ case 1: setmirror(MI_V); break;
+ case 2: setmirror(MI_H); break;
+ case 3: setmirror(MI_1); break;
+ }
+}
+
+static DECLFW(BMC42in1rWrite)
+{
+ latche=V;
+ Sync();
+}
+
+static void BMC42in1rReset(void)
+{
+ hrd_sw^=1;
+ Sync();
+}
+
+static void BMC42in1rPower(void)
+{
+ latche=0x00;
+ hrd_sw=0;
+ setchr8(0);
+ Sync();
+ SetWriteHandler(0x8000,0xFFFF,BMC42in1rWrite);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+void BMC42in1r_Init(CartInfo *info)
+{
+ info->Power=BMC42in1rPower;
+ info->Reset=BMC42in1rReset;
+ AddExState(&StateRegs, ~0, 0, 0);
+ GameStateRestore=StateRestore;
+}
+
+
--- /dev/null
+/* 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
+ *
+ * BMC 42-in-1 reset switch
+ */
+
+#include "mapinc.h"
+
+static uint8 regs[4];
+
+static SFORMAT StateRegs[]=
+{
+ {regs, 4, "REGS"},
+ {0}
+};
+
+static void Sync(void)
+{
+ if(regs[0]&0x80)
+ {
+ if(regs[1]&0x80)
+ setprg32(0x8000,regs[1]&0x1F);
+ else
+ {
+ int bank=((regs[1]&0x1f)<<1)|((regs[1]>>6)&1);
+ setprg16(0x8000,bank);
+ setprg16(0xC000,bank);
+ }
+ }
+ else
+ {
+ int bank=((regs[1]&0x1f)<<1)|((regs[1]>>6)&1);
+ setprg16(0xC000,bank);
+ }
+ if(regs[0]&0x20)
+ setmirror(MI_H);
+ else
+ setmirror(MI_V);
+ setchr8((regs[2]<<2)|((regs[0]>>1)&3));
+}
+
+static DECLFW(BMC64in1nrWriteLo)
+{
+ regs[A&3]=V;
+ Sync();
+}
+
+static DECLFW(BMC64in1nrWriteHi)
+{
+ regs[3]=V;
+ Sync();
+}
+
+static void BMC64in1nrPower(void)
+{
+ regs[0]=0x80;
+ regs[1]=0x43;
+ regs[2]=regs[3]=0;
+ Sync();
+ SetWriteHandler(0x5000,0x5003,BMC64in1nrWriteLo);
+ SetWriteHandler(0x8000,0xFFFF,BMC64in1nrWriteHi);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+void BMC64in1nr_Init(CartInfo *info)
+{
+ info->Power=BMC64in1nrPower;
+ AddExState(&StateRegs, ~0, 0, 0);
+ GameStateRestore=StateRestore;
+}
+
+
--- /dev/null
+/* 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
+ */
+
+#include "mapinc.h"
+
+static uint8 is_large_banks;
+static uint8 large_bank;
+static uint8 prg_bank;
+static uint8 chr_bank;
+static uint8 bank_mode;
+static uint8 mirroring;
+static SFORMAT StateRegs[]=
+{
+ {&large_bank, 1, "LB"},
+ {&prg_bank, 1, "PRG"},
+ {&chr_bank, 1, "CHR"},
+ {&bank_mode, 1, "BM"},
+ {&mirroring, 1, "MIRR"},
+ {0}
+};
+
+static void Sync(void)
+{
+ switch (bank_mode)
+ {
+ case 0x00:
+ case 0x10: setprg16(0x8000,large_bank|prg_bank);
+ setprg16(0xC000,large_bank|7);
+ break;
+ case 0x20: setprg32(0x8000,(large_bank|prg_bank)>>1);
+ break;
+ case 0x30: setprg16(0x8000,large_bank|prg_bank);
+ setprg16(0xC000,large_bank|prg_bank);
+ break;
+ }
+ setmirror(mirroring);
+ if(!is_large_banks)
+ setchr8(chr_bank);
+}
+
+static DECLFR(BMC70in1Read)
+{
+ if(bank_mode==0x10)
+ if(is_large_banks)
+ return CartBR((A&0xFFF0)|0x06);
+ else
+ return CartBR((A&0xFFF0)|0x0d);
+ else
+ return CartBR(A);
+}
+
+static DECLFW(BMC70in1Write)
+{
+ if(A&0x4000)
+ {
+ bank_mode=A&0x30;
+ prg_bank=A&7;
+ }
+ else
+ {
+ mirroring=((A&0x20)>>5)^1;
+ if(is_large_banks)
+ large_bank=(A&3)<<3;
+ else
+ chr_bank=A&7;
+ }
+ Sync();
+}
+
+static void BMC70in1Power(void)
+{
+ setchr8(0);
+ bank_mode=0;
+ large_bank=0;
+ Sync();
+ SetReadHandler(0x8000,0xFFFF,BMC70in1Read);
+ SetWriteHandler(0x8000,0xffff,BMC70in1Write);
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+void BMC70in1_Init(CartInfo *info)
+{
+ is_large_banks=0;
+ info->Power=BMC70in1Power;
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
+
+void BMC70in1B_Init(CartInfo *info)
+{
+ is_large_banks=1;
+ info->Power=BMC70in1Power;
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
- * Copyright (C) 2002 Xodnizel
+ * 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
#include "mapinc.h"
-static DECLFW(Mapper235_write)
-{
- uint32 m;
- int z;
+static uint16 addrlatche;
- if(A&0x400)
- onemir(0);
+static void Sync(void)
+{
+ if(addrlatche&0x40)
+ {
+ setprg16(0x8000,addrlatche&7);
+ setprg16(0xC000,addrlatche&7);
+ }
else
- setmirror(((A>>13)&1)^1);
- m=A&0x1f;
+ setprg32(0x8000,(addrlatche>>1)&3);
+ setchr8((addrlatche>>3)&7);
+ setmirror(((addrlatche&0x80)>>7)^1);
+}
- z=(A>>8)&3;
+static DECLFW(BMCGK192Write)
+{
+ addrlatche=A;
+ Sync();
+}
- if(A&0x800)
- {
- setprg16r(0x10|z,0x8000,(m<<1)|((A>>12)&1));
- setprg16r(0x10|z,0xC000,(m<<1)|((A>>12)&1));
+static void BMCGK192Reset(void)
+{
+ setprg32(0x8000,0);
+}
- }
- else
- setprg32r(0x10|z,0x8000,m);
+static void BMCGK192Power(void)
+{
+ setprg32(0x8000,0);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xffff,BMCGK192Write);
+}
+
+static void StateRestore(int version)
+{
+ Sync();
}
-void Mapper235_init(void)
+void Mapper58_Init(CartInfo *info)
{
- /* Fixme: Possible crashy bug if header is bad. */
- SetupCartPRGMapping(0x10,PRGptr[0],1024*1024,0);
- SetupCartPRGMapping(0x12,PRGptr[0]+1024*1024,1024,0);
- setprg32r(0x10,0x8000,0);
- SetReadHandler(0x8000,0xffff,CartBROB);
- SetWriteHandler(0x8000,0xffff,Mapper235_write);
+ info->Power=BMCGK192Power;
+ info->Reset=BMCGK192Reset;
+ GameStateRestore=StateRestore;
+ AddExState(&addrlatche, 2, 0, "ALATC");
}
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 2002 CaH4e3\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-#include "mapinc.h"\r
-\r
-static uint8 prg_reg;\r
-static uint8 chr_reg;\r
-\r
-static uint8 sim0reg, sim0bit, sim0byte, sim0parity, sim0bcnt;\r
-static uint16 sim0data;\r
-static uint8 sim0array[128] =\r
-{\r
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,\r
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,\r
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,\r
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,\r
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,\r
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,\r
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,\r
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xAA,\r
-};\r
-\r
-static SFORMAT StateRegs[]=\r
-{\r
- {&prg_reg, 1, "PREG"},\r
- {&chr_reg, 1, "CREG"},\r
- {0}\r
-};\r
-\r
-static void Sync(void)\r
-{\r
- setprg32(0x8000, prg_reg);\r
- setchr8(chr_reg);\r
-}\r
-\r
-static void StateRestore(int version)\r
-{\r
- Sync();\r
-}\r
-\r
-static DECLFW(M216WriteHi)\r
-{\r
-// FCEU_printf("%04x:%04x\n",A,V);\r
- prg_reg=A&1;\r
- chr_reg=(A&0x0E)>>1;\r
- Sync();\r
-}\r
-\r
-static DECLFW(M216Write5000)\r
-{\r
-// FCEU_printf("WRITE: %04x:%04x\n",A,V);\r
- sim0reg=V;\r
- if(!sim0reg)\r
- {\r
- sim0bit=sim0byte=sim0parity=0;\r
- sim0data=sim0array[0];\r
- sim0bcnt=0x80;\r
- }\r
- else if(sim0reg&0x20)\r
- {\r
- sim0bcnt=0x20;\r
- }\r
-}\r
-\r
-static DECLFR(M216Read5000)\r
-{\r
- if(sim0reg&0x60)\r
- {\r
- sim0reg=(sim0reg^(sim0reg<<1))&0x40;\r
- return sim0reg;\r
- }\r
- else\r
- {\r
- uint8 sim0out=0;\r
- if(sim0bit<8)\r
- {\r
-// sim0data=((sim0array[sim0byte]<<(sim0bit))&0x80)>>1;\r
- sim0out=(sim0data&1)<<6;\r
- sim0data>>=1;\r
- sim0bit++;\r
- sim0parity+=sim0data;\r
- }\r
- else if(sim0bit==8)\r
- {\r
- sim0bit++;\r
- sim0out=sim0parity&1;\r
- }\r
- else if(sim0bit==9)\r
- {\r
- if(sim0byte==sim0bcnt)\r
- sim0out=0x60;\r
- else\r
- {\r
- sim0bit=0;\r
- sim0byte++;\r
- sim0data=sim0array[sim0byte];\r
- sim0out=0;\r
- }\r
- }\r
-// FCEU_printf("READ: %04x (%04x-%02x,%04x)\n",A,X.PC,sim0out,sim0byte);\r
- return sim0out;\r
- }\r
-}\r
-\r
-static void Power(void)\r
-{\r
- prg_reg = 0;\r
- chr_reg = 0;\r
- Sync();\r
- SetReadHandler(0x8000,0xFFFF,CartBR);\r
- SetWriteHandler(0x8000,0xFFFF,M216WriteHi);\r
- SetWriteHandler(0x5000,0x5000,M216Write5000);\r
- SetReadHandler(0x5000,0x5000,M216Read5000);\r
-}\r
-\r
-\r
-void Mapper216_Init(CartInfo *info)\r
-{\r
- info->Power=Power;\r
- GameStateRestore=StateRestore;\r
- AddExState(&StateRegs, ~0, 0, 0);\r
-}\r
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ * Copyright (C) 2002 CaH4e3
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "mapinc.h"
+
+static uint8 prg_reg;
+static uint8 chr_reg;
+
+static uint8 sim0reg, sim0bit, sim0byte, sim0parity, sim0bcnt;
+static uint16 sim0data;
+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, 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, 0xAA,
+};
+
+static SFORMAT StateRegs[]=
+{
+ {&prg_reg, 1, "PREG"},
+ {&chr_reg, 1, "CREG"},
+ {0}
+};
+
+static void Sync(void)
+{
+ setprg32(0x8000, prg_reg);
+ setchr8(chr_reg);
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+static DECLFW(M216WriteHi)
+{
+// FCEU_printf("%04x:%04x\n",A,V);
+ prg_reg=A&1;
+ chr_reg=(A&0x0E)>>1;
+ Sync();
+}
+
+static DECLFW(M216Write5000)
+{
+// FCEU_printf("WRITE: %04x:%04x\n",A,V);
+ sim0reg=V;
+ if(!sim0reg)
+ {
+ sim0bit=sim0byte=sim0parity=0;
+ sim0data=sim0array[0];
+ sim0bcnt=0x80;
+ }
+ else if(sim0reg&0x20)
+ {
+ sim0bcnt=0x20;
+ }
+}
+
+static DECLFR(M216Read5000)
+{
+ if(sim0reg&0x60)
+ {
+ sim0reg=(sim0reg^(sim0reg<<1))&0x40;
+ return sim0reg;
+ }
+ else
+ {
+ uint8 sim0out=0;
+ if(sim0bit<8)
+ {
+// sim0data=((sim0array[sim0byte]<<(sim0bit))&0x80)>>1;
+ sim0out=(sim0data&1)<<6;
+ sim0data>>=1;
+ sim0bit++;
+ sim0parity+=sim0data;
+ }
+ else if(sim0bit==8)
+ {
+ sim0bit++;
+ sim0out=sim0parity&1;
+ }
+ else if(sim0bit==9)
+ {
+ if(sim0byte==sim0bcnt)
+ sim0out=0x60;
+ else
+ {
+ sim0bit=0;
+ sim0byte++;
+ sim0data=sim0array[sim0byte];
+ sim0out=0;
+ }
+ }
+// FCEU_printf("READ: %04x (%04x-%02x,%04x)\n",A,X.PC,sim0out,sim0byte);
+ return sim0out;
+ }
+}
+
+static void Power(void)
+{
+ prg_reg = 0;
+ chr_reg = 0;
+ Sync();
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xFFFF,M216WriteHi);
+ SetWriteHandler(0x5000,0x5000,M216Write5000);
+ SetReadHandler(0x5000,0x5000,M216Read5000);
+}
+
+
+void Mapper216_Init(CartInfo *info)
+{
+ info->Power=Power;
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 2005 CaH4e3\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-#include "mapinc.h"\r
-\r
-static uint16 addrlatche;\r
-\r
-//------------------ UNLCC21 ---------------------------\r
-\r
-static DECLFW(UNLCC21Write)\r
-{\r
- addrlatche=A;\r
- setchr8(addrlatche&1);\r
- setmirror(MI_0+((addrlatche&2)>>1));\r
-}\r
-\r
-static void UNLCC21Power(void)\r
-{\r
- setprg32(0x8000,0);\r
- setchr8(0);\r
- SetReadHandler(0x8000,0xFFFF,CartBR);\r
- SetWriteHandler(0x8000,0xffff,UNLCC21Write);\r
-}\r
-\r
-static void UNLCC21Restore(int version)\r
-{\r
- setchr8(addrlatche&1);\r
- setmirror(MI_0+((addrlatche&2)>>1));\r
-}\r
-\r
-void UNLCC21_Init(CartInfo *info)\r
-{\r
- info->Power=UNLCC21Power;\r
- GameStateRestore=UNLCC21Restore;\r
- AddExState(&addrlatche, 2, 0, "ALATC");\r
-}\r
+/* 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
+ */
+
+#include "mapinc.h"
+
+static uint16 addrlatche;
+
+//------------------ UNLCC21 ---------------------------
+
+static void UNLCC21Sync(void)
+{
+ setchr8(addrlatche&1);
+ setmirror(MI_0+((addrlatche&2)>>1));
+}
+
+static DECLFW(UNLCC21Write)
+{
+ addrlatche=A;
+ UNLCC21Sync();
+}
+
+static void UNLCC21Power(void)
+{
+ setprg32(0x8000,0);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xffff,UNLCC21Write);
+}
+
+static void UNLCC21Restore(int version)
+{
+ UNLCC21Sync();
+}
+
+void UNLCC21_Init(CartInfo *info)
+{
+ info->Power=UNLCC21Power;
+ GameStateRestore=UNLCC21Restore;
+ AddExState(&addrlatche, 2, 0, "ALATC");
+}
#include "mapinc.h"
-static uint8 latche;
+static uint8 latche, latcheinit;
+static uint16 addrreg0, addrreg1;
+static void(*WSync)(void);
-//------------------ CPROM ---------------------------
-
-static DECLFW(CPROMWrite)
+static DECLFW(LatchWrite)
{
- latche=V&3;
- setchr4(0x1000,latche);
+ latche=V;
+ WSync();
}
-static void CPROMReset(void)
+static void LatchPower(void)
{
- setprg32(0x8000,0);
- setchr8(0);
+ latche=latcheinit;
+ WSync();
SetReadHandler(0x8000,0xFFFF,CartBR);
- SetWriteHandler(0x8000,0xffff,CPROMWrite);
+ SetWriteHandler(addrreg0,addrreg1,LatchWrite);
}
-static void CPROMRestore(int version)
+static void StateRestore(int version)
{
- setchr4(0x1000,latche);
+ WSync();
}
-void CPROM_Init(CartInfo *info)
+void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 adr0, uint16 adr1)
{
- info->Power=CPROMReset;
- GameStateRestore=CPROMRestore;
+ latcheinit=init;
+ addrreg0=adr0;
+ addrreg1=adr1;
+ WSync=proc;
+ info->Power=LatchPower;
+ GameStateRestore=StateRestore;
AddExState(&latche, 1, 0, "LATC");
}
-//------------------ CNROM ---------------------------
+//------------------ CPROM ---------------------------
-DECLFW(CNROMWrite)
+static void CPROMSync(void)
{
- latche=V&3;
- setchr8(latche);
+ setchr4(0x0000,0);
+ setchr4(0x1000,latche&3);
+ setprg16(0x8000,0);
+ setprg16(0xC000,1);
}
-static void CNROMReset(void)
+void CPROM_Init(CartInfo *info)
{
- setprg16(0x8000,0);
- setprg16(0xC000,1);
- SetReadHandler(0x8000,0xFFFF,CartBR);
- SetWriteHandler(0x8000,0xffff,CNROMWrite);
+ Latch_Init(info, CPROMSync, 0, 0x8000, 0xFFFF);
}
-static void CNROMRestore(int version)
+//------------------ CNROM ---------------------------
+
+static void CNROMSync(void)
{
- setchr8(latche);
+ setchr8(latche&3);
+ setprg16(0x8000,0);
+ setprg16(0xC000,1);
}
void CNROM_Init(CartInfo *info)
{
- info->Power=CNROMReset;
- GameStateRestore=CNROMRestore;
- AddExState(&latche, 1, 0, "LATC");
+ Latch_Init(info, CNROMSync, 0, 0x8000, 0xFFFF);
}
-//------------------ NROM128 ---------------------------
+//------------------ ANROM ---------------------------
-static void NROM128Reset(void)
+static void ANROMSync()
{
- setprg16(0x8000,0);
- setprg16(0xC000,0);
+ setprg32(0x8000,latche&0xf);
+ setmirror(MI_0+((latche>>4)&1));
setchr8(0);
- SetReadHandler(0x8000,0xFFFF,CartBR);
}
-void NROM128_Init(CartInfo *info)
+void ANROM_Init(CartInfo *info)
{
- info->Power=NROM128Reset;
+ Latch_Init(info, ANROMSync, 0, 0x8000, 0xFFFF);
}
-//------------------ NROM256 ---------------------------
+//------------------ Map 70 ---------------------------
-static void NROM256Reset(void)
+static void M70Sync()
{
- setprg16(0x8000,0);
- setprg16(0xC000,1);
- setchr8(0);
- SetReadHandler(0x8000,0xFFFF,CartBR);
+ setprg16(0x8000,latche>>4);
+ setprg16(0xc000,~0);
+ setchr8(latche&0xf);
}
-void NROM256_Init(CartInfo *info)
+void Mapper70_Init(CartInfo *info)
{
- info->Power=NROM256Reset;
+ Latch_Init(info, M70Sync, 0, 0x8000, 0xFFFF);
}
-//------------------ MHROM ---------------------------
+//------------------ Map 152 ---------------------------
-static DECLFW(MHROMWrite)
+static void M152Sync()
{
- setprg32(0x8000,V>>4);
- setchr8(V);
- latche=V;
+ setprg16(0x8000,(latche>>4)&7);
+ setprg16(0xc000,~0);
+ setchr8(latche&0xf);
+ setmirror(MI_0+((latche>>7)&1)); /* Saint Seiya...hmm. */
}
-static void MHROMReset(void)
+void Mapper152_Init(CartInfo *info)
{
- setprg32(0x8000,0);
- setchr8(0);
- latche=0;
- SetReadHandler(0x8000,0xFFFF,CartBR);
+ Latch_Init(info, M152Sync, 0, 0x8000, 0xFFFF);
}
-static void MHROMRestore(int version)
+//------------------ Map 78 ---------------------------
+/* Should be two separate emulation functions for this "mapper". Sigh. URGE TO KILL RISING. */
+static void M78Sync()
{
- setprg32(0x8000,latche);
- setchr8(latche);
- SetWriteHandler(0x8000,0xffff,MHROMWrite);
+ setprg16(0x8000,(latche&7));
+ setprg16(0xc000,~0);
+ setchr8(latche>>4);
+ setmirror(MI_0+((latche>>3)&1));
+}
+
+void Mapper78_Init(CartInfo *info)
+{
+ Latch_Init(info, M78Sync, 0, 0x8000, 0xFFFF);
+}
+
+//------------------ MHROM ---------------------------
+
+static void MHROMSync(void)
+{
+ setprg32(0x8000,latche>>4);
+ setchr8(latche&0xf);
}
void MHROM_Init(CartInfo *info)
{
- info->Power=MHROMReset;
- AddExState(&latche, 1, 0,"LATC");
- PRGmask32[0]&=1;
- CHRmask8[0]&=1;
- GameStateRestore=MHROMRestore;
+ Latch_Init(info, MHROMSync, 0, 0x8000, 0xFFFF);
+}
+
+void Mapper140_Init(CartInfo *info)
+{
+ Latch_Init(info, MHROMSync, 0, 0x6000, 0x7FFF);
+}
+
+//------------------ Map 87 ---------------------------
+
+static void M87Sync(void)
+{
+ setprg16(0x8000,0);
+ setprg16(0xC000,1);
+ setchr8(latche>>1);
+}
+
+void Mapper87_Init(CartInfo *info)
+{
+ Latch_Init(info, M87Sync, ~0, 0x6000, 0xFFFF);
+}
+
+//------------------ Map 11 ---------------------------
+
+static void M11Sync(void)
+{
+ setprg32(0x8000,latche&0xf);
+ setchr8(latche>>4);
+}
+
+void Mapper11_Init(CartInfo *info)
+{
+ Latch_Init(info, M11Sync, 0, 0x8000, 0xFFFF);
+}
+
+void Mapper144_Init(CartInfo *info)
+{
+ Latch_Init(info, M11Sync, 0, 0x8001, 0xFFFF);
}
//------------------ UNROM ---------------------------
-static void UNROMRestore(int version)
+static void UNROMSync(void)
{
setprg16(0x8000,latche);
+ setprg16(0xc000,~0);
+ setchr8(0);
}
-static DECLFW(UNROMWrite)
+void UNROM_Init(CartInfo *info)
{
- setprg16(0x8000,V);
- latche=V;
+ Latch_Init(info, UNROMSync, 0, 0x8000, 0xFFFF);
}
-static void UNROMReset(void)
+//------------------ Map 93 ---------------------------
+
+static void SSUNROMSync(void)
{
- setprg16(0x8000,0);
+ setprg16(0x8000,latche>>4);
setprg16(0xc000,~0);
setchr8(0);
- SetWriteHandler(0x8000,0xffff,UNROMWrite);
- SetReadHandler(0x8000,0xFFFF,CartBR);
- latche=0;
}
-void UNROM_Init(CartInfo *info)
+void SUNSOFT_UNROM_Init(CartInfo *info)
{
- info->Power=UNROMReset;
- PRGmask16[0]&=7;
- AddExState(&latche, 1, 0, "LATC");
- GameStateRestore=UNROMRestore;
+ Latch_Init(info, SSUNROMSync, 0, 0x8000, 0xFFFF);
}
-//------------------ GNROM ---------------------------
+//------------------ Map 94 ---------------------------
-static void GNROMSync()
+static void M94Sync(void)
{
- setchr8(latche&3);
- setprg32(0x8000,(latche>>4)&3);
+ setprg16(0x8000,latche>>2);
+ setprg16(0xc000,~0);
+ setchr8(0);
}
-static DECLFW(GNROMWrite)
+void Mapper94_Init(CartInfo *info)
{
- latche=V&0x33;
- GNROMSync();
+ Latch_Init(info, M94Sync, 0, 0x8000, 0xFFFF);
}
-static void GNROMStateRestore(int version)
+//------------------ Map 107 ---------------------------
+
+static void M107Sync(void)
{
- GNROMSync();
+ setprg32(0x8000,(latche>>1)&3);
+ setchr8(latche&7);
}
-static void GNROMReset(void)
+void Mapper107_Init(CartInfo *info)
{
- latche=0;
- GNROMSync();
- SetWriteHandler(0x8000,0xffff,GNROMWrite);
+ Latch_Init(info, M107Sync, ~0, 0x8000, 0xFFFF);
+}
+
+//------------------ NROM ---------------------------
+
+#ifdef DEBUG_MAPPER
+static DECLFW(WriteHandler)
+{
+ FCEU_printf("$%04x:$%02x\n",A,V);
+}
+#endif
+
+static void NROMPower(void)
+{
+ setprg16(0x8000,0);
+ setprg16(0xC000,~0);
+ setchr8(0);
SetReadHandler(0x8000,0xFFFF,CartBR);
+ #ifdef DEBUG_MAPPER
+ SetWriteHandler(0x4020,0xFFFF,WriteHandler);
+ #endif
}
-void GNROM_Init(CartInfo *info)
+void NROM_Init(CartInfo *info)
{
- info->Power=GNROMReset;
- AddExState(&latche, 1, 0, "LATC");
- GameStateRestore=GNROMStateRestore;
+ info->Power=NROMPower;
}
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 2005 CaH4e3\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-#include "mapinc.h"\r
-\r
-static uint8 latch;\r
-\r
-static void DoPRG(void)\r
-{\r
- setprg16(0x8000,latch);\r
- setprg16(0xC000,8);\r
-}\r
-\r
-static DECLFW(DREAMWrite)\r
-{\r
- latch=V&7;\r
- DoPRG();\r
-}\r
-\r
-static void DREAMPower(void)\r
-{\r
- latch=0;\r
- SetReadHandler(0x8000,0xFFFF,CartBR);\r
- SetWriteHandler(0x5020,0x5020,DREAMWrite);\r
- setchr8(0);\r
- DoPRG();\r
-}\r
-\r
-static void Restore(int version)\r
-{\r
- DoPRG();\r
-}\r
-\r
-void DreamTech01_Init(CartInfo *info)\r
-{\r
- GameStateRestore=Restore;\r
- info->Power=DREAMPower;\r
- AddExState(&latch, 1, 0, "LATCH");\r
-}\r
+/* 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
+ */
+
+#include "mapinc.h"
+
+static uint8 latche;
+
+static void Sync(void)
+{
+ setprg16(0x8000,latche);
+ setprg16(0xC000,8);
+}
+
+static DECLFW(DREAMWrite)
+{
+ latche=V&7;
+ Sync();
+}
+
+static void DREAMPower(void)
+{
+ latche=0;
+ Sync();
+ setchr8(0);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x5020,0x5020,DREAMWrite);
+}
+
+static void Restore(int version)
+{
+ Sync();
+}
+
+void DreamTech01_Init(CartInfo *info)
+{
+ GameStateRestore=Restore;
+ info->Power=DREAMPower;
+ AddExState(&latche, 1, 0, "LATCH");
+}
--- /dev/null
+/* 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
+ */
+
+#include "mapinc.h"
+#include "mmc3.h"
+
+static uint8 unromchr;
+
+static void BMCFK23CCW(uint32 A, uint8 V)
+{
+ if(EXPREGS[0]&0x40)
+ setchr8((EXPREGS[2]&0xFC)|unromchr);
+ else
+ {
+ uint16 base=(EXPREGS[2]&0x7F)<<3;
+ setchr1(A,V|base);
+ if(EXPREGS[3]&2)
+ {
+ setchr1(0x0400,EXPREGS[6]|base);
+ setchr1(0x0C00,EXPREGS[7]|base);
+ }
+ }
+}
+
+static void BMCFK23CPW(uint32 A, uint8 V)
+{
+ if(EXPREGS[0]&4)
+ setprg32(0x8000,EXPREGS[1]>>1);
+ else
+ {
+ if(EXPREGS[0]&2)
+ setprg8(A,(V&(0x3F>>(EXPREGS[0]&3)))|(EXPREGS[1]<<1));
+ else
+ setprg8(A,V);
+ if(EXPREGS[3]&2)
+ {
+ setprg8(0xC000,EXPREGS[4]);
+ setprg8(0xE000,EXPREGS[5]);
+ }
+ }
+}
+
+static DECLFW(BMCFK23C8003Write)
+{
+ if(EXPREGS[0]&0x40)
+ {
+ unromchr=V&3;
+ FixMMC3CHR(MMC3_cmd);
+ }
+ else
+ {
+ if((A==0x8001)&&(EXPREGS[3]&2&&MMC3_cmd&8))
+ {
+ EXPREGS[4|(MMC3_cmd&3)]=V;
+ FixMMC3PRG(MMC3_cmd);
+ FixMMC3CHR(MMC3_cmd);
+ }
+ else
+ MMC3_CMDWrite(A,V);
+ }
+}
+
+static DECLFW(BMCFK23CWrite)
+{
+ EXPREGS[A&3]=V;
+ FixMMC3PRG(MMC3_cmd);
+ FixMMC3CHR(MMC3_cmd);
+}
+
+static void BMCFK23CReset(void)
+{
+ EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
+ EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
+ MMC3RegReset();
+}
+
+static void BMCFK23CPower(void)
+{
+ EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
+ EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
+ GenMMC3Power();
+ SetWriteHandler(0x5ff0,0x5fff,BMCFK23CWrite);
+ SetWriteHandler(0x8000,0x8003,BMCFK23C8003Write);
+}
+
+void BMCFK23C_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 512, 256, 8, 0);
+ cwrap=BMCFK23CCW;
+ pwrap=BMCFK23CPW;
+ info->Power=BMCFK23CPower;
+ info->Reset=BMCFK23CReset;
+ AddExState(EXPREGS, 8, 0, "EXPR");
+ AddExState(&unromchr, 1, 0, "UNCHR");
+}
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 2005 CaH4e3\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-#include "mapinc.h"\r
-#include "mmc3.h"\r
-\r
-extern uint8 m114_perm[8];\r
-\r
-static void H2288PW(uint32 A, uint8 V)\r
-{\r
- if(EXPREGS[0]&0x40)\r
- {\r
- uint8 bank=(EXPREGS[0]&5)|((EXPREGS[0]&8)>>2)|((EXPREGS[0]&0x20)>>2);\r
- if(EXPREGS[0]&2)\r
- setprg32(0x8000,bank>>1);\r
- else\r
- {\r
- setprg16(0x8000,bank);\r
- setprg16(0xC000,bank);\r
- }\r
- }\r
- else\r
- setprg8(A,V&0x3F);\r
-}\r
-\r
-static DECLFW(H2288WriteHi)\r
-{\r
- switch (A&0x8001)\r
- {\r
- case 0x8000: MMC3_CMDWrite(0x8000,(V&0xC0)|(m114_perm[V&7])); break;\r
- case 0x8001: MMC3_CMDWrite(0x8001,V); break;\r
- }\r
-}\r
-\r
-static DECLFW(H2288WriteLo)\r
-{\r
- if(A&0x800)\r
- {\r
- if(A&1)\r
- EXPREGS[1]=V;\r
- else\r
- EXPREGS[0]=V;\r
- FixMMC3PRG(MMC3_cmd);\r
- }\r
-}\r
-\r
-static DECLFR(H2288Read)\r
-{\r
- int bit;\r
- bit=(A&1)^1;\r
- bit&=((A>>8)&1);\r
- bit^=1;\r
- return((X.DB&0xFE)|bit);\r
-}\r
-\r
-static void H2288Power(void)\r
-{\r
- EXPREGS[0]=EXPREGS[1]=0;\r
- GenMMC3Power();\r
- SetReadHandler(0x5000,0x5FFF,H2288Read);\r
- SetReadHandler(0x8000,0xFFFF,CartBR);\r
- SetWriteHandler(0x5000,0x5FFF,H2288WriteLo);\r
- SetWriteHandler(0x8000,0x8FFF,H2288WriteHi);\r
-}\r
-\r
-void UNLH2288_Init(CartInfo *info)\r
-{\r
- GenMMC3_Init(info, 256, 256, 0, 0);\r
- pwrap=H2288PW;\r
- info->Power=H2288Power;\r
- AddExState(EXPREGS, 2, 0, "EXPR");\r
-}\r
+/* 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
+ */
+
+#include "mapinc.h"
+#include "mmc3.h"
+
+extern uint8 m114_perm[8];
+
+static void H2288PW(uint32 A, uint8 V)
+{
+ if(EXPREGS[0]&0x40)
+ {
+ uint8 bank=(EXPREGS[0]&5)|((EXPREGS[0]&8)>>2)|((EXPREGS[0]&0x20)>>2);
+ if(EXPREGS[0]&2)
+ setprg32(0x8000,bank>>1);
+ else
+ {
+ setprg16(0x8000,bank);
+ setprg16(0xC000,bank);
+ }
+ }
+ else
+ setprg8(A,V&0x3F);
+}
+
+static DECLFW(H2288WriteHi)
+{
+ switch (A&0x8001)
+ {
+ case 0x8000: MMC3_CMDWrite(0x8000,(V&0xC0)|(m114_perm[V&7])); break;
+ case 0x8001: MMC3_CMDWrite(0x8001,V); break;
+ }
+}
+
+static DECLFW(H2288WriteLo)
+{
+ if(A&0x800)
+ {
+ if(A&1)
+ EXPREGS[1]=V;
+ else
+ EXPREGS[0]=V;
+ FixMMC3PRG(MMC3_cmd);
+ }
+}
+
+static DECLFR(H2288Read)
+{
+ int bit;
+ bit=(A&1)^1;
+ bit&=((A>>8)&1);
+ bit^=1;
+ return((X.DB&0xFE)|bit);
+}
+
+static void H2288Power(void)
+{
+ EXPREGS[0]=EXPREGS[1]=0;
+ GenMMC3Power();
+ SetReadHandler(0x5000,0x5FFF,H2288Read);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x5000,0x5FFF,H2288WriteLo);
+ SetWriteHandler(0x8000,0x8FFF,H2288WriteHi);
+}
+
+void UNLH2288_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 256, 256, 0, 0);
+ pwrap=H2288PW;
+ info->Power=H2288Power;
+ AddExState(EXPREGS, 2, 0, "EXPR");
+}
#include "mapinc.h"
-static uint8 DReg;
-static SFORMAT StateRegs[]=
-{
- {&DReg, 1, "DREG"},
- {0}
-};
+extern uint32 ROM_size;
+static uint8 latche;
static void Sync(void)
{
- if(DReg)
+ if(latche)
{
- if(DReg & 0x10)
- setprg16(0x8000,(DReg&7));
+ if(latche&0x10)
+ setprg16(0x8000,(latche&7));
else
- setprg16(0x8000,(DReg&7)|8);
+ setprg16(0x8000,(latche&7)|8);
}
else
- setprg16(0x8000,7);
-}
-
-static void StateRestore(int version)
-{
- Sync();
+ setprg16(0x8000,7+(ROM_size>>4));
}
static DECLFW(M188Write)
{
- DReg=V;
+ latche=V;
Sync();
}
-static DECLFR(testr)
+static DECLFR(ExtDev)
{
return(3);
}
-
static void Power(void)
{
- setchr8(0);
- setprg8(0xc000,0xE);
- setprg8(0xe000,0xF);
- DReg = 0;
+ latche=0;
Sync();
- SetReadHandler(0x6000,0x7FFF,testr);
+ setchr8(0);
+ setprg16(0xc000,0x7);
+ SetReadHandler(0x6000,0x7FFF,ExtDev);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,M188Write);
}
+static void StateRestore(int version)
+{
+ Sync();
+}
void Mapper188_Init(CartInfo *info)
{
info->Power=Power;
GameStateRestore=StateRestore;
- AddExState(&StateRegs, ~0, 0, 0);
+ AddExState(&latche, 1, 0, "LATCH");
}
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
- * Copyright (C) 2002 Xodnizel
+ * 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
*/
#include "mapinc.h"
+#include "mmc3.h"
-static DECLFW(M58Write)
+static DECLFW(UNLKOF97CMDWrite)
{
- //printf("$%04x:$%02x\n",A,V);
- if(A&0x40)
- {
- ROM_BANK16(0x8000,(A&0x07));
- ROM_BANK16(0xc000,(A&0x07));
- }
- else
- ROM_BANK32((A&0x06)>>1);
+ V=(V&0xD8)|((V&0x20)>>4)|((V&4)<<3)|((V&2)>>1)|((V&1)<<2); //76143502
+ if(A==0x9000) A=0x8001;
+ MMC3_CMDWrite(A,V);
+}
- VROM_BANK8((A&0x38)>>3);
- MIRROR_SET2((V&2)>>1);
+static DECLFW(UNLKOF97IRQWrite)
+{
+ V=(V&0xD8)|((V&0x20)>>4)|((V&4)<<3)|((V&2)>>1)|((V&1)<<2);
+ if(A==0xD000) A=0xC001;
+ else if(A==0xF000) A=0xE001;
+ MMC3_IRQWrite(A,V);
+}
+
+static void UNLKOF97Power(void)
+{
+ GenMMC3Power();
+ SetWriteHandler(0x8000,0xA000,UNLKOF97CMDWrite);
+ SetWriteHandler(0xC000,0xF000,UNLKOF97IRQWrite);
}
-void Mapper58_init(void)
+void UNLKOF97_Init(CartInfo *info)
{
- ROM_BANK32(0);
- VROM_BANK8(0);
- SetWriteHandler(0x8000,0xFFFF,M58Write);
+ GenMMC3_Init(info, 128, 256, 0, 0);
+ info->Power=UNLKOF97Power;
}
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 2005 CaH4e3\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * CAI Shogakko no Sansu\r
- */\r
-\r
-#include "mapinc.h"\r
-\r
-static uint8 *CHRRAM=NULL;\r
-static uint8 SWRAM[4096];\r
-\r
-static uint8 regs[16];\r
-static uint8 WRAM[4096];\r
-static SFORMAT StateRegs[]=\r
-{\r
- {®s, 16, "REGS"},\r
- {WRAM, 4096, "WRAM"},\r
- {0}\r
-};\r
-\r
-static void Sync(void)\r
-{\r
- if(regs[5]&0x40)\r
- {\r
- setchr4r(0,0x1000,regs[5]&0x3F);\r
- }\r
- else\r
- {\r
- setchr4r(0x10,0x0000,regs[5]);\r
- setchr4r(0x10,0x1000,regs[5]^1);\r
- }\r
- setprg8r((regs[2]>>6)&1,0x8000,(regs[2]&0x3F));\r
- setprg8r((regs[3]>>6)&1,0xA000,(regs[3]&0x3F));\r
- setprg8r((regs[4]>>6)&1,0xC000,(regs[4]&0x3F));\r
- setprg8r(1,0xE000,~0);\r
- setmirror((regs[0xA]&3));\r
-}\r
-\r
-static DECLFW(M190Write)\r
-{\r
-// FCEU_printf("write %04x:%04x %d, %d\n",A,V,scanline,timestamp);\r
- regs[(A&0x0F00)>>8]=V;\r
- Sync();\r
-}\r
-\r
-static DECLFR(M190Read)\r
-{\r
-// FCEU_printf("read %04x:%04x %d, %d\n",A,regs[(A&0x0F00)>>8],scanline,timestamp);\r
- return regs[(A&0x0F00)>>8];\r
-}\r
-\r
-static DECLFR(AWRAM)\r
-{\r
- return(WRAM[A-0x7000]);\r
-}\r
-static DECLFW(BWRAM)\r
-{\r
- WRAM[A-0x7000]=V;\r
-}\r
-\r
-static DECLFR(ASWRAM)\r
-{\r
- return(SWRAM[A-0x6000]);\r
-}\r
-static DECLFW(BSWRAM)\r
-{\r
- SWRAM[A-0x6000]=V;\r
-}\r
-\r
-static void M190Power(void)\r
-{\r
- setvram8(CHRRAM);\r
- SetReadHandler(0x8000,0xFFFF,CartBR);\r
- SetWriteHandler(0x8000,0xFFFF,M190Write);\r
-// SetReadHandler(0xDA00,0xDA00,M190Read);\r
-// SetReadHandler(0xDB00,0xDB00,M190Read);\r
- SetReadHandler(0xDC00,0xDC00,M190Read);\r
- SetReadHandler(0xDD00,0xDD00,M190Read);\r
- SetReadHandler(0x7000,0x7FFF,AWRAM);\r
- SetWriteHandler(0x7000,0x7FFF,BWRAM);\r
- SetReadHandler(0x6000,0x6FFF,ASWRAM);\r
- SetWriteHandler(0x6000,0x6FFF,BSWRAM);\r
- Sync();\r
-}\r
-\r
-static void M190Close(void)\r
-{\r
- if(CHRRAM)\r
- FCEU_gfree(CHRRAM);\r
- CHRRAM=NULL;\r
-}\r
-\r
-static void StateRestore(int version)\r
-{\r
- Sync();\r
-}\r
-\r
-void Mapper190_Init(CartInfo *info)\r
-{\r
- info->Power=M190Power;\r
- info->Close=M190Close;\r
- if(info->battery)\r
- {\r
- info->SaveGame[0]=SWRAM;\r
- info->SaveGameLen[0]=4096;\r
- }\r
- GameStateRestore=StateRestore;\r
- CHRRAM=(uint8*)FCEU_gmalloc(8192);\r
- SetupCartCHRMapping(0x10,CHRRAM,8192,1);\r
- AddExState(CHRRAM, 8192, 0, "CHRRAM");\r
- AddExState(&StateRegs, ~0, 0, 0);\r
-}\r
+/* 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
+ *
+ * CAI Shogakko no Sansu
+ */
+
+#include "mapinc.h"
+
+static uint8 *CHRRAM=NULL;
+static uint8 SWRAM[4096];
+
+static uint8 regs[16];
+static uint8 WRAM[4096];
+static SFORMAT StateRegs[]=
+{
+ {®s, 16, "REGS"},
+ {WRAM, 4096, "WRAM"},
+ {0}
+};
+
+static void Sync(void)
+{
+ if(regs[5]&0x40)
+ {
+ setchr4r(0,0x1000,regs[5]&0x3F);
+ }
+ else
+ {
+ setchr4r(0x10,0x0000,regs[5]);
+ setchr4r(0x10,0x1000,regs[5]^1);
+ }
+ setprg8r((regs[2]>>6)&1,0x8000,(regs[2]&0x3F));
+ setprg8r((regs[3]>>6)&1,0xA000,(regs[3]&0x3F));
+ setprg8r((regs[4]>>6)&1,0xC000,(regs[4]&0x3F));
+ setprg8r(1,0xE000,~0);
+ setmirror((regs[0xA]&3));
+}
+
+static DECLFW(M190Write)
+{
+// FCEU_printf("write %04x:%04x %d, %d\n",A,V,scanline,timestamp);
+ regs[(A&0x0F00)>>8]=V;
+ Sync();
+}
+
+static DECLFR(M190Read)
+{
+// FCEU_printf("read %04x:%04x %d, %d\n",A,regs[(A&0x0F00)>>8],scanline,timestamp);
+ return regs[(A&0x0F00)>>8];
+}
+
+static DECLFR(AWRAM)
+{
+ return(WRAM[A-0x7000]);
+}
+static DECLFW(BWRAM)
+{
+ WRAM[A-0x7000]=V;
+}
+
+static DECLFR(ASWRAM)
+{
+ return(SWRAM[A-0x6000]);
+}
+static DECLFW(BSWRAM)
+{
+ SWRAM[A-0x6000]=V;
+}
+
+static void M190Power(void)
+{
+ setvram8(CHRRAM);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xFFFF,M190Write);
+// SetReadHandler(0xDA00,0xDA00,M190Read);
+// SetReadHandler(0xDB00,0xDB00,M190Read);
+ SetReadHandler(0xDC00,0xDC00,M190Read);
+ SetReadHandler(0xDD00,0xDD00,M190Read);
+ SetReadHandler(0x7000,0x7FFF,AWRAM);
+ SetWriteHandler(0x7000,0x7FFF,BWRAM);
+ SetReadHandler(0x6000,0x6FFF,ASWRAM);
+ SetWriteHandler(0x6000,0x6FFF,BSWRAM);
+ Sync();
+}
+
+static void M190Close(void)
+{
+ if(CHRRAM)
+ FCEU_gfree(CHRRAM);
+ CHRRAM=NULL;
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+void Mapper190_Init(CartInfo *info)
+{
+ info->Power=M190Power;
+ info->Close=M190Close;
+ if(info->battery)
+ {
+ info->SaveGame[0]=SWRAM;
+ info->SaveGameLen[0]=4096;
+ }
+ GameStateRestore=StateRestore;
+ CHRRAM=(uint8*)FCEU_gmalloc(8192);
+ SetupCartCHRMapping(0x10,CHRRAM,8192,1);
+ AddExState(CHRRAM, 8192, 0, "CHRRAM");
+ AddExState(&StateRegs, ~0, 0, 0);
+}
{
setprg2r(0x10,0x7000,0);
SetReadHandler(0x8000,0xFFFF,CartBR);
- SetReadHandler(0x6000,0x67ff,CartBR);
+ SetReadHandler(0x6000,0x67FF,CartBR);
SetReadHandler(0x7000,0x77FF,CartBR);
setprg2r(1,0x6000,0);
setprg32(0x8000,0);
#include "../sound.h"
#include "../state.h"
#include "../cart.h"
+#include "../ines.h"
#include "../cheat.h"
#include "../unif.h"
#include "../svga.h"
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 1998 BERO\r
- * Copyright (C) 2002 Xodnizel\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-#include "mapinc.h"\r
-\r
-static void GenMMC1Power(void);\r
-static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int battery);\r
-\r
-static uint8 DRegs[4];\r
-static uint8 Buffer,BufferShift;\r
-\r
-static int mmc1opts;\r
-\r
-static void (*MMC1CHRHook4)(uint32 A, uint8 V);\r
-static void (*MMC1PRGHook16)(uint32 A, uint8 V);\r
-\r
-static uint8 *WRAM=NULL;\r
-static uint8 *CHRRAM=NULL;\r
-static int is155;\r
-\r
-static DECLFW(MBWRAM)\r
-{\r
- if(!(DRegs[3]&0x10)||is155)\r
- Page[A>>11][A]=V; // WRAM is enabled.\r
-}\r
-\r
-static DECLFR(MAWRAM)\r
-{\r
- if((DRegs[3]&0x10)&&!is155)\r
- return X.DB; // WRAM is disabled\r
- return(Page[A>>11][A]);\r
-}\r
-\r
-static void MMC1CHR(void)\r
-{\r
- if(mmc1opts&4)\r
- {\r
- if(DRegs[0]&0x10)\r
- setprg8r(0x10,0x6000,(DRegs[1]>>4)&1);\r
- else\r
- setprg8r(0x10,0x6000,(DRegs[1]>>3)&1);\r
- }\r
- if(MMC1CHRHook4)\r
- {\r
- if(DRegs[0]&0x10)\r
- {\r
- MMC1CHRHook4(0x0000,DRegs[1]);\r
- MMC1CHRHook4(0x1000,DRegs[2]);\r
- }\r
- else\r
- {\r
- MMC1CHRHook4(0x0000,(DRegs[1]&0xFE));\r
- MMC1CHRHook4(0x1000,DRegs[1]|1);\r
- }\r
- }\r
- else\r
- {\r
- if(DRegs[0]&0x10)\r
- {\r
- setchr4(0x0000,DRegs[1]);\r
- setchr4(0x1000,DRegs[2]);\r
- }\r
- else\r
- setchr8(DRegs[1]>>1);\r
- }\r
-}\r
-\r
-static void MMC1PRG(void)\r
-{\r
- uint8 offs=DRegs[1]&0x10;\r
-\r
- if(MMC1PRGHook16)\r
- {\r
- switch(DRegs[0]&0xC)\r
- {\r
- case 0xC: MMC1PRGHook16(0x8000,(DRegs[3]+offs));\r
- MMC1PRGHook16(0xC000,0xF+offs);\r
- break;\r
- case 0x8: MMC1PRGHook16(0xC000,(DRegs[3]+offs));\r
- MMC1PRGHook16(0x8000,offs);\r
- break;\r
- case 0x0:\r
- case 0x4:\r
- MMC1PRGHook16(0x8000,((DRegs[3]&~1)+offs));\r
- MMC1PRGHook16(0xc000,((DRegs[3]&~1)+offs+1));\r
- break;\r
- }\r
- }\r
- else switch(DRegs[0]&0xC)\r
- {\r
- case 0xC: setprg16(0x8000,(DRegs[3]+offs));\r
- setprg16(0xC000,0xF+offs);\r
- break;\r
- case 0x8: setprg16(0xC000,(DRegs[3]+offs));\r
- setprg16(0x8000,offs);\r
- break;\r
- case 0x0:\r
- case 0x4:\r
- setprg16(0x8000,((DRegs[3]&~1)+offs));\r
- setprg16(0xc000,((DRegs[3]&~1)+offs+1));\r
- break;\r
- }\r
-}\r
-\r
-static void MMC1MIRROR(void)\r
-{\r
- switch(DRegs[0]&3)\r
- {\r
- case 2: setmirror(MI_V); break;\r
- case 3: setmirror(MI_H); break;\r
- case 0: setmirror(MI_0); break;\r
- case 1: setmirror(MI_1); break;\r
- }\r
-}\r
-\r
-\r
-static uint64 lreset;\r
-static DECLFW(MMC1_write)\r
-{\r
- int n=(A>>13)-4;\r
- //FCEU_DispMessage("%016x",timestampbase+timestamp);\r
- //printf("$%04x:$%02x, $%04x\n",A,V,X.PC);\r
- //DumpMem("out",0xe000,0xffff);\r
-\r
- /* The MMC1 is busy so ignore the write. */\r
- /* As of version FCE Ultra 0.81, the timestamp is only\r
- increased before each instruction is executed(in other words\r
- precision isn't that great), but this should still work to\r
- deal with 2 writes in a row from a single RMW instruction. */\r
- if((timestampbase+timestamp)<(lreset+2)) return;\r
-\r
- if(V&0x80)\r
- {\r
- DRegs[0]|=0xC;\r
- BufferShift=Buffer=0;\r
- MMC1PRG();\r
- lreset=timestampbase+timestamp;\r
- return;\r
- }\r
- Buffer|=(V&1)<<(BufferShift++);\r
- if(BufferShift==5)\r
- {\r
- DRegs[n] = Buffer;\r
- BufferShift = Buffer = 0;\r
- switch(n)\r
- {\r
- case 0: MMC1MIRROR(); MMC1CHR(); MMC1PRG(); break;\r
- case 1: MMC1CHR(); MMC1PRG(); break;\r
- case 2: MMC1CHR(); break;\r
- case 3: MMC1PRG(); break;\r
- }\r
- }\r
-}\r
-\r
-static void MMC1_Restore(int version)\r
-{\r
- MMC1MIRROR();\r
- MMC1CHR();\r
- MMC1PRG();\r
- //lreset=0; /* timestamp(base) is not stored in save states. */ // it is now!\r
-}\r
-\r
-static void MMC1CMReset(void)\r
-{\r
- int i;\r
- for(i=0;i<4;i++)\r
- DRegs[i]=0;\r
- Buffer = BufferShift = 0;\r
- DRegs[0]=0x1F;\r
- DRegs[1]=0;\r
- DRegs[2]=0; // Should this be something other than 0?\r
- DRegs[3]=0;\r
-\r
- MMC1MIRROR();\r
- MMC1CHR();\r
- MMC1PRG();\r
-}\r
-\r
-static int DetectMMC1WRAMSize(uint32 crc32)\r
-{\r
- switch(crc32)\r
- {\r
- case 0xc6182024: /* Romance of the 3 Kingdoms */\r
- case 0x2225c20f: /* Genghis Khan */\r
- case 0x4642dda6: /* Nobunaga's Ambition */\r
- case 0x29449ba9: /* "" "" (J) */\r
- case 0x2b11e0b0: /* "" "" (J) */\r
- FCEU_printf(" >8KB external WRAM present. Use UNIF if you hack the ROM image.\n");\r
- return(16);\r
- break;\r
- default:return(8);\r
- }\r
-}\r
-\r
-static uint32 NWCIRQCount;\r
-static uint8 NWCRec;\r
-#define NWCDIP 0xE\r
-\r
-static void FP_FASTAPASS(1) NWCIRQHook(int a)\r
-{\r
- if(!(NWCRec&0x10))\r
- {\r
- NWCIRQCount+=a;\r
- if((NWCIRQCount|(NWCDIP<<25))>=0x3e000000)\r
- {\r
- NWCIRQCount=0;\r
- X6502_IRQBegin(FCEU_IQEXT);\r
- }\r
- }\r
-}\r
-\r
-static void NWCCHRHook(uint32 A, uint8 V)\r
-{\r
- if((V&0x10)) // && !(NWCRec&0x10))\r
- {\r
- NWCIRQCount=0;\r
- X6502_IRQEnd(FCEU_IQEXT);\r
- }\r
- NWCRec=V;\r
- if(V&0x08)\r
- MMC1PRG();\r
- else\r
- setprg32(0x8000,(V>>1)&3);\r
-}\r
-\r
-static void NWCPRGHook(uint32 A, uint8 V)\r
-{\r
- if(NWCRec&0x8)\r
- setprg16(A,8|(V&0x7));\r
- else\r
- setprg32(0x8000,(NWCRec>>1)&3);\r
-}\r
-\r
-static void NWCPower(void)\r
-{\r
- GenMMC1Power();\r
- setchr8r(0,0);\r
-}\r
-\r
-void Mapper105_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 256, 256, 8, 0);\r
- MMC1CHRHook4=NWCCHRHook;\r
- MMC1PRGHook16=NWCPRGHook;\r
- MapIRQHook=NWCIRQHook;\r
- info->Power=NWCPower;\r
-}\r
-\r
-static void GenMMC1Power(void)\r
-{\r
- lreset=0;\r
- if(mmc1opts&1)\r
- {\r
- FCEU_CheatAddRAM(8,0x6000,WRAM);\r
- if(mmc1opts&4)\r
- FCEU_dwmemset(WRAM,0,8192)\r
- else if(!(mmc1opts&2))\r
- FCEU_dwmemset(WRAM,0,8192);\r
- }\r
- SetWriteHandler(0x8000,0xFFFF,MMC1_write);\r
- SetReadHandler(0x8000,0xFFFF,CartBR);\r
-\r
- if(mmc1opts&1)\r
- {\r
- SetReadHandler(0x6000,0x7FFF,MAWRAM);\r
- SetWriteHandler(0x6000,0x7FFF,MBWRAM);\r
- setprg8r(0x10,0x6000,0);\r
- }\r
-\r
- MMC1CMReset();\r
-}\r
-\r
-static void GenMMC1Close(void)\r
-{\r
- if(CHRRAM)\r
- FCEU_gfree(CHRRAM);\r
- if(WRAM)\r
- FCEU_gfree(WRAM);\r
- CHRRAM=WRAM=NULL;\r
-}\r
-\r
-static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int battery)\r
-{\r
- is155=0;\r
-\r
- info->Close=GenMMC1Close;\r
- MMC1PRGHook16=MMC1CHRHook4=0;\r
- mmc1opts=0;\r
- PRGmask16[0]&=(prg>>14)-1;\r
- CHRmask4[0]&=(chr>>12)-1;\r
- CHRmask8[0]&=(chr>>13)-1;\r
-\r
- if(wram)\r
- {\r
- WRAM=(uint8*)FCEU_gmalloc(wram*1024);\r
- mmc1opts|=1;\r
- if(wram>8) mmc1opts|=4;\r
- SetupCartPRGMapping(0x10,WRAM,wram*1024,1);\r
- AddExState(WRAM, wram*1024, 0, "WRAM");\r
- if(battery)\r
- {\r
- mmc1opts|=2;\r
- info->SaveGame[0]=WRAM+((mmc1opts&4)?8192:0);\r
- info->SaveGameLen[0]=8192;\r
- }\r
- }\r
- if(!chr)\r
- {\r
- CHRRAM=(uint8*)FCEU_gmalloc(8192);\r
- SetupCartCHRMapping(0, CHRRAM, 8192, 1);\r
- AddExState(CHRRAM, 8192, 0, "CHRR");\r
- }\r
- AddExState(DRegs, 4, 0, "DREG");\r
-\r
- info->Power=GenMMC1Power;\r
- GameStateRestore=MMC1_Restore;\r
- AddExState(&lreset, 8, 1, "LRST");\r
- AddExState(&Buffer, 1, 1, "BFFR");\r
- AddExState(&BufferShift, 1, 1, "BFRS");\r
-}\r
-\r
-void Mapper1_Init(CartInfo *info)\r
-{\r
- int ws=DetectMMC1WRAMSize(info->CRC32);\r
- GenMMC1Init(info, 512, 256, ws, info->battery);\r
-}\r
-\r
-/* Same as mapper 1, without respect for WRAM enable bit. */\r
-void Mapper155_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info,512,256,8,info->battery);\r
- is155=1;\r
-}\r
-\r
-void SAROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 128, 64, 8, info->battery);\r
-}\r
-\r
-void SBROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 128, 64, 0, 0);\r
-}\r
-\r
-void SCROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 128, 128, 0, 0);\r
-}\r
-\r
-void SEROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 32, 64, 0, 0);\r
-}\r
-\r
-void SGROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 256, 0, 0, 0);\r
-}\r
-\r
-void SKROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 256, 64, 8, info->battery);\r
-}\r
-\r
-void SLROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 256, 128, 0, 0);\r
-}\r
-\r
-void SL1ROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 128, 128, 0, 0);\r
-}\r
-\r
-/* Begin unknown - may be wrong - perhaps they use different MMC1s from the\r
- similarly functioning boards?\r
-*/\r
-\r
-void SL2ROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 256, 256, 0, 0);\r
-}\r
-\r
-void SFROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 256, 256, 0, 0);\r
-}\r
-\r
-void SHROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 256, 256, 0, 0);\r
-}\r
-\r
-/* End unknown */\r
-/* */\r
-/* */\r
-\r
-void SNROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 256, 0, 8, info->battery);\r
-}\r
-\r
-void SOROM_Init(CartInfo *info)\r
-{\r
- GenMMC1Init(info, 256, 0, 16, info->battery);\r
-}\r
-\r
-\r
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ * Copyright (C) 1998 BERO
+ * Copyright (C) 2002 Xodnizel
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "mapinc.h"
+
+static void GenMMC1Power(void);
+static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int battery);
+
+static uint8 DRegs[4];
+static uint8 Buffer,BufferShift;
+
+static int mmc1opts;
+
+static void (*MMC1CHRHook4)(uint32 A, uint8 V);
+static void (*MMC1PRGHook16)(uint32 A, uint8 V);
+
+static uint8 *WRAM=NULL;
+static uint8 *CHRRAM=NULL;
+static int is155;
+
+static DECLFW(MBWRAM)
+{
+ if(!(DRegs[3]&0x10)||is155)
+ Page[A>>11][A]=V; // WRAM is enabled.
+}
+
+static DECLFR(MAWRAM)
+{
+ if((DRegs[3]&0x10)&&!is155)
+ return X.DB; // WRAM is disabled
+ return(Page[A>>11][A]);
+}
+
+static void MMC1CHR(void)
+{
+ if(mmc1opts&4)
+ {
+ if(DRegs[0]&0x10)
+ setprg8r(0x10,0x6000,(DRegs[1]>>4)&1);
+ else
+ setprg8r(0x10,0x6000,(DRegs[1]>>3)&1);
+ }
+ if(MMC1CHRHook4)
+ {
+ if(DRegs[0]&0x10)
+ {
+ MMC1CHRHook4(0x0000,DRegs[1]);
+ MMC1CHRHook4(0x1000,DRegs[2]);
+ }
+ else
+ {
+ MMC1CHRHook4(0x0000,(DRegs[1]&0xFE));
+ MMC1CHRHook4(0x1000,DRegs[1]|1);
+ }
+ }
+ else
+ {
+ if(DRegs[0]&0x10)
+ {
+ setchr4(0x0000,DRegs[1]);
+ setchr4(0x1000,DRegs[2]);
+ }
+ else
+ setchr8(DRegs[1]>>1);
+ }
+}
+
+static void MMC1PRG(void)
+{
+ uint8 offs=DRegs[1]&0x10;
+ if(MMC1PRGHook16)
+ {
+ switch(DRegs[0]&0xC)
+ {
+ case 0xC: MMC1PRGHook16(0x8000,(DRegs[3]+offs));
+ MMC1PRGHook16(0xC000,0xF+offs);
+ break;
+ case 0x8: MMC1PRGHook16(0xC000,(DRegs[3]+offs));
+ MMC1PRGHook16(0x8000,offs);
+ break;
+ case 0x0:
+ case 0x4:
+ MMC1PRGHook16(0x8000,((DRegs[3]&~1)+offs));
+ MMC1PRGHook16(0xc000,((DRegs[3]&~1)+offs+1));
+ break;
+ }
+ }
+ else switch(DRegs[0]&0xC)
+ {
+ case 0xC: setprg16(0x8000,(DRegs[3]+offs));
+ setprg16(0xC000,0xF+offs);
+ break;
+ case 0x8: setprg16(0xC000,(DRegs[3]+offs));
+ setprg16(0x8000,offs);
+ break;
+ case 0x0:
+ case 0x4:
+ setprg16(0x8000,((DRegs[3]&~1)+offs));
+ setprg16(0xc000,((DRegs[3]&~1)+offs+1));
+ break;
+ }
+}
+
+static void MMC1MIRROR(void)
+{
+ switch(DRegs[0]&3)
+ {
+ case 2: setmirror(MI_V); break;
+ case 3: setmirror(MI_H); break;
+ case 0: setmirror(MI_0); break;
+ case 1: setmirror(MI_1); break;
+ }
+}
+
+static uint64 lreset;
+static DECLFW(MMC1_write)
+{
+ int n=(A>>13)-4;
+ //FCEU_DispMessage("%016x",timestampbase+timestamp);
+ //printf("$%04x:$%02x, $%04x\n",A,V,X.PC);
+ //DumpMem("out",0xe000,0xffff);
+
+ /* The MMC1 is busy so ignore the write. */
+ /* As of version FCE Ultra 0.81, the timestamp is only
+ increased before each instruction is executed(in other words
+ precision isn't that great), but this should still work to
+ deal with 2 writes in a row from a single RMW instruction. */
+ if((timestampbase+timestamp)<(lreset+2)) return;
+ if(V&0x80)
+ {
+ DRegs[0]|=0xC;
+ BufferShift=Buffer=0;
+ MMC1PRG();
+ lreset=timestampbase+timestamp;
+ return;
+ }
+ Buffer|=(V&1)<<(BufferShift++);
+ if(BufferShift==5)
+ {
+ DRegs[n] = Buffer;
+ BufferShift = Buffer = 0;
+ switch(n)
+ {
+ case 0: MMC1MIRROR(); MMC1CHR(); MMC1PRG(); break;
+ case 1: MMC1CHR(); MMC1PRG(); break;
+ case 2: MMC1CHR(); break;
+ case 3: MMC1PRG(); break;
+ }
+ }
+}
+
+static void MMC1_Restore(int version)
+{
+ MMC1MIRROR();
+ MMC1CHR();
+ MMC1PRG();
+ lreset=0; /* timestamp(base) is not stored in save states. */
+}
+
+static void MMC1CMReset(void)
+{
+ int i;
+ for(i=0;i<4;i++)
+ DRegs[i]=0;
+ Buffer = BufferShift = 0;
+ DRegs[0]=0x1F;
+ DRegs[1]=0;
+ DRegs[2]=0; // Should this be something other than 0?
+ DRegs[3]=0;
+
+ MMC1MIRROR();
+ MMC1CHR();
+ MMC1PRG();
+}
+
+static int DetectMMC1WRAMSize(uint32 crc32)
+{
+ switch(crc32)
+ {
+ case 0xc6182024: /* Romance of the 3 Kingdoms */
+ case 0x2225c20f: /* Genghis Khan */
+ case 0x4642dda6: /* Nobunaga's Ambition */
+ case 0x29449ba9: /* "" "" (J) */
+ case 0x2b11e0b0: /* "" "" (J) */
+ case 0xb8747abf: /* Best Play Pro Yakyuu Special (J) */
+ case 0xc9556b36: /* Final Fantasy I & II (J) [!] */
+ FCEU_printf(" >8KB external WRAM present. Use UNIF if you hack the ROM image.\n");
+ return(16);
+ break;
+ default:return(8);
+ }
+}
+
+static uint32 NWCIRQCount;
+static uint8 NWCRec;
+#define NWCDIP 0xE
+
+static void FP_FASTAPASS(1) NWCIRQHook(int a)
+{
+ if(!(NWCRec&0x10))
+ {
+ NWCIRQCount+=a;
+ if((NWCIRQCount|(NWCDIP<<25))>=0x3e000000)
+ {
+ NWCIRQCount=0;
+ X6502_IRQBegin(FCEU_IQEXT);
+ }
+ }
+}
+
+static void NWCCHRHook(uint32 A, uint8 V)
+{
+ if((V&0x10)) // && !(NWCRec&0x10))
+ {
+ NWCIRQCount=0;
+ X6502_IRQEnd(FCEU_IQEXT);
+ }
+ NWCRec=V;
+ if(V&0x08)
+ MMC1PRG();
+ else
+ setprg32(0x8000,(V>>1)&3);
+}
+
+static void NWCPRGHook(uint32 A, uint8 V)
+{
+ if(NWCRec&0x8)
+ setprg16(A,8|(V&0x7));
+ else
+ setprg32(0x8000,(NWCRec>>1)&3);
+}
+
+static void NWCPower(void)
+{
+ GenMMC1Power();
+ setchr8r(0,0);
+}
+
+void Mapper105_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 256, 256, 8, 0);
+ MMC1CHRHook4=NWCCHRHook;
+ MMC1PRGHook16=NWCPRGHook;
+ MapIRQHook=NWCIRQHook;
+ info->Power=NWCPower;
+}
+
+static void GenMMC1Power(void)
+{
+ lreset=0;
+ if(mmc1opts&1)
+ {
+ FCEU_CheatAddRAM(8,0x6000,WRAM);
+ if(mmc1opts&4)
+ FCEU_dwmemset(WRAM,0,8192)
+ else if(!(mmc1opts&2))
+ FCEU_dwmemset(WRAM,0,8192);
+ }
+ SetWriteHandler(0x8000,0xFFFF,MMC1_write);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+
+ if(mmc1opts&1)
+ {
+ SetReadHandler(0x6000,0x7FFF,MAWRAM);
+ SetWriteHandler(0x6000,0x7FFF,MBWRAM);
+ setprg8r(0x10,0x6000,0);
+ }
+
+ MMC1CMReset();
+}
+
+static void GenMMC1Close(void)
+{
+ if(CHRRAM)
+ FCEU_gfree(CHRRAM);
+ if(WRAM)
+ FCEU_gfree(WRAM);
+ CHRRAM=WRAM=NULL;
+}
+
+static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int battery)
+{
+ is155=0;
+
+ info->Close=GenMMC1Close;
+ MMC1PRGHook16=MMC1CHRHook4=0;
+ mmc1opts=0;
+ PRGmask16[0]&=(prg>>14)-1;
+ CHRmask4[0]&=(chr>>12)-1;
+ CHRmask8[0]&=(chr>>13)-1;
+
+ if(wram)
+ {
+ WRAM=(uint8*)FCEU_gmalloc(wram*1024);
+ mmc1opts|=1;
+ if(wram>8) mmc1opts|=4;
+ SetupCartPRGMapping(0x10,WRAM,wram*1024,1);
+ AddExState(WRAM, wram*1024, 0, "WRAM");
+ if(battery)
+ {
+ mmc1opts|=2;
+ info->SaveGame[0]=WRAM+((mmc1opts&4)?8192:0);
+ info->SaveGameLen[0]=8192;
+ }
+ }
+ if(!chr)
+ {
+ CHRRAM=(uint8*)FCEU_gmalloc(8192);
+ SetupCartCHRMapping(0, CHRRAM, 8192, 1);
+ AddExState(CHRRAM, 8192, 0, "CHRR");
+ }
+ AddExState(DRegs, 4, 0, "DREG");
+
+ info->Power=GenMMC1Power;
+ GameStateRestore=MMC1_Restore;
+ AddExState(&lreset, 8, 1, "LRST");
+}
+
+void Mapper1_Init(CartInfo *info)
+{
+ int ws=DetectMMC1WRAMSize(info->CRC32);
+ GenMMC1Init(info, 512, 256, ws, info->battery);
+}
+
+/* Same as mapper 1, without respect for WRAM enable bit. */
+void Mapper155_Init(CartInfo *info)
+{
+ GenMMC1Init(info,512,256,8,info->battery);
+ is155=1;
+}
+
+void SAROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 128, 64, 8, info->battery);
+}
+
+void SBROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 128, 64, 0, 0);
+}
+
+void SCROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 128, 128, 0, 0);
+}
+
+void SEROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 32, 64, 0, 0);
+}
+
+void SGROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 256, 0, 0, 0);
+}
+
+void SKROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 256, 64, 8, info->battery);
+}
+
+void SLROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 256, 128, 0, 0);
+}
+
+void SL1ROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 128, 128, 0, 0);
+}
+
+/* Begin unknown - may be wrong - perhaps they use different MMC1s from the
+ similarly functioning boards?
+*/
+
+void SL2ROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 256, 256, 0, 0);
+}
+
+void SFROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 256, 256, 0, 0);
+}
+
+void SHROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 256, 256, 0, 0);
+}
+
+/* End unknown */
+/* */
+/* */
+
+void SNROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 256, 0, 8, info->battery);
+}
+
+void SOROM_Init(CartInfo *info)
+{
+ GenMMC1Init(info, 256, 0, 16, info->battery);
+}
+
+
#include "mapinc.h"
#include "mmc3.h"
-uint8 MMC3_cmd=0;
-uint8 *WRAM=0;
-uint8 *CHRRAM=0;
-uint32 CHRRAMSize=0;
-uint8 EXPREGS[8]={0,0,0,0,0,0,0,0}; /* For bootleg games, mostly. */
+uint8 MMC3_cmd;
+uint8 *WRAM;
+uint8 *CHRRAM;
+uint32 CHRRAMSize;
+uint8 EXPREGS[8]; /* For bootleg games, mostly. */
-static uint8 A000B=0,A001B=0;
-static uint8 DRegBuf[8]={0,0,0,0,0,0,0,0};
+static uint8 A000B,A001B;
+static uint8 DRegBuf[8];
#undef IRQCount
#undef IRQLatch
#undef IRQa
-uint8 IRQCount=0,IRQLatch=0,IRQa=0;
-uint8 IRQReload=0;
+uint8 IRQCount,IRQLatch,IRQa;
+uint8 IRQReload;
static SFORMAT MMC3_StateRegs[]=
{
};
static int mmc3opts=0;
-static int wrams=0;
+static int wrams;
+static int isRevB=1;
void (*pwrap)(uint32 A, uint8 V);
void (*cwrap)(uint32 A, uint8 V);
DECLFW(MMC3_CMDWrite)
{
+// FCEU_printf("%04x:%04x\n",A,V);
switch(A&0xE001)
{
case 0x8000:
break;
case 0xA001:
A001B=V;
+ Write_IRQFM(0x4017,0x40);
break;
}
}
DECLFW(MMC3_IRQWrite)
{
+// FCEU_printf("%04x:%04x\n",A,V);
switch(A&0xE001)
{
case 0xC000:IRQLatch=V;break;
}
else
IRQCount--;
- if(count && !IRQCount)
+ if((count|isRevB) && !IRQCount)
{
if(IRQa)
{
ClockMMC3Counter();
}
-static void genmmc3restore(int version)
+void GenMMC3Restore(int version)
{
if(mwrap) mwrap(A000B&1);
FixMMC3PRG(MMC3_cmd);
static void GENCWRAP(uint32 A, uint8 V)
{
- setchr1(A,V);
+ if(!UNIFchrrama) setchr1(A,V);
}
static void GENPWRAP(uint32 A, uint8 V)
void GenMMC3Power(void)
{
+ if(UNIFchrrama) setchr8(0);
+
SetWriteHandler(0x8000,0xBFFF,MMC3_CMDWrite);
SetWriteHandler(0xC000,0xFFFF,MMC3_IRQWrite);
SetReadHandler(0x8000,0xFFFF,CartBR);
CHRRAM=WRAM=NULL;
}
+//static uint16 _a12;
+//static void FP_FASTAPASS(1) MMC3_PPU(uint32 A)
+//{
+// if(A&0x2000)return;
+// if((!_a12)&&(A&0x1000))
+// ClockMMC3Counter();
+// _a12=A&0x1000;
+//}
+
void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery)
{
-pwrap=GENPWRAP;
+ pwrap=GENPWRAP;
cwrap=GENCWRAP;
mwrap=GENMWRAP;
info->SaveGameLen[0]=wrams;
}
- if(!chr)
- {
- CHRRAM=(uint8*)FCEU_gmalloc(8192);
- CHRRAMSize=8192;
- SetupCartCHRMapping(0, CHRRAM, 8192, 1);
- AddExState(CHRRAM, 8192, 0, "CHRR");
- }
+// if(!chr) // duplicated CHR RAM set up
+// {
+// CHRRAM=(uint8*)FCEU_gmalloc(8192);
+// CHRRAMSize=8192;
+// SetupCartCHRMapping(0, CHRRAM, 8192, 1);
+// AddExState(CHRRAM, 8192, 0, "CHRR");
+// }
AddExState(MMC3_StateRegs, ~0, 0, 0);
else if(info->CRC32 == 0xfcd772eb) // PAL Star Wars, similar problem as Kick Master.
GameHBIRQHook = MMC3_hb_PALStarWarsHack;
else
- GameHBIRQHook=MMC3_hb;
- GameStateRestore=genmmc3restore;
+ GameHBIRQHook=MMC3_hb;
+// PPU_hook=MMC3_PPU;
+ GameStateRestore=GenMMC3Restore;
}
// ----------------------------------------------------------------------
AddExState(EXPREGS, 2, 0, "EXPR");
}
+// ---------------------------- Mapper 37 -------------------------------
+
+static void M37PW(uint32 A, uint8 V)
+{
+ if(EXPREGS[0]!=2)
+ V&=0x7;
+ else
+ V&=0xF;
+ V|=EXPREGS[0]<<3;
+ setprg8(A,V);
+}
+
+static void M37CW(uint32 A, uint8 V)
+{
+ uint32 NV=V;
+ NV&=0x7F;
+ NV|=EXPREGS[0]<<6;
+ setchr1(A,NV);
+}
+
+static DECLFW(M37Write)
+{
+ EXPREGS[0]=(V&6)>>1;
+ FixMMC3PRG(MMC3_cmd);
+ FixMMC3CHR(MMC3_cmd);
+}
+
+static void M37Reset(void)
+{
+ EXPREGS[0]=0;
+ MMC3RegReset();
+}
+
+static void M37Power(void)
+{
+ EXPREGS[0]=0;
+ GenMMC3Power();
+ SetWriteHandler(0x6000,0x7FFF,M37Write);
+}
+
+void Mapper37_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 512, 256, 8, info->battery);
+ pwrap=M37PW;
+ cwrap=M37CW;
+ info->Power=M37Power;
+ info->Reset=M37Reset;
+ AddExState(EXPREGS, 1, 0, "EXPR");
+}
+
// ---------------------------- Mapper 44 -------------------------------
static void M44PW(uint32 A, uint8 V)
static void M45CW(uint32 A, uint8 V)
{
- uint32 NV=V;
- if(EXPREGS[2]&8)
- NV&=(1<<((EXPREGS[2]&7)+1))-1;
- else
- NV&=0;
- NV|=EXPREGS[0]|((EXPREGS[2]&0xF0)<<4);
- // &0x10(not 0xf0) is valid given the original
- // description of mapper 45 by kevtris,
- // but this fixes Super 8 in 1.
- setchr1(A,NV);
+ if(!UNIFchrrama)
+ {
+ uint32 NV=V;
+ if(EXPREGS[2]&8)
+ NV&=(1<<((EXPREGS[2]&7)+1))-1;
+// else
+// NV&=0;
+ NV|=EXPREGS[0]|((EXPREGS[2]&0xF0)<<4);
+ setchr1(A,NV);
+ }
}
static void M45PW(uint32 A, uint8 V)
}
EXPREGS[EXPREGS[4]]=V;
EXPREGS[4]=(EXPREGS[4]+1)&3;
-// FCEU_printf("write 0=%04x 1=%04x 2=%04x 3=%04x (%04x:%04x)\n",EXPREGS[0],EXPREGS[1],EXPREGS[2],EXPREGS[3],A,V);
+ if(!EXPREGS[4])
+ {
+ FCEU_printf("CHROR %02x, PRGOR %02x, CHRAND %02x, PRGAND %02x\n",EXPREGS[0],EXPREGS[1],EXPREGS[2],EXPREGS[3]);
+ FCEU_printf("CHR0 %03x, CHR1 %03x, PRG0 %03x, PRG1 %03x\n",
+ (0x00&((1<<((EXPREGS[2]&7)+1))-1))|(EXPREGS[0]|((EXPREGS[2]&0xF0)<<4)),
+ (0xFF&((1<<((EXPREGS[2]&7)+1))-1))|(EXPREGS[0]|((EXPREGS[2]&0xF0)<<4)),
+ (0x00&((EXPREGS[3]&0x3F)^0x3F))|(EXPREGS[1]),
+ (0xFF&((EXPREGS[3]&0x3F)^0x3F))|(EXPREGS[1]));
+ }
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void M45Reset(void)
{
- FCEU_dwmemset(EXPREGS,0,5);
+ EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=EXPREGS[4]=0;
MMC3RegReset();
}
static void M45Power(void)
{
- M45Reset();
+ setchr8(0);
GenMMC3Power();
SetWriteHandler(0x6000,0x7FFF,M45Write);
}
EXPREGS[0]=0;
GenMMC3Power();
SetWriteHandler(0x6000,0x7FFF,M47Write);
- SetReadHandler(0x6000,0x7FFF,0);
+// SetReadHandler(0x6000,0x7FFF,0);
}
void Mapper47_Init(CartInfo *info)
static void M74CW(uint32 A, uint8 V)
{
-// FCEU_printf("%04x:%04x\n",A,V);
-// if((V==0)||(V==1)) //Dai-2-Ji - Super Robot Taisen (As).nes
- if((V==0)||(V==1)||(V==2)||(V==3)) //Ying Lie Qun Xia Zhuan (Chinese).nes, 4096 CHR RAM
-// if((V==8)||(V==9)) //Di 4 Ci - Ji Qi Ren Dai Zhan (As).nes
-// if((V==8)||(V==9)||(V==0xA)||(V==0xB)) //Ying Lie Qun Xia Zhuan (Chinese).nes, 4096 CHR RAM
- setchr1r(0x10,A,V);
+ if((V==8)||(V==9)) //Di 4 Ci - Ji Qi Ren Dai Zhan (As).nes, Ji Jia Zhan Shi (As).nes
+ setchr1r(0x10,A,V);
else
- setchr1r(0x0,A,V);
+ setchr1r(0,A,V);
}
void Mapper74_Init(CartInfo *info)
{
GenMMC3_Init(info, 512, 256, 8, info->battery);
cwrap=M74CW;
-// CHRRAMSize=2048;
- CHRRAMSize=4096;
+ CHRRAMSize=2048;
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
if(A==0xE003)
{
IRQa=1;
- IRQCount=V;
+ IRQLatch=V;
+ IRQReload=1;
}
else if(A==0xE002)
{
static void M115PW(uint32 A, uint8 V)
{
- setprg8(A,V);
- if(EXPREGS[0]&0x80)
- setprg16(0x8000,EXPREGS[0]&7);
+ if(EXPREGS[0]&0x80)
+ setprg32(0x8000,(EXPREGS[0]&7)>>1);
+ else
+ setprg8(A,V);
}
static void M115CW(uint32 A, uint8 V)
{
- setchr1(A,(uint32)V|((EXPREGS[1]&1)<<8));
+ setchr1(A,(uint32)V|((EXPREGS[1]&1)<<8));
}
static DECLFW(M115Write)
static void M116CW(uint32 A, uint8 V)
{
- setchr1(A,V|((EXPREGS[0]&0x4)<<6));
+// setchr1(A,V|((EXPREGS[0]&0x4)<<6));
+ if(EXPREGS[0]&2)
+ setchr8r(0x10,0);
+ else
+ setchr1(A,V);
}
static DECLFW(M116Write)
{
EXPREGS[0]=V;
- FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
GenMMC3_Init(info, 128, 512, 0, 0);
cwrap=M116CW;
info->Power=M116Power;
+ CHRRAM = (uint8*)FCEU_gmalloc(8192);
+ SetupCartCHRMapping(0x10, CHRRAM, 8192, 1);
AddExState(EXPREGS, 4, 0, "EXPR");
}
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
}
-// ---------------------------- Mapper 191 ------------------------------
-
-static void M191CW(uint32 A, uint8 V)
-{
- setchr1r((V&0x80)>>3,A,V);
-}
-
-void Mapper191_Init(CartInfo *info)
-{
- GenMMC3_Init(info, 256, 256, 8, info->battery);
- cwrap=M191CW;
- CHRRAMSize=2048;
- CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
- SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
- AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
-}
-
// ---------------------------- Mapper 165 ------------------------------
static void M165CW(uint32 A, uint8 V)
static void M165CWM(uint32 A, uint8 V)
{
- if(((MMC3_cmd&0x7)==0)||((MMC3_cmd&0x7)==2)) M165PPUFD();
- if(((MMC3_cmd&0x7)==1)||((MMC3_cmd&0x7)==4)) M165PPUFE();
+ if(((MMC3_cmd&0x7)==0)||((MMC3_cmd&0x7)==2))
+ M165PPUFD();
+ if(((MMC3_cmd&0x7)==1)||((MMC3_cmd&0x7)==4))
+ M165PPUFE();
}
static void FP_FASTAPASS(1) M165PPU(uint32 A)
case 0x8001: setmirror((V&1)^1); break;
case 0xA000: MMC3_CMDWrite(0x8000,m114_perm[V&7]); break;
case 0xC000: MMC3_CMDWrite(0x8001,V); break;
- case 0xE003: IRQCount=V; IRQa=1; X6502_IRQEnd(FCEU_IQEXT); break;
+ case 0xE003: if(V)
+ {
+ IRQLatch=V;
+ IRQReload=1;
+ IRQa=1;
+ }
+ X6502_IRQEnd(FCEU_IQEXT);
+ break;
}
}
info->Power=M182Power;
}
+// ---------------------------- Mapper 191 ------------------------------
+
+static void M191CW(uint32 A, uint8 V)
+{
+ setchr1r((V&0x80)>>3,A,V);
+}
+
+void Mapper191_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 256, 256, 8, info->battery);
+ cwrap=M191CW;
+ CHRRAMSize=2048;
+ CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
+ SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
+ AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
+}
+
+// ---------------------------- Mapper 192 -------------------------------
+
+static void M192CW(uint32 A, uint8 V)
+{
+ if((V==8)||(V==9)||(V==0xA)||(V==0xB)) //Ying Lie Qun Xia Zhuan (Chinese),
+ setchr1r(0x10,A,V);
+ else
+ setchr1r(0,A,V);
+}
+
+void Mapper192_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 512, 256, 8, info->battery);
+ cwrap=M192CW;
+ CHRRAMSize=4096;
+ CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
+ SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
+ AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
+}
+
+// ---------------------------- Mapper 194 -------------------------------
+
+static void M194CW(uint32 A, uint8 V)
+{
+ if(V<=1) //Dai-2-Ji - Super Robot Taisen (As).nes
+ setchr1r(0x10,A,V);
+ else
+ setchr1r(0,A,V);
+}
+
+void Mapper194_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 512, 256, 8, info->battery);
+ cwrap=M194CW;
+ CHRRAMSize=2048;
+ CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
+ SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
+ AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
+}
+
+// ---------------------------- Mapper 198 -------------------------------
+
+static uint8 *wramtw;
+static uint16 wramsize;
+static void M198CW(uint32 A, uint8 V)
+{
+ if(V<=3) // Crystalis (c).nes, Captain Tsubasa Vol 2 - Super Striker (C)
+ setchr1r(0x10,A,V);
+ else
+ setchr1r(0,A,V);
+}
+
+static void M198Power(void)
+{
+ GenMMC3Power();
+ setprg4r(0x10,0x5000,0);
+ SetWriteHandler(0x5000,0x5fff,CartBW);
+ SetReadHandler(0x5000,0x5fff,CartBR);
+}
+
+static void M198Close(void)
+{
+ if(wramtw)
+ FCEU_gfree(wramtw);
+ wramtw=NULL;
+}
+
+void Mapper198_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 512, 256, 8, info->battery);
+ cwrap=M198CW;
+ info->Power=M198Power;
+ info->Close=M198Close;
+ CHRRAMSize=4096;
+ CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
+ SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
+ wramsize=4096;
+ wramtw=(uint8*)FCEU_gmalloc(wramsize);
+ SetupCartPRGMapping(0x10, wramtw, wramsize, 1);
+ AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
+ AddExState(wramtw, wramsize, 0, "WRAMTW");
+}
+
+// ---------------------------- Mapper 199 -------------------------------
+
+static uint8 *wramtw;
+static uint16 wramsize;
+static void M199PW(uint32 A, uint8 V)
+{
+ if(V>=0x50)
+ setprg8(A,V&0x4F);
+ else
+ setprg8(A,V);
+}
+
+void Mapper199_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 1024, 256, 8, info->battery);
+ pwrap=M199PW;
+ info->Power=M198Power;
+ info->Close=M198Close;
+ wramsize=4096;
+ wramtw=(uint8*)FCEU_gmalloc(wramsize);
+ SetupCartPRGMapping(0x10, wramtw, wramsize, 1);
+ AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
+ AddExState(wramtw, wramsize, 0, "WRAMTW");
+}
+
// ---------------------------- Mapper 205 ------------------------------
static void M205PW(uint32 A, uint8 V)
static void M205CW(uint32 A, uint8 V)
{
- setchr1(A,V|((EXPREGS[0]&3)*128));
+ setchr1(A,V|((EXPREGS[0]&3)<<7));
}
static DECLFW(M205Write)
}
else switch(A&0xE001)
{
+ case 0xC001: IRQLatch=V; break;
+ case 0xA001: IRQReload=1; break;
+ case 0xE001: IRQa=1; break;
case 0xE000: X6502_IRQEnd(FCEU_IQEXT); IRQa=0; break;
- case 0xE001: IRQCount=V; break;
- case 0xC001: IRQa=1; break;
case 0xC000: setmirror(((V|(V>>7))&1)^1); break;
case 0xA000: MMC3_CMDWrite(0x8000,(V&0xC0)|(m215_perm[V&7])); cmdin=1; break;
case 0x8001: if(!cmdin) break;
if(!EXPREGS[2])
{
if(A >= 0xc000)
- MMC3_IRQWrite(A, V);
+ MMC3_IRQWrite(A, V);
else
- MMC3_CMDWrite(A,V);
+ MMC3_CMDWrite(A,V);
}
else switch(A&0xE001)
{
- case 0x8000: IRQCount=V; break;
- case 0xE000: X6502_IRQEnd(FCEU_IQEXT);IRQa=0; break;
- case 0xC001: IRQa=1; break;
- case 0xA001: setmirror((V&1)^1); break;
- case 0x8001: MMC3_CMDWrite(0x8000,(V&0xC0)|(m217_perm[V&7])); cmdin=1; break;
- case 0xA000: if(!cmdin) break;
- MMC3_CMDWrite(0x8001,V);
- cmdin=0;
- break;
+ case 0x8000: IRQCount=V; break;
+ case 0xE000: X6502_IRQEnd(FCEU_IQEXT);IRQa=0; break;
+ case 0xC001: IRQa=1; break;
+ case 0xA001: setmirror((V&1)^1); break;
+ case 0x8001: MMC3_CMDWrite(0x8000,(V&0xC0)|(m217_perm[V&7])); cmdin=1; break;
+ case 0xA000: if(!cmdin) break;
+ MMC3_CMDWrite(0x8001,V);
+ cmdin=0;
+ break;
}
}
-extern uint8 MMC3_cmd;\r
-extern uint8 *WRAM;\r
-//extern uint8 *CHRRAM;\r
-extern uint8 EXPREGS[8];\r
-#undef IRQCount\r
-#undef IRQLatch\r
-#undef IRQa\r
-extern uint8 IRQCount,IRQLatch,IRQa;\r
-extern uint8 IRQReload;\r
-\r
-extern void (*pwrap)(uint32 A, uint8 V);\r
-extern void (*cwrap)(uint32 A, uint8 V);\r
-extern void (*mwrap)(uint8 V);\r
-\r
-void GenMMC3Power(void);\r
-void MMC3RegReset(void);\r
-void FixMMC3PRG(int V);\r
-void FixMMC3CHR(int V);\r
-DECLFW(MMC3_CMDWrite);\r
-DECLFW(MMC3_IRQWrite);\r
-\r
-void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery);\r
+extern uint8 MMC3_cmd;
+extern uint8 *WRAM;
+extern uint8 *CHRRAM;
+extern uint8 EXPREGS[8];
+#undef IRQCount
+#undef IRQLatch
+#undef IRQa
+extern uint8 IRQCount,IRQLatch,IRQa;
+extern uint8 IRQReload;
+
+extern void (*pwrap)(uint32 A, uint8 V);
+extern void (*cwrap)(uint32 A, uint8 V);
+extern void (*mwrap)(uint8 V);
+
+void GenMMC3Power(void);
+void GenMMC3Restore(int version);
+void MMC3RegReset(void);
+void FixMMC3PRG(int V);
+void FixMMC3CHR(int V);
+DECLFW(MMC3_CMDWrite);
+DECLFW(MMC3_IRQWrite);
+
+void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery);
static uint8 cmd;
static uint8 latch[8];
-static void MSync(uint8 mirr)
+static void S74LS374MSync(uint8 mirr)
{
switch(mirr&3)
{
{
setprg32(0x8000,latch[0]);
setchr8(latch[1]|latch[3]|latch[4]);
- MSync(latch[2]);
+ S74LS374MSync(latch[2]);
}
static DECLFW(S74LS374NWrite)
{
switch(cmd)
{
- case 2:latch[3]=(V&1)<<3;break;
+ case 2:latch[0]=V&1; latch[3]=(V&1)<<3;break;
case 4:latch[4]=(V&1)<<2;break;
- case 5:latch[0]=V&0x7;break;
+ case 5:latch[0]=V&7;break;
case 6:latch[1]=V&3;break;
case 7:latch[2]=V>>1;break;
}
}
}
+static DECLFR(S74LS374NRead)
+{
+ uint8 ret;
+ if((A&0x4100)==0x4100)
+ ret=(X.DB&0xC0)|((~cmd)&0x3F);
+ else
+ ret=X.DB;
+ return ret;
+}
+
static void S74LS374NPower(void)
{
latch[0]=latch[1]=latch[2]=latch[3]=latch[4]=0;
S74LS374NSynco();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4100,0x7FFF,S74LS374NWrite);
+ SetReadHandler(0x4100,0x5fff,S74LS374NRead);
}
static void S74LS374NRestore(int version)
{
setprg32(0x8000,latch[0]);
setchr8(latch[1]);
- MSync(latch[2]);
+ S74LS374MSync(latch[2]);
}
static DECLFW(S74LS374NAWrite)
case 6:latch[1]=(latch[1]&1)|latch[3]|((V&3)<<1);break;
case 7:latch[2]=V&1;break;
}
- S74LS374NSynco();
+ S74LS374NASynco();
}
}
}
static int type;
-//static int PPUbus;
static void S8259Synco(void)
{
int x;
}
}
}
- MSync(latch[7]>>1);
+ if(!(latch[7]&1))
+ S74LS374MSync(latch[7]>>1);
+ else
+ setmirror(MI_V);
}
static DECLFW(S8259Write)
static void(*WSync)(void);
-static void SA0161MSynco()
-{
- setprg32(0x8000,(latch[0]>>3)&1);
- setchr8(latch[0]&7);
-}
-
static DECLFW(SAWrite)
{
if(A&0x100)
}
}
-static void SAReset(void)
+static void SAPower(void)
{
latch[0]=0;
WSync();
SetWriteHandler(0x4100,0x5FFF,SAWrite);
}
-static void SA0161MRestore(int version)
+static void SARestore(int version)
{
- SA0161MSynco();
+ WSync();
}
-void SA0161M_Init(CartInfo *info)
+static DECLFW(SADWrite)
{
- WSync=SA0161MSynco;
- GameStateRestore=SA0161MRestore;
- info->Power=SAReset;
- AddExState(&latch[0], 1, 0, "LATC");
+ latch[0]=V;
+ WSync();
}
-static void SA72007Synco()
+static void SADPower(void)
{
- setprg32(0x8000,0);
- setchr8(latch[0]>>7);
+ latch[0]=0;
+ WSync();
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xFFFF,SADWrite);
}
-static void SA72007Restore(int version)
+static void SA0161MSynco()
{
- SA72007Synco();
+ setprg32(0x8000,(latch[0]>>3)&1);
+ setchr8(latch[0]&7);
}
-void SA72007_Init(CartInfo *info)
+static void SA72007Synco()
{
- WSync=SA72007Synco;
- GameStateRestore=SA72007Restore;
- info->Power=SAReset;
- AddExState(&latch[0], 1, 0, "LATC");
+ setprg32(0x8000,0);
+ setchr8(latch[0]>>7);
}
static void SA72008Synco()
setchr8(latch[0]&3);
}
-static void SA72008Restore(int version)
-{
- SA72008Synco();
-}
-
-void SA72008_Init(CartInfo *info)
+void SA0161M_Init(CartInfo *info)
{
- WSync=SA72008Synco;
- GameStateRestore=SA72008Restore;
- info->Power=SAReset;
+ WSync=SA0161MSynco;
+ GameStateRestore=SARestore;
+ info->Power=SAPower;
AddExState(&latch[0], 1, 0, "LATC");
}
-static DECLFW(SADWrite)
-{
- latch[0]=V;
- WSync();
-}
-
-static void SADReset(void)
-{
- latch[0]=0;
- WSync();
- SetReadHandler(0x8000,0xFFFF,CartBR);
- SetWriteHandler(0x8000,0xFFFF,SADWrite);
-}
-
-static void SA0037Synco()
+void SA72007_Init(CartInfo *info)
{
- setprg32(0x8000,(latch[0]>>3)&1);
- setchr8(latch[0]&7);
+ WSync=SA72007Synco;
+ GameStateRestore=SARestore;
+ info->Power=SAPower;
+ AddExState(&latch[0], 1, 0, "LATC");
}
-static void SA0037Restore(int version)
+void SA72008_Init(CartInfo *info)
{
- SA0037Synco();
+ WSync=SA72008Synco;
+ GameStateRestore=SARestore;
+ info->Power=SAPower;
+ AddExState(&latch[0], 1, 0, "LATC");
}
void SA0036_Init(CartInfo *info)
{
WSync=SA72007Synco;
- GameStateRestore=SA72007Restore;
- info->Power=SADReset;
+ GameStateRestore=SARestore;
+ info->Power=SADPower;
AddExState(&latch[0], 1, 0, "LATC");
}
void SA0037_Init(CartInfo *info)
{
- WSync=SA0037Synco;
- GameStateRestore=SA0037Restore;
- info->Power=SADReset;
+ WSync=SA0161MSynco;
+ GameStateRestore=SARestore;
+ info->Power=SADPower;
AddExState(&latch[0], 1, 0, "LATC");
}
static DECLFW(TCWrite)
{
if((A&0x103)==0x102)
+ {
latch[0]=V;
- TCU01Synco();
+ TCU01Synco();
+ }
}
static void TCU01Reset(void)
{
info->Power=TCA01Reset;
}
+
--- /dev/null
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ * Copyright (C) 2006 CaH4e3
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "mapinc.h"
+#include "mmc3.h"
+
+//static uint8 *CHRRAM;
+static uint8 tekker;
+
+static void MSHCW(uint32 A, uint8 V)
+{
+ if(EXPREGS[0]&0x40)
+ setchr8r(0x10,0);
+ else
+ {
+ if(A<0x800)
+ setchr1(A,V|((EXPREGS[0]&8)<<5));
+ else if(A<0x1000)
+ setchr1(A,V|((EXPREGS[0]&4)<<6));
+ else if(A<0x1800)
+ setchr1(A,V|((EXPREGS[0]&1)<<8));
+ else
+ setchr1(A,V|((EXPREGS[0]&2)<<7));
+ }
+}
+
+static DECLFW(MSHWrite)
+{
+ EXPREGS[0]=V;
+ FixMMC3CHR(MMC3_cmd);
+}
+
+static DECLFR(MSHRead)
+{
+ return(tekker);
+}
+
+static void MSHReset(void)
+{
+ MMC3RegReset();
+ tekker^=0xFF;
+}
+
+static void MSHPower(void)
+{
+ tekker=0x00;
+ GenMMC3Power();
+ SetWriteHandler(0x4100,0x4100,MSHWrite);
+ SetReadHandler(0x4100,0x4100,MSHRead);
+}
+
+static void MSHClose(void)
+{
+ if(CHRRAM)
+ FCEU_gfree(CHRRAM);
+ CHRRAM=NULL;
+}
+
+void UNLSHeroes_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 256, 512, 0, 0);
+ cwrap=MSHCW;
+ info->Power=MSHPower;
+ info->Reset=MSHReset;
+ info->Close=MSHClose;
+ CHRRAM = (uint8*)FCEU_gmalloc(8192);
+ SetupCartCHRMapping(0x10, CHRRAM, 8192, 1);
+ AddExState(EXPREGS, 4, 0, "EXPR");
+}
--- /dev/null
+/* 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
+ */
+
+#include "mapinc.h"
+
+static uint8 chrcmd[8], prg0, prg1, brk, mirr;
+static uint8 reg[8], cmd;
+static uint8 IRQCount,IRQLatch,IRQa;
+static uint8 IRQReload;
+static SFORMAT StateRegs[]=
+{
+ {reg, 8, "MMCREG"},
+ {&cmd, 1, "MMCCMD"},
+ {chrcmd, 8, "CHRCMD"},
+ {&prg0, 1, "PRG0"},
+ {&prg1, 1, "PRG1"},
+ {&brk, 1, "BRK"},
+ {&mirr, 1, "MIRR"},
+ {&IRQReload, 1, "IRQR"},
+ {&IRQCount, 1, "IRQC"},
+ {&IRQLatch, 1, "IRQL"},
+ {&IRQa, 1, "IRQA"},
+ {0}
+};
+
+static void Sync(void)
+{
+// if(brk&2)
+// {
+// setprg16(0x8000,~0);
+// setprg16(0xC000,~0);
+// }
+// else
+ {
+ setprg8(0x8000,prg0);
+ setprg8(0xA000,prg1);
+ }
+ int i;
+ for(i=0; i<8; i++)
+ setchr1(i<<10,chrcmd[i]);
+ setmirror(mirr^1);
+}
+
+static void Sync2(void)
+{
+ setprg8(0x8000,reg[6]&0x3F);
+ setprg8(0xA000,reg[7]&0x3F);
+ setchr2(0x0000,reg[0]>>1);
+ setchr2(0x8000,reg[1]>>1);
+ setchr1(0x1000,reg[2]);
+ setchr1(0x1400,reg[3]);
+ setchr1(0x1800,reg[4]);
+ setchr1(0x1C00,reg[5]);
+ setmirror(mirr^1);
+}
+
+static DECLFW(UNLSL1632CMDWrite)
+{
+ FCEU_printf("bs %04x %02x\n",A,V);
+// if((A&0xA131)==0xA131) brk=V;
+ if((A&0xA131)==0xA131) brk=V;
+ if(brk==2)
+ {
+ switch(A&0xE001)
+ {
+ case 0x8000: cmd=V&7; break;
+ case 0x8001: reg[cmd]=V; Sync(); break;
+ case 0xA000: mirr=V&1; break;
+ case 0xC000: IRQLatch=V; break;
+ case 0xC001: IRQReload=1; break;
+ case 0xE000: X6502_IRQEnd(FCEU_IQEXT); IRQa=0; break;
+ case 0xE001: IRQa=1; break;
+ }
+ Sync2();
+ }
+ else
+ {
+ switch(A&0xF003)
+ {
+ case 0x8000: prg0=V; break;
+ case 0xA000: prg1=V; break;
+ case 0x9000: mirr=V&1; break;
+ case 0xB000: chrcmd[0]=(chrcmd[0]&0xF0)|(V&0x0F); break;
+ case 0xB001: chrcmd[0]=(chrcmd[0]&0x0F)|(V<<4); break;
+ case 0xB002: chrcmd[1]=(chrcmd[1]&0xF0)|(V&0x0F); break;
+ case 0xB003: chrcmd[1]=(chrcmd[1]&0x0F)|(V<<4); break;
+ case 0xC000: chrcmd[2]=(chrcmd[2]&0xF0)|(V&0x0F); break;
+ case 0xC001: chrcmd[2]=(chrcmd[2]&0x0F)|(V<<4); break;
+ case 0xC002: chrcmd[3]=(chrcmd[3]&0xF0)|(V&0x0F); break;
+ case 0xC003: chrcmd[3]=(chrcmd[3]&0x0F)|(V<<4); break;
+ case 0xD000: chrcmd[4]=(chrcmd[4]&0xF0)|(V&0x0F); break;
+ case 0xD001: chrcmd[4]=(chrcmd[4]&0x0F)|(V<<4); break;
+ case 0xD002: chrcmd[5]=(chrcmd[5]&0xF0)|(V&0x0F); break;
+ case 0xD003: chrcmd[5]=(chrcmd[5]&0x0F)|(V<<4); break;
+ case 0xE000: chrcmd[6]=(chrcmd[6]&0xF0)|(V&0x0F); break;
+ case 0xE001: chrcmd[6]=(chrcmd[6]&0x0F)|(V<<4); break;
+ case 0xE002: chrcmd[7]=(chrcmd[7]&0xF0)|(V&0x0F); break;
+ case 0xE003: chrcmd[7]=(chrcmd[7]&0x0F)|(V<<4); break;
+ }
+ Sync();
+ }
+}
+
+static void UNLSL1632IRQHook(void)
+{
+ int count = IRQCount;
+ if((scanline==128)&&IRQa)X6502_IRQBegin(FCEU_IQEXT);
+ if(!count || IRQReload)
+ {
+ IRQCount = IRQLatch;
+ IRQReload = 0;
+ }
+ else
+ IRQCount--;
+ if(!IRQCount)
+ {
+ if(IRQa)
+ {
+ X6502_IRQBegin(FCEU_IQEXT);
+ }
+ }
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+static void UNLSL1632Power(void)
+{
+ setprg16(0xC000,~0);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ SetWriteHandler(0x8000,0xFFFF,UNLSL1632CMDWrite);
+}
+
+void UNLSL1632_Init(CartInfo *info)
+{
+ info->Power=UNLSL1632Power;
+ GameHBIRQHook2=UNLSL1632IRQHook;
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
--- /dev/null
+/* 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
+ */
+
+#include "mapinc.h"
+#include "mmc3.h"
+
+//static uint8 m_perm[8] = {0, 1, 0, 3, 0, 5, 6, 7};
+
+static void UNLSonicPW(uint32 A, uint8 V)
+{
+ if(EXPREGS[0]&0x80)
+ {
+ uint8 bank=EXPREGS[0]&0x1F;
+ if(EXPREGS[0]&0x20)
+ setprg32(0x8000,bank>>2);
+ else
+ {
+ setprg16(0x8000,bank);
+ setprg16(0xC000,bank);
+ }
+ }
+ else
+ setprg8(A,V&0x3F);
+}
+
+/*
+static DECLFW(UNLSonicWrite8000)
+{
+ if(V&0x80)
+ MMC3_CMDWrite(A,V);
+ else
+ MMC3_CMDWrite(A,m_perm[V&7]);
+}
+*/
+
+static DECLFW(UNLSonicWriteLo)
+{
+ EXPREGS[0]=V;
+ FixMMC3PRG(MMC3_cmd);
+}
+
+static void UNLSonicPower(void)
+{
+ EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=0;
+ GenMMC3Power();
+ SetWriteHandler(0x5000,0x5FFF,UNLSonicWriteLo);
+// SetWriteHandler(0x8000,0x8000,UNLSonicWrite8000);
+}
+
+void UNLSonic_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 256, 256, 0, 0);
+ pwrap=UNLSonicPW;
+ info->Power=UNLSonicPower;
+ AddExState(EXPREGS, 3, 0, "EXPR");
+}
-#include "mapinc.h"\r
-\r
-static uint8 mode;\r
-static uint8 DRegs[4];\r
-\r
-static SFORMAT StateRegs[]=\r
-{\r
- {DRegs, 4, "DREG"},\r
- {0}\r
-};\r
-\r
-static void Sync(void)\r
-{\r
- int base, bank;\r
- base = ((DRegs[0]^DRegs[1])&0x10)<<1;\r
- bank = (DRegs[2]^DRegs[3])&0x1f;\r
-\r
- if(DRegs[1]&0x08)\r
- {\r
- bank &= 0xfe;\r
- if(mode==0)\r
- {\r
- setprg16(0x8000,base+bank+1);\r
- setprg16(0xC000,base+bank+0);\r
- }\r
- else\r
- {\r
- setprg16(0x8000,base+bank+0);\r
- setprg16(0xC000,base+bank+1);\r
- }\r
- }\r
- else\r
- {\r
- if(DRegs[1]&0x04)\r
- {\r
- setprg16(0x8000,0x1f);\r
- setprg16(0xC000,base+bank);\r
- }\r
- else\r
- {\r
- setprg16(0x8000,base+bank);\r
- if(mode==0)\r
- setprg16(0xC000,0x20);\r
- else\r
- setprg16(0xC000,0x07);\r
- }\r
- }\r
-}\r
-\r
-static DECLFW(Mapper167_write)\r
-{\r
- DRegs[(A>>13)&0x03]=V;\r
- Sync();\r
-}\r
-\r
-static void StateRestore(int version)\r
-{\r
- Sync();\r
-}\r
-\r
-void Mapper166_init(void)\r
-{\r
- mode=1;\r
- DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;\r
- Sync();\r
- SetWriteHandler(0x8000,0xFFFF,Mapper167_write);\r
- GameStateRestore=StateRestore;\r
- AddExState(&StateRegs, ~0, 0, 0);\r
-}\r
-\r
-void Mapper167_init(void)\r
-{\r
- mode=0;\r
- DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;\r
- Sync();\r
- SetWriteHandler(0x8000,0xFFFF,Mapper167_write);\r
- GameStateRestore=StateRestore;\r
- AddExState(&StateRegs, ~0, 0, 0);\r
-}\r
+#include "mapinc.h"
+
+static uint8 mode;
+static uint8 DRegs[4];
+
+static SFORMAT StateRegs[]=
+{
+ {DRegs, 4, "DREG"},
+ {0}
+};
+
+static void Sync(void)
+{
+ int base, bank;
+ base = ((DRegs[0]^DRegs[1])&0x10)<<1;
+ bank = (DRegs[2]^DRegs[3])&0x1f;
+
+ if(DRegs[1]&0x08)
+ {
+ bank &= 0xfe;
+ if(mode==0)
+ {
+ setprg16(0x8000,base+bank+1);
+ setprg16(0xC000,base+bank+0);
+ }
+ else
+ {
+ setprg16(0x8000,base+bank+0);
+ setprg16(0xC000,base+bank+1);
+ }
+ }
+ else
+ {
+ if(DRegs[1]&0x04)
+ {
+ setprg16(0x8000,0x1f);
+ setprg16(0xC000,base+bank);
+ }
+ else
+ {
+ setprg16(0x8000,base+bank);
+ if(mode==0)
+ setprg16(0xC000,0x20);
+ else
+ setprg16(0xC000,0x07);
+ }
+ }
+}
+
+static DECLFW(Mapper167_write)
+{
+ DRegs[(A>>13)&0x03]=V;
+ Sync();
+}
+
+static void StateRestore(int version)
+{
+ Sync();
+}
+
+void Mapper166_init(void)
+{
+ mode=1;
+ DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
+ Sync();
+ SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
+
+void Mapper167_init(void)
+{
+ mode=0;
+ DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
+ Sync();
+ SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
+ GameStateRestore=StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 2005 CaH4e3\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-#include "mapinc.h"\r
-#include "mmc3.h"\r
-\r
-static uint8 *CHRRAM = NULL;\r
-static uint8 resetmode;\r
-static int masko8[8]={63,31,15,1,3,0,0,0};\r
-\r
-static void Super24PW(uint32 A, uint8 V)\r
-{\r
- uint32 NV=V&masko8[EXPREGS[0]&7];\r
- NV|=(EXPREGS[1]<<1);\r
- setprg8r((NV>>6)&0xF,A,NV);\r
-}\r
-\r
-static void Super24CW(uint32 A, uint8 V)\r
-{\r
- if(EXPREGS[0]&0x20)\r
- setchr1r(0x10,A,V);\r
- else\r
- {\r
- uint32 NV=V|(EXPREGS[2]<<3);\r
- setchr1r((NV>>9)&0xF,A,NV);\r
- }\r
-}\r
-\r
-static DECLFW(Super24Write)\r
-{\r
- switch(A)\r
- {\r
- case 0x5FF0: EXPREGS[0]=V;\r
- FixMMC3PRG(MMC3_cmd);\r
- FixMMC3CHR(MMC3_cmd);\r
- break;\r
- case 0x5FF1: EXPREGS[1]=V;\r
- FixMMC3PRG(MMC3_cmd);\r
- break;\r
- case 0x5FF2: EXPREGS[2]=V;\r
- FixMMC3CHR(MMC3_cmd);\r
- break;\r
- }\r
-}\r
-\r
-static DECLFW(Super24IRQ)\r
-{\r
- switch(A&0xE001)\r
- {\r
- case 0xc000: IRQLatch=V;\r
- if(resetmode==1)\r
- IRQCount=IRQLatch;\r
- break;\r
- case 0xc001: resetmode=1;\r
- IRQCount=IRQLatch;\r
- break;\r
- case 0xE000: IRQa=0;\r
- X6502_IRQEnd(FCEU_IQEXT);\r
- if(resetmode==1)\r
- IRQCount=IRQLatch;\r
- break;\r
- case 0xE001: IRQa=1;\r
- if(resetmode==1)\r
- IRQCount=IRQLatch;\r
- break;\r
- }\r
-}\r
-\r
-static void Super24HB(void)\r
-{\r
- resetmode=0;\r
- if(IRQCount!=0)\r
- {\r
- IRQCount--;\r
- if(IRQCount==0)\r
- {\r
- if(IRQa)\r
- {\r
- resetmode=1;\r
- X6502_IRQBegin(FCEU_IQEXT);\r
- }\r
- }\r
- }\r
-}\r
-\r
-static void Super24Power(void)\r
-{\r
- EXPREGS[0]=0x24;\r
- EXPREGS[1]=159;\r
- EXPREGS[2]=0;\r
- GenMMC3Power();\r
- SetWriteHandler(0x5000,0x7FFF,Super24Write);\r
- SetWriteHandler(0xC000,0xFFFF,Super24IRQ);\r
- SetReadHandler(0x8000,0xFFFF,CartBR);\r
-}\r
-\r
-static void Super24Reset(void)\r
-{\r
- EXPREGS[0]=0x24;\r
- EXPREGS[1]=159;\r
- EXPREGS[2]=0;\r
- MMC3RegReset();\r
-}\r
-\r
-static void Super24Close(void)\r
-{\r
- if(CHRRAM)\r
- FCEU_gfree(CHRRAM);\r
- CHRRAM = NULL;\r
-}\r
-\r
-void Super24_Init(CartInfo *info)\r
-{\r
- info->Power=Super24Power;\r
- info->Reset=Super24Reset;\r
- info->Close=Super24Close;\r
- cwrap=Super24CW;\r
- pwrap=Super24PW;\r
- CHRRAM=(uint8*)FCEU_gmalloc(8192);\r
- SetupCartCHRMapping(0x10, CHRRAM, 8192, 1);\r
- GameHBIRQHook=Super24HB;\r
- AddExState(CHRRAM, 8192, 0, "CHRR");\r
- AddExState(EXPREGS, 3, 0, "BIG2");\r
-}\r
+/* 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
+ */
+
+#include "mapinc.h"
+#include "mmc3.h"
+
+//static uint8 *CHRRAM = NULL;
+static int masko8[8]={63,31,15,1,3,0,0,0};
+
+static void Super24PW(uint32 A, uint8 V)
+{
+ uint32 NV=V&masko8[EXPREGS[0]&7];
+ NV|=(EXPREGS[1]<<1);
+ setprg8r((NV>>6)&0xF,A,NV);
+}
+
+static void Super24CW(uint32 A, uint8 V)
+{
+ if(EXPREGS[0]&0x20)
+ setchr1r(0x10,A,V);
+ else
+ {
+ uint32 NV=V|(EXPREGS[2]<<3);
+ setchr1r((NV>>9)&0xF,A,NV);
+ }
+}
+
+static DECLFW(Super24Write)
+{
+ switch(A)
+ {
+ case 0x5FF0: EXPREGS[0]=V;
+ FixMMC3PRG(MMC3_cmd);
+ FixMMC3CHR(MMC3_cmd);
+ break;
+ case 0x5FF1: EXPREGS[1]=V;
+ FixMMC3PRG(MMC3_cmd);
+ break;
+ case 0x5FF2: EXPREGS[2]=V;
+ FixMMC3CHR(MMC3_cmd);
+ break;
+ }
+}
+
+static void Super24Power(void)
+{
+ EXPREGS[0]=0x24;
+ EXPREGS[1]=159;
+ EXPREGS[2]=0;
+ GenMMC3Power();
+ SetWriteHandler(0x5000,0x7FFF,Super24Write);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+}
+
+static void Super24Reset(void)
+{
+ EXPREGS[0]=0x24;
+ EXPREGS[1]=159;
+ EXPREGS[2]=0;
+ MMC3RegReset();
+}
+
+static void Super24Close(void)
+{
+ if(CHRRAM)
+ FCEU_gfree(CHRRAM);
+ CHRRAM = NULL;
+}
+
+void Super24_Init(CartInfo *info)
+{
+ GenMMC3_Init(info, 128, 256, 0, 0);
+ info->Power=Super24Power;
+ info->Reset=Super24Reset;
+ info->Close=Super24Close;
+ cwrap=Super24CW;
+ pwrap=Super24PW;
+ CHRRAM=(uint8*)FCEU_gmalloc(8192);
+ SetupCartCHRMapping(0x10, CHRRAM, 8192, 1);
+ AddExState(CHRRAM, 8192, 0, "CHRR");
+ AddExState(EXPREGS, 3, 0, "BIG2");
+}
static void DoSuper(void)
{
- setprg8r((cmd0&0xC)>>2,0x6000,((cmd0&0x3)<<4)|0xF);
- if(cmd0&0x10)
- {
- setprg16r((cmd0&0xC)>>2,0x8000,((cmd0&0x3)<<3)|(cmd1&7));
- setprg16r((cmd0&0xC)>>2,0xc000,((cmd0&0x3)<<3)|7);
- }
- else
- setprg32r(4,0x8000,0);
- setmirror(((cmd0&0x20)>>5)^1);
+ setprg8r((cmd0&0xC)>>2,0x6000,((cmd0&0x3)<<4)|0xF);
+ if(cmd0&0x10)
+ {
+ setprg16r((cmd0&0xC)>>2,0x8000,((cmd0&0x3)<<3)|(cmd1&7));
+ setprg16r((cmd0&0xC)>>2,0xc000,((cmd0&0x3)<<3)|7);
+ }
+ else
+ setprg32r(4,0x8000,0);
+ setmirror(((cmd0&0x20)>>5)^1);
}
static DECLFW(SuperWrite)
{
- if(!(cmd0&0x10))
- {
- cmd0=V;
- DoSuper();
- }
+ if(!(cmd0&0x10))
+ {
+ cmd0=V;
+ DoSuper();
+ }
}
static DECLFW(SuperHi)
{
- cmd1=V;
- DoSuper();
+ cmd1=V;
+ DoSuper();
}
static void SuperReset(void)
static void SuperRestore(int version)
{
- DoSuper();
+ DoSuper();
}
void Supervision16_Init(CartInfo *info)
--- /dev/null
+/* 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
+ */
+
+#include "mapinc.h"
+
+static uint16 addrreg;
+static uint8 datareg;
+static uint8 busy;
+static SFORMAT StateRegs[]=
+{
+ {&addrreg, 2, "ADDRREG"},
+ {&datareg, 1, "DATAREG"},
+ {&busy, 1, "BUSY"},
+ {0}
+};
+
+static void Sync(void)
+{
+ setprg16(0x8000,(datareg&7)|((addrreg&0x60)>>2)|((addrreg&0x100)>>3));
+ setprg16(0xC000,7|((addrreg&0x60)>>2)|((addrreg&0x100)>>3));
+ setmirror(((addrreg&2)>>1)^1);
+}
+
+static DECLFW(BMCT262Write)
+{
+ if(busy||(A==0x8000))
+ datareg=V;
+ else
+ {
+ addrreg=A;
+ busy=1;
+ }
+ Sync();
+}
+
+static void BMCT262Power(void)
+{
+ setchr8(0);
+ SetWriteHandler(0x8000,0xFFFF,BMCT262Write);
+ SetReadHandler(0x8000,0xFFFF,CartBR);
+ busy=0;
+ addrreg=0;
+ datareg=0;
+ Sync();
+}
+
+static void BMCT262Reset(void)
+{
+ busy=0;
+ addrreg=0;
+ datareg=0;
+ Sync();
+}
+
+static void BMCT262Restore(int version)
+{
+ Sync();
+}
+
+void BMCT262_Init(CartInfo *info)
+{
+ info->Power=BMCT262Power;
+ info->Reset=BMCT262Reset;
+ GameStateRestore=BMCT262Restore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
static uint8 IRQCount,IRQa,IRQLatch;
static SFORMAT Rambo_StateRegs[]={
- {&cmd, 1, "CMD"},
- {&mir, 1, "MIR"},
- {&rmode, 1, "RMOD"},
- {&IRQmode, 1, "IRQM"},
- {&IRQCount, 1, "IRQC"},
- {&IRQa, 1, "IRQA"},
- {&IRQLatch, 1, "IRQL"},
- {DRegs, 11, "DREG"},
- {0}
+ {&cmd, 1, "CMD"},
+ {&mir, 1, "MIR"},
+ {&rmode, 1, "RMOD"},
+ {&IRQmode, 1, "IRQM"},
+ {&IRQCount, 1, "IRQC"},
+ {&IRQa, 1, "IRQA"},
+ {&IRQLatch, 1, "IRQL"},
+ {DRegs, 11, "DREG"},
+ {0}
};
static void FP_FASTAPASS(2) (*setchr1wrap)(unsigned int A, unsigned int V);
static void FP_FASTAPASS(1) RAMBO1_IRQHook(int a)
{
- static int smallcount;
- if(!IRQmode) return;
+ static int smallcount;
+ if(!IRQmode) return;
- smallcount+=a;
- while(smallcount>=4)
- {
- smallcount-=4;
- IRQCount--;
- if(IRQCount==0xFF)
+ smallcount+=a;
+ while(smallcount>=4)
+ {
+ smallcount-=4;
+ IRQCount--;
+ if(IRQCount==0xFF)
if(IRQa) X6502_IRQBegin(FCEU_IQEXT);
- }
+ }
}
static void RAMBO1_hb(void)
{
- if(IRQmode) return;
+ if(IRQmode) return;
if(scanline==240) return; /* hmm. Maybe that should be an mmc3-only call in fce.c. */
- rmode=0;
- IRQCount--;
- if(IRQCount==0xFF)
- {
- if(IRQa)
- {
- rmode = 1;
- X6502_IRQBegin(FCEU_IQEXT);
- }
- }
+ rmode=0;
+ IRQCount--;
+ if(IRQCount==0xFF)
+ {
+ if(IRQa)
+ {
+ rmode = 1;
+ X6502_IRQBegin(FCEU_IQEXT);
+ }
+ }
}
static void Synco(void)
{
- int x;
-
- if(cmd&0x20)
- {
- setchr1wrap(0x0000,DRegs[0]);
- setchr1wrap(0x0800,DRegs[1]);
- setchr1wrap(0x0400,DRegs[8]);
- setchr1wrap(0x0c00,DRegs[9]);
- }
- else
- {
- setchr1wrap(0x0000,(DRegs[0]&0xFE));
- setchr1wrap(0x0400,(DRegs[0]&0xFE)|1);
- setchr1wrap(0x0800,(DRegs[1]&0xFE));
- setchr1wrap(0x0C00,(DRegs[1]&0xFE)|1);
- }
-
- for(x=0;x<4;x++)
- setchr1wrap(0x1000+x*0x400,DRegs[2+x]);
-
- setprg8(0x8000,DRegs[6]);
- setprg8(0xA000,DRegs[7]);
-
- setprg8(0xC000,DRegs[10]);
+ int x;
+
+ if(cmd&0x20)
+ {
+ setchr1wrap(0x0000,DRegs[0]);
+ setchr1wrap(0x0800,DRegs[1]);
+ setchr1wrap(0x0400,DRegs[8]);
+ setchr1wrap(0x0c00,DRegs[9]);
+ }
+ else
+ {
+ setchr1wrap(0x0000,(DRegs[0]&0xFE));
+ setchr1wrap(0x0400,(DRegs[0]&0xFE)|1);
+ setchr1wrap(0x0800,(DRegs[1]&0xFE));
+ setchr1wrap(0x0C00,(DRegs[1]&0xFE)|1);
+ }
+
+ for(x=0;x<4;x++)
+ setchr1wrap(0x1000+x*0x400,DRegs[2+x]);
+
+ setprg8(0x8000,DRegs[6]);
+ setprg8(0xA000,DRegs[7]);
+
+ setprg8(0xC000,DRegs[10]);
}
static DECLFW(RAMBO1_write)
{
- switch(A&0xF001)
+ switch(A&0xF001)
{
case 0xa000: mir=V&1;
if(!nomirror)
case 0x8000: cmd = V;
break;
case 0x8001: if((cmd&0xF)<10)
- DRegs[cmd&0xF]=V;
- else if((cmd&0xF)==0xF)
- DRegs[10]=V;
- Synco();
- break;
+ DRegs[cmd&0xF]=V;
+ else if((cmd&0xF)==0xF)
+ DRegs[10]=V;
+ Synco();
+ break;
case 0xc000: IRQLatch=V;
if(rmode==1)
IRQCount=IRQLatch;
break;
case 0xc001: rmode=1;
- IRQCount=IRQLatch;
- IRQmode=V&1;
- break;
+ IRQCount=IRQLatch;
+ IRQmode=V&1;
+ break;
case 0xE000: IRQa=0;
X6502_IRQEnd(FCEU_IQEXT);
if(rmode==1)
case 0xE001: IRQa=1;
if(rmode==1)
IRQCount=IRQLatch;
- break;
+ break;
}
}
static void RAMBO1_Restore(int version)
{
- Synco();
- if(!nomirror)
- setmirror(mir^1);
+ Synco();
+ if(!nomirror)
+ setmirror(mir^1);
}
static void RAMBO1_init(void)
{
- int x;
- for(x=0;x<11;x++)
- DRegs[x]=~0;
+ int x;
+ for(x=0;x<11;x++)
+ DRegs[x]=~0;
cmd=mir=0;
- if(!nomirror)
- setmirror(1);
- Synco();
- GameHBIRQHook=RAMBO1_hb;
- MapIRQHook=RAMBO1_IRQHook;
- GameStateRestore=RAMBO1_Restore;
- SetWriteHandler(0x8000,0xffff,RAMBO1_write);
- AddExState(Rambo_StateRegs, ~0, 0, 0);
+ if(!nomirror)
+ setmirror(1);
+ Synco();
+ GameHBIRQHook=RAMBO1_hb;
+ MapIRQHook=RAMBO1_IRQHook;
+ GameStateRestore=RAMBO1_Restore;
+ SetWriteHandler(0x8000,0xffff,RAMBO1_write);
+ AddExState(Rambo_StateRegs, ~0, 0, 0);
}
static void FP_FASTAPASS(2) CHRWrap(unsigned int A, unsigned int V)
{
- setchr1(A,V);
+ setchr1(A,V);
}
void Mapper64_init(void)
{
- setchr1wrap=CHRWrap;
- nomirror=0;
- RAMBO1_init();
+ setchr1wrap=CHRWrap;
+ nomirror=0;
+ RAMBO1_init();
}
static int MirCache[8];
static void FP_FASTAPASS(2) MirWrap(unsigned int A, unsigned int V)
{
- MirCache[A>>10]=(V>>7)&1;
- if(PPUCHRBus==(A>>10))
- setmirror(MI_0+((V>>7)&1));
- setchr1(A,V);
+ MirCache[A>>10]=(V>>7)&1;
+ if(PPUCHRBus==(A>>10))
+ setmirror(MI_0+((V>>7)&1));
+ setchr1(A,V);
}
static void FP_FASTAPASS(1) MirrorFear(uint32 A)
{
- A&=0x1FFF;
- A>>=10;
- PPUCHRBus=A;
- setmirror(MI_0+MirCache[A]);
+ A&=0x1FFF;
+ A>>=10;
+ PPUCHRBus=A;
+ setmirror(MI_0+MirCache[A]);
}
void Mapper158_init(void)
{
- setchr1wrap=MirWrap;
- PPU_hook=MirrorFear;
- nomirror=1;
- RAMBO1_init();
+ setchr1wrap=MirWrap;
+ PPU_hook=MirrorFear;
+ nomirror=1;
+ RAMBO1_init();
}
// TODO: handlers for other formats then iNES
{
int MapperNo;
- iNES_HEADER *head = iNESGetHead();
+ iNES_HEADER *head = iNESGetHead(); // TODO: ReMake
MapperNo = (head->ROM_type>>4);
MapperNo|=(head->ROM_type2&0xF0);
FCEU_DispMessage("%s, Mapper: %d%s%s", PAL?"PAL":"NTSC", MapperNo, (head->ROM_type&2)?", BB":"", (head->ROM_type&4)?", T":"");
{0x9cbadc25,5,8}, /* JustBreed */
-{0x6e68e31a,16,8}, /* Dragon Ball 3*/
-{0x3f15d20d,153,8}, /* Famicom Jump 2 */
+ {0x6e68e31a,16,8}, /* Dragon Ball 3*/
+ {0x3f15d20d,153,8}, /* Famicom Jump 2 */
{0x983d8175,157,8}, /* Datach Battle Rush */
{0x894efdbc,157,8}, /* Datach Crayon Shin Chan */
{0x19e81461,157,8}, /* Datach DBZ */
{0xe62e3382,71,-1}, /* Mig-29 Soviet Fighter */
{0x21a653c7,4,-1}, /* Super Sky Kid */
-{0xdd4d9a62,209,-1}, /* Shin Samurai Spirits 2 */
+ {0xdd4d9a62,209,-1}, /* Shin Samurai Spirits 2 */
{0x063b1151,209,-1}, /* Power Rangers 4 */
{0xdd8ced31,209,-1}, /* Power Rangers 3 */
-{0x60bfeb0c,90,-1}, /* MK 2*/
{0x0c47946d,210,-1}, /* Chibi Maruko Chan */
{0xbd523011,210,-1}, /* Dream Master */
-{0xc247cc80,210,-1}, /* Family Circuit '91 */
+ {0xc247cc80,210,-1}, /* Family Circuit '91 */
{0x6ec51de5,210,-1}, /* Famista '92 */
{0xadffd64f,210,-1}, /* Famista '93 */
{0x429103c9,210,-1}, /* Famista '94 */
{0x276237b3,206,0}, /* Karnov */
{0x4e1c1e3c,206,0}, /* Karnov */
- /* Some entries to sort out the minor 33/48 mess. */
-{0xaebd6549,48,8}, /* Bakushou!! Jinsei Gekijou 3 */
+ /* Some entries to sort out the minor 33/48 mess. */
+ {0xaebd6549,48,8}, /* Bakushou!! Jinsei Gekijou 3 */
{0x6cdc0cd9,48,8}, /* Bubble Bobble 2 */
//{0x10e24006,48,8}, /* Flintstones 2 - bad dump? */
{0x40c0ad47,48,8}, /* Flintstones 2 */
{0xf518dd58,7,8}, /* Captain Skyhawk */
{0x7ccb12a3,43,-1}, /* SMB2j */
{0x6f12afc5,235,-1}, /* Golden Game 150-in-1 */
- {0xccc03440,156,-1},
+ {0xccc03440,156,-1},
{0xc9ee15a7,3,-1}, /* 3 is probably best. 41 WILL NOT WORK. */
{0x3e1271d5,79,1}, /* Tiles of Fate */
{0x8eab381c,113,1}, /* Death Bots */
{0xd4a76b07,79,0}, /* F-15 City Wars*/
- {0xa4fbb438,79,0},
+ {0xa4fbb438,79,0},
{0x1eb4a920,79,1}, /* Double Strike */
{0x345d3a1a,11,1}, /* Castle of Deceit */
{0x5caa3e61,144,1}, /* Death Race */
{0xd2699893,88,0}, /* Dragon Spirit */
-{0x2f27cdef,155,8}, /* Tatakae!! Rahmen Man */
+ {0x2f27cdef,155,8}, /* Tatakae!! Rahmen Man */
{0xcfd4a281,155,8}, /* Money Game. Yay for money! */
{0xd1691028,154,8}, /* Devil Man */
{0xc2730c30,34,0}, /* Deadly Towers */
{0x932ff06e,34,1}, /* Classic Concentration */
{0x4c7c1af3,34,1}, /* Caesar's Palace */
-
+
{0x15141401,4,8}, /* Asmik Kun Land */
{0x59280bec,4,8}, /* Jackie Chan */
{0x4cccd878,4,8}, /* Cat Ninden Teyandee */
{0x291bcd7d,1,8}, /* Pachio Kun 2 */
{0xf74dfc91,1,-1}, /* Win, Lose, or Draw */
- {0x3f56a392,1,8}, /* Captain Ed (J) */
- {0x078ced30,1,8}, /* Choujin - Ultra Baseball */
+ {0x3f56a392,1,8}, /* Captain Ed (J) */
+ {0x078ced30,1,8}, /* Choujin - Ultra Baseball */
{0x391aa1b8,1,8}, /* Bloody Warriors (J) */
{0x61a852ea,1,8}, /* Battle Stadium - Senbatsu Pro Yakyuu */
{0xfe364be5,1,8}, /* Deep Dungeon 4 */
{0x5b837e8d,1,8}, /* Alien Syndrome */
{0x283ad224,32,8}, /* Ai Sensei no Oshiete */
{0x5555fca3,32,8}, /* "" "" */
- {0x243a8735,32,0x10|4}, /* Major League */
+ {0x243a8735,32,0x10|4}, /* Major League */
-{0x6bc65d7e,66,1}, /* Youkai Club*/
-{0xc2df0a00,66,1}, /* Bio Senshi Dan(hacked) */
+{0x6bc65d7e,140,1}, /* Youkai Club*/
+{0xc2df0a00,140,1}, /* Bio Senshi Dan(hacked) */
{0xbde3ae9b,66,1}, /* Doraemon */
{0xd26efd78,66,1}, /* SMB Duck Hunt */
{0x811f06d9,66,1}, /* Dragon Power */
-{0x3293afea,66,1}, /* Mississippi Satsujin Jiken */
+{0x3293afea,140,1}, /* Mississippi Satsujin Jiken */
{0xe84274c5,66,1}, /* "" "" */
{0x9552e8df,66,1}, /* Dragon Ball */
- {0xba51ac6f,78,2},
+ {0xba51ac6f,78,2},
{0x3d1c3137,78,8}, /* Uchuusen - Cosmo Carrier */
{0xbda8f8e4,152,8}, /* Gegege no Kitarou 2 */
{0xb9b4d9e0,118,-1}, /* NES Play Action Football */
{0x78b657ac,118,-1}, /* Armadillo */
{0x37b62d04,118,-1}, /* Ys 3 */
- {0x07d92c31,118,-1}, /* RPG Jinsei Game */
+ {0x07d92c31,118,-1}, /* RPG Jinsei Game */
{0x2705eaeb,234,-1}, /* Maxi 15 */
{0x404b2e8b,4,2}, /* Rad Racer 2 */
- {0x2cc381f6,191,-1}, /* Sugoro Quest - Dice no Senshitachi (As).nes */
- {0x555a555e,191,-1},
{0xa912b064,51|0x800,8}, /* 11-in-1 Ball Games(has CHR ROM when it shouldn't) */
{0xc5e5c5b2,115,-1}, /* Bao Qing Tian (As).nes */
- {0,-1,-1}
+ {0xcfb224e6,-1,1}, /* Dragon Ninja (J) [p1][!].nes */
+ {0xf46ef39a,37,-1}, /* Super Mario Bros. + Tetris + Nintendo World Cup (E) [!] */
+ {0x0f05ff0a,181,-1}, /* Seicross (redump) */
+
+ {0x054bd3e9,74,-1}, /* Di 4 Ci - Ji Qi Ren Dai Zhan (As) */
+ {0x496ac8f7,74,-1}, /* Ji Jia Zhan Shi (As) */
+ {0xae854cef,74,-1}, /* Jia A Fung Yun (Chinese) */
+ {0x2cc381f6,191,-1}, /* Sugoro Quest - Dice no Senshitachi (As) */
+ {0x555a555e,191,-1},
+ {0x98c1cd4b,192,-1},/* Ying Lie Qun Xia Zhuan (Chinese) */
+ {0x442f1a29,192,-1},/* Young chivalry */
+ {0xa925226c,194,-1},/* Dai-2-Ji - Super Robot Taisen (As) */
+ {0xd5224fde,198,-1},/* [074]Crystalis (c) */
+ {0x1bc0be6c,198,-1},/* Captain Tsubasa Vol 2 - Super Striker (C) */
+ {0xdd431ba7,199,-1},/* Tenchi wo kurau 2 (c) */
+ {0x28192599,199,-1},
+ {0x700705f4,199,-1},
+ {0x9a2cf02c,199,-1},
+ {0xd8b401a7,199,-1},
+
+ {0x1f1326d4,218,-1},
+ {0xa1dc16c0,116,-1},
+ {0,-1,-1}
\r
void (*MapInitTab[256])(void)=\r
{\r
+ 0,0, //Mapper2_init,Mapper3_init,\r
0,0,\r
-// Mapper2_init,Mapper3_init,\r
0,0,\r
- 0,0,\r
- Mapper6_init,Mapper7_init,Mapper8_init,Mapper9_init,\r
- Mapper10_init,Mapper11_init,\r
- 0,\r
-// Mapper13_init,\r
+ Mapper6_init,\r
+ 0,//Mapper7_init,\r
+ Mapper8_init,Mapper9_init,\r
+ Mapper10_init,\r
+ 0, //Mapper11_init,\r
+ 0, //Mapper13_init,\r
0,\r
0,\r
Mapper15_init,Mapper16_init,Mapper17_init,Mapper18_init,\r
0,0,\r
- Mapper21_init,Mapper22_init,Mapper23_init,Mapper24_init,\r
+ Mapper21_init,Mapper22_init,Mapper23_init,Mapper24_init,\r
Mapper25_init,Mapper26_init,Mapper27_init,\r
0,0,0,0,\r
Mapper32_init,Mapper33_init,Mapper34_init,\r
0,\r
Mapper50_init,Mapper51_init,\r
0,0,0,0,0,\r
- Mapper57_init,Mapper58_init,Mapper59_init,Mapper60_init,\r
+ 0,// Mapper57_init,\r
+ 0,// Mapper58_init,\r
+ Mapper59_init,Mapper60_init,\r
Mapper61_init,Mapper62_init,\r
0,\r
- Mapper64_init,Mapper65_init,Mapper66_init,Mapper67_init,\r
- Mapper68_init,Mapper69_init,Mapper70_init,Mapper71_init,\r
+ Mapper64_init,Mapper65_init,\r
+ 0,//Mapper66_init,\r
+ Mapper67_init,\r
+ Mapper68_init,Mapper69_init,\r
+ 0,//Mapper70_init,\r
+ Mapper71_init,\r
Mapper72_init,Mapper73_init,\r
0,\r
- Mapper75_init,Mapper76_init,Mapper77_init,Mapper78_init,\r
+ Mapper75_init,Mapper76_init,Mapper77_init,\r
+ 0, //Mapper78_init,\r
Mapper79_init,Mapper80_init,\r
0,\r
Mapper82_init,Mapper83_init,\r
0,\r
- Mapper85_init,Mapper86_init,Mapper87_init,Mapper88_init,\r
+ Mapper85_init,Mapper86_init,\r
+ 0, //Mapper87_init,\r
+ 0, //Mapper88_init,\r
Mapper89_init,\r
0,\r
- Mapper91_init,Mapper92_init,Mapper93_init,Mapper94_init,\r
+ Mapper91_init,Mapper92_init,\r
+ 0, //Mapper93_init,\r
+ 0, //Mapper94_init,\r
0,\r
Mapper96_init,Mapper97_init,\r
0,\r
Mapper99_init,\r
0,0,0,0,0,0,0,\r
- Mapper107_init,\r
+ 0, //Mapper107_init,\r
0,0,0,0,\r
0,Mapper113_init,\r
0,0,0,\r
- Mapper117_init,\r
+ 0, //Mapper117_init,\r
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\r
- Mapper140_init,\r
+ 0, //Mapper140_init,\r
0,0,0,\r
- Mapper144_init,\r
+ 0, //Mapper144_init,\r
0,0,0,0,0,0,\r
- Mapper151_init,Mapper152_init,Mapper153_init,Mapper154_init,\r
+ Mapper151_init,\r
+ 0, //Mapper152_init,\r
+ Mapper153_init,\r
+ 0, //Mapper154_init,\r
0,\r
Mapper156_init,Mapper157_init,Mapper158_init,0,\r
0,0,0,0,0,0,\r
0,0,0,0,0,0,0,0,0,0,0,0,\r
Mapper180_init,\r
0,0,0,\r
- Mapper184_init,Mapper185_init,\r
+ Mapper184_init,\r
+ 0, //Mapper185_init,\r
0,0,0,\r
- Mapper189_init,\r
- 0,\r
-// Mapper191_init,\r
+ 0, //Mapper189_init,\r
0,\r
+ 0, //Mapper191_init,\r
0,\r
Mapper193_init,\r
0,0,0,0,0,0,\r
0,0,\r
Mapper207_init,\r
0,0,0,\r
- Mapper211_init,Mapper212_init,Mapper213_init,Mapper214_init,\r
+ 0, //Mapper211_init,\r
+ Mapper212_init,Mapper213_init,Mapper214_init,\r
0,0,0,0,0,0,0,0,0,0,\r
Mapper225_init,Mapper226_init,Mapper227_init,Mapper228_init,\r
Mapper229_init,Mapper230_init,Mapper231_init,Mapper232_init,\r
0,\r
- Mapper234_init,Mapper235_init,\r
+ Mapper234_init,\r
+ 0, //Mapper235_init,\r
0,0,0,0,\r
Mapper240_init,Mapper241_init,Mapper242_init,0,\r
Mapper244_init,\r
Mapper255_init\r
};\r
\r
+\r
+\r
static DECLFW(BWRAM)\r
{\r
WRAM[A-0x6000]=V;\r
} BMAPPING;\r
\r
static BMAPPING bmap[] = {\r
+ {0, NROM_Init},\r
{1, Mapper1_Init},\r
{2, UNROM_Init},\r
{3, CNROM_Init},\r
{4, Mapper4_Init},\r
{5, Mapper5_Init},\r
+ {7, ANROM_Init},\r
+ {11, Mapper11_Init},\r
{12, Mapper12_Init},\r
{13, CPROM_Init},\r
{19, Mapper19_Init},\r
+ {37, Mapper37_Init},\r
{44, Mapper44_Init},\r
{45, Mapper45_Init},\r
{47, Mapper47_Init},\r
{49, Mapper49_Init},\r
{52, Mapper52_Init},\r
+ {57, Mapper57_Init},\r
+ {58, Mapper58_Init},\r
+ {66, MHROM_Init},\r
+ {70, Mapper70_Init},\r
{74, Mapper74_Init},\r
+ {78, Mapper78_Init},\r
+ {87, Mapper87_Init},\r
+ {88, Mapper88_Init},\r
{90, Mapper90_Init},\r
+ {93, SUNSOFT_UNROM_Init},\r
+ {94, Mapper94_Init},\r
{95, Mapper95_Init},\r
{105, Mapper105_Init},\r
+ {107, Mapper107_Init},\r
{112, Mapper112_Init},\r
{114, Mapper114_Init},\r
- {115, Mapper115_Init},\r
- {116, Mapper116_Init},\r
- {118, Mapper118_Init},\r
+ {115, Mapper115_Init},\r
+ {116, Mapper116_Init},\r
+ {117, Mapper117_Init},\r
+ {118, Mapper118_Init},\r
{119, Mapper119_Init},\r
{133, SA72008_Init},\r
{137, S8259D_Init},\r
{138, S8259B_Init},\r
{139, S8259C_Init},\r
+ {140, Mapper140_Init},\r
{141, S8259A_Init},\r
{143, TCA01_Init},\r
+ {144, Mapper144_Init},\r
{145, SA72007_Init},\r
{146, SA0161M_Init},\r
{147, TCU01_Init},\r
{148, SA0037_Init},\r
{149, SA0036_Init},\r
{150, S74LS374N_Init},\r
- {155, Mapper155_Init},\r
+ {152, Mapper152_Init},\r
+ {154, Mapper154_Init},\r
+ {155, Mapper155_Init},\r
{160, Mapper90_Init},\r
{163, Mapper163_Init},\r
- {164, Mapper164_Init},\r
+ {164, Mapper164_Init},\r
{165, Mapper165_Init},\r
+ {181, Mapper181_Init},\r
{182, Mapper182_Init},\r
{183, Mapper183_Init},\r
+ {185, Mapper185_Init},\r
{186, Mapper186_Init},\r
- {187, Mapper187_Init},\r
- {188, Mapper188_Init},\r
+ {187, Mapper187_Init},\r
+ {188, Mapper188_Init},\r
+ {189, Mapper189_Init},\r
{191, Mapper191_Init},\r
+ {192, Mapper192_Init},\r
+ {194, Mapper194_Init},\r
+ {198, Mapper198_Init},\r
+ {199, Mapper199_Init},\r
{205, Mapper205_Init},\r
{206, DEIROM_Init},\r
- {208, Mapper208_Init},\r
+ {208, Mapper208_Init},\r
{209, Mapper209_Init},\r
- {210, Mapper210_Init},\r
+ {210, Mapper210_Init},\r
+ {211, Mapper211_Init},\r
{215, Mapper215_Init},\r
{216, Mapper216_Init},\r
{217, Mapper217_Init},\r
+ {218, UNLSonic_Init},\r
+ {219, UNLSL1632_Init},\r
+// {220, Mapper220_Init},\r
+ {222, Mapper222_Init},\r
+ {235, Mapper235_Init},\r
{243, S74LS374NA_Init},\r
- {245, Mapper245_Init},\r
- {249, Mapper249_Init},\r
- {250, Mapper250_Init},\r
+ {245, Mapper245_Init},\r
+ {249, Mapper249_Init},\r
+ {250, Mapper250_Init},\r
{254, Mapper254_Init},\r
{ 0, 0}\r
};\r
\r
+\r
static int NewiNES_Init(int num)\r
{\r
BMAPPING *tmp=bmap;\r
void iNESStateRestore(int version);\r
extern uint32 iNESGameCRC32;\r
\r
-extern uint8 *VROM;\r
-\r
extern uint32 VROM_size;\r
extern uint32 ROM_size;\r
\r
#else\r
#endif\r
\r
- typedef struct {\r
- char ID[4]; /*NES^Z*/\r
- uint8 ROM_size;\r
- uint8 VROM_size;\r
- uint8 ROM_type;\r
- uint8 ROM_type2;\r
- uint8 reserve[8];\r
- } iNES_HEADER;\r
+ typedef struct {\r
+ char ID[4]; /*NES^Z*/\r
+ uint8 ROM_size;\r
+ uint8 VROM_size;\r
+ uint8 ROM_type;\r
+ uint8 ROM_type2;\r
+ uint8 reserve[8];\r
+ } iNES_HEADER;\r
\r
void FASTAPASS(2) VRAM_BANK1(uint32 A, uint8 V);\r
void FASTAPASS(2) VRAM_BANK4(uint32 A,uint32 V);\r
void FASTAPASS(1) MIRROR_SET2(uint8 V);\r
void FASTAPASS(1) MIRROR_SET(uint8 V);\r
\r
-iNES_HEADER *iNESGetHead(void);\r
-\r
void Mapper0_init(void);\r
void Mapper1_init(void);\r
//void Mapper2_init(void);\r
//void Mapper3_init(void);\r
void Mapper6_init(void);\r
-void Mapper7_init(void);\r
+//void Mapper7_init(void);\r
void Mapper8_init(void);\r
void Mapper9_init(void);\r
void Mapper10_init(void);\r
-void Mapper11_init(void);\r
+//void Mapper11_init(void);\r
void Mapper12_init(void);\r
//void Mapper13_init(void);\r
void Mapper14_init(void);\r
void Mapper34_init(void);\r
void Mapper35_init(void);\r
void Mapper36_init(void);\r
-void Mapper37_init(void);\r
+//void Mapper37_init(void);\r
void Mapper38_init(void);\r
void Mapper39_init(void);\r
void Mapper40_init(void);\r
void Mapper54_init(void);\r
void Mapper55_init(void);\r
void Mapper56_init(void);\r
-void Mapper57_init(void);\r
-void Mapper58_init(void);\r
void Mapper59_init(void);\r
void Mapper60_init(void);\r
void Mapper61_init(void);\r
void Mapper63_init(void);\r
void Mapper64_init(void);\r
void Mapper65_init(void);\r
-void Mapper66_init(void);\r
+//void Mapper66_init(void);\r
void Mapper67_init(void);\r
void Mapper68_init(void);\r
void Mapper69_init(void);\r
-void Mapper70_init(void);\r
+//void Mapper70_init(void);\r
void Mapper71_init(void);\r
void Mapper72_init(void);\r
void Mapper73_init(void);\r
void Mapper75_init(void);\r
void Mapper76_init(void);\r
void Mapper77_init(void);\r
-void Mapper78_init(void);\r
+//void Mapper78_init(void);\r
void Mapper79_init(void);\r
void Mapper80_init(void);\r
void Mapper81_init(void);\r
void Mapper84_init(void);\r
void Mapper85_init(void);\r
void Mapper86_init(void);\r
-void Mapper87_init(void);\r
+//void Mapper87_init(void);\r
void Mapper88_init(void);\r
void Mapper89_init(void);\r
void Mapper91_init(void);\r
void Mapper92_init(void);\r
-void Mapper93_init(void);\r
-void Mapper94_init(void);\r
+//void Mapper93_init(void);\r
+//void Mapper94_init(void);\r
void Mapper96_init(void);\r
void Mapper97_init(void);\r
void Mapper98_init(void);\r
void Mapper99_init(void);\r
void Mapper100_init(void);\r
void Mapper101_init(void);\r
-void Mapper102_init(void);\r
void Mapper103_init(void);\r
void Mapper104_init(void);\r
void Mapper106_init(void);\r
-void Mapper107_init(void);\r
+//void Mapper107_init(void);\r
void Mapper108_init(void);\r
void Mapper109_init(void);\r
void Mapper110_init(void);\r
void Mapper111_init(void);\r
-//void Mapper112_init(void);\r
void Mapper113_init(void);\r
-//void Mapper114_init(void);\r
void Mapper115_init(void);\r
void Mapper116_init(void);\r
-void Mapper117_init(void);\r
+//void Mapper117_init(void);\r
void Mapper120_init(void);\r
void Mapper121_init(void);\r
void Mapper122_init(void);\r
void Mapper135_init(void);\r
void Mapper136_init(void);\r
void Mapper137_init(void);\r
-//void Mapper138_init(void);\r
void Mapper139_init(void);\r
-void Mapper140_init(void);\r
+//void Mapper140_init(void);\r
void Mapper141_init(void);\r
void Mapper142_init(void);\r
void Mapper143_init(void);\r
-void Mapper144_init(void);\r
-//void Mapper145_init(void);\r
-//void Mapper146_init(void);\r
-//void Mapper147_init(void);\r
-//void Mapper149_init(void);\r
+//void Mapper144_init(void);\r
void Mapper150_init(void);\r
void Mapper151_init(void);\r
-void Mapper152_init(void);\r
+//void Mapper152_init(void);\r
void Mapper153_init(void);\r
void Mapper154_init(void);\r
void Mapper156_init(void);\r
void Mapper178_init(void);\r
void Mapper179_init(void);\r
void Mapper180_init(void);\r
-void Mapper181_init(void);\r
+//void Mapper181_init(void);\r
void Mapper184_init(void);\r
-void Mapper185_init(void);\r
-void Mapper189_init(void);\r
-//void Mapper191_init(void);\r
-void Mapper192_init(void);\r
+//void Mapper185_init(void);\r
+//void Mapper189_init(void);\r
+//void Mapper192_init(void);\r
void Mapper193_init(void);\r
-void Mapper194_init(void);\r
+//void Mapper194_init(void);\r
void Mapper195_init(void);\r
void Mapper196_init(void);\r
void Mapper197_init(void);\r
-void Mapper198_init(void);\r
+//void Mapper198_init(void);\r
void Mapper199_init(void);\r
void Mapper200_init(void);\r
void Mapper201_init(void);\r
void Mapper203_init(void);\r
void Mapper204_init(void);\r
void Mapper207_init(void);\r
-void Mapper211_init(void);\r
+//void Mapper211_init(void);\r
void Mapper212_init(void);\r
void Mapper213_init(void);\r
void Mapper214_init(void);\r
-void Mapper218_init(void);\r
+//void Mapper218_init(void);\r
void Mapper219_init(void);\r
-void Mapper220_init(void);\r
+//void Mapper220_init(void);\r
void Mapper221_init(void);\r
-void Mapper222_init(void);\r
+//void Mapper222_init(void);\r
void Mapper223_init(void);\r
void Mapper224_init(void);\r
void Mapper225_init(void);\r
void Mapper232_init(void);\r
void Mapper233_init(void);\r
void Mapper234_init(void);\r
-void Mapper235_init(void);\r
+//void Mapper235_init(void);\r
void Mapper236_init(void);\r
void Mapper237_init(void);\r
void Mapper238_init(void);\r
void Mapper1_Init(CartInfo *);\r
void Mapper4_Init(CartInfo *);\r
void Mapper5_Init(CartInfo *);\r
+void Mapper11_Init(CartInfo *);\r
void Mapper12_Init(CartInfo *);\r
void Mapper19_Init(CartInfo *);\r
+void Mapper37_Init(CartInfo *);\r
void Mapper44_Init(CartInfo *);\r
void Mapper45_Init(CartInfo *);\r
void Mapper47_Init(CartInfo *);\r
void Mapper49_Init(CartInfo *);\r
void Mapper52_Init(CartInfo *);\r
+void Mapper57_Init(CartInfo *);\r
+void Mapper58_Init(CartInfo *);\r
+void Mapper70_Init(CartInfo *);\r
void Mapper74_Init(CartInfo *);\r
+void Mapper78_Init(CartInfo *);\r
+void Mapper87_Init(CartInfo *);\r
+void Mapper88_Init(CartInfo *);\r
void Mapper90_Init(CartInfo *);\r
+void Mapper93_Init(CartInfo *);\r
+void Mapper94_Init(CartInfo *);\r
void Mapper95_Init(CartInfo *);\r
void Mapper105_Init(CartInfo *);\r
+void Mapper107_Init(CartInfo *);\r
void Mapper112_Init(CartInfo *);\r
void Mapper114_Init(CartInfo *);\r
void Mapper115_Init(CartInfo *);\r
void Mapper116_Init(CartInfo *);\r
+void Mapper117_Init(CartInfo *);\r
void Mapper118_Init(CartInfo *);\r
void Mapper119_Init(CartInfo *);\r
void Mapper125_Init(CartInfo *);\r
+void Mapper140_Init(CartInfo *);\r
+void Mapper144_Init(CartInfo *);\r
+void Mapper152_Init(CartInfo *);\r
+void Mapper154_Init(CartInfo *);\r
void Mapper155_Init(CartInfo *);\r
void Mapper163_Init(CartInfo *);\r
void Mapper164_Init(CartInfo *);\r
void Mapper165_Init(CartInfo *);\r
+void Mapper181_Init(CartInfo *);\r
void Mapper182_Init(CartInfo *);\r
void Mapper183_Init(CartInfo *);\r
+void Mapper185_Init(CartInfo *);\r
void Mapper186_Init(CartInfo *);\r
void Mapper187_Init(CartInfo *);\r
void Mapper188_Init(CartInfo *);\r
+void Mapper189_Init(CartInfo *);\r
void Mapper191_Init(CartInfo *);\r
+void Mapper192_Init(CartInfo *);\r
+void Mapper194_Init(CartInfo *);\r
+void Mapper198_Init(CartInfo *);\r
+void Mapper199_Init(CartInfo *);\r
void Mapper205_Init(CartInfo *);\r
void Mapper208_Init(CartInfo *);\r
void Mapper209_Init(CartInfo *);\r
void Mapper210_Init(CartInfo *);\r
+void Mapper211_Init(CartInfo *);\r
void Mapper215_Init(CartInfo *);\r
void Mapper216_Init(CartInfo *);\r
void Mapper217_Init(CartInfo *);\r
+void Mapper220_Init(CartInfo *);\r
+void Mapper222_Init(CartInfo *);\r
+void Mapper235_Init(CartInfo *);\r
+void Mapper236_Init(CartInfo *);\r
+void Mapper237_Init(CartInfo *);\r
void Mapper245_Init(CartInfo *);\r
void Mapper249_Init(CartInfo *);\r
void Mapper250_Init(CartInfo *);\r
+++ /dev/null
-/* FCE Ultra - NES/Famicom Emulator
- *
- * Copyright notice for this file:
- * Copyright (C) 2002 Xodnizel
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "mapinc.h"
-
-
-
-DECLFW(Mapper117_write)
-{
- //if(A>=0xc000)
- //printf("$%04x:$%02x, %d,%d\n",A,V,scanline,timestamp);
- switch(A)
- {
- case 0xc001:IRQLatch=V;break;
- case 0xc003:IRQCount=IRQLatch;IRQa|=2;break;
- case 0xe000:IRQa&=~1;IRQa|=V&1;X6502_IRQEnd(FCEU_IQEXT);break;
- case 0xc002:X6502_IRQEnd(FCEU_IQEXT);break;
- case 0xa000:VROM_BANK1(0x0000,V);break;
- case 0xa001:VROM_BANK1(0x0400,V);break;
- case 0xa002:VROM_BANK1(0x0800,V);break;
- case 0xa003:VROM_BANK1(0x0c00,V);break;
- case 0xa004:VROM_BANK1(0x1000,V);break;
- case 0xa005:VROM_BANK1(0x1400,V);break;
- case 0xa006:VROM_BANK1(0x1800,V);break;
- case 0xa007:VROM_BANK1(0x1c00,V);break;
- case 0x8000:ROM_BANK8(0x8000,V);break;
- case 0x8001:ROM_BANK8(0xa000,V);break;
- case 0x8002:ROM_BANK8(0xc000,V);break;
- case 0x8003:ROM_BANK8(0xe000,V);break;
- }
-}
-
-static void Mapper117_hb(void)
-{
- //if(scanline==0x40) X6502_IRQBegin(FCEU_IQEXT);
- //return;
- if(IRQa==3 && IRQCount)
- {
- IRQCount--;
- if(!IRQCount)
- {
- IRQa&=1;
- X6502_IRQBegin(FCEU_IQEXT);
- }
- }
-}
-
-void Mapper117_init(void)
-{
- GameHBIRQHook=Mapper117_hb;
- SetWriteHandler(0x8000,0xffff,Mapper117_write);
-}
-
IRQa=V&1;
IRQCount=IRQLatch;
break;
- case 0xB:IRQLatch&=0xFF00;
- IRQLatch|=V;
+ case 0xB:IRQLatch&=0xFF00; IRQLatch|=V;
break;
- case 0xC:IRQLatch&=0xFF;
- IRQLatch|=V<<8;
+ case 0xC:IRQLatch&=0xFF; IRQLatch|=V<<8;
break;
case 0xD: break;/* Serial EEPROM control port */
}
+++ /dev/null
-/* FCE Ultra - NES/Famicom Emulator
- *
- * Copyright notice for this file:
- * Copyright (C) 2003 Xodnizel
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "mapinc.h"
-
-static uint8 LastWr;
-static uint8 ExtMode;
-static uint8 cmd;
-static uint8 DRegs[8];
-static uint32 count=0;
-static uint32 last=0;
-static int safe=0;
-static uint8 poofish;
-
-static void Sync(void)
-{
- int x;
- uint32 base=0;
-
- if(cmd&0x80) base=0x1000;
- setchr2(0x0000^base,(0x100|DRegs[0])>>1);
- setchr2(0x0800^base,(0x100|DRegs[1])>>1);
- for(x=0;x<4;x++)
- setchr1((0x1000^base)+x*0x400,DRegs[2+x]);
-
- if(ExtMode&0x80)
- {
- if(ExtMode&0x20)
- setprg32(0x8000,(ExtMode&0x1F)>>1);
- else
- {
- setprg16(0x8000,(ExtMode&0x1F));
- setprg16(0xc000,(ExtMode&0x1F));
- }
- }
- else
- {
- setprg8(0x8000,DRegs[6]);
- setprg8(0xa000,DRegs[7]);
- setprg8(0xc000,~1);
- setprg8(0xe000,~0);
- }
-}
-
-static DECLFW(M187Write)
-{
-// FCEU_printf("Write: %04x:%04x (%04x,%d)\n",A,V,X.PC,scanline);
- LastWr=V;
- if(A==0x5000)
- ExtMode=V;
- Sync();
-}
-
-static DECLFW(M187HWrite)
-{
-// FCEU_printf("Write: %04x:%04x (%04x,%d)\n",A,V,X.PC,scanline);
- //if(A==0x8003 && X.PC<0x800) FCEUI_DumpMem("dmp",0x0000,0xFFFF);
- //printf("$%04x:$%02x, %04x\n",A,V,X.PC);
- LastWr=V;
-
- if(A==0x8003)
- {
-// if(V==0x28 || V==0x2A)
- poofish=V;
- }
- else if(A==0x8000) poofish=0;
-
- switch(A)
- {
- case 0xc000:IRQLatch=IRQCount=V;break;
- case 0xc001:IRQCount=IRQLatch;last=count=0;break;
- case 0xe000:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
- case 0xe001:IRQa=1;break;
- case 0xa000:MIRROR_SET(V&1);break;
-
- case 0x8000:cmd=V;safe=1;break;
- case 0x8001:
- if(safe)
- {
- //printf("Cmd: %d, %02x, %04x\n",cmd&0x7,V,X.PC);
- DRegs[cmd&7]=V;
- Sync();
- safe=0;
- }
- if(poofish==0x28)
- setprg8(0xC000,0x17);
- else if(poofish==0x2A)
- setprg8(0xA000,0x0F);
- break;
-
- }
-}
-
-static DECLFR(ProtRead)
-{
- switch(LastWr&0x3)
- {
- case 0x1:
- case 0x0: return(0x83);
- case 0x2: return(0x42);
- }
- return(0);
-}
-
-DECLFW(Write_IRQFM);
-
-static void M187Power(void)
-{
- Write_IRQFM(0x4017,0x40);
- SetWriteHandler(0x5000,0x5fff,M187Write);
- SetWriteHandler(0x8000,0xFFFF,M187HWrite);
- SetReadHandler(0x5000,0x5FFF,ProtRead);
- SetWriteHandler(0x6000,0x7FFF,M187Write);
- SetReadHandler(0x8000,0xffff,CartBR);
- Sync();
-}
-
-static void sl(void)
-{
- if(IRQa)
- {
- if(IRQCount>=0)
- {
- IRQCount--;
- if(IRQCount<0)
- {
- X6502_IRQBegin(FCEU_IQEXT);
- }
- }
- }
-}
-
-static void FP_FASTAPASS(1) foo(uint32 A)
-{
- if((A&0x2000) && !(last&0x2000))
- {
- count++;
- if(count==42)
- {
- sl();
- count=0;
- }
- }
- last=A;
-}
-
-void Mapper187_Init(CartInfo *info)
-{
- info->Power=M187Power;
-// GameHBIRQHook=sl;
- PPU_hook=foo;
-}
-
+++ /dev/null
-/* Is this an MMC3 workalike piece of hardware, with the addition of
- a register at $4120 or does it have only partial MMC3 functionality?
- A good test would be to see if commands 6 and 7 can change PRG banks
- and of course test the regs >=$c000, on the real cart.
-*/
-#include "mapinc.h"
-
-#define cmd mapbyte1[0]
-static DECLFW(Mapper189_write)
-{
- //if(A>=0xc000) printf("$%04x:$%02x\n",A,V);
- if((A&0xF100)==0x4100) ROM_BANK32(V>>4);
- else if((A&0xF100)==0x6100) ROM_BANK32(V&3);
- else switch(A&0xE001)
- {
- case 0xa000:MIRROR_SET(V&1);break;
- case 0x8000:cmd=V;break;
- case 0x8001:switch(cmd&7)
- {
- case 0:VROM_BANK2(0x0000,V>>1);break;
- case 1:VROM_BANK2(0x0800,V>>1);break;
- case 2:VROM_BANK1(0x1000,V);break;
- case 3:VROM_BANK1(0x1400,V);break;
- case 4:VROM_BANK1(0x1800,V);break;
- case 5:VROM_BANK1(0x1C00,V);break;
- }
- case 0xc000:IRQLatch=V;break;
- case 0xc001:IRQCount=IRQLatch;break;
- case 0xe000:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
- case 0xe001:IRQa=1;break;
- break;
-
- }
-}
-void m189irq(void)
-{
- if(IRQa)
- {
- if(IRQCount)
- {
- IRQCount--;
- if(!IRQCount) X6502_IRQBegin(FCEU_IQEXT);
- }
- }
-
-}
-void Mapper189_init(void)
-{
- GameHBIRQHook=m189irq;
- SetWriteHandler(0x4120,0xFFFF,Mapper189_write);
- SetReadHandler(0x6000,0x7FFF,0);
- ROM_BANK32(0);
-}
-
-
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 2003 CaH4e3\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-#include "mapinc.h"\r
-\r
-static DECLFW(Mapper204_write)\r
-{\r
- int tmp2=A&0x6;\r
- int tmp1=tmp2+((tmp2==0x6)?0:(A&1));\r
- MIRROR_SET((A>>4)&1);\r
- ROM_BANK16(0x8000,tmp1);\r
- ROM_BANK16(0xc000,tmp2+((tmp2==0x6)?1:(A&1)));\r
- VROM_BANK8(tmp1);\r
-}\r
-\r
-void Mapper204_init(void)\r
-{\r
- ROM_BANK32(~0);\r
- VROM_BANK8(~0);\r
- SetWriteHandler(0x8000,0xFFFF,Mapper204_write);\r
-}\r
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ * Copyright (C) 2003 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 DECLFW(Mapper204_write)
+{
+ int tmp2=A&0x6;
+ int tmp1=tmp2+((tmp2==0x6)?0:(A&1));
+ MIRROR_SET((A>>4)&1);
+ ROM_BANK16(0x8000,tmp1);
+ ROM_BANK16(0xc000,tmp2+((tmp2==0x6)?1:(A&1)));
+ VROM_BANK8(tmp1);
+}
+
+void Mapper204_init(void)
+{
+ ROM_BANK32(~0);
+ VROM_BANK8(~0);
+ SetWriteHandler(0x8000,0xFFFF,Mapper204_write);
+}
+++ /dev/null
-#include "mapinc.h"\r
-\r
-static uint8 mul[2];\r
-static uint8 regie;\r
-#define tkcom1 mapbyte1[1]\r
-#define tkcom2 mapbyte1[2]\r
-#define tkcom3 mapbyte1[3]\r
-\r
-#define prgb mapbyte2\r
-#define chr mapbyte3\r
-\r
-static uint16 names[4];\r
-static uint8 tekker;\r
-\r
-static DECLFR(tekread)\r
-{\r
-// FCEU_printf("READ READ READ: $%04x, $%04x, $%04x\n",A,X.PC,tekker);\r
- switch(A)\r
- {\r
- case 0x5000:return(tekker);\r
- case 0x5800:return(mul[0]*mul[1]);\r
- case 0x5801:return((mul[0]*mul[1])>>8);\r
- case 0x5803:return(regie);\r
- default:break;\r
- }\r
- return(X.DB);\r
-}\r
-\r
-static void mira(void)\r
-{\r
- int x;\r
- if(tkcom1&0x40) // Name tables are ROM-only\r
- {\r
- for(x=0;x<4;x++)\r
- setntamem(CHRptr[0]+(((names[x])&CHRmask1[0])<<10), 0, x);\r
- }\r
- else // Name tables can be RAM or ROM.\r
- {\r
- for(x=0;x<4;x++)\r
- {\r
- if(((tkcom3&0x80)==(names[x]&0x80))) // RAM selected.\r
- setntamem(NTARAM + ((names[x]&0x1)<<10),1,x);\r
- else\r
- setntamem(CHRptr[0]+(((names[x])&CHRmask1[0])<<10), 0, x);\r
- }\r
- }\r
-}\r
-\r
-static void tekprom(void)\r
-{\r
- switch(tkcom1&3)\r
- {\r
- case 1: // 16 KB\r
- ROM_BANK16(0x8000,prgb[0]);\r
- ROM_BANK16(0xC000,prgb[2]);\r
- break;\r
-\r
- case 2: //2 = 8 KB ??\r
- ROM_BANK8(0x8000,prgb[0]);\r
- ROM_BANK8(0xa000,prgb[1]);\r
- ROM_BANK8(0xc000,prgb[2]);\r
- ROM_BANK8(0xe000,~0);\r
- break;\r
- }\r
-}\r
-\r
-static void tekvrom(void)\r
-{\r
- int x;\r
- switch(tkcom1&0x18)\r
- {\r
- case 0x00: // 8KB\r
- setchr8(chr[0]);\r
- break;\r
- case 0x08: // 4KB\r
- for(x=0;x<8;x+=4)\r
- setchr4(x<<10,chr[x]);\r
- break;\r
- case 0x10: // 2KB\r
- for(x=0;x<8;x+=2)\r
- setchr2(x<<10,chr[x]);\r
- break;\r
- case 0x18: // 1KB\r
- for(x=0;x<8;x++)\r
- setchr1(x<<10,chr[x]);\r
- break;\r
- }\r
-}\r
-\r
-static DECLFW(Mapper211_write)\r
-{\r
- if(A==0x5800) mul[0]=V;\r
- else if(A==0x5801) mul[1]=V;\r
- else if(A==0x5803) regie=V;\r
-\r
- A&=0xF007;\r
- if(A>=0x8000 && A<=0x8003)\r
- {\r
- prgb[A&3]=V;\r
- tekprom();\r
- }\r
- else if(A>=0x9000 && A<=0x9007)\r
- {\r
- chr[A&7]=V;\r
- tekvrom();\r
- }\r
- else if(A>=0xb000 && A<=0xb007)\r
- {\r
- names[A&3]=V&3;\r
- mira();\r
- }\r
- else switch(A)\r
- {\r
- case 0xc002:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;\r
- case 0xc003:\r
- case 0xc004:if(!IRQa) {IRQa=1;IRQCount=IRQLatch;} break;\r
- case 0xc005:IRQCount=IRQLatch=V;\r
- X6502_IRQEnd(FCEU_IQEXT);break;\r
- case 0xd000: tkcom1=V; mira(); break;\r
- case 0xd001: tkcom3=V; mira(); break;\r
- }\r
-}\r
-\r
-static void Mapper211_hb(void)\r
-{\r
- if(IRQCount) IRQCount--;\r
- if(!IRQCount)\r
- {\r
- if(IRQa) X6502_IRQBegin(FCEU_IQEXT);\r
- IRQa=0;\r
- }\r
-}\r
-static void togglie()\r
-{\r
- tekker^=0xFF;\r
-}\r
-\r
-void Mapper211_init(void)\r
-{\r
- tekker=0xFF;\r
- MapperReset=togglie;\r
- SetWriteHandler(0x5000,0xffff,Mapper211_write);\r
- SetReadHandler(0x5000,0x5fff,tekread);\r
- GameHBIRQHook=Mapper211_hb;\r
-}\r
-\r
-#include "mapinc.h"\r
-\r
-static DECLFW(Mapper212_write)\r
-{\r
- if((A&0x4000)==0x4000)\r
- {\r
- ROM_BANK32((A&6)>>1);\r
- }\r
- else\r
- {\r
- ROM_BANK16(0x8000,A&7);\r
- ROM_BANK16(0xc000,A&7);\r
- }\r
- VROM_BANK8(A&7);\r
- MIRROR_SET((A>>3)&1);\r
-}\r
-\r
-void Mapper212_init(void)\r
-{\r
- ROM_BANK32(~0);\r
- VROM_BANK8(~0);\r
- SetWriteHandler(0x8000,0xFFFF,Mapper212_write);\r
-}\r
+#include "mapinc.h"
+
+static DECLFW(Mapper212_write)
+{
+ if((A&0x4000)==0x4000)
+ {
+ ROM_BANK32((A&6)>>1);
+ }
+ else
+ {
+ ROM_BANK16(0x8000,A&7);
+ ROM_BANK16(0xc000,A&7);
+ }
+ VROM_BANK8(A&7);
+ MIRROR_SET((A>>3)&1);
+}
+
+void Mapper212_init(void)
+{
+ ROM_BANK32(~0);
+ VROM_BANK8(~0);
+ SetWriteHandler(0x8000,0xFFFF,Mapper212_write);
+}
-#include "mapinc.h"\r
-\r
-static DECLFW(Mapper213_write)\r
-{\r
- ROM_BANK32((A>>1)&3);\r
- VROM_BANK8((A>>3)&7);\r
-}\r
-\r
-void Mapper213_init(void)\r
-{\r
- ROM_BANK32(0);\r
- VROM_BANK8(0);\r
- SetWriteHandler(0x8000,0xFFFF,Mapper213_write);\r
-}\r
+#include "mapinc.h"
+
+static DECLFW(Mapper213_write)
+{
+ ROM_BANK32((A>>1)&3);
+ VROM_BANK8((A>>3)&7);
+}
+
+void Mapper213_init(void)
+{
+ ROM_BANK32(0);
+ VROM_BANK8(0);
+ SetWriteHandler(0x8000,0xFFFF,Mapper213_write);
+}
-#include "mapinc.h"\r
-\r
-static DECLFW(Mapper214_write)\r
-{\r
-// FCEU_printf("%02x:%02x\n",A,V);\r
- ROM_BANK16(0x8000,(A>>2)&3);\r
- ROM_BANK16(0xC000,(A>>2)&3);\r
- VROM_BANK8(A&3);\r
-}\r
-\r
-void Mapper214_init(void)\r
-{\r
- ROM_BANK16(0x8000,0);\r
- ROM_BANK16(0xC000,0);\r
- VROM_BANK8(0);\r
- SetWriteHandler(0x8000,0xFFFF,Mapper214_write);\r
-}\r
+#include "mapinc.h"
+
+static DECLFW(Mapper214_write)
+{
+// FCEU_printf("%02x:%02x\n",A,V);
+ ROM_BANK16(0x8000,(A>>2)&3);
+ ROM_BANK16(0xC000,(A>>2)&3);
+ VROM_BANK8(A&3);
+}
+
+void Mapper214_init(void)
+{
+ ROM_BANK16(0x8000,0);
+ ROM_BANK16(0xC000,0);
+ VROM_BANK8(0);
+ SetWriteHandler(0x8000,0xFFFF,Mapper214_write);
+}
mapbyte1[0]=mapbyte1[1]=0xF;
ROM_BANK32(0);
VROM_BANK8(0);
- SetWriteHandler(0x5800,0x5FFF,Mapper255_wl);
+ SetWriteHandler(0x5800,0x5FF0,Mapper255_wl);
SetWriteHandler(0x8000,0xffff,Mapper255_write);
SetReadHandler(0x5800,0x5FFF,Mapper255_read);
}
-#include "mapinc.h"\r
-\r
-static uint32 regchr[9];\r
-\r
-static DECLFW(Mapper27_write)\r
-{\r
- A&=0xF00F;\r
- int regnum;\r
- if((A>=0xB000) && (A<=0xE003)) {\r
- regnum=((((A>>12)+1)&0x03)<<1)|((A&0x02)>>1);\r
- if(A&1)\r
- regchr[regnum]=(regchr[regnum]&0x0F)|(V<<4);\r
- else\r
- regchr[regnum]=(regchr[regnum]&0xFF0)|(V&0xF);\r
- VROM_BANK1(regnum<<10,regchr[regnum]);\r
- }\r
- switch(A)\r
- {\r
- case 0x8000: if(regchr[8]&2)\r
- ROM_BANK8(0xc000,V);\r
- else\r
- ROM_BANK8(0x8000,V);\r
- break;\r
- case 0xA000: ROM_BANK8(0xa000,V); break;\r
- case 0x9000:\r
- switch(V&3){\r
- case 0:setmirror(MI_V);break;\r
- case 1:setmirror(MI_H);break;\r
- case 2:setmirror(MI_0);break;\r
- case 3:setmirror(MI_1);break;\r
- }\r
- case 0x9002: regchr[8]=V; break;\r
- case 0xF000: //X6502_IRQEnd(FCEU_IQEXT);\r
- IRQLatch=(IRQLatch&0xF0)|(V&0x0F);\r
- break;\r
- case 0xF001: //X6502_IRQEnd(FCEU_IQEXT);\r
- IRQLatch=(IRQLatch&0x0F)|((V&0xF)<<4);\r
- break;\r
- case 0xF003: IRQa=((IRQa&0x1)<<1)|(IRQa&0x1);\r
- X6502_IRQEnd(FCEU_IQEXT);\r
- break;\r
- case 0xF002: IRQa=V&3;\r
- if(IRQa&0x02) IRQCount=IRQLatch;\r
- X6502_IRQEnd(FCEU_IQEXT);\r
- break;\r
- }\r
-// if((A&0xF000)==0xF000) FCEU_printf("$%04x:$%02x, %d\n",A,V, scanline);\r
-}\r
-\r
-static void Mapper27_hb(void)\r
-{\r
-// FCEU_printf("%02x-%d,%d,%d\n",scanline,IRQa,IRQCount,IRQLatch);\r
- if(IRQa&0x2){\r
- if(IRQCount==0xFF){\r
- X6502_IRQBegin(FCEU_IQEXT);\r
- IRQCount=IRQLatch+1;\r
- } else {\r
- IRQCount++;\r
- }\r
- }\r
-}\r
-\r
-void Mapper27_init(void)\r
-{\r
- int i;\r
- for (i=0; i<9; i++) {\r
- regchr[i]=0;\r
- }\r
- IRQa=0;\r
- IRQCount=IRQLatch=0;\r
- SetWriteHandler(0x8000,0xffff,Mapper27_write);\r
- GameHBIRQHook=Mapper27_hb;\r
-}\r
-\r
+#include "mapinc.h"
+
+static uint32 regchr[9];
+
+static DECLFW(Mapper27_write)
+{
+ A&=0xF00F;
+ int regnum;
+ if((A>=0xB000) && (A<=0xE003)) {
+ regnum=((((A>>12)+1)&0x03)<<1)|((A&0x02)>>1);
+ if(A&1)
+ regchr[regnum]=(regchr[regnum]&0x0F)|(V<<4);
+ else
+ regchr[regnum]=(regchr[regnum]&0xFF0)|(V&0xF);
+ VROM_BANK1(regnum<<10,regchr[regnum]);
+ }
+ switch(A)
+ {
+ case 0x8000: if(regchr[8]&2)
+ ROM_BANK8(0xc000,V);
+ else
+ ROM_BANK8(0x8000,V);
+ break;
+ case 0xA000: ROM_BANK8(0xa000,V); break;
+ case 0x9000:
+ switch(V&3){
+ case 0:setmirror(MI_V);break;
+ case 1:setmirror(MI_H);break;
+ case 2:setmirror(MI_0);break;
+ case 3:setmirror(MI_1);break;
+ }
+ case 0x9002: regchr[8]=V; break;
+ case 0xF000: //X6502_IRQEnd(FCEU_IQEXT);
+ IRQLatch=(IRQLatch&0xF0)|(V&0x0F);
+ break;
+ case 0xF001: //X6502_IRQEnd(FCEU_IQEXT);
+ IRQLatch=(IRQLatch&0x0F)|((V&0xF)<<4);
+ break;
+ case 0xF003: IRQa=((IRQa&0x1)<<1)|(IRQa&0x1);
+ X6502_IRQEnd(FCEU_IQEXT);
+ break;
+ case 0xF002: IRQa=V&3;
+ if(IRQa&0x02) IRQCount=IRQLatch;
+ X6502_IRQEnd(FCEU_IQEXT);
+ break;
+ }
+// if((A&0xF000)==0xF000) FCEU_printf("$%04x:$%02x, %d\n",A,V, scanline);
+}
+
+static void Mapper27_hb(void)
+{
+// FCEU_printf("%02x-%d,%d,%d\n",scanline,IRQa,IRQCount,IRQLatch);
+ if(IRQa&0x2){
+ if(IRQCount==0xFF){
+ X6502_IRQBegin(FCEU_IQEXT);
+ IRQCount=IRQLatch+1;
+ } else {
+ IRQCount++;
+ }
+ }
+}
+
+void Mapper27_init(void)
+{
+ int i;
+ for (i=0; i<9; i++) {
+ regchr[i]=0;
+ }
+ IRQa=0;
+ IRQCount=IRQLatch=0;
+ SetWriteHandler(0x8000,0xffff,Mapper27_write);
+ GameHBIRQHook=Mapper27_hb;
+}
+
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- * Copyright (C) 2002 Xodnizel\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-#include "mapinc.h"\r
-\r
-static uint8 FFEmode;\r
-\r
-#define FVRAM_BANK8(A,V) {VPage[0]=VPage[1]=VPage[2]=VPage[3]=VPage[4]=VPage[5]=VPage[6]=VPage[7]=V?&MapperExRAM[(V)<<13]-(A):&CHRRAM[(V)<<13]-(A);CHRBankList[0]=((V)<<3);CHRBankList[1]=((V)<<3)+1;CHRBankList[2]=((V)<<3)+2;CHRBankList[3]=((V)<<3)+3;CHRBankList[4]=((V)<<3)+4;CHRBankList[5]=((V)<<3)+5;CHRBankList[6]=((V)<<3)+6;CHRBankList[7]=((V)<<3)+7;PPUCHRRAM=0xFF;}\r
-\r
-static void FP_FASTAPASS(1) FFEIRQHook(int a)\r
-{\r
- if(IRQa)\r
- {\r
- IRQCount+=a;\r
- if(IRQCount>=0x10000)\r
- {\r
- X6502_IRQBegin(FCEU_IQEXT);\r
- IRQa=0;\r
- IRQCount=0;\r
- }\r
- }\r
-}\r
-\r
-DECLFW(Mapper6_write)\r
-{\r
- if(A<0x8000)\r
- {\r
- switch(A){\r
- case 0x42FF:MIRROR_SET((V>>4)&1);break;\r
- case 0x42FE:onemir((V>>3)&2); FFEmode=V&0x80;break;\r
- case 0x4501:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;\r
- case 0x4502:IRQCount&=0xFF00;IRQCount|=V;break;\r
- case 0x4503:IRQCount&=0xFF;IRQCount|=V<<8;IRQa=1;break;\r
- }\r
- } else {\r
- switch (FFEmode)\r
- {\r
- case 0x80: setchr8(V); break;\r
- default: ROM_BANK16(0x8000,V>>2);\r
- FVRAM_BANK8(0x0000,V&3);\r
- }\r
- }\r
-}\r
-void Mapper6_StateRestore(int version)\r
-{\r
- int x;\r
- for(x=0;x<8;x++)\r
- if(PPUCHRRAM&(1<<x))\r
- {\r
- if(CHRBankList[x]>7)\r
- VPage[x]=&MapperExRAM[(CHRBankList[x]&31)*0x400]-(x*0x400);\r
- else VPage[x]=&CHRRAM[(CHRBankList[x]&7)*0x400]-(x*0x400);\r
- }\r
-}\r
-void Mapper6_init(void)\r
-{\r
-MapIRQHook=FFEIRQHook;\r
-ROM_BANK16(0xc000,7);\r
-\r
-SetWriteHandler(0x4020,0x5fff,Mapper6_write);\r
-SetWriteHandler(0x8000,0xffff,Mapper6_write);\r
-MapStateRestore=Mapper6_StateRestore;\r
-}\r
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ * Copyright (C) 2002 Xodnizel
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "mapinc.h"
+
+static uint8 FFEmode;
+
+#define FVRAM_BANK8(A,V) {VPage[0]=VPage[1]=VPage[2]=VPage[3]=VPage[4]=VPage[5]=VPage[6]=VPage[7]=V?&MapperExRAM[(V)<<13]-(A):&CHRRAM[(V)<<13]-(A);CHRBankList[0]=((V)<<3);CHRBankList[1]=((V)<<3)+1;CHRBankList[2]=((V)<<3)+2;CHRBankList[3]=((V)<<3)+3;CHRBankList[4]=((V)<<3)+4;CHRBankList[5]=((V)<<3)+5;CHRBankList[6]=((V)<<3)+6;CHRBankList[7]=((V)<<3)+7;PPUCHRRAM=0xFF;}
+
+static void FP_FASTAPASS(1) FFEIRQHook(int a)
+{
+ if(IRQa)
+ {
+ IRQCount+=a;
+ if(IRQCount>=0x10000)
+ {
+ X6502_IRQBegin(FCEU_IQEXT);
+ IRQa=0;
+ IRQCount=0;
+ }
+ }
+}
+
+DECLFW(Mapper6_write)
+{
+ if(A<0x8000)
+ {
+ switch(A){
+ case 0x42FF:MIRROR_SET((V>>4)&1);break;
+ case 0x42FE:onemir((V>>3)&2); FFEmode=V&0x80;break;
+ case 0x4501:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
+ case 0x4502:IRQCount&=0xFF00;IRQCount|=V;break;
+ case 0x4503:IRQCount&=0xFF;IRQCount|=V<<8;IRQa=1;break;
+ }
+ } else {
+ switch (FFEmode)
+ {
+ case 0x80: setchr8(V); break;
+ default: ROM_BANK16(0x8000,V>>2);
+ FVRAM_BANK8(0x0000,V&3);
+ }
+ }
+}
+void Mapper6_StateRestore(int version)
+{
+ int x;
+ for(x=0;x<8;x++)
+ if(PPUCHRRAM&(1<<x))
+ {
+ if(CHRBankList[x]>7)
+ VPage[x]=&MapperExRAM[(CHRBankList[x]&31)*0x400]-(x*0x400);
+ else VPage[x]=&CHRRAM[(CHRBankList[x]&7)*0x400]-(x*0x400);
+ }
+}
+void Mapper6_init(void)
+{
+MapIRQHook=FFEIRQHook;
+ROM_BANK16(0xc000,7);
+
+SetWriteHandler(0x4020,0x5fff,Mapper6_write);
+SetWriteHandler(0x8000,0xffff,Mapper6_write);
+MapStateRestore=Mapper6_StateRestore;
+}
static DECLFW(Mapper62_write)
{
VROM_BANK8(((A&0x1F)<<2)|(V&0x03));
- if((A&0x20)>>5) {
+ if(A&0x20) {
ROM_BANK16(0x8000,(A&0x40)|((A>>8)&0x3F));
ROM_BANK16(0xc000,(A&0x40)|((A>>8)&0x3F));
}
DECLFW(Mapper68_write)
{
+// FCEU_printf("%04x,%04x\n",A,V);
A&=0xF000;
if(A>=0x8000 && A<=0xB000)
static void m83chr(void)
{
- int x;
- for(x=0;x<8;x++)
- VROM_BANK1(x*0x400,mapbyte2[x]|((mapbyte1[0]&0x30)<<4));
+// if(0)
+// {
+// VROM_BANK2(0x0000,mapbyte2[0]);
+// VROM_BANK2(0x0800,mapbyte2[1]);
+// VROM_BANK2(0x1000,mapbyte2[6]);
+// VROM_BANK2(0x1800,mapbyte2[7]);
+// }
+// else
+// {
+ int x;
+ for(x=0;x<8;x++)
+ VROM_BANK1(x*0x400,mapbyte2[x]|((mapbyte1[0]&0x30)<<4));
+// }
}
static DECLFW(Mapper83_write)
}
break;
case 0x8100:
+ mapbyte3[0]=V&0x80;
switch(V&0x3)
{
case 0x00:MIRROR_SET2(1);break;
}
break;
case 0x8200:IRQCount&=0xFF00;IRQCount|=V;X6502_IRQEnd(FCEU_IQEXT);break;
- case 0x8201:IRQa=1;IRQCount&=0xFF;IRQCount|=V<<8;break;
+ case 0x8201:IRQa=mapbyte3[0];IRQCount&=0xFF;IRQCount|=V<<8;break;
case 0x8300:ROM_BANK8(0x8000,V);break;
case 0x8301:ROM_BANK8(0xA000,V);break;
case 0x8302:ROM_BANK8(0xC000,V);break;
+++ /dev/null
-/* FCE Ultra - NES/Famicom Emulator
- *
- * Copyright notice for this file:
- * Copyright (C) 2002 Xodnizel
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "mapinc.h"
-
-static int mn;
-static DECLFW(Mapper88_write)
-{
- //if(A>=0x8002 || A<0x8000)
- //if(A==0xc000)
- // printf("$%04x:$%02x\n",A,V);
- switch(A&0x8001) //&0xc001)
- {
- case 0x8000:mapbyte1[0]=V;
- if(mn)
- onemir((V>>6)&1);
- break;
- case 0x8001:
- switch(mapbyte1[0]&7)
- {
- case 0:VROM_BANK2(0,V>>1);break;
- case 1:VROM_BANK2(0x800,V>>1);break;
- case 2:VROM_BANK1(0x1000,V|0x40);break;
- case 3:VROM_BANK1(0x1400,V|0x40);break;
- case 4:VROM_BANK1(0x1800,V|0x40);break;
- case 5:VROM_BANK1(0x1c00,V|0x40);break;
- case 6:ROM_BANK8(0x8000,V);break;
- case 7:ROM_BANK8(0xA000,V);break;
- }
- break;
-
- }
-}
-
-void Mapper88_init(void)
-{
- mn=0;
- SetWriteHandler(0x8000,0xffff,Mapper88_write);
-}
-
-void Mapper154_init(void)
-{
- mn=1;
- SetWriteHandler(0x8000,0xffff,Mapper88_write);
-}
+++ /dev/null
-/* FCE Ultra - NES/Famicom Emulator
- *
- * Copyright notice for this file:
- * Copyright (C) 2002 Xodnizel
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "mapinc.h"
-
-static uint8 lastA;
-static uint8 DRegs[8];
-static uint8 cmd;
-static uint8 MirCache[8];
-
-static SFORMAT DB_StateRegs[]={
- {DRegs, 8, "DREG"},
- {&cmd, 1, "CMD"},
- {&lastA, 1, "LAST"},
- {0}
-};
-
-static void FP_FASTAPASS(1) dragonbust_ppu(uint32 A)
-{
- static int last=-1;
- static uint8 z;
-
- if(A>=0x2000) return;
-
- A>>=10;
-
- lastA=A;
-
- z=MirCache[A];
- if(z!=last)
- {
- onemir(z);
- last=z;
- }
-}
-
-static void toot(void)
-{
- int x;
-
- MirCache[0]=MirCache[1]=(DRegs[0]>>4)&1;
- MirCache[2]=MirCache[3]=(DRegs[1]>>4)&1;
-
- for(x=0;x<4;x++)
- MirCache[4+x]=(DRegs[2+x]>>5)&1;
- onemir(MirCache[lastA]);
-}
-
-static DECLFW(Mapper95_write)
-{
- switch(A&0xF001)
- {
-
- case 0x8000:
- cmd = V;
- break;
-
- case 0x8001:
- switch(cmd&0x07)
- {
- case 0: DRegs[0]=(V&0x3F)>>1;toot();V>>=1;setchr2(0x0000,V&0x1F);break;
- case 1: DRegs[1]=(V&0x3F)>>1;toot();V>>=1;setchr2(0x0800,V&0x1F);break;
- case 2: DRegs[2]=V&0x3F;toot();setchr1(0x1000,V&0x1F); break;
- case 3: DRegs[3]=V&0x3F;toot();setchr1(0x1400,V&0x1F); break;
- case 4: DRegs[4]=V&0x3F;toot();setchr1(0x1800,V&0x1F); break;
- case 5: DRegs[5]=V&0x3F;toot();setchr1(0x1C00,V&0x1F); break;
- case 6: DRegs[6]=V&0x3F;
- setprg8(0x8000,V);
- break;
- case 7: DRegs[7]=V&0x3F;
- setprg8(0xA000,V);
- break;
- }
- break;
- }
-}
-
-static void DBSync()
-{
- int x;
-
- setchr2(0x0000,DRegs[0]);
- setchr2(0x0800,DRegs[1]);
-
- for(x=0;x<4;x++)
- setchr1(0x1000+x*0x400,DRegs[2+x]);
-
- setprg8(0x8000,DRegs[6]);
- setprg8(0xa000,DRegs[7]);
- toot();
-}
-
-static void DBPower(void)
-{
- memset(DRegs,0x3F,8);
- DRegs[0]=DRegs[1]=0x1F;
-
- DBSync();
-
- setprg8(0xc000,0x3E);
- setprg8(0xe000,0x3F);
-
- SetReadHandler(0x8000,0xffff,CartBR);
- SetWriteHandler(0x8000,0xffff,Mapper95_write);
-}
-
-static void StateRestore(int version)
-{
- DBSync();
-}
-
-void Mapper95_Init(CartInfo *info)
-{
- info->Power=DBPower;
- AddExState(DB_StateRegs, ~0, 0, 0);
- PPU_hook=dragonbust_ppu;
- GameStateRestore=StateRestore;
-}
-
-MOBJS += mappers/6.o mappers/8.o mappers/15.o mappers/16.o mappers/17.o mappers/18.o mappers/21.o mappers/22.o
-MOBJS += mappers/23.o mappers/24and26.o mappers/25.o mappers/27.o mappers/32.o mappers/33.o mappers/40.o
-MOBJS += mappers/41.o mappers/42.o mappers/43.o mappers/46.o mappers/50.o mappers/51.o mappers/57.o mappers/58.o
-MOBJS += mappers/59.o mappers/60.o mappers/61.o mappers/62.o mappers/65.o mappers/67.o mappers/68.o mappers/69.o
-MOBJS += mappers/71.o mappers/72.o mappers/73.o mappers/75.o mappers/76.o mappers/77.o mappers/79.o mappers/80.o
-MOBJS += mappers/82.o mappers/83.o mappers/85.o mappers/86.o mappers/88.o mappers/89.o mappers/91.o mappers/92.o
-MOBJS += mappers/95.o mappers/97.o mappers/99.o mappers/113.o mappers/117.o mappers/151.o mappers/180.o mappers/183.o
-MOBJS += mappers/184.o mappers/187.o mappers/189.o mappers/193.o mappers/200.o mappers/201.o mappers/202.o mappers/203.o
-MOBJS += mappers/204.o mappers/208.o mappers/211.o mappers/212.o mappers/213.o mappers/214.o mappers/215.o
-MOBJS += mappers/217.o mappers/225.o mappers/226.o mappers/227.o mappers/228.o mappers/229.o mappers/230.o mappers/231.o
-MOBJS += mappers/232.o mappers/234.o mappers/235.o mappers/240.o mappers/241.o mappers/242.o mappers/244.o mappers/246.o
-MOBJS += mappers/255.o mappers/emu2413.o mappers/mmc2and4.o mappers/simple.o
+MM_C += mappers/113.c
+MM_C += mappers/15.c
+MM_C += mappers/151.c
+MM_C += mappers/16.c
+MM_C += mappers/17.c
+MM_C += mappers/18.c
+MM_C += mappers/180.c
+MM_C += mappers/183.c
+MM_C += mappers/184.c
+MM_C += mappers/193.c
+MM_C += mappers/200.c
+MM_C += mappers/201.c
+MM_C += mappers/202.c
+MM_C += mappers/203.c
+MM_C += mappers/204.c
+MM_C += mappers/21.c
+MM_C += mappers/212.c
+MM_C += mappers/213.c
+MM_C += mappers/214.c
+MM_C += mappers/215.c
+MM_C += mappers/217.c
+MM_C += mappers/22.c
+MM_C += mappers/225.c
+MM_C += mappers/226.c
+MM_C += mappers/227.c
+MM_C += mappers/228.c
+MM_C += mappers/229.c
+MM_C += mappers/23.c
+MM_C += mappers/230.c
+MM_C += mappers/231.c
+MM_C += mappers/232.c
+MM_C += mappers/234.c
+MM_C += mappers/240.c
+MM_C += mappers/241.c
+MM_C += mappers/242.c
+MM_C += mappers/244.c
+MM_C += mappers/246.c
+MM_C += mappers/24and26.c
+MM_C += mappers/25.c
+MM_C += mappers/255.c
+MM_C += mappers/27.c
+MM_C += mappers/32.c
+MM_C += mappers/33.c
+MM_C += mappers/40.c
+MM_C += mappers/41.c
+MM_C += mappers/42.c
+MM_C += mappers/43.c
+MM_C += mappers/46.c
+MM_C += mappers/50.c
+MM_C += mappers/51.c
+MM_C += mappers/59.c
+MM_C += mappers/6.c
+MM_C += mappers/60.c
+MM_C += mappers/61.c
+MM_C += mappers/62.c
+MM_C += mappers/65.c
+MM_C += mappers/67.c
+MM_C += mappers/68.c
+MM_C += mappers/69.c
+MM_C += mappers/71.c
+MM_C += mappers/72.c
+MM_C += mappers/73.c
+MM_C += mappers/75.c
+MM_C += mappers/76.c
+MM_C += mappers/77.c
+MM_C += mappers/79.c
+MM_C += mappers/8.c
+MM_C += mappers/80.c
+MM_C += mappers/82.c
+MM_C += mappers/83.c
+MM_C += mappers/85.c
+MM_C += mappers/86.c
+MM_C += mappers/89.c
+MM_C += mappers/91.c
+MM_C += mappers/92.c
+MM_C += mappers/97.c
+MM_C += mappers/99.c
+MM_C += mappers/emu2413.c
+MM_C += mappers/mmc2and4.c
+MM_C += mappers/simple.c
+
+MOBJS += $(patsubst %.c,%.o,$(MM_C))
#include "../sound.h"
#include "../state.h"
#include "../svga.h"
-#include "../dprintf.h"
#include <string.h>
static uint8 latche;
-//static DECLFW(Mapper2_write)
-//{
-// latche=V;
-// ROM_BANK16(0x8000,V);
-//}
-//
-//void Mapper2_init(void)
-//{
-// SetWriteHandler(0x8000,0xFFFF,Mapper2_write);
-// AddExState(&latche, 1, 0, "LATC");
-//}
-
-//static DECLFW(Mapper3_write)
-//{
-// VROM_BANK8(V);
-// latche=V;
-//}
-
-//void Mapper3_init(void)
-//{
-// SetWriteHandler(0x8000,0xFFFF,Mapper3_write);
-// AddExState(&latche, 1, 0, "LATC");
-//}
-
-static DECLFW(Mapper7_write)
-{
-// FCEU_printf("%04x,%04x\n",A,V);
- ROM_BANK32(V&0xF);
- onemir((V>>4)&1);
- latche=V;
-}
-
-void Mapper7_init(void)
-{
- onemir(0);
- ROM_BANK32(0);
- SetWriteHandler(0x8000,0xFFFF,Mapper7_write);
- AddExState(&latche, 1, 0, "LATC");
-}
-
-static DECLFW(Mapper11_write)
-{
- ROM_BANK32(V&0xF);
- VROM_BANK8(V>>4);
- latche=V;
-}
-
-void Mapper11_init(void)
-{
- ROM_BANK32(0);
- SetWriteHandler(0x8000,0xFFFF,Mapper11_write);
- AddExState(&latche, 1, 0, "LATC");
-}
-void Mapper144_init(void)
-{
- ROM_BANK32(0);
- SetWriteHandler(0x8001,0xFFFF,Mapper11_write);
- AddExState(&latche, 1, 0, "LATC");
-
-}
-//static DECLFW(Mapper13_write)
-//{
-// setchr4r(0x10,0x1000,V&3);
-// setprg32(0x8000,(V>>4)&3);
-// latche=V;
-//}
-
-//static void Mapper13_StateRestore(int version)
-//{
-// setchr4r(0x10,0x0000,0);
-// setchr4r(0x10,0x1000,latche&3);
-// setprg32(0x8000,(latche>>4)&3);
-//}
-
-//void Mapper13_init(void)
-//{
-// SetWriteHandler(0x8000,0xFFFF,Mapper13_write);
-// GameStateRestore=Mapper13_StateRestore;
-// AddExState(&latche, 1, 0, "LATC");
-// AddExState(MapperExRAM, 16384, 0, "CHRR");
-// SetupCartCHRMapping(0x10, MapperExRAM, 16384, 1);
-// latche=0;
-// Mapper13_StateRestore(FCEU_VERSION_NUMERIC);
-//}
-
static DECLFW(Mapper34_write)
{
switch(A)
SetWriteHandler(0x7ffd,0xffff,Mapper34_write);
}
-DECLFW(Mapper66_write)
-{
- VROM_BANK8(V&0xF);
- ROM_BANK32((V>>4));
- latche=V;
-}
-
-void Mapper66_init(void)
-{
- ROM_BANK32(0);
- SetWriteHandler(0x6000,0xffff,Mapper66_write);
- AddExState(&latche, 1, 0, "LATC");
-}
-
-DECLFW(Mapper152_write)
-{
- ROM_BANK16(0x8000,(V>>4)&0x7);
- VROM_BANK8(V&0xF);
- onemir((V>>7)&1); /* Saint Seiya...hmm. */
- latche=V;
-}
-
-void Mapper152_init(void)
-{
- onemir(0);
- SetWriteHandler(0x6000,0xffff,Mapper152_write);
- AddExState(&latche, 1, 0, "LATC");
-}
-
-static DECLFW(Mapper70_write)
-{
- ROM_BANK16(0x8000,V>>4);
- VROM_BANK8(V&0xF);
- latche=V;
-}
-
-void Mapper70_init(void)
-{
- SetWriteHandler(0x6000,0xffff,Mapper70_write);
- AddExState(&latche, 1, 0, "LATC");
-}
-/* Should be two separate emulation functions for this "mapper". Sigh. URGE TO KILL RISING. */
-static DECLFW(Mapper78_write)
-{
- //printf("$%04x:$%02x\n",A,V&0x8);
- ROM_BANK16(0x8000,V&0x7);
- VROM_BANK8(V>>4);
- onemir((V>>3)&1);
- latche=V;
-}
-
-void Mapper78_init(void)
-{
- SetWriteHandler(0x8000,0xffff,Mapper78_write);
- AddExState(&latche, 1, 0, "LATC");
-}
-
-DECLFW(Mapper87_write)
-{
- VROM_BANK8(V>>1);
- latche=V;
-}
-
-void Mapper87_init(void)
-{
- SetWriteHandler(0x6000,0xffff,Mapper87_write);
- AddExState(&latche, 1, 0, "LATC");
-}
-
-DECLFW(Mapper93_write)
-{
- ROM_BANK16(0x8000,V>>4);
- MIRROR_SET(V&1);
- latche=V;
-}
-
-void Mapper93_init(void)
-{
- SetWriteHandler(0x8000,0xffff,Mapper93_write);
- AddExState(&latche, 1, 0, "LATC");
-}
-
-
-DECLFW(Mapper94_write)
-{
- ROM_BANK16(0x8000,V>>2);
- latche=V;
-}
-
-void Mapper94_init(void)
-{
- SetWriteHandler(0x8000,0xffff,Mapper94_write);
- AddExState(&latche, 1, 0, "LATC");
-}
-
/* I might want to add some code to the mapper 96 PPU hook function
to not change CHR banks if the attribute table is being accessed,
if I make emulation a little more accurate in the future.
GameStateRestore=M96Sync;
}
-static DECLFW(Mapper140_write)
-{
- VROM_BANK8(V&0xF);
- ROM_BANK32((V>>4)&0xF);
-}
-
-void Mapper140_init(void)
-{
- ROM_BANK32(0);
- SetWriteHandler(0x6000,0x7FFF,Mapper140_write);
-}
-
-static void M185Sync(int version)
-{
-// on off
-//1 0x0F, 0xF0 - Bird Week
-//2 0x33, 0x00 - B-Wings
-//3 0x11, 0x00 - Mighty Bomb Jack
-//4 0x22, 0x20 - Sansuu 1 Nen, Sansuu 2 Nen
-//5 0xFF, 0x00 - Sansuu 3 Nen
-//6 0x21, 0x13 - Spy vs Spy
-
-// if((mapbyte1[0]&3)==1) // 6, 3
-// if(mapbyte1[0]&1) // 1, 2, 3, 5
-// if(mapbyte1[0]&2) // 1, 2, 4, 5,
- if((mapbyte1[0]&2)||((mapbyte1[0]&3)==1)) // 1, 2, 3, 4, 5
- setchr8(0);
- else
- setchr8r(0x10,0);
-}
-
-static DECLFW(Mapper185_write)
-{
- mapbyte1[0]=V;
- M185Sync(0);
-}
-
-void Mapper185_init(void)
-{
- int x;
- for(x=0;x<8192;x++)
- MapperExRAM[x]=0xff;
- MapStateRestore=M185Sync;
- mapbyte1[0]=0;
- M185Sync(0);
- SetupCartCHRMapping(0x10,MapperExRAM,8192,0);
- SetWriteHandler(0x8000,0xFFFF,Mapper185_write);
-}
-
-
static DECLFW(M156Write)
{
if(A>=0xc000 && A<=0xC003)
onemir(0);
SetWriteHandler(0xc000,0xc010,M156Write);
}
-
-static DECLFW(m107w)
-{
- ROM_BANK32((V>>1)&0x3);
- VROM_BANK8(V&0x7);
-}
-
-void Mapper107_init(void)
-{
- SetWriteHandler(0x8000,0xffff,m107w);
-}
-
void FrameSoundUpdate(void);
void FixOldSaveStateSFreq(void);
+DECLFW(Write_IRQFM);
+
{ "SA-0037", SA0037_Init,0},\r
{ "SA-NROM", TCA01_Init,0},\r
\r
- { "H2288", UNLH2288_Init,0},\r
- { "8237", UNL8237_Init,0},\r
-\r
// /* AVE carts. */\r
// { "MB-91", MB91_Init,0}, // DeathBots\r
// { "NINA-06", NINA06_Init,0}, // F-15 City War\r
// { "NINA-03", NINA03_Init,0}, // Tiles of Fate\r
// { "NINA-001", NINA001_Init,0}, // Impossible Mission 2\r
\r
+ { "ANROM", ANROM_Init,0},\r
+\r
{ "HKROM", HKROM_Init,0},\r
\r
{ "EWROM", EWROM_Init,0},\r
\r
{ "CPROM", CPROM_Init,BMCFLAG_16KCHRR},\r
{ "CNROM", CNROM_Init,0},\r
- { "GNROM", GNROM_Init,0},\r
- { "NROM", NROM256_Init,0 },\r
- { "RROM", NROM128_Init,0 },\r
- { "RROM-128", NROM128_Init,0 },\r
- { "NROM-128", NROM128_Init,0 },\r
- { "NROM-256", NROM256_Init,0 },\r
+ { "NROM", NROM_Init,0 }, //NROM256_Init,0 },\r
+ { "NROM-128", NROM_Init,0 }, //NROM128_Init,0 },\r
+ { "NROM-256", NROM_Init,0 }, //NROM256_Init,0 },\r
+ { "RROM", NROM_Init,0 }, //NROM128_Init,0 },\r
+ { "RROM-128", NROM_Init,0 }, //NROM128_Init,0 },\r
{ "MHROM", MHROM_Init,0},\r
{ "UNROM", UNROM_Init,0},\r
+ { "SUNSOFT_UNROM", SUNSOFT_UNROM_Init,0},\r
{ "MARIO1-MALEE2", MALEE_Init,0},\r
\r
{ "CC-21", UNLCC21_Init,0},\r
\r
+ { "H2288", UNLH2288_Init,0},\r
+ { "KOF97", UNLKOF97_Init,0},\r
+ { "SL1632", UNLSL1632_Init,0},\r
+ { "SHERO", UNLSHeroes_Init,0},\r
+ { "8237", UNL8237_Init,0},\r
{ "8157", UNL8157_Init,0},\r
+ { "T-262", BMCT262_Init,0},\r
+ { "FK23C", BMCFK23C_Init,0},\r
{ "Supervision16in1", Supervision16_Init,0},\r
{ "NovelDiamond9999999in1", Novel_Init,0},\r
{ "Super24in1SC03", Super24_Init,0},\r
+ { "42in1ResetSwitch", BMC42in1r_Init, 0},\r
+ { "64in1NoRepeat", BMC64in1nr_Init, 0},\r
+ { "13in1JY110", BMC13in1JY110_Init, 0},\r
+ { "70in1", BMC70in1_Init, 0},\r
+ { "70in1B", BMC70in1B_Init, 0},\r
+ { "GK-192", Mapper58_Init, 0},\r
{ "SuperHIK8in1", Mapper45_Init,0},\r
+\r
{ "DREAMTECH01", DreamTech01_Init,0},\r
{ "KONAMI-QTAI", Mapper190_Init,0},\r
+\r
+ { "TEK90", Mapper90_Init,0},\r
+\r
{0,0,0}\r
};\r
\r
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
*/\r
\r
-void TCA01_Init(CartInfo *info);\r
-void TCU01_Init(CartInfo *info);\r
-void S8259A_Init(CartInfo *info);\r
-void S8259B_Init(CartInfo *info);\r
-void S8259C_Init(CartInfo *info);\r
-void S8259D_Init(CartInfo *info);\r
-void S74LS374N_Init(CartInfo *info);\r
-void S74LS374NA_Init(CartInfo *info);\r
-void SA0161M_Init(CartInfo *info);\r
-\r
-void SA72007_Init(CartInfo *info);\r
-void SA72008_Init(CartInfo *info);\r
-void SA0036_Init(CartInfo *info);\r
-void SA0037_Init(CartInfo *info);\r
-\r
-void UNLH2288_Init(CartInfo *info);\r
-void UNL8237_Init(CartInfo *info);\r
-void UNL8157_Init(CartInfo *info);\r
+void ANROM_Init(CartInfo *info);\r
\r
void HKROM_Init(CartInfo *info);\r
\r
void SOROM_Init(CartInfo *info);\r
\r
void NROM_Init(CartInfo *info);\r
-void NROM256_Init(CartInfo *info);\r
-void NROM128_Init(CartInfo *info);\r
void MHROM_Init(CartInfo *info);\r
void UNROM_Init(CartInfo *info);\r
+void SUNSOFT_UNROM_Init(CartInfo *info); // "Shanghi" original version mapper\r
void MALEE_Init(CartInfo *info);\r
-void Supervision16_Init(CartInfo *info);\r
-void Super24_Init(CartInfo *info);\r
-void Novel_Init(CartInfo *info);\r
void CNROM_Init(CartInfo *info);\r
void CPROM_Init(CartInfo *info);\r
void GNROM_Init(CartInfo *info);\r
void TQROM_Init(CartInfo *info);\r
\r
void DEIROM_Init(CartInfo *info);\r
+\r
+void TCA01_Init(CartInfo *info);\r
+void TCU01_Init(CartInfo *info);\r
+void S8259A_Init(CartInfo *info);\r
+void S8259B_Init(CartInfo *info);\r
+void S8259C_Init(CartInfo *info);\r
+void S8259D_Init(CartInfo *info);\r
+void S74LS374N_Init(CartInfo *info);\r
+void S74LS374NA_Init(CartInfo *info);\r
+void SA0161M_Init(CartInfo *info);\r
+\r
+void SA72007_Init(CartInfo *info);\r
+void SA72008_Init(CartInfo *info);\r
+void SA0036_Init(CartInfo *info);\r
+void SA0037_Init(CartInfo *info);\r
+\r
+void Supervision16_Init(CartInfo *info);\r
+void Super24_Init(CartInfo *info);\r
+void Novel_Init(CartInfo *info);\r
+\r
+void BMC42in1r_Init(CartInfo *info);\r
+void BMC64in1nr_Init(CartInfo *info);\r
+void BMC70in1_Init(CartInfo *info);\r
+void BMC70in1B_Init(CartInfo *info);\r
+void BMC13in1JY110_Init(CartInfo *info);\r
+void BMCT262_Init(CartInfo *info);\r
+void BMCFK23C_Init(CartInfo *info);\r
+\r
void DreamTech01_Init(CartInfo *info);\r
void Mapper190_Init(CartInfo *info);\r
void UNLCC21_Init(CartInfo *info);\r
+void UNLSL1632_Init(CartInfo *info);\r
+void UNLKOF97_Init(CartInfo *info);\r
+void UNLSonic_Init(CartInfo *info);\r
+void UNLSHeroes_Init(CartInfo *info);\r
+void UNLH2288_Init(CartInfo *info);\r
+void UNL8237_Init(CartInfo *info);\r
+void UNL8157_Init(CartInfo *info);\r
\r
extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM\r
- // bank switcherooing with certain boards...\r
+ // bank switcherooing with certain boards...\r