*\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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\r
*/\r
\r
#include "mapinc.h"\r
\r
static uint8 *WRAM=NULL;\r
static uint8 *CHRRAM=NULL;\r
-static int is155;\r
+static int is155, is171;\r
\r
static DECLFW(MBWRAM)\r
{\r
else\r
setprg8r(0x10,0x6000,(DRegs[1]>>3)&1);\r
}\r
+\r
if(MMC1CHRHook4)\r
{\r
if(DRegs[0]&0x10)\r
static void MMC1PRG(void)\r
{\r
uint8 offs=DRegs[1]&0x10;\r
-\r
if(MMC1PRGHook16)\r
{\r
switch(DRegs[0]&0xC)\r
break;\r
}\r
}\r
- else switch(DRegs[0]&0xC)\r
+ else\r
+ {\r
+ switch(DRegs[0]&0xC)\r
{\r
case 0xC: setprg16(0x8000,(DRegs[3]+offs));\r
setprg16(0xC000,0xF+offs);\r
break;\r
}\r
}\r
+}\r
\r
static void MMC1MIRROR(void)\r
{\r
+ if(!is171) \r
switch(DRegs[0]&3)\r
{\r
case 2: setmirror(MI_V); 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
+ //FCEU_DispMessage("%016x",0,timestampbase+timestamp);\r
+// FCEU_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
+ deal with 2 writes in a row from a single RMW instruction.\r
+ */\r
+ if((timestampbase+timestamp)<(lreset+2))\r
+ return;\r
+// FCEU_printf("Write %04x:%02x\n",A,V);\r
if(V&0x80)\r
{\r
DRegs[0]|=0xC;\r
lreset=timestampbase+timestamp;\r
return;\r
}\r
+\r
Buffer|=(V&1)<<(BufferShift++);\r
+\r
if(BufferShift==5)\r
{\r
DRegs[n] = Buffer;\r
MMC1MIRROR();\r
MMC1CHR();\r
MMC1PRG();\r
- //lreset=0; /* timestamp(base) is not stored in save states. */ // it is now!\r
+ lreset=0; /* timestamp(base) is not stored in save states. */\r
}\r
\r
static void MMC1CMReset(void)\r
{\r
int i;\r
+\r
for(i=0;i<4;i++)\r
DRegs[i]=0;\r
Buffer = BufferShift = 0;\r
DRegs[0]=0x1F;\r
+\r
DRegs[1]=0;\r
DRegs[2]=0; // Should this be something other than 0?\r
DRegs[3]=0;\r
case 0x4642dda6: /* Nobunaga's Ambition */\r
case 0x29449ba9: /* "" "" (J) */\r
case 0x2b11e0b0: /* "" "" (J) */\r
+ case 0xb8747abf: /* Best Play Pro Yakyuu Special (J) */\r
+ case 0xc9556b36: /* Final Fantasy I & II (J) [!] */\r
FCEU_printf(" >8KB external WRAM present. Use UNIF if you hack the ROM image.\n");\r
return(16);\r
break;\r
static uint8 NWCRec;\r
#define NWCDIP 0xE\r
\r
-static void FP_FASTAPASS(1) NWCIRQHook(int a)\r
+static void NWCIRQHook(int a)\r
{\r
if(!(NWCRec&0x10))\r
{\r
NWCIRQCount=0;\r
X6502_IRQEnd(FCEU_IQEXT);\r
}\r
+\r
NWCRec=V;\r
if(V&0x08)\r
MMC1PRG();\r
if(wram)\r
{\r
WRAM=(uint8*)FCEU_gmalloc(wram*1024);\r
+ //mbg 17-jun-08 - this shouldve been cleared to re-initialize save ram\r
+ //ch4 10-dec-08 - nope, this souldn't\r
+ //mbg 29-mar-09 - no time to debate this, we need to keep from breaking some old stuff.\r
+ //we really need to make up a policy for how compatibility and accuracy can be resolved.\r
+ memset(WRAM,0,wram*1024);\r
mmc1opts|=1;\r
if(wram>8) mmc1opts|=4;\r
SetupCartPRGMapping(0x10,WRAM,wram*1024,1);\r
is155=1;\r
}\r
\r
+/* Same as mapper 1, with different (or without) mirroring control. */\r
+/* Kaiser KS7058 board, KS203 custom chip */\r
+void Mapper171_Init(CartInfo *info)\r
+{\r
+ GenMMC1Init(info,32,32,0,0);\r
+ is171=1;\r
+}\r
+\r
void SAROM_Init(CartInfo *info)\r
{\r
GenMMC1Init(info, 128, 64, 8, info->battery);\r