X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=mappers%2F83.c;h=ca26388338459ef608bbd5f4dbee73ef841dcb95;hp=9a3bcd7b0e5abbb3fbfd9ca4b63bb01723d707a4;hb=386f5371eb984fb9c2860c83e740890a75cd45c1;hpb=eec2623f6183dd0f9494b99065a16bf90f2a1ccf diff --git a/mappers/83.c b/mappers/83.c index 9a3bcd7..ca26388 100644 --- a/mappers/83.c +++ b/mappers/83.c @@ -15,18 +15,19 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "mapinc.h" +static uint8 is2kbank, isnot2kbank, dipreg; /*void Mapper83_init(void) { } */ -static void FP_FASTAPASS(1) m83IRQHook(int a) +static void m83IRQHook(int a) { if(IRQa) { @@ -50,6 +51,11 @@ static DECLFR(rdlow) return mapbyte4[A&3]; } +static DECLFR(rd5000) +{ + return dipreg; +} + static void m83prg(void) { ROM_BANK16(0x8000,(mapbyte1[0]&0x3F)); @@ -58,19 +64,19 @@ static void m83prg(void) static void m83chr(void) { -// if(0) -// { -// VROM_BANK2(0x0000,mapbyte2[0]); -// VROM_BANK2(0x0800,mapbyte2[1]); -// VROM_BANK2(0x1000,mapbyte2[6]); -// VROM_BANK2(0x1800,mapbyte2[7]); -// } -// else -// { + if(is2kbank&&!isnot2kbank) + { + VROM_BANK2(0x0000,mapbyte2[0]); + VROM_BANK2(0x0800,mapbyte2[1]); + VROM_BANK2(0x1000,mapbyte2[6]); + VROM_BANK2(0x1800,mapbyte2[7]); + } + else + { int x; for(x=0;x<8;x++) VROM_BANK1(x*0x400,mapbyte2[x]|((mapbyte1[0]&0x30)<<4)); -// } + } } static DECLFW(Mapper83_write) @@ -78,7 +84,7 @@ static DECLFW(Mapper83_write) //printf("$%04x:$%02x\n",A,V); switch(A) { - case 0x8000: + case 0x8000: is2kbank = 1; case 0xB000: case 0xB0FF: case 0xB1FF: @@ -105,10 +111,10 @@ static DECLFW(Mapper83_write) case 0x8302:ROM_BANK8(0xC000,V);break; case 0x8310:mapbyte2[0]=V;m83chr();break; case 0x8311:mapbyte2[1]=V;m83chr();break; - case 0x8312:mapbyte2[2]=V;m83chr();break; - case 0x8313:mapbyte2[3]=V;m83chr();break; - case 0x8314:mapbyte2[4]=V;m83chr();break; - case 0x8315:mapbyte2[5]=V;m83chr();break; + case 0x8312:mapbyte2[2]=V;isnot2kbank = 1;m83chr();break; // 2 mappers in one :) + case 0x8313:mapbyte2[3]=V;isnot2kbank = 1;m83chr();break; + case 0x8314:mapbyte2[4]=V;isnot2kbank = 1;m83chr();break; + case 0x8315:mapbyte2[5]=V;isnot2kbank = 1;m83chr();break; case 0x8316:mapbyte2[6]=V;m83chr();break; case 0x8317:mapbyte2[7]=V;m83chr();break; case 0x8318:mapbyte1[1]=V;m83prg();break; @@ -117,13 +123,23 @@ static DECLFW(Mapper83_write) } +static void m83Reset(void) +{ + dipreg^=1; +} + void Mapper83_init(void) { + is2kbank = 0; + isnot2kbank = 0; + dipreg = 0; ROM_BANK8(0xc000,0x1e); ROM_BANK8(0xe000,0x1f); MapIRQHook=m83IRQHook; + MapperReset=m83Reset; + SetReadHandler(0x5000,0x5000,rd5000); // title scren dip switch SetReadHandler(0x5100,0x5103,rdlow); SetWriteHandler(0x5100,0x5103,wrlow); SetWriteHandler(0x8000,0xffff,Mapper83_write);