diff --git a/src/boards/8237.cpp b/src/boards/8237.cpp index 5b4e2df1..37bd5505 100644 --- a/src/boards/8237.cpp +++ b/src/boards/8237.cpp @@ -1,93 +1,195 @@ -/* 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 cmdin; -static uint8 UNL8237_perm[8] = {0, 2, 6, 1, 7, 3, 4, 5}; - -static void UNL8237CW(uint32 A, uint8 V) -{ - setchr1(A,((EXPREGS[1]&4)<<6)|V); -} - -static void UNL8237PW(uint32 A, uint8 V) -{ - if(EXPREGS[0]&0x80) - { - if(EXPREGS[0]&0x20) - setprg32(0x8000,(EXPREGS[0]&0xF)>>1); - else - { - setprg16(0x8000,(EXPREGS[0]&0x1F)); - setprg16(0xC000,(EXPREGS[0]&0x1F)); - } - } - else - setprg8(A,V&0x3F); -} - -static DECLFW(UNL8237Write) -{ - if((A&0xF000)==0xF000) - IRQCount=V; - else if((A&0xF000)==0xE000) - X6502_IRQEnd(FCEU_IQEXT); - else switch(A&0xE001) - { - case 0x8000: setmirror(((V|(V>>7))&1)^1); break; - case 0xA000: MMC3_CMDWrite(0x8000,(V&0xC0)|(UNL8237_perm[V&7])); cmdin=1; break; - case 0xC000: if(cmdin) - { - MMC3_CMDWrite(0x8001,V); - cmdin=0; - } - break; - } -} - -static DECLFW(UNL8237ExWrite) -{ - switch(A) - { - case 0x5000: EXPREGS[0]=V; FixMMC3PRG(MMC3_cmd); break; - case 0x5001: EXPREGS[1]=V; FixMMC3CHR(MMC3_cmd); break; - } -} - -static void UNL8237Power(void) -{ - IRQa=1; - EXPREGS[0]=EXPREGS[1]=0; - GenMMC3Power(); - SetWriteHandler(0x8000,0xFFFF,UNL8237Write); - SetWriteHandler(0x5000,0x7FFF,UNL8237ExWrite); -} - -void UNL8237_Init(CartInfo *info) -{ - GenMMC3_Init(info, 256, 256, 0, 0); - cwrap=UNL8237CW; - pwrap=UNL8237PW; - info->Power=UNL8237Power; - AddExState(EXPREGS, 3, 0, "EXPR"); - AddExState(&cmdin, 1, 0, "CMDIN"); -} +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2005-2011 CaH4e3 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Super Game (Sugar Softec) protected mapper + * Pocahontas 2 (Unl) [U][!], etc. + * TODO: 9in1 LION KING HANGS! + */ + +#include "mapinc.h" +#include "mmc3.h" + +static uint8 cmdin; + +static uint8 regperm[8][8] = + { + {0, 1, 2, 3, 4, 5, 6, 7}, + {0, 2, 6, 1, 7, 3, 4, 5}, + {0, 5, 4, 1, 7, 2, 6, 3}, // unused + {0, 6, 3, 7, 5, 2, 4, 1}, + {0, 2, 5, 3, 6, 1, 7, 4}, + {0, 1, 2, 3, 4, 5, 6, 7}, // empty + {0, 1, 2, 3, 4, 5, 6, 7}, // empty + {0, 1, 2, 3, 4, 5, 6, 7}, // empty + }; + +static uint8 adrperm[8][8] = + { + {0, 1, 2, 3, 4, 5, 6, 7}, + {3, 2, 0, 4, 1, 5, 6, 7}, + {0, 1, 2, 3, 4, 5, 6, 7}, // unused + {5, 0, 1, 2, 3, 7, 6, 4}, + {3, 1, 0, 5, 2, 4, 6, 7}, + {0, 1, 2, 3, 4, 5, 6, 7}, // empty + {0, 1, 2, 3, 4, 5, 6, 7}, // empty + {0, 1, 2, 3, 4, 5, 6, 7}, // empty + }; + +static void UNL8237CW(uint32 A, uint8 V) +{ + if(EXPREGS[0]&0x40) + setchr1(A,((EXPREGS[1]&0xc)<<6)|(V&0x7F)|((EXPREGS[1]&0x20)<<2)); + else + setchr1(A,((EXPREGS[1]&0xc)<<6)|V); +} + +static void UNL8237PW(uint32 A, uint8 V) +{ + if(EXPREGS[0]&0x40) + { + uint8 sbank = (EXPREGS[1]&0x10); + if(EXPREGS[0]&0x80) + { + uint8 bank = ((EXPREGS[1]&3)<<4)|(EXPREGS[0]&0x7)|(sbank>>1); + if(EXPREGS[0]&0x20) + setprg32(0x8000,bank>>1); + else + { + setprg16(0x8000,bank); + setprg16(0xC000,bank); + } + } + else + setprg8(A,((EXPREGS[1]&3)<<5)|(V&0x0F)|sbank); + } + else + { + if(EXPREGS[0]&0x80) + { + uint8 bank = ((EXPREGS[1]&3)<<4)|(EXPREGS[0]&0xF); + if(EXPREGS[0]&0x20) + setprg32(0x8000,bank>>1); + else + { + setprg16(0x8000,bank); + setprg16(0xC000,bank); + } + } + else + setprg8(A,((EXPREGS[1]&3)<<5)|(V&0x1F)); + } +} + +static void UNL8237ACW(uint32 A, uint8 V) +{ + if(EXPREGS[0]&0x40) + setchr1(A,((EXPREGS[1]&0xE)<<7)|(V&0x7F)|((EXPREGS[1]&0x20)<<2)); + else + setchr1(A,((EXPREGS[1]&0xE)<<7)|V); +} + +static void UNL8237APW(uint32 A, uint8 V) +{ + if(EXPREGS[0]&0x40) + { + uint8 sbank = (EXPREGS[1]&0x10); + if(EXPREGS[0]&0x80) + { + uint8 bank = ((EXPREGS[1]&3)<<4)|((EXPREGS[1]&8)<<3)|(EXPREGS[0]&0x7)|(sbank>>1); + if(EXPREGS[0]&0x20) + setprg32(0x8000,bank>>1); + else + { + setprg16(0x8000,bank); + setprg16(0xC000,bank); + } + } + else + setprg8(A,((EXPREGS[1]&3)<<5)|((EXPREGS[1]&8)<<4)|(V&0x0F)|sbank); + } + else + { + if(EXPREGS[0]&0x80) + { + uint8 bank = ((EXPREGS[1]&3)<<4)|((EXPREGS[1]&8)<<3)|(EXPREGS[0]&0xF); + if(EXPREGS[0]&0x20) + setprg32(0x8000,bank>>1); + else + { + setprg16(0x8000,bank); + setprg16(0xC000,bank); + } + } + else + setprg8(A,((EXPREGS[1]&3)<<5)|((EXPREGS[1]&8)<<4)|(V&0x1F)); + } +} +static DECLFW(UNL8237Write) +{ + uint8 dat = V; + uint8 adr = adrperm[EXPREGS[2]][((A>>12)&6)|(A&1)]; + uint16 addr = (adr & 1)|((adr & 6)<<12)|0x8000; + if(adr < 4) + { + if(!adr) + dat = (dat & 0xC0)|(regperm[EXPREGS[2]][dat & 7]); + MMC3_CMDWrite(addr,dat); + } + else + MMC3_IRQWrite(addr,dat); +} + +static DECLFW(UNL8237ExWrite) +{ + switch(A) + { + case 0x5000: EXPREGS[0]=V; FixMMC3PRG(MMC3_cmd); break; + case 0x5001: EXPREGS[1]=V; FixMMC3PRG(MMC3_cmd); FixMMC3CHR(MMC3_cmd); break; + case 0x5007: EXPREGS[2]=V; break; + } +} + +static void UNL8237Power(void) +{ + EXPREGS[0]=EXPREGS[2]=0; + EXPREGS[1]=3; + GenMMC3Power(); + SetWriteHandler(0x8000,0xFFFF,UNL8237Write); + SetWriteHandler(0x5000,0x7FFF,UNL8237ExWrite); +} + +void UNL8237_Init(CartInfo *info) +{ + GenMMC3_Init(info, 256, 256, 0, 0); + cwrap=UNL8237CW; + pwrap=UNL8237PW; + info->Power=UNL8237Power; + AddExState(EXPREGS, 3, 0, "EXPR"); + AddExState(&cmdin, 1, 0, "CMDIN"); +} + +void UNL8237A_Init(CartInfo *info) +{ + GenMMC3_Init(info, 256, 256, 0, 0); + cwrap=UNL8237ACW; + pwrap=UNL8237APW; + info->Power=UNL8237Power; + AddExState(EXPREGS, 3, 0, "EXPR"); + AddExState(&cmdin, 1, 0, "CMDIN"); +} diff --git a/src/boards/copyfami_mmc3.cpp b/src/boards/copyfami_mmc3.cpp deleted file mode 100644 index b1238535..00000000 --- a/src/boards/copyfami_mmc3.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2007 CaH4e3 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - /* -0000 - 1FFF - RAM -2000 - 23FF - PPU -2400 - 27FF - Write: "PAG" / Read: -- -2800 - 2BFF - Write: "BNK" / Read: "STS" -2C00 - 2FFF - Write: "UWR" / Read: "URD" -3000 - 3FFF - Small Flash Page (в регистре BNK) -4000 - 7FFF - Free -8000 - FFFF - Cart/Big Flash Page (смотри регистр PAG) -Биты: -Регистр [PAG], по сбросу должен быть = $00. -D3-D0 - Big Page High Address (D3,D2,D1,D0,A14,A13,A12,A11,A10,A9,A8,A7,A6,A5,A4,A3,A2,A1,A0) - D4 - VMD бит. Если =0, то к PPU подключено внутренее ОЗу на 8Кб, если =1 - то картридж. - D5 - STR бит. Если =0, то вместо карта по адресам 8000-FFFF внутренняя флэш, =1 - карт. -Регистр [BNK], не предустанавливается -D6-D0 - Small Page High Address (D6,D5,D4,D3,D2,D1,D0,A11,A10,A9,A8,A7,A6,A5,A4,A3,A2,A1,A0) - D7 - S/W бит. Управляет USB мостом, в эмуле реализовывать не надо. -Регистры [UWR]/[URD], не предустанавливаются, в эмуле реализовывать не надо. -[UWR] - Регистр записи данных в USB мост. -[URD] - Регистр чтения из USB моста. - */ - -#include "mapinc.h" -#include "mmc3.h" - -static uint8 reg[3]; - -static uint8 *CHRRAM=NULL; // there is no more extern CHRRAM in mmc3.h - // I need chrram here and local static == local -static uint32 CHRRAMSIZE; - -static SFORMAT StateRegs[]= -{ - {reg, 3, "REGS"}, - {0} -}; - -static void Sync(void) -{ - setprg4r(1,0x3000,reg[1]&0x7F); - FixMMC3PRG(MMC3_cmd); - FixMMC3CHR(MMC3_cmd); -} - -static void MCopyFamiMMC3PW(uint32 A, uint8 V) -{ - if(reg[0]&0x20) - setprg8r(0,A,V); - else - setprg32r(1,0x8000,reg[0]&0x0F); -} - -static void MCopyFamiMMC3CW(uint32 A, uint8 V) -{ - if(reg[0]&0x20) - setchr1r(0,A,V); - else - setchr8r(0x10,0); -} - -static DECLFW(MCopyFamiMMC3WritePAG) -{ - reg[0]=V; - Sync(); -} - -static DECLFW(MCopyFamiMMC3WriteBNK) -{ - reg[1]=V; - Sync(); -} - -static DECLFW(MCopyFamiMMC3WriteUSB) -{ - reg[2]=V; -} - -static void MCopyFamiMMC3Power(void) -{ - reg[0] = 0; - GenMMC3Power(); - Sync(); - SetReadHandler(0x3000,0x3FFF,CartBR); - SetWriteHandler(0x3000,0x3FFF,CartBW); - - SetWriteHandler(0x2400,0x27FF,MCopyFamiMMC3WritePAG); - SetWriteHandler(0x2800,0x2BFF,MCopyFamiMMC3WriteBNK); - SetWriteHandler(0x2C00,0x2FFF,MCopyFamiMMC3WriteUSB); -} - -static void MCopyFamiMMC3Reset(void) -{ - reg[0] = 0; - MMC3RegReset(); - Sync(); -} - -static void MCopyFamiMMC3Close(void) -{ - if(CHRRAM) - FCEU_gfree(CHRRAM); - CHRRAM=NULL; -} - -static void StateRestore(int version) -{ - Sync(); -} - -void MapperCopyFamiMMC3_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 512, 0, 0); - - cwrap=MCopyFamiMMC3CW; - pwrap=MCopyFamiMMC3PW; - - info->Reset=MCopyFamiMMC3Reset; - info->Power=MCopyFamiMMC3Power; - info->Close=MCopyFamiMMC3Close; - GameStateRestore=StateRestore; - - CHRRAMSIZE=8192; - CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE); - SetupCartPRGMapping(0x10,CHRRAM,CHRRAMSIZE,1); - AddExState(CHRRAM, CHRRAMSIZE, 0, "SRAM"); - - AddExState(&StateRegs, ~0, 0, 0); -} diff --git a/src/boards/mmc3.cpp b/src/boards/mmc3.cpp index f43620e4..24bd26de 100644 --- a/src/boards/mmc3.cpp +++ b/src/boards/mmc3.cpp @@ -1,1703 +1,1442 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 1998 BERO - * Copyright (C) 2003 Xodnizel - * Mapper 12 code 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 - */ - -/* Code for emulating iNES mappers 4,12,44,45,47,49,52,74,114,115,116,118, - 119,165,205,214,215,245,249,250,254 -*/ - -#include "mapinc.h" -#include "mmc3.h" - -uint8 MMC3_cmd; -uint32 CHRRAMSize; -uint8 DRegBuf[8]; -uint8 EXPREGS[8]; /* For bootleg games, mostly. */ - -static uint8 *WRAM; -static uint8 *CHRRAM; -static uint8 A000B,A001B; - -#undef IRQCount -#undef IRQLatch -#undef IRQa -uint8 IRQCount,IRQLatch,IRQa; -uint8 IRQReload; - -static SFORMAT MMC3_StateRegs[]= -{ - {DRegBuf, 8, "REGS"}, - {&MMC3_cmd, 1, "CMD"}, - {&A000B, 1, "A000"}, - {&A001B, 1, "A001"}, - {&IRQReload, 1, "IRQR"}, - {&IRQCount, 1, "IRQC"}, - {&IRQLatch, 1, "IRQL"}, - {&IRQa, 1, "IRQA"}, - {0} -}; - -static int mmc3opts=0; -static int wrams; -static int isRevB=1; - -void (*pwrap)(uint32 A, uint8 V); -void (*cwrap)(uint32 A, uint8 V); -void (*mwrap)(uint8 V); - -void GenMMC3Power(void); -void FixMMC3PRG(int V); -void FixMMC3CHR(int V); - -void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery); - -// ---------------------------------------------------------------------- -// ------------------------- Generic MM3 Code --------------------------- -// ---------------------------------------------------------------------- - -void FixMMC3PRG(int V) -{ - if(V&0x40) - { - pwrap(0xC000,DRegBuf[6]); - pwrap(0x8000,~1); - } - else - { - pwrap(0x8000,DRegBuf[6]); - pwrap(0xC000,~1); - } - pwrap(0xA000,DRegBuf[7]); - pwrap(0xE000,~0); -} - -void FixMMC3CHR(int V) -{ - int cbase=(V&0x80)<<5; - - cwrap((cbase^0x000),DRegBuf[0]&(~1)); - cwrap((cbase^0x400),DRegBuf[0]|1); - cwrap((cbase^0x800),DRegBuf[1]&(~1)); - cwrap((cbase^0xC00),DRegBuf[1]|1); - - cwrap(cbase^0x1000,DRegBuf[2]); - cwrap(cbase^0x1400,DRegBuf[3]); - cwrap(cbase^0x1800,DRegBuf[4]); - cwrap(cbase^0x1c00,DRegBuf[5]); -} - -void MMC3RegReset(void) -{ - IRQCount=IRQLatch=IRQa=MMC3_cmd=0; - - DRegBuf[0]=0; - DRegBuf[1]=2; - DRegBuf[2]=4; - DRegBuf[3]=5; - DRegBuf[4]=6; - DRegBuf[5]=7; - DRegBuf[6]=0; - DRegBuf[7]=1; - - FixMMC3PRG(0); - FixMMC3CHR(0); -} - -DECLFW(MMC3_CMDWrite) -{ -// FCEU_printf("bs %04x %02x\n",A,V); - switch(A&0xE001) - { - case 0x8000: - if((V&0x40) != (MMC3_cmd&0x40)) - { - FixMMC3PRG(V); - } - if((V&0x80) != (MMC3_cmd&0x80)) - FixMMC3CHR(V); - MMC3_cmd = V; - break; - case 0x8001: - { - int cbase=(MMC3_cmd&0x80)<<5; - DRegBuf[MMC3_cmd&0x7]=V; - switch(MMC3_cmd&0x07) - { - case 0: cwrap((cbase^0x000),V&(~1)); - cwrap((cbase^0x400),V|1); - break; - case 1: cwrap((cbase^0x800),V&(~1)); - cwrap((cbase^0xC00),V|1); - break; - case 2: cwrap(cbase^0x1000,V); - break; - case 3: cwrap(cbase^0x1400,V); - break; - case 4: cwrap(cbase^0x1800,V); - break; - case 5: cwrap(cbase^0x1C00,V); - break; - case 6: - if(MMC3_cmd&0x40) - pwrap(0xC000,V); - else - pwrap(0x8000,V); - break; - case 7: - pwrap(0xA000,V); - break; - } - } - break; - case 0xA000: - if(mwrap) mwrap(V); - break; - case 0xA001: - A001B=V; - break; - } -} - -DECLFW(MMC3_IRQWrite) -{ -// FCEU_printf("%04x:%04x\n",A,V); - switch(A&0xE001) - { - case 0xC000:IRQLatch=V;break; - case 0xC001:IRQReload=1;break; - case 0xE000:X6502_IRQEnd(FCEU_IQEXT);IRQa=0;break; - case 0xE001:IRQa=1;break; - } -} - -static void ClockMMC3Counter(void) -{ - int count = IRQCount; - if(!count || IRQReload) - { - IRQCount = IRQLatch; - IRQReload = 0; - } - else - IRQCount--; - if((count|isRevB) && !IRQCount) - { - if(IRQa) - { - X6502_IRQBegin(FCEU_IQEXT); - } - } -} - -static void MMC3_hb(void) -{ - ClockMMC3Counter(); -} - -static void MMC3_hb_KickMasterHack(void) -{ - if(scanline==238) ClockMMC3Counter(); - ClockMMC3Counter(); -} - -static void MMC3_hb_PALStarWarsHack(void) -{ - if(scanline==240) ClockMMC3Counter(); - ClockMMC3Counter(); -} - -void GenMMC3Restore(int version) -{ - if(mwrap) mwrap(A000B); - FixMMC3PRG(MMC3_cmd); - FixMMC3CHR(MMC3_cmd); -} - -static void GENCWRAP(uint32 A, uint8 V) -{ -// if(!UNIFchrrama) // Yong Zhe Dou E Long - Dragon Quest VI (As).nes NEEDS THIS - setchr1(A,V); // Business Wars NEEDS THIS -} - -static void GENPWRAP(uint32 A, uint8 V) -{ - setprg8(A,V&0x3F); -} - -static void GENMWRAP(uint8 V) -{ - A000B=V; - setmirror((V&1)^1); -} - -static void GENNOMWRAP(uint8 V) -{ - A000B=V; -} - -static DECLFW(MBWRAM) -{ - WRAM[A-0x6000]=V; -} - -static DECLFR(MAWRAM) -{ - return(WRAM[A-0x6000]); -} - -static DECLFW(MBWRAMMMC6) -{ - WRAM[A&0x3ff]=V; -} - -static DECLFR(MAWRAMMMC6) -{ - return(WRAM[A&0x3ff]); -} - -void GenMMC3Power(void) -{ - if(UNIFchrrama) setchr8(0); - - SetWriteHandler(0x8000,0xBFFF,MMC3_CMDWrite); - SetWriteHandler(0xC000,0xFFFF,MMC3_IRQWrite); - SetReadHandler(0x8000,0xFFFF,CartBR); - A001B=A000B=0; - setmirror(1); - if(mmc3opts&1) - { - if(wrams==1024) - { - FCEU_CheatAddRAM(1,0x7000,WRAM); - SetReadHandler(0x7000,0x7FFF,MAWRAMMMC6); - SetWriteHandler(0x7000,0x7FFF,MBWRAMMMC6); - } - else - { - FCEU_CheatAddRAM(wrams>>10,0x6000,WRAM); - SetReadHandler(0x6000,0x6000+wrams-1,MAWRAM); - SetWriteHandler(0x6000,0x6000+wrams-1,MBWRAM); - } - if(!(mmc3opts&2)) - FCEU_dwmemset(WRAM,0,wrams); - } - MMC3RegReset(); - if(CHRRAM) - FCEU_dwmemset(CHRRAM,0,CHRRAMSize); -} - -static void GenMMC3Close(void) -{ - if(CHRRAM) - FCEU_gfree(CHRRAM); - if(WRAM) - FCEU_gfree(WRAM); - CHRRAM=WRAM=NULL; -} - -//static uint16 _a12; -//static void 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; - cwrap=GENCWRAP; - mwrap=GENMWRAP; - - wrams=wram<<10; - - PRGmask8[0]&=(prg>>13)-1; - CHRmask1[0]&=(chr>>10)-1; - CHRmask2[0]&=(chr>>11)-1; - - if(wram) - { - mmc3opts|=1; - WRAM=(uint8*)FCEU_gmalloc(wrams); - AddExState(WRAM, wrams, 0, "WRAM"); - } - - if(battery) - { - mmc3opts|=2; - info->SaveGame[0]=WRAM; - info->SaveGameLen[0]=wrams; - } - -// 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); - - info->Power=GenMMC3Power; - info->Reset=MMC3RegReset; - info->Close=GenMMC3Close; - - if(info->CRC32 == 0x5104833e) // Kick Master - GameHBIRQHook = MMC3_hb_KickMasterHack; - else if(info->CRC32 == 0x5a6860f1 || info->CRC32 == 0xae280e20) // Shougi Meikan '92/'93 - GameHBIRQHook = MMC3_hb_KickMasterHack; - else if(info->CRC32 == 0xfcd772eb) // PAL Star Wars, similar problem as Kick Master. - GameHBIRQHook = MMC3_hb_PALStarWarsHack; - else - GameHBIRQHook=MMC3_hb; -// PPU_hook=MMC3_PPU; - GameStateRestore=GenMMC3Restore; -} - -// ---------------------------------------------------------------------- -// -------------------------- MMC3 Based Code --------------------------- -// ---------------------------------------------------------------------- - -// ---------------------------- Mapper 4 -------------------------------- - -static int hackm4=0;/* For Karnov, maybe others. BLAH. Stupid iNES format.*/ - -static void M4Power(void) -{ - GenMMC3Power(); - A000B=(hackm4^1)&1; - setmirror(hackm4); -} - -void Mapper4_Init(CartInfo *info) -{ - int ws=8; - - if((info->CRC32==0x93991433 || info->CRC32==0xaf65aa84)) - { - FCEU_printf("Low-G-Man can not work normally in the iNES format.\nThis game has been recognized by its CRC32 value, and the appropriate changes will be made so it will run.\nIf you wish to hack this game, you should use the UNIF format for your hack.\n\n"); - ws=0; - } - GenMMC3_Init(info,512,256,ws,info->battery); - info->Power=M4Power; - hackm4=info->mirror; -} - -// ---------------------------- Mapper 12 ------------------------------- - -static void M12CW(uint32 A, uint8 V) -{ - setchr1(A,(EXPREGS[(A&0x1000)>>12]<<8)+V); -} - -static DECLFW(M12Write) -{ - EXPREGS[0]=V&0x01; - EXPREGS[1]=(V&0x10)>>4; -} - -static void M12Power(void) -{ - EXPREGS[0]=EXPREGS[1]=0; - GenMMC3Power(); - SetWriteHandler(0x4100,0x5FFF,M12Write); -} - -void Mapper12_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, info->battery); - cwrap=M12CW; - info->Power=M12Power; - 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) -{ - uint32 NV=V; - if(EXPREGS[0]>=6) NV&=0x1F; - else NV&=0x0F; - NV|=EXPREGS[0]<<4; - setprg8(A,NV); -} - -static void M44CW(uint32 A, uint8 V) -{ - uint32 NV=V; - if(EXPREGS[0]<6) NV&=0x7F; - NV|=EXPREGS[0]<<7; - setchr1(A,NV); -} - -static DECLFW(M44Write) -{ - if(A&1) - { - EXPREGS[0]=V&7; - FixMMC3PRG(MMC3_cmd); - FixMMC3CHR(MMC3_cmd); - } - else - MMC3_CMDWrite(A,V); -} - -static void M44Power(void) -{ - EXPREGS[0]=0; - GenMMC3Power(); - SetWriteHandler(0xA000,0xBFFF,M44Write); -} - -void Mapper44_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, info->battery); - cwrap=M44CW; - pwrap=M44PW; - info->Power=M44Power; - AddExState(EXPREGS, 1, 0, "EXPR"); -} - -// ---------------------------- Mapper 45 ------------------------------- - -static void M45CW(uint32 A, uint8 V) -{ - if(!UNIFchrrama) - { - uint32 NV=V; - if(EXPREGS[2]&8) - NV&=(1<<((EXPREGS[2]&7)+1))-1; - else - if(EXPREGS[2]) - NV&=0; // hack ;( don't know exactly how it should be - NV|=EXPREGS[0]|((EXPREGS[2]&0xF0)<<4); - setchr1(A,NV); - } -} - -static void M45PW(uint32 A, uint8 V) -{ - V&=(EXPREGS[3]&0x3F)^0x3F; - V|=EXPREGS[1]; - setprg8(A,V); -} - -static DECLFW(M45Write) -{ - if(EXPREGS[3]&0x40) - { - WRAM[A-0x6000]=V; - return; - } - EXPREGS[EXPREGS[4]]=V; - EXPREGS[4]=(EXPREGS[4]+1)&3; -// 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) -{ - EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=EXPREGS[4]=0; - MMC3RegReset(); -} - -static void M45Power(void) -{ - setchr8(0); - GenMMC3Power(); - SetWriteHandler(0x6000,0x7FFF,M45Write); -} - -void Mapper45_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, info->battery); - cwrap=M45CW; - pwrap=M45PW; - info->Reset=M45Reset; - info->Power=M45Power; - AddExState(EXPREGS, 5, 0, "EXPR"); -} - -// ---------------------------- Mapper 47 ------------------------------- - -static void M47PW(uint32 A, uint8 V) -{ - V&=0xF; - V|=EXPREGS[0]<<4; - setprg8(A,V); -} - -static void M47CW(uint32 A, uint8 V) -{ - uint32 NV=V; - NV&=0x7F; - NV|=EXPREGS[0]<<7; - setchr1(A,NV); -} - -static DECLFW(M47Write) -{ - EXPREGS[0]=V&1; - FixMMC3PRG(MMC3_cmd); - FixMMC3CHR(MMC3_cmd); -} - -static void M47Power(void) -{ - EXPREGS[0]=0; - GenMMC3Power(); - SetWriteHandler(0x6000,0x7FFF,M47Write); -// SetReadHandler(0x6000,0x7FFF,0); -} - -void Mapper47_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, 0); - pwrap=M47PW; - cwrap=M47CW; - info->Power=M47Power; - AddExState(EXPREGS, 1, 0, "EXPR"); -} - -// ---------------------------- Mapper 49 ------------------------------- - -static void M49PW(uint32 A, uint8 V) -{ - if(EXPREGS[0]&1) - { - V&=0xF; - V|=(EXPREGS[0]&0xC0)>>2; - setprg8(A,V); - } - else - setprg32(0x8000,(EXPREGS[0]>>4)&3); -} - -static void M49CW(uint32 A, uint8 V) -{ - uint32 NV=V; - NV&=0x7F; - NV|=(EXPREGS[0]&0xC0)<<1; - setchr1(A,NV); -} - -static DECLFW(M49Write) -{ - if(A001B&0x80) - { - EXPREGS[0]=V; - FixMMC3PRG(MMC3_cmd); - FixMMC3CHR(MMC3_cmd); - } -} - -static void M49Reset(void) -{ - EXPREGS[0]=0; - MMC3RegReset(); -} - -static void M49Power(void) -{ - M49Reset(); - GenMMC3Power(); - SetWriteHandler(0x6000,0x7FFF,M49Write); - SetReadHandler(0x6000,0x7FFF,0); -} - -void Mapper49_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 0, 0); - cwrap=M49CW; - pwrap=M49PW; - info->Reset=M49Reset; - info->Power=M49Power; - AddExState(EXPREGS, 1, 0, "EXPR"); -} - -// ---------------------------- Mapper 52 ------------------------------- - -static void M52PW(uint32 A, uint8 V) -{ - uint32 NV=V; - NV&=0x1F^((EXPREGS[0]&8)<<1); - NV|=((EXPREGS[0]&6)|((EXPREGS[0]>>3)&EXPREGS[0]&1))<<4; - setprg8(A,NV); -} - -static void M52CW(uint32 A, uint8 V) -{ - uint32 NV=V; - NV&=0xFF^((EXPREGS[0]&0x40)<<1); - NV|=(((EXPREGS[0]>>3)&4)|((EXPREGS[0]>>1)&2)|((EXPREGS[0]>>6)&(EXPREGS[0]>>4)&1))<<7; - setchr1(A,NV); -} - -static DECLFW(M52Write) -{ - if(EXPREGS[1]) - { - WRAM[A-0x6000]=V; - return; - } - EXPREGS[1]=1; - EXPREGS[0]=V; - FixMMC3PRG(MMC3_cmd); - FixMMC3CHR(MMC3_cmd); -} - -static void M52Reset(void) -{ - EXPREGS[0]=EXPREGS[1]=0; - MMC3RegReset(); -} - -static void M52Power(void) -{ - M52Reset(); - GenMMC3Power(); - SetWriteHandler(0x6000,0x7FFF,M52Write); -} - -void Mapper52_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, info->battery); - cwrap=M52CW; - pwrap=M52PW; - info->Reset=M52Reset; - info->Power=M52Power; - AddExState(EXPREGS, 2, 0, "EXPR"); -} - -// ---------------------------- Mapper 74 ------------------------------- - -static void M74CW(uint32 A, uint8 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(0,A,V); -} - -void Mapper74_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, info->battery); - cwrap=M74CW; - CHRRAMSize=2048; - CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize); - SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); - AddExState(CHRRAM, CHRRAMSize, 0, "CHRR"); -} - -// ---------------------------- Mapper 114 ------------------------------ - -static uint8 cmdin; -uint8 m114_perm[8] = {0, 3, 1, 5, 6, 7, 2, 4}; - -static void M114PWRAP(uint32 A, uint8 V) -{ - if(EXPREGS[0]&0x80) - { - setprg16(0x8000,EXPREGS[0]&0xF); - setprg16(0xC000,EXPREGS[0]&0xF); - } - else - setprg8(A,V&0x3F); -} - -static DECLFW(M114Write) -{ - if(A==0xE003) - { - IRQa=1; - IRQLatch=V; - IRQReload=1; - } - else if(A==0xE002) - { - IRQa=0; - X6502_IRQEnd(FCEU_IQEXT); - } - else switch(A&0xE000) - { - case 0x8000: setmirror((V&1)^1); break; - case 0xA000: MMC3_CMDWrite(0x8000,(V&0xC0)|(m114_perm[V&7])); cmdin=1; break; - case 0xC000: if(!cmdin) break; - MMC3_CMDWrite(0x8001,V); - cmdin=0; - break; - } -} - -static DECLFW(M114ExWrite) -{ - if(A<=0x7FFF) - { - EXPREGS[0]=V; - FixMMC3PRG(MMC3_cmd); - } -} - -static void M114Power(void) -{ - GenMMC3Power(); - SetWriteHandler(0x8000,0xFFFF,M114Write); - SetWriteHandler(0x5000,0x7FFF,M114ExWrite); -} - -static void M114Reset(void) -{ - EXPREGS[0]=0; - MMC3RegReset(); -} - -void Mapper114_Init(CartInfo *info) -{ - GenMMC3_Init(info, 256, 256, 0, 0); - pwrap=M114PWRAP; - info->Power=M114Power; - info->Reset=M114Reset; - AddExState(EXPREGS, 1, 0, "EXPR"); - AddExState(&cmdin, 1, 0, "CMDIN"); -} - -// ---------------------------- Mapper 115 ------------------------------ - -static void M115PW(uint32 A, uint8 V) -{ - 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)); -} - -static DECLFW(M115Write) -{ -// FCEU_printf("%04x:%04x\n",A,V); - if(A==0x5080) EXPREGS[2]=V; - if(A==0x6000) - EXPREGS[0]=V; - else if(A==0x6001) - EXPREGS[1]=V; - FixMMC3PRG(MMC3_cmd); -} - -static DECLFR(M115Read) -{ - return EXPREGS[2]; -} - -static void M115Power(void) -{ - GenMMC3Power(); - SetWriteHandler(0x4100,0x7FFF,M115Write); - SetReadHandler(0x5000,0x5FFF,M115Read); -} - -void Mapper115_Init(CartInfo *info) -{ - GenMMC3_Init(info, 128, 512, 0, 0); - cwrap=M115CW; - pwrap=M115PW; - info->Power=M115Power; - AddExState(EXPREGS, 2, 0, "EXPR"); -} - -// ---------------------------- Mapper 116 ------------------------------ - -static void M116CW(uint32 A, uint8 V) -{ -// setchr1(A,V|((EXPREGS[0]&0x4)<<6)); - if(EXPREGS[0]&2) - setchr8r(0x10,0); - else - setchr1(A,V); -} - -static DECLFW(M116Write) -{ - EXPREGS[0]=V; - FixMMC3CHR(MMC3_cmd); -} - -static void M116Power(void) -{ - GenMMC3Power(); - SetWriteHandler(0x4100,0x4100,M116Write); -} - -void Mapper116_Init(CartInfo *info) -{ - 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"); -} - -// ---------------------------- Mapper 118 ------------------------------ - -static uint8 PPUCHRBus; -static uint8 TKSMIR[8]; - -static void TKSPPU(uint32 A) -{ - A&=0x1FFF; - A>>=10; - PPUCHRBus=A; - setmirror(MI_0+TKSMIR[A]); -} - -static void TKSWRAP(uint32 A, uint8 V) -{ - TKSMIR[A>>10]=V>>7; - setchr1(A,V&0x7F); - if(PPUCHRBus==(A>>10)) - setmirror(MI_0+(V>>7)); -} - -//void Mapper118_Init(CartInfo *info) -//{ -// GenMMC3_Init(info, 512, 256, 8, info->battery); -// cwrap=TKSWRAP; -// mwrap=GENNOMWRAP; -// PPU_hook=TKSPPU; -// AddExState(&PPUCHRBus, 1, 0, "PPUC"); -//} - -// ---------------------------- Mapper 119 ------------------------------ - -static void TQWRAP(uint32 A, uint8 V) -{ - setchr1r((V&0x40)>>2,A,V&0x3F); -} - -void Mapper119_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 64, 0, 0); - cwrap=TQWRAP; - CHRRAMSize=8192; - CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize); - SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); -} - -// ---------------------------- Mapper 134 ------------------------------ - -static void M134PW(uint32 A, uint8 V) -{ - setprg8(A,(V&0x1F)|((EXPREGS[0]&2)<<4)); -} - -static void M134CW(uint32 A, uint8 V) -{ - setchr1(A,(V&0xFF)|((EXPREGS[0]&0x20)<<3)); -} - -static DECLFW(M134Write) -{ - EXPREGS[0]=V; - FixMMC3CHR(MMC3_cmd); - FixMMC3PRG(MMC3_cmd); -} - -static void M134Power(void) -{ - EXPREGS[0]=0; - GenMMC3Power(); - SetWriteHandler(0x6001,0x6001,M134Write); -} - -static void M134Reset(void) -{ - EXPREGS[0]=0; - MMC3RegReset(); -} - -void Mapper134_Init(CartInfo *info) -{ - GenMMC3_Init(info, 256, 256, 0, 0); - pwrap=M134PW; - cwrap=M134CW; - info->Power=M134Power; - info->Reset=M134Reset; - AddExState(EXPREGS, 4, 0, "EXPR"); -} - -// ---------------------------- Mapper 165 ------------------------------ - -static void M165CW(uint32 A, uint8 V) -{ - if(V==0) - setchr4r(0x10,A,0); - else - setchr4(A,V>>2); -} - -static void M165PPUFD(void) -{ - if(EXPREGS[0]==0xFD) - { - M165CW(0x0000,DRegBuf[0]); - M165CW(0x1000,DRegBuf[2]); - } -} - -static void M165PPUFE(void) -{ - if(EXPREGS[0]==0xFE) - { - M165CW(0x0000,DRegBuf[1]); - M165CW(0x1000,DRegBuf[4]); - } -} - -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(); -} - -static void M165PPU(uint32 A) -{ - if((A&0x1FF0)==0x1FD0) - { - EXPREGS[0]=0xFD; - M165PPUFD(); - } else if((A&0x1FF0)==0x1FE0) - { - EXPREGS[0]=0xFE; - M165PPUFE(); - } -} - -static void M165Power(void) -{ - EXPREGS[0]=0xFD; - GenMMC3Power(); -} - -void Mapper165_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 128, 8, info->battery); - cwrap=M165CWM; - PPU_hook=M165PPU; - info->Power=M165Power; - CHRRAMSize = 4096; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize); - SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); - AddExState(CHRRAM, CHRRAMSize, 0, "CHRR"); - AddExState(EXPREGS, 4, 0, "EXPR"); -} - -// ---------------------------- Mapper 182 ------------------------------ -// таблица пермутаци аналогична 114 мапперу, регистры маппера гораздо сложнее, -// чем используются здесь, хотя все прекрасно работает. - -//static uint8 m182_perm[8] = {0, 3, 1, 5, 6, 7, 2, 4}; -static DECLFW(M182Write) -{ - switch(A&0xF003) - { - 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: if(V) - { - IRQLatch=V; - IRQReload=1; - IRQa=1; - } - X6502_IRQEnd(FCEU_IQEXT); - break; - } -} - -static void M182Power(void) -{ - GenMMC3Power(); - SetWriteHandler(0x8000,0xFFFF,M182Write); -} - -void Mapper182_Init(CartInfo *info) -{ - GenMMC3_Init(info, 256, 256, 0, 0); - 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 195 ------------------------------- -static uint8 *wramtw; -static uint16 wramsize; - -static void M195CW(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 M195Power(void) -{ - GenMMC3Power(); - setprg4r(0x10,0x5000,0); - SetWriteHandler(0x5000,0x5fff,CartBW); - SetReadHandler(0x5000,0x5fff,CartBR); -} - -static void M195Close(void) -{ - if(wramtw) - FCEU_gfree(wramtw); - wramtw=NULL; -} - -void Mapper195_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, info->battery); - cwrap=M195CW; - info->Power=M195Power; - info->Close=M195Close; - 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 196 ------------------------------- - -static DECLFW(Mapper196Write) -{ - A=(A&0xFFFE)|((A>>2)&1)|((A>>3)&1)|((A>>1)&1); - if(A >= 0xC000) - MMC3_IRQWrite(A,V); - else - MMC3_CMDWrite(A,V); -} - -static void Mapper196Power(void) -{ - GenMMC3Power(); - SetWriteHandler(0x8000,0xFFFF,Mapper196Write); -} - -void Mapper196_Init(CartInfo *info) -{ - GenMMC3_Init(info, 128, 128, 0, 0); - info->Power=Mapper196Power; -} - -// ---------------------------- Mapper 197 ------------------------------- - -static void M197CW(uint32 A, uint8 V) -{ - if(A==0x0000) - setchr4(0x0000,V>>1); - else if(A==0x1000) - setchr2(0x1000,V); - else if(A==0x1400) - setchr2(0x1800,V); -} - -void Mapper197_Init(CartInfo *info) -{ - GenMMC3_Init(info, 128, 512, 8, 0); - cwrap=M197CW; -} - -// ---------------------------- Mapper 198 ------------------------------- - -static void M198PW(uint32 A, uint8 V) -{ - if(V>=0x50) // Tenchi o Kurau II - Shokatsu Koumei Den (J) (C).nes - setprg8(A,V&0x4F); - else - setprg8(A,V); -} - -void Mapper198_Init(CartInfo *info) -{ - GenMMC3_Init(info, 1024, 256, 8, info->battery); - pwrap=M198PW; - info->Power=M195Power; - info->Close=M195Close; - wramsize=4096; - wramtw=(uint8*)FCEU_gmalloc(wramsize); - SetupCartPRGMapping(0x10, wramtw, wramsize, 1); - AddExState(wramtw, wramsize, 0, "WRAMTW"); -} - -// ---------------------------- Mapper 205 ------------------------------ - -static void M205PW(uint32 A, uint8 V) -{ - if(EXPREGS[0]&2) - setprg8(A,(V&0x0f)|((EXPREGS[0]&3)<<4)); - else - setprg8(A,(V&0x1f)|((EXPREGS[0]&3)<<4)); -} - -static void M205CW(uint32 A, uint8 V) -{ - setchr1(A,V|((EXPREGS[0]&3)<<7)); -} - -static DECLFW(M205Write) -{ - if((A&0x6800)==0x6800) EXPREGS[0]= V; - FixMMC3PRG(MMC3_cmd); - FixMMC3CHR(MMC3_cmd); -} - -static void M205Reset(void) -{ - EXPREGS[0]=0; - MMC3RegReset(); -} - -static void M205Power(void) -{ - GenMMC3Power(); - SetWriteHandler(0x4020,0x7FFF,M205Write); -} - -void Mapper205_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, 0); - pwrap=M205PW; - cwrap=M205CW; - info->Power=M205Power; - info->Reset=M205Reset; - AddExState(EXPREGS, 1, 0, "EXPR"); -} - -// ---------------------------- Mapper 215 ------------------------------ - -static uint8 m215_perm[8] = {0, 2, 5, 3, 6, 1, 7, 4}; -//static uint8 m215_perm[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - -static void M215CW(uint32 A, uint8 V) -{ - if(EXPREGS[1]&0x04) - setchr1(A,V|0x100); - else - setchr1(A,(V&0x7F)|((EXPREGS[1]&0x10)<<3)); -} - -static void M215PW(uint32 A, uint8 V) -{ - if(EXPREGS[0]&0x80) - { - setprg16(0x8000,(EXPREGS[0]&0x0F)|(EXPREGS[1]&0x10)); - setprg16(0xC000,(EXPREGS[0]&0x0F)|(EXPREGS[1]&0x10)); - } - else if(EXPREGS[1]&0x08) - setprg8(A,(V&0x1F)|0x20); - else - setprg8(A,(V&0x0F)|(EXPREGS[1]&0x10)); -} - -static DECLFW(M215Write) -{ -// FCEU_printf("bs %04x %02x\n",A,V); - if(!(EXPREGS[2])) - { - if(A >= 0xc000) - MMC3_IRQWrite(A,V); - else - MMC3_CMDWrite(A,V); - } - 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 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; - MMC3_CMDWrite(0x8001,V); - cmdin=0; - break; - } -} - -static DECLFW(M215ExWrite) -{ -// FCEU_printf("bs %04x %02x (%04x)\n",A,V,A&0x5007); - switch(A) - { -// case 0x6000: - case 0x5000: - EXPREGS[0]=V; - FixMMC3PRG(MMC3_cmd); - break; -// case 0x6001: - case 0x5001: - EXPREGS[1]=V; - FixMMC3CHR(MMC3_cmd); - break; -// case 0x6007: - case 0x5007: - EXPREGS[2]=V; - MMC3RegReset(); - break; - } -} - -static void M215Power(void) -{ - EXPREGS[0]=0; - EXPREGS[1]=0xFF; - EXPREGS[2]=4; - GenMMC3Power(); - SetWriteHandler(0x8000,0xFFFF,M215Write); - SetWriteHandler(0x5000,0x7FFF,M215ExWrite); -} - -void Mapper215_Init(CartInfo *info) -{ - GenMMC3_Init(info, 256, 256, 0, 0); - cwrap=M215CW; - pwrap=M215PW; - info->Power=M215Power; - AddExState(EXPREGS, 3, 0, "EXPR"); - AddExState(&cmdin, 1, 0, "CMDIN"); -} - -// ---------------------------- Mapper 217 ------------------------------ - -static uint8 m217_perm[8] = {0, 6, 3, 7, 5, 2, 4, 1}; - -static void M217CW(uint32 A, uint8 V) -{ - if(EXPREGS[1]&0x08) - setchr1(A,V|((EXPREGS[1]&3)<<8)); - else - setchr1(A,(V&0x7F)|((EXPREGS[1]&3)<<8)|((EXPREGS[1]&0x10)<<3)); -} - -static void M217PW(uint32 A, uint8 V) -{ - if(EXPREGS[0]&0x80) - { - setprg16(0x8000,(EXPREGS[0]&0x0F)|((EXPREGS[1]&3)<<4)); - setprg16(0xC000,(EXPREGS[0]&0x0F)|((EXPREGS[1]&3)<<4)); - } - else if(EXPREGS[1]&0x08) - setprg8(A,(V&0x1F)|((EXPREGS[1]&3)<<5)); - else - setprg8(A,(V&0x0F)|((EXPREGS[1]&3)<<5)|(EXPREGS[1]&0x10)); -} - -static DECLFW(M217Write) -{ - if(!EXPREGS[2]) - { - if(A >= 0xc000) - MMC3_IRQWrite(A, V); - else - 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; - } -} - -static DECLFW(M217ExWrite) -{ - switch(A) - { - case 0x5000: - EXPREGS[0]=V; - FixMMC3PRG(MMC3_cmd); - break; - case 0x5001: - EXPREGS[1]=V; - FixMMC3PRG(MMC3_cmd); - break; - case 0x5007: - EXPREGS[2]=V; - break; - } -} - -static void M217Power(void) -{ - EXPREGS[0]=0; - EXPREGS[1]=0xFF; - EXPREGS[2]=3; - GenMMC3Power(); - SetWriteHandler(0x8000,0xFFFF,M217Write); - SetWriteHandler(0x5000,0x7FFF,M217ExWrite); -} - -void Mapper217_Init(CartInfo *info) -{ - GenMMC3_Init(info, 256, 256, 0, 0); - cwrap=M217CW; - pwrap=M217PW; - info->Power=M217Power; - AddExState(EXPREGS, 3, 0, "EXPR"); - AddExState(&cmdin, 1, 0, "CMDIN"); -} - -// ---------------------------- Mapper 245 ------------------------------ - -static void M245CW(uint32 A, uint8 V) -{ - setchr1(A,V&7); - EXPREGS[0]=V; - FixMMC3PRG(MMC3_cmd); -} - -static void M245PW(uint32 A, uint8 V) -{ - setprg8(A,(V&0x3F)|((EXPREGS[0]&2)<<5)); -} - -static void M245Power(void) -{ - EXPREGS[0]=0; - GenMMC3Power(); -} - -void Mapper245_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, info->battery); - cwrap=M245CW; - pwrap=M245PW; - info->Power=M245Power; - AddExState(EXPREGS, 1, 0, "EXPR"); -} - -// ---------------------------- Mapper 249 ------------------------------ - -static void M249PW(uint32 A, uint8 V) -{ - if(EXPREGS[0]&0x2) - { - if(V<0x20) - V=(V&1)|((V>>3)&2)|((V>>1)&4)|((V<<2)&8)|((V<<2)&0x10); - else - { - V-=0x20; - V=(V&3)|((V>>1)&4)|((V>>4)&8)|((V>>2)&0x10)|((V<<3)&0x20)|((V<<2)&0xC0); - } - } - setprg8(A,V); -} - -static void M249CW(uint32 A, uint8 V) -{ - if(EXPREGS[0]&0x2) - V=(V&3)|((V>>1)&4)|((V>>4)&8)|((V>>2)&0x10)|((V<<3)&0x20)|((V<<2)&0xC0); - setchr1(A,V); -} - -static DECLFW(M249Write) -{ - EXPREGS[0]=V; - FixMMC3PRG(MMC3_cmd); - FixMMC3CHR(MMC3_cmd); -} - -static void M249Power(void) -{ - EXPREGS[0]=0; - GenMMC3Power(); - SetWriteHandler(0x5000,0x5000,M249Write); -} - -void Mapper249_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, info->battery); - cwrap=M249CW; - pwrap=M249PW; - info->Power=M249Power; - AddExState(EXPREGS, 1, 0, "EXPR"); -} - -// ---------------------------- Mapper 250 ------------------------------ - -static DECLFW(M250Write) -{ - MMC3_CMDWrite((A&0xE000)|((A&0x400)>>10),A&0xFF); -} - -static DECLFW(M250IRQWrite) -{ - MMC3_IRQWrite((A&0xE000)|((A&0x400)>>10),A&0xFF); -} - -static void M250_Power(void) -{ - GenMMC3Power(); - SetWriteHandler(0x8000,0xBFFF,M250Write); - SetWriteHandler(0xC000,0xFFFF,M250IRQWrite); -} - -void Mapper250_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, info->battery); - info->Power=M250_Power; -} - -// ---------------------------- Mapper 254 ------------------------------ - -static DECLFR(MR254WRAM) -{ - if(EXPREGS[0]) - return WRAM[A-0x6000]; - else - return WRAM[A-0x6000]^EXPREGS[1]; -} - -static DECLFW(M254Write) -{ - switch (A) { - case 0x8000: EXPREGS[0]=0xff; - break; - case 0xA001: EXPREGS[1]=V; - } - MMC3_CMDWrite(A,V); -} - -static void M254_Power(void) -{ - GenMMC3Power(); - SetWriteHandler(0x8000,0xBFFF,M254Write); - SetReadHandler(0x6000,0x7FFF,MR254WRAM); -} - -void Mapper254_Init(CartInfo *info) -{ - GenMMC3_Init(info, 128, 128, 8, info->battery); - info->Power=M254_Power; - AddExState(EXPREGS, 2, 0, "EXPR"); -} - -// ---------------------------- UNIF Boards ----------------------------- - -void TBROM_Init(CartInfo *info) -{ - GenMMC3_Init(info, 64, 64, 0, 0); -} - -void TEROM_Init(CartInfo *info) -{ - GenMMC3_Init(info, 32, 32, 0, 0); -} - -void TFROM_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 64, 0, 0); -} - -void TGROM_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 0, 0, 0); -} - -void TKROM_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, info->battery); -} - -void TLROM_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 0, 0); -} - -void TSROM_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, 0); -} - -void TLSROM_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, 0); - cwrap=TKSWRAP; - mwrap=GENNOMWRAP; - PPU_hook=TKSPPU; - AddExState(&PPUCHRBus, 1, 0, "PPUC"); -} - -void TKSROM_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 256, 8, info->battery); - cwrap=TKSWRAP; - mwrap=GENNOMWRAP; - PPU_hook=TKSPPU; - AddExState(&PPUCHRBus, 1, 0, "PPUC"); -} - -void TQROM_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 64, 0, 0); - cwrap=TQWRAP; - CHRRAMSize=8192; - CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize); - SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); -} - -void HKROM_Init(CartInfo *info) -{ - GenMMC3_Init(info, 512, 512, 1, info->battery); -} +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 1998 BERO + * Copyright (C) 2003 Xodnizel + * Mapper 12 code 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 + */ + +/* Code for emulating iNES mappers 4,12,44,45,47,49,52,74,114,115,116,118, + 119,165,205,214,215,245,249,250,254 +*/ + +#include "mapinc.h" +#include "mmc3.h" + +uint8 MMC3_cmd; +uint8 *WRAM; +uint8 *CHRRAM; +uint32 CHRRAMSize; +uint8 DRegBuf[8]; +uint8 EXPREGS[8]; /* For bootleg games, mostly. */ +uint8 A000B,A001B; + +#undef IRQCount +#undef IRQLatch +#undef IRQa +uint8 IRQCount,IRQLatch,IRQa; +uint8 IRQReload; + +static SFORMAT MMC3_StateRegs[]= +{ + {DRegBuf, 8, "REGS"}, + {&MMC3_cmd, 1, "CMD"}, + {&A000B, 1, "A000"}, + {&A001B, 1, "A001"}, + {&IRQReload, 1, "IRQR"}, + {&IRQCount, 1, "IRQC"}, + {&IRQLatch, 1, "IRQL"}, + {&IRQa, 1, "IRQA"}, + {0} +}; + +static int mmc3opts=0; +static int wrams; +static int isRevB=1; + +void (*pwrap)(uint32 A, uint8 V); +void (*cwrap)(uint32 A, uint8 V); +void (*mwrap)(uint8 V); + +void GenMMC3Power(void); +void FixMMC3PRG(int V); +void FixMMC3CHR(int V); + +void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery); + +// ---------------------------------------------------------------------- +// ------------------------- Generic MM3 Code --------------------------- +// ---------------------------------------------------------------------- + +void FixMMC3PRG(int V) +{ + if(V&0x40) + { + pwrap(0xC000,DRegBuf[6]); + pwrap(0x8000,~1); + } + else + { + pwrap(0x8000,DRegBuf[6]); + pwrap(0xC000,~1); + } + pwrap(0xA000,DRegBuf[7]); + pwrap(0xE000,~0); +} + +void FixMMC3CHR(int V) +{ + int cbase=(V&0x80)<<5; + + cwrap((cbase^0x000),DRegBuf[0]&(~1)); + cwrap((cbase^0x400),DRegBuf[0]|1); + cwrap((cbase^0x800),DRegBuf[1]&(~1)); + cwrap((cbase^0xC00),DRegBuf[1]|1); + + cwrap(cbase^0x1000,DRegBuf[2]); + cwrap(cbase^0x1400,DRegBuf[3]); + cwrap(cbase^0x1800,DRegBuf[4]); + cwrap(cbase^0x1c00,DRegBuf[5]); + + if(mwrap) mwrap(A000B); +} + +void MMC3RegReset(void) +{ + IRQCount=IRQLatch=IRQa=MMC3_cmd=0; + + DRegBuf[0]=0; + DRegBuf[1]=2; + DRegBuf[2]=4; + DRegBuf[3]=5; + DRegBuf[4]=6; + DRegBuf[5]=7; + DRegBuf[6]=0; + DRegBuf[7]=1; + + FixMMC3PRG(0); + FixMMC3CHR(0); +} + +DECLFW(MMC3_CMDWrite) +{ +// FCEU_printf("bs %04x %02x\n",A,V); + switch(A&0xE001) + { + case 0x8000: + if((V&0x40) != (MMC3_cmd&0x40)) + FixMMC3PRG(V); + if((V&0x80) != (MMC3_cmd&0x80)) + FixMMC3CHR(V); + MMC3_cmd = V; + break; + case 0x8001: + { + int cbase=(MMC3_cmd&0x80)<<5; + DRegBuf[MMC3_cmd&0x7]=V; + switch(MMC3_cmd&0x07) + { + case 0: cwrap((cbase^0x000),V&(~1)); + cwrap((cbase^0x400),V|1); + break; + case 1: cwrap((cbase^0x800),V&(~1)); + cwrap((cbase^0xC00),V|1); + break; + case 2: cwrap(cbase^0x1000,V); + break; + case 3: cwrap(cbase^0x1400,V); + break; + case 4: cwrap(cbase^0x1800,V); + break; + case 5: cwrap(cbase^0x1C00,V); + break; + case 6: + if(MMC3_cmd&0x40) + pwrap(0xC000,V); + else + pwrap(0x8000,V); + break; + case 7: + pwrap(0xA000,V); + break; + } + } + break; + case 0xA000: + if(mwrap) mwrap(V); + break; + case 0xA001: + A001B=V; + break; + } +} + +DECLFW(MMC3_IRQWrite) +{ +// FCEU_printf("%04x:%04x\n",A,V); + switch(A&0xE001) + { + case 0xC000:IRQLatch=V;break; + case 0xC001:IRQReload=1;break; + case 0xE000:X6502_IRQEnd(FCEU_IQEXT);IRQa=0;break; + case 0xE001:IRQa=1;break; + } +} + +static void ClockMMC3Counter(void) +{ + int count = IRQCount; + if(!count || IRQReload) + { + IRQCount = IRQLatch; + IRQReload = 0; + } + else + IRQCount--; + if((count|isRevB) && !IRQCount) + { + if(IRQa) + { + X6502_IRQBegin(FCEU_IQEXT); + } + } +} + +static void MMC3_hb(void) +{ + ClockMMC3Counter(); +} + +static void MMC3_hb_KickMasterHack(void) +{ + if(scanline==238) ClockMMC3Counter(); + ClockMMC3Counter(); +} + +static void MMC3_hb_PALStarWarsHack(void) +{ + if(scanline==240) ClockMMC3Counter(); + ClockMMC3Counter(); +} + +void GenMMC3Restore(int version) +{ + FixMMC3PRG(MMC3_cmd); + FixMMC3CHR(MMC3_cmd); +} + +static void GENCWRAP(uint32 A, uint8 V) +{ + setchr1(A,V); // Business Wars NEEDS THIS for 8K CHR-RAM +} + +static void GENPWRAP(uint32 A, uint8 V) +{ + setprg8(A,V&0x7F); // [NJ102] Mo Dao Jie (C) has 1024Mb MMC3 BOARD, maybe something other will be broken +} + +static void GENMWRAP(uint8 V) +{ + A000B=V; + setmirror((V&1)^1); +} + +static void GENNOMWRAP(uint8 V) +{ + A000B=V; +} + +static DECLFW(MBWRAMMMC6) +{ + WRAM[A&0x3ff]=V; +} + +static DECLFR(MAWRAMMMC6) +{ + return(WRAM[A&0x3ff]); +} + +void GenMMC3Power(void) +{ + if(UNIFchrrama) setchr8(0); + + SetWriteHandler(0x8000,0xBFFF,MMC3_CMDWrite); + SetWriteHandler(0xC000,0xFFFF,MMC3_IRQWrite); + SetReadHandler(0x8000,0xFFFF,CartBR); + A001B=A000B=0; + setmirror(1); + if(mmc3opts&1) + { + if(wrams==1024) + { + FCEU_CheatAddRAM(1,0x7000,WRAM); + SetReadHandler(0x7000,0x7FFF,MAWRAMMMC6); + SetWriteHandler(0x7000,0x7FFF,MBWRAMMMC6); + } + else + { + FCEU_CheatAddRAM((wrams&0x1fff)>>10,0x6000,WRAM); + SetWriteHandler(0x6000,0x6000 + ((wrams - 1) & 0x1fff),CartBW); + SetReadHandler(0x6000,0x6000 + ((wrams - 1) & 0x1fff),CartBR); + setprg8r(0x10,0x6000,0); + } + if(!(mmc3opts&2)) + FCEU_dwmemset(WRAM,0,wrams); + } + MMC3RegReset(); + if(CHRRAM) + FCEU_dwmemset(CHRRAM,0,CHRRAMSize); +} + +static void GenMMC3Close(void) +{ + if(CHRRAM) + FCEU_gfree(CHRRAM); + if(WRAM) + FCEU_gfree(WRAM); + CHRRAM=WRAM=NULL; +} + +void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery) +{ + pwrap=GENPWRAP; + cwrap=GENCWRAP; + mwrap=GENMWRAP; + + wrams=wram<<10; + + PRGmask8[0]&=(prg>>13)-1; + CHRmask1[0]&=(chr>>10)-1; + CHRmask2[0]&=(chr>>11)-1; + + if(wram) + { + mmc3opts|=1; + WRAM=(uint8*)FCEU_gmalloc(wrams); + SetupCartPRGMapping(0x10,WRAM,wrams,1); + AddExState(WRAM, wrams, 0, "MMC3WRAM"); + } + + if(battery) + { + mmc3opts|=2; + info->SaveGame[0]=WRAM; + info->SaveGameLen[0]=wrams; + } + + AddExState(MMC3_StateRegs, ~0, 0, 0); + + info->Power=GenMMC3Power; + info->Reset=MMC3RegReset; + info->Close=GenMMC3Close; + + if(info->CRC32 == 0x5104833e) // Kick Master + GameHBIRQHook = MMC3_hb_KickMasterHack; + else if(info->CRC32 == 0x5a6860f1 || info->CRC32 == 0xae280e20) // Shougi Meikan '92/'93 + GameHBIRQHook = MMC3_hb_KickMasterHack; + else if(info->CRC32 == 0xfcd772eb) // PAL Star Wars, similar problem as Kick Master. + GameHBIRQHook = MMC3_hb_PALStarWarsHack; + else + GameHBIRQHook=MMC3_hb; + GameStateRestore=GenMMC3Restore; +} + +// ---------------------------------------------------------------------- +// -------------------------- MMC3 Based Code --------------------------- +// ---------------------------------------------------------------------- + +// ---------------------------- Mapper 4 -------------------------------- + +static int hackm4=0;/* For Karnov, maybe others. BLAH. Stupid iNES format.*/ + +static void M4Power(void) +{ + GenMMC3Power(); + A000B=(hackm4^1)&1; + setmirror(hackm4); +} + +void Mapper4_Init(CartInfo *info) +{ + int ws=8; + + if((info->CRC32==0x93991433 || info->CRC32==0xaf65aa84)) + { + FCEU_printf("Low-G-Man can not work normally in the iNES format.\nThis game has been recognized by its CRC32 value, and the appropriate changes will be made so it will run.\nIf you wish to hack this game, you should use the UNIF format for your hack.\n\n"); + ws=0; + } + GenMMC3_Init(info,512,256,ws,info->battery); + info->Power=M4Power; + hackm4=info->mirror; +} + +// ---------------------------- Mapper 12 ------------------------------- + +static void M12CW(uint32 A, uint8 V) +{ + setchr1(A,(EXPREGS[(A&0x1000)>>12]<<8)+V); +} + +static DECLFW(M12Write) +{ + EXPREGS[0]=V&0x01; + EXPREGS[1]=(V&0x10)>>4; +} + +static void M12Power(void) +{ + EXPREGS[0]=EXPREGS[1]=0; + GenMMC3Power(); + SetWriteHandler(0x4100,0x5FFF,M12Write); +} + +void Mapper12_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, info->battery); + cwrap=M12CW; + info->Power=M12Power; + 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) +{ + uint32 NV=V; + if(EXPREGS[0]>=6) NV&=0x1F; + else NV&=0x0F; + NV|=EXPREGS[0]<<4; + setprg8(A,NV); +} + +static void M44CW(uint32 A, uint8 V) +{ + uint32 NV=V; + if(EXPREGS[0]<6) NV&=0x7F; + NV|=EXPREGS[0]<<7; + setchr1(A,NV); +} + +static DECLFW(M44Write) +{ + if(A&1) + { + EXPREGS[0]=V&7; + FixMMC3PRG(MMC3_cmd); + FixMMC3CHR(MMC3_cmd); + } + else + MMC3_CMDWrite(A,V); +} + +static void M44Power(void) +{ + EXPREGS[0]=0; + GenMMC3Power(); + SetWriteHandler(0xA000,0xBFFF,M44Write); +} + +void Mapper44_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, info->battery); + cwrap=M44CW; + pwrap=M44PW; + info->Power=M44Power; + AddExState(EXPREGS, 1, 0, "EXPR"); +} + +// ---------------------------- Mapper 45 ------------------------------- + +static void M45CW(uint32 A, uint8 V) +{ + if(!UNIFchrrama) + { + uint32 NV=V; + if(EXPREGS[2]&8) + NV&=(1<<((EXPREGS[2]&7)+1))-1; + else + if(EXPREGS[2]) + NV&=0; // hack ;( don't know exactly how it should be + NV|=EXPREGS[0]|((EXPREGS[2]&0xF0)<<4); + setchr1(A,NV); + } +} + +static void M45PW(uint32 A, uint8 V) +{ + V&=(EXPREGS[3]&0x3F)^0x3F; + V|=EXPREGS[1]; + setprg8(A,V); +} + +static DECLFW(M45Write) +{ + if(EXPREGS[3]&0x40) + { + WRAM[A-0x6000]=V; + return; + } + EXPREGS[EXPREGS[4]]=V; + EXPREGS[4]=(EXPREGS[4]+1)&3; +// 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) +{ + EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=EXPREGS[4]=0; + MMC3RegReset(); +} + +static void M45Power(void) +{ + setchr8(0); + GenMMC3Power(); + SetWriteHandler(0x6000,0x7FFF,M45Write); +} + +void Mapper45_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, info->battery); + cwrap=M45CW; + pwrap=M45PW; + info->Reset=M45Reset; + info->Power=M45Power; + AddExState(EXPREGS, 5, 0, "EXPR"); +} + +// ---------------------------- Mapper 47 ------------------------------- + +static void M47PW(uint32 A, uint8 V) +{ + V&=0xF; + V|=EXPREGS[0]<<4; + setprg8(A,V); +} + +static void M47CW(uint32 A, uint8 V) +{ + uint32 NV=V; + NV&=0x7F; + NV|=EXPREGS[0]<<7; + setchr1(A,NV); +} + +static DECLFW(M47Write) +{ + EXPREGS[0]=V&1; + FixMMC3PRG(MMC3_cmd); + FixMMC3CHR(MMC3_cmd); +} + +static void M47Power(void) +{ + EXPREGS[0]=0; + GenMMC3Power(); + SetWriteHandler(0x6000,0x7FFF,M47Write); +// SetReadHandler(0x6000,0x7FFF,0); +} + +void Mapper47_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, 0); + pwrap=M47PW; + cwrap=M47CW; + info->Power=M47Power; + AddExState(EXPREGS, 1, 0, "EXPR"); +} + +// ---------------------------- Mapper 49 ------------------------------- + +static void M49PW(uint32 A, uint8 V) +{ + if(EXPREGS[0]&1) + { + V&=0xF; + V|=(EXPREGS[0]&0xC0)>>2; + setprg8(A,V); + } + else + setprg32(0x8000,(EXPREGS[0]>>4)&3); +} + +static void M49CW(uint32 A, uint8 V) +{ + uint32 NV=V; + NV&=0x7F; + NV|=(EXPREGS[0]&0xC0)<<1; + setchr1(A,NV); +} + +static DECLFW(M49Write) +{ + if(A001B&0x80) + { + EXPREGS[0]=V; + FixMMC3PRG(MMC3_cmd); + FixMMC3CHR(MMC3_cmd); + } +} + +static void M49Reset(void) +{ + EXPREGS[0]=0; + MMC3RegReset(); +} + +static void M49Power(void) +{ + M49Reset(); + GenMMC3Power(); + SetWriteHandler(0x6000,0x7FFF,M49Write); + SetReadHandler(0x6000,0x7FFF,0); +} + +void Mapper49_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 0, 0); + cwrap=M49CW; + pwrap=M49PW; + info->Reset=M49Reset; + info->Power=M49Power; + AddExState(EXPREGS, 1, 0, "EXPR"); +} + +// ---------------------------- Mapper 52 ------------------------------- + +static void M52PW(uint32 A, uint8 V) +{ + uint32 NV=V; + NV&=0x1F^((EXPREGS[0]&8)<<1); + NV|=((EXPREGS[0]&6)|((EXPREGS[0]>>3)&EXPREGS[0]&1))<<4; + setprg8(A,NV); +} + +static void M52CW(uint32 A, uint8 V) +{ + uint32 NV=V; + NV&=0xFF^((EXPREGS[0]&0x40)<<1); + NV|=(((EXPREGS[0]>>3)&4)|((EXPREGS[0]>>1)&2)|((EXPREGS[0]>>6)&(EXPREGS[0]>>4)&1))<<7; + setchr1(A,NV); +} + +static DECLFW(M52Write) +{ + if(EXPREGS[1]) + { + WRAM[A-0x6000]=V; + return; + } + EXPREGS[1]=1; + EXPREGS[0]=V; + FixMMC3PRG(MMC3_cmd); + FixMMC3CHR(MMC3_cmd); +} + +static void M52Reset(void) +{ + EXPREGS[0]=EXPREGS[1]=0; + MMC3RegReset(); +} + +static void M52Power(void) +{ + M52Reset(); + GenMMC3Power(); + SetWriteHandler(0x6000,0x7FFF,M52Write); +} + +void Mapper52_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, info->battery); + cwrap=M52CW; + pwrap=M52PW; + info->Reset=M52Reset; + info->Power=M52Power; + AddExState(EXPREGS, 2, 0, "EXPR"); +} + +// ---------------------------- Mapper 74 ------------------------------- + +static void M74CW(uint32 A, uint8 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(0,A,V); +} + +void Mapper74_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, info->battery); + cwrap=M74CW; + CHRRAMSize=2048; + CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize); + SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); + AddExState(CHRRAM, CHRRAMSize, 0, "CHRR"); +} + +// ---------------------------- Mapper 114 ------------------------------ + +static uint8 cmdin; +uint8 m114_perm[8] = {0, 3, 1, 5, 6, 7, 2, 4}; + +static void M114PWRAP(uint32 A, uint8 V) +{ + if(EXPREGS[0]&0x80) + { + setprg16(0x8000,EXPREGS[0]&0xF); + setprg16(0xC000,EXPREGS[0]&0xF); + } + else + setprg8(A,V&0x3F); +} + +static DECLFW(M114Write) +{ + switch(A&0xE001) + { + case 0x8001: MMC3_CMDWrite(0xA000,V); break; + case 0xA000: MMC3_CMDWrite(0x8000,(V&0xC0)|(m114_perm[V&7])); cmdin=1; break; + case 0xC000: if(!cmdin) break; MMC3_CMDWrite(0x8001,V); cmdin=0; break; + case 0xA001: IRQLatch=V; break; + case 0xC001: IRQReload=1; break; + case 0xE000: X6502_IRQEnd(FCEU_IQEXT);IRQa=0; break; + case 0xE001: IRQa=1; break; + } +} + +static DECLFW(M114ExWrite) +{ + if(A<=0x7FFF) + { + EXPREGS[0]=V; + FixMMC3PRG(MMC3_cmd); + } +} + +static void M114Power(void) +{ + GenMMC3Power(); + SetWriteHandler(0x8000,0xFFFF,M114Write); + SetWriteHandler(0x5000,0x7FFF,M114ExWrite); +} + +static void M114Reset(void) +{ + EXPREGS[0]=0; + MMC3RegReset(); +} + +void Mapper114_Init(CartInfo *info) +{ + isRevB=0; + GenMMC3_Init(info, 256, 256, 0, 0); + pwrap=M114PWRAP; + info->Power=M114Power; + info->Reset=M114Reset; + AddExState(EXPREGS, 1, 0, "EXPR"); + AddExState(&cmdin, 1, 0, "CMDIN"); +} + +// ---------------------------- Mapper 115 ------------------------------ + +static void M115PW(uint32 A, uint8 V) +{ + 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)); +} + +static DECLFW(M115Write) +{ +// FCEU_printf("%04x:%04x\n",A,V); + if(A==0x5080) EXPREGS[2]=V; + if(A==0x6000) + EXPREGS[0]=V; + else if(A==0x6001) + EXPREGS[1]=V; + FixMMC3PRG(MMC3_cmd); +} + +static DECLFR(M115Read) +{ + return EXPREGS[2]; +} + +static void M115Power(void) +{ + GenMMC3Power(); + SetWriteHandler(0x4100,0x7FFF,M115Write); + SetReadHandler(0x5000,0x5FFF,M115Read); +} + +void Mapper115_Init(CartInfo *info) +{ + GenMMC3_Init(info, 128, 512, 0, 0); + cwrap=M115CW; + pwrap=M115PW; + info->Power=M115Power; + AddExState(EXPREGS, 2, 0, "EXPR"); +} + +// ---------------------------- Mapper 116 ------------------------------ + +static void M116CW(uint32 A, uint8 V) +{ +// setchr1(A,V|((EXPREGS[0]&0x4)<<6)); + if(EXPREGS[0]&2) + setchr8r(0x10,0); + else + setchr1(A,V); +} + +static DECLFW(M116Write) +{ + EXPREGS[0]=V; + FixMMC3CHR(MMC3_cmd); +} + +static void M116Power(void) +{ + GenMMC3Power(); + SetWriteHandler(0x4100,0x4100,M116Write); +} + +void Mapper116_Init(CartInfo *info) +{ + 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"); +} + +// ---------------------------- Mapper 118 ------------------------------ + +static uint8 PPUCHRBus; +static uint8 TKSMIR[8]; + +static void TKSPPU(uint32 A) +{ + A&=0x1FFF; + A>>=10; + PPUCHRBus=A; + setmirror(MI_0+TKSMIR[A]); +} + +static void TKSWRAP(uint32 A, uint8 V) +{ + TKSMIR[A>>10]=V>>7; + setchr1(A,V&0x7F); + if(PPUCHRBus==(A>>10)) + setmirror(MI_0+(V>>7)); +} + +// ---------------------------- Mapper 119 ------------------------------ + +static void TQWRAP(uint32 A, uint8 V) +{ + setchr1r((V&0x40)>>2,A,V&0x3F); +} + +void Mapper119_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 64, 0, 0); + cwrap=TQWRAP; + CHRRAMSize=8192; + CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize); + SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); +} + +// ---------------------------- Mapper 134 ------------------------------ + +static void M134PW(uint32 A, uint8 V) +{ + setprg8(A,(V&0x1F)|((EXPREGS[0]&2)<<4)); +} + +static void M134CW(uint32 A, uint8 V) +{ + setchr1(A,(V&0xFF)|((EXPREGS[0]&0x20)<<3)); +} + +static DECLFW(M134Write) +{ + EXPREGS[0]=V; + FixMMC3CHR(MMC3_cmd); + FixMMC3PRG(MMC3_cmd); +} + +static void M134Power(void) +{ + EXPREGS[0]=0; + GenMMC3Power(); + SetWriteHandler(0x6001,0x6001,M134Write); +} + +static void M134Reset(void) +{ + EXPREGS[0]=0; + MMC3RegReset(); +} + +void Mapper134_Init(CartInfo *info) +{ + GenMMC3_Init(info, 256, 256, 0, 0); + pwrap=M134PW; + cwrap=M134CW; + info->Power=M134Power; + info->Reset=M134Reset; + AddExState(EXPREGS, 4, 0, "EXPR"); +} + +// ---------------------------- Mapper 165 ------------------------------ + +static void M165CW(uint32 A, uint8 V) +{ + if(V==0) + setchr4r(0x10,A,0); + else + setchr4(A,V>>2); +} + +static void M165PPUFD(void) +{ + if(EXPREGS[0]==0xFD) + { + M165CW(0x0000,DRegBuf[0]); + M165CW(0x1000,DRegBuf[2]); + } +} + +static void M165PPUFE(void) +{ + if(EXPREGS[0]==0xFE) + { + M165CW(0x0000,DRegBuf[1]); + M165CW(0x1000,DRegBuf[4]); + } +} + +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(); +} + +static void M165PPU(uint32 A) +{ + if((A&0x1FF0)==0x1FD0) + { + EXPREGS[0]=0xFD; + M165PPUFD(); + } else if((A&0x1FF0)==0x1FE0) + { + EXPREGS[0]=0xFE; + M165PPUFE(); + } +} + +static void M165Power(void) +{ + EXPREGS[0]=0xFD; + GenMMC3Power(); +} + +void Mapper165_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 128, 8, info->battery); + cwrap=M165CWM; + PPU_hook=M165PPU; + info->Power=M165Power; + CHRRAMSize = 4096; + CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize); + SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); + AddExState(CHRRAM, CHRRAMSize, 0, "CHRR"); + AddExState(EXPREGS, 4, 0, "EXPR"); +} + +// ---------------------------- 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 195 ------------------------------- +static uint8 *wramtw; +static uint16 wramsize; + +static void M195CW(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 M195Power(void) +{ + GenMMC3Power(); + setprg4r(0x10,0x5000,0); + SetWriteHandler(0x5000,0x5fff,CartBW); + SetReadHandler(0x5000,0x5fff,CartBR); +} + +static void M195Close(void) +{ + if(wramtw) + FCEU_gfree(wramtw); + wramtw=NULL; +} + +void Mapper195_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, info->battery); + cwrap=M195CW; + info->Power=M195Power; + info->Close=M195Close; + 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 196 ------------------------------- + +static DECLFW(Mapper196Write) +{ + A=(A&0xFFFE)|((A>>2)&1)|((A>>3)&1)|((A>>1)&1); + if(A >= 0xC000) + MMC3_IRQWrite(A,V); + else + MMC3_CMDWrite(A,V); +} + +static void Mapper196Power(void) +{ + GenMMC3Power(); + SetWriteHandler(0x8000,0xFFFF,Mapper196Write); +} + +void Mapper196_Init(CartInfo *info) +{ + GenMMC3_Init(info, 128, 128, 0, 0); + info->Power=Mapper196Power; +} + +// ---------------------------- Mapper 197 ------------------------------- + +static void M197CW(uint32 A, uint8 V) +{ + if(A==0x0000) + setchr4(0x0000,V>>1); + else if(A==0x1000) + setchr2(0x1000,V); + else if(A==0x1400) + setchr2(0x1800,V); +} + +void Mapper197_Init(CartInfo *info) +{ + GenMMC3_Init(info, 128, 512, 8, 0); + cwrap=M197CW; +} + +// ---------------------------- Mapper 198 ------------------------------- + +static void M198PW(uint32 A, uint8 V) +{ + if(V>=0x50) // Tenchi o Kurau II - Shokatsu Koumei Den (J) (C).nes + setprg8(A,V&0x4F); + else + setprg8(A,V); +} + +void Mapper198_Init(CartInfo *info) +{ + GenMMC3_Init(info, 1024, 256, 8, info->battery); + pwrap=M198PW; + info->Power=M195Power; + info->Close=M195Close; + wramsize=4096; + wramtw=(uint8*)FCEU_gmalloc(wramsize); + SetupCartPRGMapping(0x10, wramtw, wramsize, 1); + AddExState(wramtw, wramsize, 0, "WRAMTW"); +} + +// ---------------------------- Mapper 205 ------------------------------ + +static void M205PW(uint32 A, uint8 V) +{ + if(EXPREGS[0]&2) + setprg8(A,(V&0x0f)|((EXPREGS[0]&3)<<4)); + else + setprg8(A,(V&0x1f)|((EXPREGS[0]&3)<<4)); +} + +static void M205CW(uint32 A, uint8 V) +{ + setchr1(A,V|((EXPREGS[0]&3)<<7)); +} + +static DECLFW(M205Write) +{ + if((A&0x6800)==0x6800) EXPREGS[0]= V; + FixMMC3PRG(MMC3_cmd); + FixMMC3CHR(MMC3_cmd); +} + +static void M205Reset(void) +{ + EXPREGS[0]=0; + MMC3RegReset(); +} + +static void M205Power(void) +{ + GenMMC3Power(); + SetWriteHandler(0x4020,0x7FFF,M205Write); +} + +void Mapper205_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, 0); + pwrap=M205PW; + cwrap=M205CW; + info->Power=M205Power; + info->Reset=M205Reset; + AddExState(EXPREGS, 1, 0, "EXPR"); +} + +// ---------------------------- Mapper 245 ------------------------------ + +static void M245CW(uint32 A, uint8 V) +{ + if(!UNIFchrrama) // Yong Zhe Dou E Long - Dragon Quest VI (As).nes NEEDS THIS for RAM cart + setchr1(A,V&7); + EXPREGS[0]=V; + FixMMC3PRG(MMC3_cmd); +} + +static void M245PW(uint32 A, uint8 V) +{ + setprg8(A,(V&0x3F)|((EXPREGS[0]&2)<<5)); +} + +static void M245Power(void) +{ + EXPREGS[0]=0; + GenMMC3Power(); +} + +void Mapper245_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, info->battery); + cwrap=M245CW; + pwrap=M245PW; + info->Power=M245Power; + AddExState(EXPREGS, 1, 0, "EXPR"); +} + +// ---------------------------- Mapper 249 ------------------------------ + +static void M249PW(uint32 A, uint8 V) +{ + if(EXPREGS[0]&0x2) + { + if(V<0x20) + V=(V&1)|((V>>3)&2)|((V>>1)&4)|((V<<2)&8)|((V<<2)&0x10); + else + { + V-=0x20; + V=(V&3)|((V>>1)&4)|((V>>4)&8)|((V>>2)&0x10)|((V<<3)&0x20)|((V<<2)&0xC0); + } + } + setprg8(A,V); +} + +static void M249CW(uint32 A, uint8 V) +{ + if(EXPREGS[0]&0x2) + V=(V&3)|((V>>1)&4)|((V>>4)&8)|((V>>2)&0x10)|((V<<3)&0x20)|((V<<2)&0xC0); + setchr1(A,V); +} + +static DECLFW(M249Write) +{ + EXPREGS[0]=V; + FixMMC3PRG(MMC3_cmd); + FixMMC3CHR(MMC3_cmd); +} + +static void M249Power(void) +{ + EXPREGS[0]=0; + GenMMC3Power(); + SetWriteHandler(0x5000,0x5000,M249Write); +} + +void Mapper249_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, info->battery); + cwrap=M249CW; + pwrap=M249PW; + info->Power=M249Power; + AddExState(EXPREGS, 1, 0, "EXPR"); +} + +// ---------------------------- Mapper 250 ------------------------------ + +static DECLFW(M250Write) +{ + MMC3_CMDWrite((A&0xE000)|((A&0x400)>>10),A&0xFF); +} + +static DECLFW(M250IRQWrite) +{ + MMC3_IRQWrite((A&0xE000)|((A&0x400)>>10),A&0xFF); +} + +static void M250_Power(void) +{ + GenMMC3Power(); + SetWriteHandler(0x8000,0xBFFF,M250Write); + SetWriteHandler(0xC000,0xFFFF,M250IRQWrite); +} + +void Mapper250_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, info->battery); + info->Power=M250_Power; +} + +// ---------------------------- Mapper 254 ------------------------------ + +static DECLFR(MR254WRAM) +{ + if(EXPREGS[0]) + return WRAM[A-0x6000]; + else + return WRAM[A-0x6000]^EXPREGS[1]; +} + +static DECLFW(M254Write) +{ + switch (A) { + case 0x8000: EXPREGS[0]=0xff; + break; + case 0xA001: EXPREGS[1]=V; + } + MMC3_CMDWrite(A,V); +} + +static void M254_Power(void) +{ + GenMMC3Power(); + SetWriteHandler(0x8000,0xBFFF,M254Write); + SetReadHandler(0x6000,0x7FFF,MR254WRAM); +} + +void Mapper254_Init(CartInfo *info) +{ + GenMMC3_Init(info, 128, 128, 8, info->battery); + info->Power=M254_Power; + AddExState(EXPREGS, 2, 0, "EXPR"); +} + +// ---------------------------- UNIF Boards ----------------------------- + +void TBROM_Init(CartInfo *info) +{ + GenMMC3_Init(info, 64, 64, 0, 0); +} + +void TEROM_Init(CartInfo *info) +{ + GenMMC3_Init(info, 32, 32, 0, 0); +} + +void TFROM_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 64, 0, 0); +} + +void TGROM_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 0, 0, 0); +} + +void TKROM_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, info->battery); +} + +void TLROM_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 0, 0); +} + +void TSROM_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, 0); +} + +void TLSROM_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, 0); + cwrap=TKSWRAP; + mwrap=GENNOMWRAP; + PPU_hook=TKSPPU; + AddExState(&PPUCHRBus, 1, 0, "PPUC"); +} + +void TKSROM_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 256, 8, info->battery); + cwrap=TKSWRAP; + mwrap=GENNOMWRAP; + PPU_hook=TKSPPU; + AddExState(&PPUCHRBus, 1, 0, "PPUC"); +} + +void TQROM_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 64, 0, 0); + cwrap=TQWRAP; + CHRRAMSize=8192; + CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize); + SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); +} + +void HKROM_Init(CartInfo *info) +{ + GenMMC3_Init(info, 512, 512, 1, info->battery); +} diff --git a/src/debug.cpp b/src/debug.cpp index 51b9e46b..037af069 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -395,21 +395,19 @@ void LogCDData(){ uint16 A = 0; uint8 opcode[3] = {0}, memop = 0; - j = GetPRGAddress(_PC); - - if(j != -1) { - opcode[0] = GetMem(_PC); - switch (opsize[opcode[0]]) { - case 2: - opcode[1] = GetMem(_PC + 1); - break; - case 3: - opcode[1] = GetMem(_PC + 1); - opcode[2] = GetMem(_PC + 2); - break; - } + opcode[0] = GetMem(_PC); + switch (opsize[opcode[0]]) { + case 2: + opcode[1] = GetMem(_PC + 1); + break; + case 3: + opcode[1] = GetMem(_PC + 1); + opcode[2] = GetMem(_PC + 2); + break; + } - for (i = 0; i < opsize[opcode[0]]; i++){ + if((j = GetPRGAddress(_PC)) != -1) + for (i = 0; i < opsize[opcode[0]]; i++) { if(cdloggerdata[j+i] & 1)continue; //this has been logged so skip cdloggerdata[j+i] |= 1; cdloggerdata[j+i] |=((_PC+i)>>11)&0x0c; @@ -418,36 +416,35 @@ void LogCDData(){ if(!(cdloggerdata[j+i] & 2))undefinedcount--; } - //log instruction jumped to in an indirect jump - if(opcode[0] == 0x6c) indirectnext = 1; else indirectnext = 0; + //log instruction jumped to in an indirect jump + if(opcode[0] == 0x6c) indirectnext = 1; else indirectnext = 0; - switch (optype[opcode[0]]) { - case 0: break; - case 1: - A = (opcode[1]+_X) & 0xFF; - A = GetMem(A) | (GetMem(A+1)<<8); - memop = 0x20; - break; - case 2: A = opcode[1]; break; - case 3: A = opcode[1] | opcode[2]<<8; break; - case 4: - A = (GetMem(opcode[1]) | (GetMem(opcode[1]+1)<<8))+_Y; - memop = 0x20; - break; - case 5: A = opcode[1]+_X; break; - case 6: A = (opcode[1] | (opcode[2]<<8))+_Y; break; - case 7: A = (opcode[1] | (opcode[2]<<8))+_X; break; - case 8: A = opcode[1]+_Y; break; - } + switch (optype[opcode[0]]) { + case 0: break; + case 1: + A = (opcode[1]+_X) & 0xFF; + A = GetMem(A) | (GetMem(A+1)<<8); + memop = 0x20; + break; + case 2: A = opcode[1]; break; + case 3: A = opcode[1] | opcode[2]<<8; break; + case 4: + A = (GetMem(opcode[1]) | (GetMem(opcode[1]+1)<<8))+_Y; + memop = 0x20; + break; + case 5: A = opcode[1]+_X; break; + case 6: A = (opcode[1] | (opcode[2]<<8))+_Y; break; + case 7: A = (opcode[1] | (opcode[2]<<8))+_X; break; + case 8: A = opcode[1]+_Y; break; + } - if((j = GetPRGAddress(A)) != -1) { - if(!(cdloggerdata[j] & 2)) { - cdloggerdata[j] |= 2; - cdloggerdata[j] |=(A>>11)&0x0c; - cdloggerdata[j] |= memop; - datacount++; - if(!(cdloggerdata[j] & 1))undefinedcount--; - } + if((j = GetPRGAddress(A)) != -1) { + if(!(cdloggerdata[j] & 2)) { + cdloggerdata[j] |= 2; + cdloggerdata[j] |=(A>>11)&0x0c; + cdloggerdata[j] |= memop; + datacount++; + if(!(cdloggerdata[j] & 1))undefinedcount--; } } } diff --git a/src/drivers/win/cdlogger.cpp b/src/drivers/win/cdlogger.cpp index 3708e0da..de307262 100644 --- a/src/drivers/win/cdlogger.cpp +++ b/src/drivers/win/cdlogger.cpp @@ -38,7 +38,7 @@ using namespace std; void LoadCDLogFile(); void SaveCDLogFileAs(); void SaveCDLogFile(); -void SaveStrippedRom(); +void SaveStrippedRom(int invert); extern iNES_HEADER head; //defined in ines.c extern uint8 *trainerpoo; @@ -169,7 +169,10 @@ MB_OK); SaveCDLogFile(); break; case BTN_CDLOGGER_SAVE_STRIPPED: - SaveStrippedRom(); + SaveStrippedRom(0); + break; + case BTN_CDLOGGER_SAVE_UNUSED: + SaveStrippedRom(1); break; } break; @@ -319,7 +322,7 @@ void UpdateCDLogger(){ return; } -void SaveStrippedRom(){ //this is based off of iNesSave() +void SaveStrippedRom(int invert){ //this is based off of iNesSave() //todo: make this support nsfs const char NESfilter[]="Stripped iNes Rom file (*.NES)\0*.nes\0All Files (*.*)\0*.*\0\0"; const char NSFfilter[]="Stripped NSF file (*.NSF)\0*.nsf\0All Files (*.*)\0*.*\0\0"; @@ -376,8 +379,12 @@ void SaveStrippedRom(){ //this is based off of iNesSave() fseek(fp,0x8,SEEK_SET); for(i = 0;i < ((NSFMaxBank+1)*4096);i++){ - if(cdloggerdata[i] & 3)fputc(NSFDATA[i],fp); - else fputc(0,fp); + unsigned char pchar; + if(cdloggerdata[i] & 3) + pchar = invert?0:NSFDATA[i]; + else + pchar = invert?NSFDATA[i]:0; + fputc(pchar, fp); } } @@ -395,8 +402,12 @@ void SaveStrippedRom(){ //this is based off of iNesSave() } for(i = 0;i < head.ROM_size*0x4000;i++){ - if(cdloggerdata[i] & 3)fputc(ROM[i],fp); - else fputc(0,fp); + unsigned char pchar; + if(cdloggerdata[i] & 3) + pchar = invert?0:ROM[i]; + else + pchar = invert?ROM[i]:0; + fputc(pchar, fp); } //fwrite(ROM,0x4000,head.ROM_size,fp); diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index a7ef8320..8b5e0c13 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -1386,7 +1386,7 @@ BEGIN DEFPUSHBUTTON "&OK",IDOK,67,52,50,14 END -CDLOGGER DIALOGEX 0, 0, 322, 213 +CDLOGGER DIALOGEX 0, 0, 315, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES CAPTION "Code Data Logger" @@ -1394,12 +1394,12 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Load...",BTN_CDLOGGER_LOAD,7,81,50,14 PUSHBUTTON "Save",BTN_CDLOGGER_SAVE,257,81,50,14 - GROUPBOX "Code Data Log Status",-1,2,4,316,119,BS_CENTER + GROUPBOX "Code Data Log Status",-1,3,4,308,131,BS_CENTER PUSHBUTTON "Start",BTN_CDLOGGER_START_PAUSE,129,81,50,14 - GROUPBOX "Address Label Logger",65534,3,128,315,79,BS_CENTER - PUSHBUTTON "Load...",111,7,182,50,14,WS_DISABLED - PUSHBUTTON "Start",112,127,181,50,14,WS_DISABLED - PUSHBUTTON "Save...",113,259,181,50,14,WS_DISABLED + GROUPBOX "Address Label Logger",65534,3,136,308,79,BS_CENTER + PUSHBUTTON "Load...",111,7,190,50,14,WS_DISABLED + PUSHBUTTON "Start",112,127,189,50,14,WS_DISABLED + PUSHBUTTON "Save...",113,256,189,50,14,WS_DISABLED LTEXT "4067 - 29.5%",LBL_CDLOGGER_CODECOUNT,38,31,68,11 GROUPBOX "Bytes Logged As Code",65533,29,20,84,27 GROUPBOX "Bytes Logged as data",65532,117,20,84,27 @@ -1409,7 +1409,8 @@ BEGIN LTEXT "Itsa me the Code Data Logger! Press Start to play!",65530,69,56,172,12 PUSHBUTTON "Reset Log",BTN_CDLOGGER_RESET,7,66,50,14 PUSHBUTTON "Save as...",BTN_CDLOGGER_SAVE_AS,257,66,50,14 - PUSHBUTTON "Save Stripped iNes Rom...",BTN_CDLOGGER_SAVE_STRIPPED,213,102,99,14 + PUSHBUTTON "Save Stripped iNes Rom...",BTN_CDLOGGER_SAVE_STRIPPED,208,102,99,14 + PUSHBUTTON "Save Unused Data...",BTN_CDLOGGER_SAVE_UNUSED,208,117,99,14 END PPUVIEW DIALOGEX 44, 38, 355, 246 @@ -1817,6 +1818,10 @@ BEGIN BOTTOMMARGIN, 318 END + "TRACER", DIALOG + BEGIN + END + "ADDBP", DIALOG BEGIN RIGHTMARGIN, 185 @@ -1882,6 +1887,7 @@ BEGIN "CDLOGGER", DIALOG BEGIN + BOTTOMMARGIN, 213 END "ARCHIVECHOOSERDIALOG", DIALOG diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index d61be9ef..b4518645 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -103,6 +103,7 @@ #define IDC_ROMPATCHER_PATCH_DATA 109 #define IDC_ADDBP_MODE_X2 109 #define IDC_ADDBP_MODE_F 109 +#define BTN_CDLOGGER_SAVE_UNUSED 109 #define IDC_CHEAT_VAL_LT_BY 110 #define MENU_SAVE_STATE 110 #define CB_ASK_EXIT 110 diff --git a/src/ines-correct.h b/src/ines-correct.h index 900a4606..27484dcc 100644 --- a/src/ines-correct.h +++ b/src/ines-correct.h @@ -1,252 +1,254 @@ - {0x9cbadc25,5,8}, /* JustBreed */ - - {0x6e68e31a,16,8}, /* Dragon Ball 3*/ - {0xbfc7a2e9,16,8}, - {0x33b899c9,16,-1}, /* Dragon Ball - Dai Maou Fukkatsu (J) [!] */ - {0x3f15d20d,153,8}, /* Famicom Jump 2 */ -// {0xb049a8c4,153,-1}, /* SD Gundam Gaiden - Knight Gundam Monogatari 2 - Hikari no Kishi (J) [!] */ -// NOT 16, since uses WRAM but 8000-FFFF address range for bankswitching, - - {0x983d8175,157,8}, /* Datach Battle Rush */ - {0x894efdbc,157,8}, /* Datach Crayon Shin Chan */ - {0x19e81461,157,8}, /* Datach DBZ */ - {0xbe06853f,157,8}, /* Datach J-League */ - {0x0be0a328,157,8}, /* Datach SD Gundam Wars */ - {0x5b457641,157,8}, /* Datach Ultraman Club */ - {0xf51a7f46,157,8}, /* Datach Yuu Yuu Hakusho */ - - {0xe62e3382,71,-1}, /* Mig-29 Soviet Fighter */ - {0x21a653c7,4,-1}, /* Super Sky Kid */ - - {0xdd4d9a62,209,-1}, /* Shin Samurai Spirits 2 */ - {0x063b1151,209,-1}, /* Power Rangers 4 */ - {0xdd8ced31,209,-1}, /* Power Rangers 3 */ - - {0x0c47946d,210,1}, /* Chibi Maruko Chan */ - {0xbd523011,210,2}, /* Dream Master */ // may be wrong, but seems it solve most problems - {0xc247cc80,210,1}, /* Family Circuit '91 */ - {0x6ec51de5,210,1}, /* Famista '92 */ - {0xadffd64f,210,1}, /* Famista '93 */ - {0x429103c9,210,1}, /* Famista '94 */ - {0x81b7f1a8,210,1}, /* Heisei Tensai Bakabon */ - {0x2447e03b,210,1}, /* Top Striker */ - {0x1dc0f740,210,1}, /* Wagyan Land 2 */ - {0xd323b806,210,1}, /* Wagyan Land 3 */ - - {0x07eb2c12,208,-1}, /* Street Fighter IV */ - {0x96ce586e,189,8}, /* Street Fighter 2 YOKO */ - {0x7678f1d5,207,8}, /* Fudou Myouou Den */ - {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 */ - {0x6cdc0cd9,48,8}, /* Bubble Bobble 2 */ - //{0x10e24006,48,8}, /* Flintstones 2 - bad dump? */ - {0x40c0ad47,48,8}, /* Flintstones 2 */ - {0xa7b0536c,48,8}, /* Don Doko Don 2 */ - {0x99c395f9,48,8}, /* Captain Saver */ - {0x1500e835,48,8}, /* Jetsons (J) */ - - {0x637134e8,193,1}, /* Fighting Hero */ - {0xcbf4366f,118,8}, /* Alien Syndrome (U.S. unlicensed) */ - {0xb19a55dd,64,8}, /* Road Runner */ - //{0x3eafd012,116,-1}, /* AV Girl Fighting */ - {0x1d0f4d6b,2,1}, /* Black Bass thinging */ - {0xf92be3ec,64,-1}, /* Rolling Thunder */ - {0x345ee51a,245,-1}, /* DQ4c */ - {0xf518dd58,7,8}, /* Captain Skyhawk */ - {0x7ccb12a3,43,-1}, /* SMB2j */ - {0x6f12afc5,235,-1}, /* Golden Game 150-in-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}, - - {0x1eb4a920,79,1}, /* Double Strike */ - {0x345d3a1a,11,1}, /* Castle of Deceit */ - {0x62ef6c79,232,8}, /* Quattro Sports -Aladdin */ - {0x5caa3e61,144,1}, /* Death Race */ - {0xd2699893,88,0}, /* Dragon Spirit */ - - {0x2f27cdef,155,8}, /* Tatakae!! Rahmen Man */ - {0xcfd4a281,155,8}, /* Money Game. Yay for money! */ - {0xd1691028,154,8}, /* Devil Man */ - - {0xc68363f6,180,0}, /* Crazy Climber */ - {0xbe939fce,9,1}, /* Punchout*/ - {0x5e66eaea,13,1}, /* Videomation */ - {0xaf5d7aa2,-1,0}, /* Clu Clu Land */ - -{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 */ -{0x9eefb4b4,4,8}, /* Pachi Slot Adventure 2 */ -{0x5337f73c,4,8}, /* Niji no Silk Road */ -{0x7474ac92,4,8}, /* Kabuki: Quantum Fighter */ - -{0xbb7c5f7a,89,8}, /* Mito Koumon or something similar */ - -/* Probably a Namco MMC3-workalike */ -//{0xa5e6baf9,4,1|4}, /* Dragon Slayer 4 */ -//{0xe40b4973,4,1|4}, /* Metro Cross */ -//{0xd97c31b0,4,1|4}, /* Rasaaru Ishii no Childs Quest */ - -{0x84382231,9,0}, /* Punch Out (J) */ - -{0xe28f2596,0,1}, /* Pac Land (J) */ -{0xfcdaca80,0,0}, /* Elevator Action */ -{0xe492d45a,0,0}, /* Zippy Race */ -{0x32fa246f,0,0}, /* Tag Team Pro Wrestling */ -{0xc05a365b,0,0}, /* Exed Exes (J) */ -{0xb3c30bea,0,0}, /* Xevious (J) */ - -{0x804f898a,2,1}, /* Dragon Unit */ -{0xe1b260da,2,1}, /* Argos no Senshi */ -{0x6d65cac6,2,0}, /* Terra Cresta */ -{0x9ea1dc76,2,0}, /* Rainbow Islands */ -{0x28c11d24,2,1}, /* Sukeban Deka */ -{0x02863604,2,1}, /* Sukeban Deka */ -{0x2bb6a0f8,2,1}, /* Sherlock Holmes */ -{0x55773880,2,1}, /* Gilligan's Island */ -{0x419461d0,2,1}, /* Super Cars */ -{0x6e0eb43e,2,1}, /* Puss n Boots */ -{0x266ce198,2,1}, /* City Adventure Touch */ - -//{0x48349b0b,1,8}, /* Dragon Quest 2 */ -{0xd09b74dc,1,8}, /* Great Tank (J) */ -{0xe8baa782,1,8}, /* Gun Hed (J) */ -{0x970bd9c2,1,8}, /* Hanjuku Hero */ -{0xcd7a2fd7,1,8}, /* Hanjuku Hero */ -{0x63469396,1,8}, /* Hokuto no Ken 4 */ -{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 */ - {0x391aa1b8,1,8}, /* Bloody Warriors (J) */ - {0x61a852ea,1,8}, /* Battle Stadium - Senbatsu Pro Yakyuu */ - {0xfe364be5,1,8}, /* Deep Dungeon 4 */ - {0xd8ee7669,1,8}, /* Adventures of Rad Gravity */ - {0xa5e8d2cd,1,8}, /* Breakthru */ - {0xf6fa4453,1,8}, /* Bigfoot */ - {0x37ba3261,1,8}, /* Back to the Future 2 and 3 */ - {0x934db14a,1,-1}, /* All-Pro Basketball */ - {0xe94d5181,1,8}, /* Mirai Senshi - Lios */ - {0x7156cb4d,1,8}, /* Muppet Adventure Carnival thingy */ - {0x5b6ca654,1,8}, /* Barbie rev X*/ - {0x57c12280,1,8}, /* Demon Sword */ - {0x70f67ab7,1,8}, /* Musashi no Bouken */ - {0xa9a4ea4c,1,8}, /* Satomi Hakkenden */ - {0xcc3544b0,1,8}, /* Triathron */ - - {0x1d41cc8c,3,1}, /* Gyruss */ - {0xd8eff0df,3,1}, /* Gradius (J) */ - {0xdbf90772,3,0}, /* Alpha Mission */ - {0xd858033d,3,0}, /* Armored Scrum Object */ - {0xcf322bb3,3,1}, /* John Elway's Quarterback */ - {0x9bde3267,3,1}, /* Adventures of Dino Riki */ - {0x02cc3973,3,1}, /* Ninja Kid */ - {0xb5d28ea2,3,1}, /* Mystery Quest - mapper 3?*/ - {0xbc065fc3,3,1}, /* Pipe Dream */ - - {0x5b837e8d,1,8}, /* Alien Syndrome */ - {0x283ad224,32,8}, /* Ai Sensei no Oshiete */ - {0x5555fca3,32,8}, /* "" "" */ - {0x243a8735,32,0x10|4}, /* Major League */ - -{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,140,1}, /* Mississippi Satsujin Jiken */ -{0xe46b1c5d,140,1}, /* Mississippi Satsujin Jiken */ -{0xe84274c5,66,1}, /* "" "" */ -{0x9552e8df,66,1}, /* Dragon Ball */ - - {0xba51ac6f,78,2}, - {0x3d1c3137,78,8}, /* Uchuusen - Cosmo Carrier */ - - {0xbda8f8e4,152,8}, /* Gegege no Kitarou 2 */ - {0x026c5fca,152,8}, /* Saint Seiya Ougon Densetsu */ - {0x0f141525,152,8}, /* Arkanoid 2 (Japanese) */ - {0xb1a94b82,152,8}, /* Pocket Zaurus */ - - {0xbba58be5,70,-1}, /* Family Trainer - Manhattan Police */ - {0x370ceb65,70,-1}, /* Family Trainer - Meiro Dai Sakusen */ - {0xdd8ed0f7,70,1}, /* Kamen Rider Club */ - - {0x90c773c1,118,-1}, /* Goal! 2 */ - {0xb9b4d9e0,118,-1}, /* NES Play Action Football */ - {0x78b657ac,118,-1}, /* Armadillo */ - {0x37b62d04,118,-1}, /* Ys 3 */ - {0x07d92c31,118,-1}, /* RPG Jinsei Game */ - {0x2705eaeb,234,-1}, /* Maxi 15 */ - {0x404b2e8b,4,2}, /* Rad Racer 2 */ - {0xa912b064,51|0x800,8}, /* 11-in-1 Ball Games(has CHR ROM when it shouldn't) */ - {0xc5e5c5b2,115,-1}, /* Bao Qing Tian (As).nes */ - - {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 */ - {0xa9115bc1,192,-1}, - {0x4c7bbb0e,192,-1}, - {0xa145fae6,192,-1}, - {0xa925226c,194,-1},/* Dai-2-Ji - Super Robot Taisen (As) */ - {0xd5224fde,195,-1},/* Crystalis (c) */ - {0x1bc0be6c,195,-1},/* Captain Tsubasa Vol 2 - Super Striker (C) */ - {0x33c5df92,195,-1}, - {0xb616885c,195,0}, /* CHaos WOrld (Ch)*/ - {0x7f3dbf1b,195,0}, - {0xdd431ba7,198,-1},/* Tenchi wo kurau 2 (c) */ - {0x28192599,198,-1}, - {0x700705f4,198,-1}, - {0x9a2cf02c,198,-1}, - {0xd8b401a7,198,-1}, - {0x19b9e732,198,-1}, - {0xd871d3e6,199,-1},/* Dragon Ball Z 2 - Gekishin Freeza! (C) */ - {0xed481b7c,199,-1},/* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C) */ - {0x44c20420,199,-1},/* San Guo Zhi 2 (C) */ - - {0xa1dc16c0,116,-1}, - - {0xcc868d4e,149,-1}, /* 16 Mahjong [p1][!] */ - {0x48239b42,146,-1}, /* Mahjong Companion (Sachen) [!] */ - {0xb6a727fa,146,-1}, /* Papillion (As) [!] */ - {0xa62b79e1,146,-1}, /* Side Winder (HES) [!] */ - {0x73fb55ac,150,-1}, /* 2-in-1 Cosmo Cop + Cyber Monster (Sachen) [!] */ - {0xddcbda16,150,-1}, /* 2-in-1 Tough Cop + Super Tough Cop (Sachen) [!] */ - {0x47918d84,150,-1}, /* auto-upturn */ - {0x29582ca1,150,-1}, - {0x40dbf7a2,150,-1}, - {0x5aefbc94,133,-1}, /* Jovial Race (Sachen) [a1][!] */ - {0x58152b42,160,1}, /* Pipe 5 (Sachen) */ - - {0x22d6d5bd,4,1}, - {0x6a03d3f3,114,-1}, - - {0x02c41438,176,-1}, /* Xing He Zhan Shi (C) */ - - {0x0da5e32e,101,-1}, /* new Uruusey Yatsura */ - {0x4f2f1846,-1,1}, /* Famista '89 - Kaimaku Han!! (J) */ - {0x6c71feae,45,-1}, /* Kunio 8-in-1 */ -// {0xbdbe3c96,238,-1}, /* Contra Fighter iNES version */ - - {0,-1,-1} + {0x9cbadc25,5,8}, /* JustBreed */ + + {0x6e68e31a,16,8}, /* Dragon Ball 3*/ + {0xbfc7a2e9,16,8}, + {0x33b899c9,16,-1}, /* Dragon Ball - Dai Maou Fukkatsu (J) [!] */ + {0x3f15d20d,153,8}, /* Famicom Jump 2 */ +// {0xb049a8c4,153,-1}, /* SD Gundam Gaiden - Knight Gundam Monogatari 2 - Hikari no Kishi (J) [!] */ +// NOT 16, since uses WRAM but 8000-FFFF address range for bankswitching, + + {0x983d8175,157,8}, /* Datach Battle Rush */ + {0x894efdbc,157,8}, /* Datach Crayon Shin Chan */ + {0x19e81461,157,8}, /* Datach DBZ */ + {0xbe06853f,157,8}, /* Datach J-League */ + {0x0be0a328,157,8}, /* Datach SD Gundam Wars */ + {0x5b457641,157,8}, /* Datach Ultraman Club */ + {0xf51a7f46,157,8}, /* Datach Yuu Yuu Hakusho */ + + {0xe62e3382,71,-1}, /* Mig-29 Soviet Fighter */ + {0x21a653c7,4,-1}, /* Super Sky Kid */ + + {0xdd4d9a62,209,-1}, /* Shin Samurai Spirits 2 */ + {0x063b1151,209,-1}, /* Power Rangers 4 */ + {0xdd8ced31,209,-1}, /* Power Rangers 3 */ + + {0x0c47946d,210,1}, /* Chibi Maruko Chan */ + {0xbd523011,210,2}, /* Dream Master */ // may be wrong, but seems it solve most problems + {0xc247cc80,210,1}, /* Family Circuit '91 */ + {0x6ec51de5,210,1}, /* Famista '92 */ + {0xadffd64f,210,1}, /* Famista '93 */ + {0x429103c9,210,1}, /* Famista '94 */ + {0x81b7f1a8,210,1}, /* Heisei Tensai Bakabon */ + {0x2447e03b,210,1}, /* Top Striker */ + {0x1dc0f740,210,1}, /* Wagyan Land 2 */ + {0xd323b806,210,1}, /* Wagyan Land 3 */ + + {0x07eb2c12,208,-1}, /* Street Fighter IV */ + {0x96ce586e,189,8}, /* Street Fighter 2 YOKO */ + {0x7678f1d5,207,8}, /* Fudou Myouou Den */ + {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 */ + {0x6cdc0cd9,48,8}, /* Bubble Bobble 2 */ + //{0x10e24006,48,8}, /* Flintstones 2 - bad dump? */ + {0x40c0ad47,48,8}, /* Flintstones 2 */ + {0xa7b0536c,48,8}, /* Don Doko Don 2 */ + {0x99c395f9,48,8}, /* Captain Saver */ + {0x1500e835,48,8}, /* Jetsons (J) */ + + {0x637134e8,193,1}, /* Fighting Hero */ + {0xcbf4366f,118,8}, /* Alien Syndrome (U.S. unlicensed) */ + {0xb19a55dd,64,8}, /* Road Runner */ + //{0x3eafd012,116,-1}, /* AV Girl Fighting */ + {0x1d0f4d6b,2,1}, /* Black Bass thinging */ + {0xf92be3ec,64,-1}, /* Rolling Thunder */ + {0x345ee51a,245,-1}, /* DQ4c */ + {0xf518dd58,7,8}, /* Captain Skyhawk */ + {0x7ccb12a3,43,-1}, /* SMB2j */ + {0x6f12afc5,235,-1}, /* Golden Game 150-in-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}, + + {0x1eb4a920,79,1}, /* Double Strike */ + {0x345d3a1a,11,1}, /* Castle of Deceit */ + {0x62ef6c79,232,8}, /* Quattro Sports -Aladdin */ + {0x5caa3e61,144,1}, /* Death Race */ + {0xd2699893,88,0}, /* Dragon Spirit */ + + {0x2f27cdef,155,8}, /* Tatakae!! Rahmen Man */ + {0xcfd4a281,155,8}, /* Money Game. Yay for money! */ + {0xd1691028,154,8}, /* Devil Man */ + + {0xc68363f6,180,0}, /* Crazy Climber */ + {0xbe939fce,9,1}, /* Punchout*/ + {0x5e66eaea,13,1}, /* Videomation */ + {0xaf5d7aa2,-1,0}, /* Clu Clu Land */ + +{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 */ +{0x9eefb4b4,4,8}, /* Pachi Slot Adventure 2 */ +{0x5337f73c,4,8}, /* Niji no Silk Road */ +{0x7474ac92,4,8}, /* Kabuki: Quantum Fighter */ + +{0xbb7c5f7a,89,8}, /* Mito Koumon or something similar */ + +/* Probably a Namco MMC3-workalike */ +//{0xa5e6baf9,4,1|4}, /* Dragon Slayer 4 */ +//{0xe40b4973,4,1|4}, /* Metro Cross */ +//{0xd97c31b0,4,1|4}, /* Rasaaru Ishii no Childs Quest */ + +{0x84382231,9,0}, /* Punch Out (J) */ + +{0xe28f2596,0,1}, /* Pac Land (J) */ +{0xfcdaca80,0,0}, /* Elevator Action */ +{0xe492d45a,0,0}, /* Zippy Race */ +{0x32fa246f,0,0}, /* Tag Team Pro Wrestling */ +{0xc05a365b,0,0}, /* Exed Exes (J) */ +{0xb3c30bea,0,0}, /* Xevious (J) */ + +{0x804f898a,2,1}, /* Dragon Unit */ +{0xe1b260da,2,1}, /* Argos no Senshi */ +{0x6d65cac6,2,0}, /* Terra Cresta */ +{0x9ea1dc76,2,0}, /* Rainbow Islands */ +{0x28c11d24,2,1}, /* Sukeban Deka */ +{0x02863604,2,1}, /* Sukeban Deka */ +{0x2bb6a0f8,2,1}, /* Sherlock Holmes */ +{0x55773880,2,1}, /* Gilligan's Island */ +{0x419461d0,2,1}, /* Super Cars */ +{0x6e0eb43e,2,1}, /* Puss n Boots */ +{0x266ce198,2,1}, /* City Adventure Touch */ + +//{0x48349b0b,1,8}, /* Dragon Quest 2 */ +{0xd09b74dc,1,8}, /* Great Tank (J) */ +{0xe8baa782,1,8}, /* Gun Hed (J) */ +{0x970bd9c2,1,8}, /* Hanjuku Hero */ +{0xcd7a2fd7,1,8}, /* Hanjuku Hero */ +{0x63469396,1,8}, /* Hokuto no Ken 4 */ +{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 */ + {0x391aa1b8,1,8}, /* Bloody Warriors (J) */ + {0x61a852ea,1,8}, /* Battle Stadium - Senbatsu Pro Yakyuu */ + {0xfe364be5,1,8}, /* Deep Dungeon 4 */ + {0xd8ee7669,1,8}, /* Adventures of Rad Gravity */ + {0xa5e8d2cd,1,8}, /* Breakthru */ + {0xf6fa4453,1,8}, /* Bigfoot */ + {0x37ba3261,1,8}, /* Back to the Future 2 and 3 */ + {0x934db14a,1,-1}, /* All-Pro Basketball */ + {0xe94d5181,1,8}, /* Mirai Senshi - Lios */ + {0x7156cb4d,1,8}, /* Muppet Adventure Carnival thingy */ + {0x5b6ca654,1,8}, /* Barbie rev X*/ + {0x57c12280,1,8}, /* Demon Sword */ + {0x70f67ab7,1,8}, /* Musashi no Bouken */ + {0xa9a4ea4c,1,8}, /* Satomi Hakkenden */ + {0xcc3544b0,1,8}, /* Triathron */ + + {0x1d41cc8c,3,1}, /* Gyruss */ + {0xd8eff0df,3,1}, /* Gradius (J) */ + {0xdbf90772,3,0}, /* Alpha Mission */ + {0xd858033d,3,0}, /* Armored Scrum Object */ + {0xcf322bb3,3,1}, /* John Elway's Quarterback */ + {0x9bde3267,3,1}, /* Adventures of Dino Riki */ + {0x02cc3973,3,1}, /* Ninja Kid */ + {0xb5d28ea2,3,1}, /* Mystery Quest - mapper 3?*/ + {0xbc065fc3,3,1}, /* Pipe Dream */ + + {0x5b837e8d,1,8}, /* Alien Syndrome */ + {0x283ad224,32,8}, /* Ai Sensei no Oshiete */ + {0x5555fca3,32,8}, /* "" "" */ + {0x243a8735,32,0x10|4}, /* Major League */ + +{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,140,1}, /* Mississippi Satsujin Jiken */ +{0xe46b1c5d,140,1}, /* Mississippi Satsujin Jiken */ +{0xe84274c5,66,1}, /* "" "" */ +{0x9552e8df,66,1}, /* Dragon Ball */ + + {0xba51ac6f,78,2}, + {0x3d1c3137,78,8}, /* Uchuusen - Cosmo Carrier */ + + {0xbda8f8e4,152,8}, /* Gegege no Kitarou 2 */ + {0x026c5fca,152,8}, /* Saint Seiya Ougon Densetsu */ + {0x0f141525,152,8}, /* Arkanoid 2 (Japanese) */ + {0xb1a94b82,152,8}, /* Pocket Zaurus */ + + {0xbba58be5,70,-1}, /* Family Trainer - Manhattan Police */ + {0x370ceb65,70,-1}, /* Family Trainer - Meiro Dai Sakusen */ + {0xdd8ed0f7,70,1}, /* Kamen Rider Club */ + + {0x90c773c1,118,-1}, /* Goal! 2 */ + {0xb9b4d9e0,118,-1}, /* NES Play Action Football */ + {0x78b657ac,118,-1}, /* Armadillo */ + {0x37b62d04,118,-1}, /* Ys 3 */ + {0x07d92c31,118,-1}, /* RPG Jinsei Game */ + {0x2705eaeb,234,-1}, /* Maxi 15 */ + {0x404b2e8b,4,2}, /* Rad Racer 2 */ + {0xa912b064,51|0x800,8}, /* 11-in-1 Ball Games(has CHR ROM when it shouldn't) */ + {0xc5e5c5b2,115,-1}, /* Bao Qing Tian (As).nes */ + + {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 */ + {0xa9115bc1,192,-1}, + {0x4c7bbb0e,192,-1}, + {0xa145fae6,192,-1}, + {0xa925226c,194,-1},/* Dai-2-Ji - Super Robot Taisen (As) */ + {0xd5224fde,195,-1},/* Crystalis (c) */ + {0x1bc0be6c,195,-1},/* Captain Tsubasa Vol 2 - Super Striker (C) */ + {0x33c5df92,195,-1}, + {0xb616885c,195,0}, /* CHaos WOrld (Ch)*/ + {0x7f3dbf1b,195,0}, + {0xdd431ba7,198,-1},/* Tenchi wo kurau 2 (c) */ + {0x28192599,198,-1}, + {0x700705f4,198,-1}, + {0x9a2cf02c,198,-1}, + {0xd8b401a7,198,-1}, + {0x19b9e732,198,-1}, + {0xd871d3e6,199,-1},/* Dragon Ball Z 2 - Gekishin Freeza! (C) */ + {0xed481b7c,199,-1},/* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C) */ + {0x44c20420,199,-1},/* San Guo Zhi 2 (C) */ + + {0xa1dc16c0,116,-1}, + + {0xcc868d4e,149,-1}, /* 16 Mahjong [p1][!] */ + {0x48239b42,146,-1}, /* Mahjong Companion (Sachen) [!] */ + {0xb6a727fa,146,-1}, /* Papillion (As) [!] */ + {0xa62b79e1,146,-1}, /* Side Winder (HES) [!] */ + {0x73fb55ac,150,-1}, /* 2-in-1 Cosmo Cop + Cyber Monster (Sachen) [!] */ + {0xddcbda16,150,-1}, /* 2-in-1 Tough Cop + Super Tough Cop (Sachen) [!] */ + {0x47918d84,150,-1}, /* auto-upturn */ + {0x29582ca1,150,-1}, + {0x40dbf7a2,150,-1}, + {0x5aefbc94,133,-1}, /* Jovial Race (Sachen) [a1][!] */ + {0x58152b42,160,1}, /* Pipe 5 (Sachen) */ + + {0x22d6d5bd,4,1}, + {0x6a03d3f3,114,-1}, + {0x0d98db53,114,-1}, /* Pocahontas */ + {0x4e7729ff,114,-1}, /* Super Donkey Kong */ + + {0x02c41438,176,-1}, /* Xing He Zhan Shi (C) */ + + {0x0da5e32e,101,-1}, /* new Uruusey Yatsura */ + {0x4f2f1846,-1,1}, /* Famista '89 - Kaimaku Han!! (J) */ + {0x6c71feae,45,-1}, /* Kunio 8-in-1 */ +// {0xbdbe3c96,238,-1}, /* Contra Fighter iNES version */ + + {0,-1,-1} diff --git a/src/ines.cpp b/src/ines.cpp index deffee0d..9ff75283 100644 --- a/src/ines.cpp +++ b/src/ines.cpp @@ -580,7 +580,7 @@ static BMAPPINGLocal bmap[] = { {"", 178, Mapper178_Init}, {"", 180, Mapper180_Init}, {"", 181, Mapper181_Init}, - {"", 182, Mapper182_Init}, +// {"", 182, Mapper182_Init}, // identical to 114 {"", 183, Mapper183_Init}, {"", 184, Mapper184_Init}, {"", 185, Mapper185_Init}, @@ -603,9 +603,9 @@ static BMAPPINGLocal bmap[] = { {"", 209, Mapper209_Init}, {"", 210, Mapper210_Init}, {"", 211, Mapper211_Init}, - {"", 215, Mapper215_Init}, + {"", 215, UNL8237_Init}, {"", 216, Mapper216_Init}, - {"", 217, Mapper217_Init}, +// {"", 217, Mapper217_Init}, {"UNLA9746", 219, UNLA9746_Init}, {"OneBus", 220, UNLOneBus_Init}, diff --git a/src/ines.h b/src/ines.h index 9020bb1d..c166ea02 100644 --- a/src/ines.h +++ b/src/ines.h @@ -418,7 +418,7 @@ void Mapper177_Init(CartInfo *); void Mapper178_Init(CartInfo *); void Mapper180_Init(CartInfo *); void Mapper181_Init(CartInfo *); -void Mapper182_Init(CartInfo *); +//void Mapper182_Init(CartInfo *); void Mapper183_Init(CartInfo *); void Mapper184_Init(CartInfo *); void Mapper185_Init(CartInfo *); @@ -440,9 +440,9 @@ void Mapper208_Init(CartInfo *); void Mapper209_Init(CartInfo *); void Mapper210_Init(CartInfo *); void Mapper211_Init(CartInfo *); -void Mapper215_Init(CartInfo *); +//void Mapper215_Init(CartInfo *); void Mapper216_Init(CartInfo *); -void Mapper217_Init(CartInfo *); +//void Mapper217_Init(CartInfo *); void Mapper220_Init(CartInfo *); void Mapper222_Init(CartInfo *); void Mapper226_Init(CartInfo *); diff --git a/src/unif.cpp b/src/unif.cpp index f38277f2..ee3a44fe 100644 --- a/src/unif.cpp +++ b/src/unif.cpp @@ -392,12 +392,12 @@ static BMAPPING bmap[] = { { "SMB2J", UNLSMB2J_Init, 0}, { "AX5705", UNLAX5705_Init, 0}, { "CC-21", UNLCC21_Init,0}, - { "H2288", UNLH2288_Init,0}, { "KOF97", UNLKOF97_Init,0}, { "SL1632", UNLSL1632_Init,0}, { "SHERO", UNLSHeroes_Init,0}, { "8237", UNL8237_Init,0}, + { "8237A", UNL8237A_Init,0}, { "8157", UNL8157_Init,0}, { "T-262", BMCT262_Init,0}, { "FK23C", BMCFK23C_Init,0}, diff --git a/src/unif.h b/src/unif.h index 7512ea52..64aed184 100644 --- a/src/unif.h +++ b/src/unif.h @@ -108,6 +108,7 @@ void UNLA9746_Init(CartInfo *info); void UNLSHeroes_Init(CartInfo *info); void UNLH2288_Init(CartInfo *info); void UNL8237_Init(CartInfo *info); +void UNL8237A_Init(CartInfo *info); void UNL8157_Init(CartInfo *info); void UNL22211_Init(CartInfo *info); void UNLTF1201_Init(CartInfo *info); diff --git a/src/x6502.cpp b/src/x6502.cpp index 3f04de88..6807a7e0 100644 --- a/src/x6502.cpp +++ b/src/x6502.cpp @@ -479,7 +479,7 @@ extern int test; test++; } //will probably cause a major speed decrease on low-end systems - DEBUG( DebugCycle() ); + DEBUG( DebugCycle() ); _PI=_P; b1=RdMem(_PC); diff --git a/vc/vc10_fceux.vcxproj b/vc/vc10_fceux.vcxproj index 4a006396..ba402f81 100644 --- a/vc/vc10_fceux.vcxproj +++ b/vc/vc10_fceux.vcxproj @@ -274,7 +274,6 @@ - diff --git a/vc/vc10_fceux.vcxproj.filters b/vc/vc10_fceux.vcxproj.filters index 718d5cb2..9cc1bd19 100644 --- a/vc/vc10_fceux.vcxproj.filters +++ b/vc/vc10_fceux.vcxproj.filters @@ -193,9 +193,6 @@ boards - - boards - boards