From 13e88c076d8fa2b42b8e0af393eb6c411647a848 Mon Sep 17 00:00:00 2001 From: CaH4e3 Date: Sat, 27 Oct 2012 15:07:35 +0000 Subject: [PATCH] mapper 21, 22, 25 boardification, merged to one vrc board source --- src/boards/23.cpp | 204 -------------------------- src/boards/SConscript | 2 +- src/boards/vrc2and4.cpp | 261 ++++++++++++++++++++++++++++++++++ src/ines-correct.h | 1 + src/ines.cpp | 16 +-- src/ines.h | 9 +- src/mappers/21.cpp | 106 -------------- src/mappers/22.cpp | 64 --------- src/mappers/25.cpp | 115 --------------- src/mappers/SConscript | 3 - vc/vc10_fceux.vcxproj | 5 +- vc/vc10_fceux.vcxproj.filters | 15 +- vc/vc8_fceux.vcproj | 14 +- vc/vc9_fceux.vcproj | 14 +- 14 files changed, 283 insertions(+), 546 deletions(-) delete mode 100644 src/boards/23.cpp create mode 100644 src/boards/vrc2and4.cpp delete mode 100644 src/mappers/21.cpp delete mode 100644 src/mappers/22.cpp delete mode 100644 src/mappers/25.cpp diff --git a/src/boards/23.cpp b/src/boards/23.cpp deleted file mode 100644 index cf5927fc..00000000 --- a/src/boards/23.cpp +++ /dev/null @@ -1,204 +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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "mapinc.h" - -static uint8 is23; -static uint16 IRQCount; -static uint8 IRQLatch,IRQa; -static uint8 prgreg[2]; -static uint8 chrreg[8]; -static uint8 regcmd, irqcmd, mirr, big_bank; -static uint16 acount=0; - -static uint8 *WRAM=NULL; -static uint32 WRAMSIZE; - -static SFORMAT StateRegs[]= -{ - {prgreg, 2, "PREG"}, - {chrreg, 8, "CREG"}, - {®cmd, 1, "CMDR"}, - {&irqcmd, 1, "CMDI"}, - {&mirr, 1, "MIRR"}, - {&big_bank, 1, "BIGB"}, - {&IRQCount, 2, "IRQC"}, - {&IRQLatch, 1, "IRQL"}, - {&IRQa, 1, "IRQA"}, - {0} -}; - -static void Sync(void) -{ - if(regcmd&2) - { - setprg8(0xC000,prgreg[0]|big_bank); - setprg8(0x8000,((~1)&0x1F)|big_bank); - } - else - { - setprg8(0x8000,prgreg[0]|big_bank); - setprg8(0xC000,((~1)&0x1F)|big_bank); - } - setprg8(0xA000,prgreg[1]|big_bank); - setprg8(0xE000,((~0)&0x1F)|big_bank); - if(UNIFchrrama) - setchr8(0); - else - { - uint8 i; - for(i=0; i<8; i++) - setchr1(i<<10, chrreg[i]); - } - switch(mirr&0x3) - { - case 0: setmirror(MI_V); break; - case 1: setmirror(MI_H); break; - case 2: setmirror(MI_0); break; - case 3: setmirror(MI_1); break; - } -} - -static DECLFW(M23Write) -{ -// FCEU_printf("%04x:%04x\n",A,V); - A|=((A>>2)&0x3)|((A>>4)&0x3)|((A>>6)&0x3); // actually there is many-in-one mapper source, some pirate or - // licensed games use various address bits for registers - A&=0xF003; - if((A>=0xB000)&&(A<=0xE003)) - { - if(UNIFchrrama) - big_bank=(V&8)<<2; // my personally many-in-one feature ;) just for support pirate cart 2-in-1 - else - { - uint16 i=((A>>1)&1)|((A-0xB000)>>11); - chrreg[i]&=(0xF0)>>((A&1)<<2); - chrreg[i]|=(V&0xF)<<((A&1)<<2); - } - Sync(); - } - else - switch(A&0xF003) - { - case 0x8000: - case 0x8001: - case 0x8002: - case 0x8003: if(is23) - prgreg[0]=V&0x1F; - Sync(); - break; - case 0xA000: - case 0xA001: - case 0xA002: - case 0xA003: if(is23) - prgreg[1]=V&0x1F; - else - { - prgreg[0]=(V<<1)&0x1F; - prgreg[1]=((V<<1)&0x1F)|1; - } - Sync(); - break; - case 0x9000: - case 0x9001: if(V!=0xFF) mirr=V; Sync(); break; - case 0x9002: - case 0x9003: regcmd=V; Sync(); break; - case 0xF000: X6502_IRQEnd(FCEU_IQEXT); IRQLatch&=0xF0; IRQLatch|=V&0xF; break; - case 0xF001: X6502_IRQEnd(FCEU_IQEXT); IRQLatch&=0x0F; IRQLatch|=V<<4; break; - case 0xF002: X6502_IRQEnd(FCEU_IQEXT); acount=0; IRQCount=IRQLatch; IRQa=V&2; irqcmd=V&1; break; - case 0xF003: X6502_IRQEnd(FCEU_IQEXT); IRQa=irqcmd; break; - } -} - -static void M23Power(void) -{ - big_bank=0x20; - Sync(); - setprg8r(0x10,0x6000,0); // another many-in-one code, WRAM actually contain only WaiWaiWorld game - SetReadHandler(0x6000,0x7FFF,CartBR); - SetWriteHandler(0x6000,0x7FFF,CartBW); - SetReadHandler(0x8000,0xFFFF,CartBR); - SetWriteHandler(0x8000,0xFFFF,M23Write); -} - -void M23IRQHook(int a) -{ - #define LCYCS 341 - if(IRQa) - { - acount+=a*3; - if(acount>=LCYCS) - { - while(acount>=LCYCS) - { - acount-=LCYCS; - IRQCount++; - if(IRQCount&0x100) - { - X6502_IRQBegin(FCEU_IQEXT); - IRQCount=IRQLatch; - } - } - } - } -} - -static void StateRestore(int version) -{ - Sync(); -} - -static void M23Close(void) -{ - if(WRAM) - FCEU_gfree(WRAM); -} - -void Mapper23_Init(CartInfo *info) -{ - is23=1; - info->Power=M23Power; - info->Close=M23Close; - MapIRQHook=M23IRQHook; - GameStateRestore=StateRestore; - - WRAMSIZE=8192; - WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); - SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); - AddExState(WRAM, WRAMSIZE, 0, "WRAM"); - - AddExState(&StateRegs, ~0, 0, 0); -} - -void UNLT230_Init(CartInfo *info) -{ - is23=0; - info->Power=M23Power; - info->Close=M23Close; - MapIRQHook=M23IRQHook; - GameStateRestore=StateRestore; - - WRAMSIZE=8192; - WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); - SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); - AddExState(WRAM, WRAMSIZE, 0, "WRAM"); - - AddExState(&StateRegs, ~0, 0, 0); -} diff --git a/src/boards/SConscript b/src/boards/SConscript index 8542969c..d934c6c5 100644 --- a/src/boards/SConscript +++ b/src/boards/SConscript @@ -32,7 +32,6 @@ my_list = Split(""" 208.cpp 222.cpp 225.cpp -23.cpp 235.cpp 253.cpp 34.cpp @@ -117,6 +116,7 @@ t-262.cpp tengen.cpp tf-1201.cpp transformer.cpp +vrc2and4.cpp vrc7.cpp yoko.cpp """) diff --git a/src/boards/vrc2and4.cpp b/src/boards/vrc2and4.cpp new file mode 100644 index 00000000..fe10670f --- /dev/null +++ b/src/boards/vrc2and4.cpp @@ -0,0 +1,261 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2007 CaH4e3 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "mapinc.h" + +static uint8 isPirate, is22; +static uint16 IRQCount; +static uint8 IRQLatch, IRQa; +static uint8 prgreg[2]; +static uint8 chrreg[8]; +static uint8 regcmd, irqcmd, mirr, big_bank; +static uint16 acount = 0; + +static uint8 *WRAM = NULL; +static uint32 WRAMSIZE; + +static SFORMAT StateRegs[] = +{ + { prgreg, 2, "PREG" }, + { chrreg, 8, "CREG" }, + { ®cmd, 1, "CMDR" }, + { &irqcmd, 1, "CMDI" }, + { &mirr, 1, "MIRR" }, + { &big_bank, 1, "BIGB" }, + { &IRQCount, 2, "IRQC" }, + { &IRQLatch, 1, "IRQL" }, + { &IRQa, 1, "IRQA" }, + { 0 } +}; + +static void Sync(void) { + if (regcmd & 2) { + setprg8(0xC000, prgreg[0] | big_bank); + setprg8(0x8000, ((~1) & 0x1F) | big_bank); + }else { + setprg8(0x8000, prgreg[0] | big_bank); + setprg8(0xC000, ((~1) & 0x1F) | big_bank); + } + setprg8(0xA000, prgreg[1] | big_bank); + setprg8(0xE000, ((~0) & 0x1F) | big_bank); + if (UNIFchrrama) + setchr8(0); + else{ + uint8 i; + for (i = 0; i < 8; i++) + setchr1(i << 10, chrreg[i] >> is22); + } + switch (mirr & 0x3) { + case 0: setmirror(MI_V); break; + case 1: setmirror(MI_H); break; + case 2: setmirror(MI_0); break; + case 3: setmirror(MI_1); break; + } +} + +static DECLFW(VRC24Write) { + A &= 0xF003; + if ((A >= 0xB000) && (A <= 0xE003)) { + if (UNIFchrrama) + big_bank = (V & 8) << 2; // my personally many-in-one feature ;) just for support pirate cart 2-in-1 + else{ + uint16 i = ((A >> 1) & 1) | ((A - 0xB000) >> 11); + chrreg[i] &= (0xF0) >> ((A & 1) << 2); + chrreg[i] |= (V & 0xF) << ((A & 1) << 2); + } + Sync(); + }else + switch (A & 0xF003) { + case 0x8000: + case 0x8001: + case 0x8002: + case 0x8003: + if (!isPirate) { + prgreg[0] = V & 0x1F; + Sync(); + } + break; + case 0xA000: + case 0xA001: + case 0xA002: + case 0xA003: + if (!isPirate) + prgreg[1] = V & 0x1F; + else{ + prgreg[0] = (V << 1) & 0x1F; + prgreg[1] = ((V << 1) & 0x1F) | 1; + } + Sync(); + break; + case 0x9000: + case 0x9001: if (V != 0xFF) mirr = V; Sync(); break; + case 0x9002: + case 0x9003: regcmd = V; Sync(); break; + case 0xF000: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0xF0; IRQLatch |= V & 0xF; break; + case 0xF001: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0x0F; IRQLatch |= V << 4; break; + case 0xF002: X6502_IRQEnd(FCEU_IQEXT); acount = 0; IRQCount = IRQLatch; IRQa = V & 2; irqcmd = V & 1; break; + case 0xF003: X6502_IRQEnd(FCEU_IQEXT); IRQa = irqcmd; break; + } +} + +static DECLFW(M21Write) { + A = (A & 0xF000) | ((A >> 1) & 0x3); // Ganbare Goemon Gaiden 2 - Tenka no Zaihou (J) [!] isn't mapper 21 actually, + // it's mapper 23 by wirings + VRC24Write(A, V); +} + +static DECLFW(M22Write) { + A |= ((A >> 2) & 0x3); // It's just swapped lines from 21 mapper + // + VRC24Write((A & 0xF000) | ((A >> 1) & 1) | ((A << 1) & 2), V); +} + +static DECLFW(M23Write) { + A |= ((A >> 2) & 0x3) | ((A >> 4) & 0x3) | ((A >> 6) & 0x3);// actually there is many-in-one mapper source, some pirate or + // licensed games use various address bits for registers + VRC24Write(A, V); +} + +static void M21Power(void) { + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, M21Write); +} + +static void M22Power(void) { + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, M22Write); +} + +static void M23Power(void) { + big_bank = 0x20; + Sync(); + setprg8r(0x10, 0x6000, 0); // Only two Goemon games are have battery backed RAM, three more shooters + // (Parodius Da!, Gradius 2 and Crisis Force uses 2k or SRAM at 6000-67FF only + SetReadHandler(0x6000, 0x7FFF, CartBR); + SetWriteHandler(0x6000, 0x7FFF, CartBW); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, M23Write); +} + +static void M25Power(void) { + big_bank = 0x20; + Sync(); + setprg8r(0x10, 0x6000, 0); + SetReadHandler(0x6000, 0x7FFF, CartBR); + SetWriteHandler(0x6000, 0x7FFF, CartBW); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, M22Write); +} + +void VRC24IRQHook(int a) { + #define LCYCS 341 + if (IRQa) { + acount += a * 3; + if (acount >= LCYCS) { + while (acount >= LCYCS) { + acount -= LCYCS; + IRQCount++; + if (IRQCount & 0x100) { + X6502_IRQBegin(FCEU_IQEXT); + IRQCount = IRQLatch; + } + } + } + } +} + +static void StateRestore(int version) { + Sync(); +} + +static void VRC24Close(void) { + if (WRAM) + FCEU_gfree(WRAM); + WRAM = NULL; +} + +void Mapper21_Init(CartInfo *info) { + isPirate = 0; + is22 = 0; + info->Power = M21Power; + MapIRQHook = VRC24IRQHook; + GameStateRestore = StateRestore; + + AddExState(&StateRegs, ~0, 0, 0); +} + +void Mapper22_Init(CartInfo *info) { + isPirate = 0; + is22 = 1; + info->Power = M22Power; + GameStateRestore = StateRestore; + + AddExState(&StateRegs, ~0, 0, 0); +} + +void Mapper23_Init(CartInfo *info) { + isPirate = 0; + is22 = 0; + info->Power = M23Power; + info->Close = VRC24Close; + MapIRQHook = VRC24IRQHook; + GameStateRestore = StateRestore; + + WRAMSIZE = 8192; + WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); + AddExState(WRAM, WRAMSIZE, 0, "WRAM"); + + if(info->battery) { + info->SaveGame[0]=WRAM; + info->SaveGameLen[0]=WRAMSIZE; + } + + AddExState(&StateRegs, ~0, 0, 0); +} + +void Mapper25_Init(CartInfo *info) { + isPirate = 0; + is22 = 0; + info->Power = M25Power; + info->Close = VRC24Close; + MapIRQHook = VRC24IRQHook; + GameStateRestore = StateRestore; + + WRAMSIZE = 8192; + WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); + AddExState(WRAM, WRAMSIZE, 0, "WRAM"); + + if(info->battery) { + info->SaveGame[0]=WRAM; + info->SaveGameLen[0]=WRAMSIZE; + } + + AddExState(&StateRegs, ~0, 0, 0); +} + +void UNLT230_Init(CartInfo *info) { + isPirate = 1; + is22 = 0; + Mapper23_Init(info); +} diff --git a/src/ines-correct.h b/src/ines-correct.h index 6787f8b0..4bd6a3fb 100644 --- a/src/ines-correct.h +++ b/src/ines-correct.h @@ -81,6 +81,7 @@ {0x6e68e31a, 16, 8}, /* Dragon Ball 3*/ {0x183859d2, 16, -1}, {0x33b899c9, 16, -1}, /* Dragon Ball - Dai Maou Fukkatsu (J) [!] */ + {0x286fcd20, 23, -1}, /* Ganbare Goemon Gaiden 2 - Tenka no Zaihou (J) [!] */ {0x5555fca3, 32, 8}, {0x283ad224, 32, 8}, /* Ai Sensei no Oshiete */ {0x243a8735, 32, 0x10|4}, /* Major League */ diff --git a/src/ines.cpp b/src/ines.cpp index 39b54517..c88c2db5 100644 --- a/src/ines.cpp +++ b/src/ines.cpp @@ -545,11 +545,11 @@ static BMAPPINGLocal bmap[] = { {"", 18, Mapper18_Init}, {"Namcot 106", 19, Mapper19_Init}, // {"", 20, Mapper20_Init}, -// {"", 21, Mapper21_Init}, -// {"", 22, Mapper22_Init}, - {"Konami VRC2 type B", 23, Mapper23_Init}, -// {"", 24, Mapper24_Init}, -// {"", 25, Mapper25_Init}, + {"Konami VRC2/VRC4", 21, Mapper21_Init}, + {"Konami VRC2/VRC4", 22, Mapper22_Init}, + {"Konami VRC2/VRC4", 23, Mapper23_Init}, +// {"Konami VRC6", 24, Mapper24_Init}, + {"Konami VRC2/VRC4", 25, Mapper25_Init}, // {"", 26, Mapper26_Init}, // {"", 27, Mapper27_Init}, // {"", 28, Mapper28_Init}, @@ -1192,11 +1192,11 @@ void (*MapInitTab[256])(void)= 0, //Mapper18_init, 0, 0, - Mapper21_init, - Mapper22_init, + 0, //Mapper21_init, + 0, //Mapper22_init, 0, //Mapper23_init, Mapper24_init, - Mapper25_init, + 0, //Mapper25_init, Mapper26_init, Mapper27_init, 0, diff --git a/src/ines.h b/src/ines.h index ba3eebd0..29e22cb8 100644 --- a/src/ines.h +++ b/src/ines.h @@ -166,11 +166,11 @@ void Mapper14_init(void); //void Mapper18_init(void); void Mapper19_init(void); void Mapper20_init(void); -void Mapper21_init(void); -void Mapper22_init(void); +//void Mapper21_init(void); +//void Mapper22_init(void); //void Mapper23_init(void); void Mapper24_init(void); -void Mapper25_init(void); +//void Mapper25_init(void); void Mapper26_init(void); void Mapper27_init(void); void Mapper28_init(void); @@ -378,7 +378,10 @@ void Mapper16_Init(CartInfo *); void Mapper17_Init(CartInfo *); void Mapper18_Init(CartInfo *); void Mapper19_Init(CartInfo *); +void Mapper21_Init(CartInfo *); +void Mapper22_Init(CartInfo *); void Mapper23_Init(CartInfo *); +void Mapper25_Init(CartInfo *); void Mapper34_Init(CartInfo *); void Mapper36_Init(CartInfo *); void Mapper37_Init(CartInfo *); diff --git a/src/mappers/21.cpp b/src/mappers/21.cpp deleted file mode 100644 index c8b8cd9e..00000000 --- a/src/mappers/21.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "mapinc.h" - -#define K4buf mapbyte2 -#define K4IRQ mapbyte1[1] -#define K4sel mapbyte1[0] - -static int acount=0; - -DECLFW(Mapper21_write) -{ - A|=((A>>5)&0xF); - - if((A&0xF000)==0xA000) - ROM_BANK8(0xA000,V); - else if((A&0xF000)==0x8000) - { - if(K4sel&2) - ROM_BANK8(0xC000,V); - else - ROM_BANK8(0x8000,V); - } - else if(A>=0xb000 && A<=0xefff) - { - A&=0xF006; - { - int x=((A>>2)&1)|((A-0xB000)>>11); - - K4buf[x]&=(0xF0)>>((A&2)<<1); - K4buf[x]|=(V&0xF)<<((A&2)<<1); - VROM_BANK1(x<<10,K4buf[x]); - } - - } - else switch(A&0xF006) - { - case 0x9000: - switch(V&0x3) - { - case 0:MIRROR_SET(0);break; - case 1:MIRROR_SET(1);break; - case 2:onemir(0);break; - case 3:onemir(1);break; - } - break; - case 0x9006: - case 0x9004: - case 0x9002:if((K4sel&2)!=(V&2)) - { - uint8 swa; - swa=PRGBankList[0]; - ROM_BANK8(0x8000,PRGBankList[2]); - ROM_BANK8(0xc000,swa); - } - K4sel=V; - break; - case 0xf000:IRQLatch&=0xF0;IRQLatch|=V&0xF;break; - case 0xf002:IRQLatch&=0x0F;IRQLatch|=V<<4;break; - case 0xf004:IRQCount=IRQLatch;acount=0; - IRQa=V&2;K4IRQ=V&1; - X6502_IRQEnd(FCEU_IQEXT); - break; - case 0xf006:IRQa=K4IRQ;X6502_IRQEnd(FCEU_IQEXT);break; - } -} -static void KonamiIRQHook(int a) -{ - #define LCYCS ((227*2)+1) - //#define LCYCS 341 - if(IRQa) - { -// acount+=a*3; - acount+=a*4; - if(acount>=LCYCS) - { - doagainbub:acount-=LCYCS;IRQCount++; - if(IRQCount&0x100) {X6502_IRQBegin(FCEU_IQEXT);IRQCount=IRQLatch;} - if(acount>=LCYCS) goto doagainbub; - } - } -} - -void Mapper21_init(void) -{ - SetWriteHandler(0x8000,0xffff,Mapper21_write); - MapIRQHook=KonamiIRQHook; -} diff --git a/src/mappers/22.cpp b/src/mappers/22.cpp deleted file mode 100644 index eee53652..00000000 --- a/src/mappers/22.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * (VRC4 mapper) - */ - -#include "mapinc.h" - -#define K4buf mapbyte2 - - - -DECLFW(Mapper22_write) -{ - if(A<=0xAFFF) - { - switch(A&0xF000) - { - case 0x8000:ROM_BANK8(0x8000,V);break; - case 0xa000:ROM_BANK8(0xA000,V);break; - case 0x9000:switch(V&3) - { - case 0x00:MIRROR_SET2(1);break; - case 0x01:MIRROR_SET2(0);break; - case 0x02:onemir(0);break; - case 0x03:onemir(1);break; - } - break; - } - } - else - { - A&=0xF003; - if(A>=0xb000 && A<=0xe003) - { - int x=(A&1)|((A-0xB000)>>11); - - K4buf[x]&=(0xF0)>>((A&2)<<1); - K4buf[x]|=(V&0xF)<<((A&2)<<1); - VROM_BANK1(x<<10,K4buf[x]>>1); - } - } -} - - -void Mapper22_init(void) -{ - SetWriteHandler(0x8000,0xffff,Mapper22_write); -} diff --git a/src/mappers/25.cpp b/src/mappers/25.cpp deleted file mode 100644 index 9ff6efa6..00000000 --- a/src/mappers/25.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * (VRCII mapper) - */ - -#include "mapinc.h" - -#define K4buf mapbyte2 -#define K4IRQ mapbyte1[1] -#define K4sel mapbyte1[0] - -static int acount=0; -static int weirdo=0; -static DECLFW(Mapper25_write) -{ - if(A==0xC007) - { - weirdo=8; // Ganbare Goemon Gaiden does strange things!!! at the end credits - // quick dirty hack, seems there is no other games with such PCB, so - // we never know if it will not work for something else lol - VROM_BANK1(0x0000,0xFC); - VROM_BANK1(0x0400,0xFD); - VROM_BANK1(0x0800,0xFF); - } - - A=(A&0xF003)|((A&0xC)>>2); - - if((A&0xF000)==0xA000) - ROM_BANK8(0xA000,V); - else if(A>=0xB000 && A<=0xEFFF) - { - int x=(A&1)|((A-0xB000)>>11); - - K4buf[x]&=(0xF0)>>((A&2)<<1); - K4buf[x]|=(V&0xF)<<((A&2)<<1); - if(weirdo) - weirdo--; - else - VROM_BANK1(x<<10,K4buf[x]); - } - else if((A&0xF000)==0x8000) - { - if(K4sel&2) - ROM_BANK8(0xC000,V); - else - ROM_BANK8(0x8000,V); - } - else switch(A) - { - case 0x9000:switch(V&0x3) - { - case 0:MIRROR_SET(0);break; - case 1:MIRROR_SET(1);break; - case 2:onemir(0);break; - case 3:onemir(1);break; - } - break; - case 0x9001:if((K4sel&2)!=(V&2)) - { - uint8 swa; - swa=PRGBankList[0]; - ROM_BANK8(0x8000,PRGBankList[2]); - ROM_BANK8(0xc000,swa); - } - K4sel=V; - break; - case 0xf000:IRQLatch&=0xF0;IRQLatch|=V&0xF;break; - case 0xf002:IRQLatch&=0x0F;IRQLatch|=V<<4;break; - case 0xf001:IRQCount=IRQLatch;IRQa=V&2;K4IRQ=V&1;acount=0;X6502_IRQEnd(FCEU_IQEXT);break; - case 0xf003:IRQa=K4IRQ;X6502_IRQEnd(FCEU_IQEXT);break; - } -} - -static void KonamiIRQHook(int a) -{ -// #define LCYCS ((227*2)) - #define LCYCS 341 - if(IRQa) - { - acount+=a*3; - // acount+=a*4; - if(acount>=LCYCS) - { - doagainbub:acount-=LCYCS;IRQCount++; - if(IRQCount&0x100) - {//acount=0; - X6502_IRQBegin(FCEU_IQEXT);IRQCount=IRQLatch; - } - if(acount>=LCYCS) goto doagainbub; - } - } -} - -void Mapper25_init(void) -{ - SetWriteHandler(0x8000,0xffff,Mapper25_write); - MapIRQHook=KonamiIRQHook; -} - diff --git a/src/mappers/SConscript b/src/mappers/SConscript index aa1c1e61..f0249aee 100644 --- a/src/mappers/SConscript +++ b/src/mappers/SConscript @@ -1,6 +1,4 @@ my_list = Split(""" -21.cpp -22.cpp 228.cpp 230.cpp 232.cpp @@ -8,7 +6,6 @@ my_list = Split(""" 244.cpp 246.cpp 24and26.cpp -25.cpp 255.cpp 27.cpp 32.cpp diff --git a/vc/vc10_fceux.vcxproj b/vc/vc10_fceux.vcxproj index 377d551a..cf6c4f7c 100644 --- a/vc/vc10_fceux.vcxproj +++ b/vc/vc10_fceux.vcxproj @@ -259,7 +259,6 @@ - @@ -298,6 +297,7 @@ + @@ -569,8 +569,6 @@ - - @@ -578,7 +576,6 @@ - diff --git a/vc/vc10_fceux.vcxproj.filters b/vc/vc10_fceux.vcxproj.filters index b5e90ae4..b17a3a86 100644 --- a/vc/vc10_fceux.vcxproj.filters +++ b/vc/vc10_fceux.vcxproj.filters @@ -121,9 +121,6 @@ boards - - boards - boards @@ -647,12 +644,6 @@ drivers\win\lua - - mappers - - - mappers - mappers @@ -674,9 +665,6 @@ mappers - - mappers - mappers @@ -976,6 +964,9 @@ boards + + boards + diff --git a/vc/vc8_fceux.vcproj b/vc/vc8_fceux.vcproj index 4a01ad4b..864f0bfb 100644 --- a/vc/vc8_fceux.vcproj +++ b/vc/vc8_fceux.vcproj @@ -682,7 +682,7 @@ > - - @@ -4136,10 +4132,6 @@ RelativePath="..\src\mappers\217.cpp" > - - @@ -4168,10 +4160,6 @@ RelativePath="..\src\mappers\24and26.cpp" > - - diff --git a/vc/vc9_fceux.vcproj b/vc/vc9_fceux.vcproj index 8726c6da..ba35fea8 100644 --- a/vc/vc9_fceux.vcproj +++ b/vc/vc9_fceux.vcproj @@ -462,7 +462,7 @@ > - - @@ -2269,10 +2265,6 @@ RelativePath="..\src\mappers\217.cpp" > - - @@ -2325,10 +2317,6 @@ RelativePath="..\src\mappers\24and26.cpp" > - -