X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=mappers%2F80.c;h=d569fa018a3b7205ce81eef2f831af1dc5bc8cf5;hp=b8673982b3d4c77551e3b52018dd1d122cd076a0;hb=386f5371eb984fb9c2860c83e740890a75cd45c1;hpb=c0bf6f9f02a2b6afb961a7e9195e2168d7e9cecf diff --git a/mappers/80.c b/mappers/80.c index b867398..d569fa0 100644 --- a/mappers/80.c +++ b/mappers/80.c @@ -1,7 +1,7 @@ /* FCE Ultra - NES/Famicom Emulator * * Copyright notice for this file: - * Copyright (C) 2002 Ben Parnell + * 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 @@ -15,38 +15,87 @@ * * 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 uint32 lastA; +static int isfu; +static uint8 CCache[8]; +static void Fudou_PPU(uint32 A) +{ + static int last=-1; + static uint8 z; + + if(A>=0x2000) return; + + A>>=10; + lastA=A; + + z=CCache[A]; + if(z!=last) + { + onemir(z); + last=z; + } +} + +static void mira() +{ + if(isfu) + { + int x; + CCache[0]=CCache[1]=mapbyte2[0]>>7; + CCache[2]=CCache[3]=mapbyte2[1]>>7; -DECLFW(Mapper80_write) + for(x=0;x<4;x++) + CCache[4+x]=mapbyte2[2+x]>>7; + + onemir(CCache[lastA]); + } + else + MIRROR_SET2(mapbyte1[0]&1); +} + +static DECLFW(Mapper80_write) { -switch(A) + switch(A) { - case 0x7ef0: VROM_BANK1(0x000,V);VROM_BANK1(0x400,(V+1));break; - case 0x7ef1: VROM_BANK1(0x800,V);VROM_BANK1(0xC00,(V+1));break; + case 0x7ef0: mapbyte2[0]=V;VROM_BANK2(0x0000,(V>>1)&0x3F);mira();break; + case 0x7ef1: mapbyte2[1]=V;VROM_BANK2(0x0800,(V>>1)&0x3f);mira();break; - case 0x7ef2: VROM_BANK1(0x1000,V);break; - case 0x7ef3: VROM_BANK1(0x1400,V);break; - case 0x7ef4: VROM_BANK1(0x1800,V);break; - case 0x7ef5: VROM_BANK1(0x1c00,V);break; + case 0x7ef2: mapbyte2[2]=V;VROM_BANK1(0x1000,V);mira();break; + case 0x7ef3: mapbyte2[3]=V;VROM_BANK1(0x1400,V);mira();break; + case 0x7ef4: mapbyte2[4]=V;VROM_BANK1(0x1800,V);mira();break; + case 0x7ef5: mapbyte2[5]=V;VROM_BANK1(0x1c00,V);mira();break; + case 0x7ef6: mapbyte1[0]=V;mira();break; case 0x7efa: - case 0x7efb: ROM_BANK8(0x8000,V); - X6502_Rebase();break; + case 0x7efb: ROM_BANK8(0x8000,V);break; case 0x7efd: - case 0x7efc: ROM_BANK8(0xA000,V); - X6502_Rebase();break; + case 0x7efc: ROM_BANK8(0xA000,V);break; case 0x7efe: - case 0x7eff: ROM_BANK8(0xC000,V); - X6502_Rebase();break; + case 0x7eff: ROM_BANK8(0xC000,V);break; } } +static void booga(int version) +{ + mira(); +} + void Mapper80_init(void) { -SetWriteHandler(0x4020,0x7fff,Mapper80_write); + SetWriteHandler(0x4020,0x7eff,Mapper80_write);// 7f00-7fff battery backed ram inside mapper chip, + // controlled by 7ef8 register, A8 - enable, FF - disable (?) + MapStateRestore=booga; + isfu=0; } +void Mapper207_init(void) +{ + Mapper80_init(); + isfu=1; + PPU_hook=Fudou_PPU; +}