X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=boards%2FKS7012.c;fp=boards%2F179.c;h=b764ff80dd574a4ff9cd4bb215629df1ac25c230;hp=91a530fe22cb365a049833f45f2c8c406e9c287f;hb=43725da7349c85fa13e828fdbf20cc7ac8d298d6;hpb=386f5371eb984fb9c2860c83e740890a75cd45c1 diff --git a/boards/179.c b/boards/KS7012.c similarity index 62% rename from boards/179.c rename to boards/KS7012.c index 91a530f..b764ff8 100644 --- a/boards/179.c +++ b/boards/KS7012.c @@ -15,80 +15,80 @@ * * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * FDS Conversion + * */ #include "mapinc.h" -static uint8 reg[2]; - +static uint8 reg; static uint8 *WRAM=NULL; static uint32 WRAMSIZE; static SFORMAT StateRegs[]= { - {reg, 2, "REG"}, + {®, 1, "REGS"}, {0} }; static void Sync(void) { - setchr8(0); setprg8r(0x10,0x6000,0); - setprg32(0x8000,reg[1]>>1); - setmirror((reg[0]&1)^1); + setprg32(0x8000,reg&1); + setchr8(0); +} + +static DECLFW(UNLKS7012Write) +{ +// FCEU_printf("bs %04x %02x\n",A,V); + switch(A) + { + case 0xE0A0: reg=0; Sync(); break; + case 0xEE36: reg=1; Sync(); break; + } } -static DECLFW(M179Write) +static void UNLKS7012Power(void) { - if(A==0xa000) reg[0]=V; + reg = ~0; Sync(); + SetReadHandler(0x6000,0x7FFF,CartBR); + SetWriteHandler(0x6000,0x7FFF,CartBW); + SetReadHandler(0x8000,0xFFFF,CartBR); + SetWriteHandler(0x8000,0xFFFF,UNLKS7012Write); } -static DECLFW(M179WriteLo) +static void UNLKS7012Reset(void) { - if(A==0x5ff1) reg[1]=V; + reg = ~0; Sync(); } -static void M179Power(void) +static void StateRestore(int version) { - reg[0]=reg[1]=0; - Sync(); - SetWriteHandler(0x4020,0x5fff,M179WriteLo); - SetReadHandler(0x6000,0x7fff,CartBR); - SetWriteHandler(0x6000,0x7fff,CartBW); - SetReadHandler(0x8000,0xFFFF,CartBR); - SetWriteHandler(0x8000,0xFFFF,M179Write); + Sync(); } -static void M179Close(void) +static void UNLKS7012Close(void) { if(WRAM) FCEU_gfree(WRAM); WRAM=NULL; } -static void StateRestore(int version) +void UNLKS7012_Init(CartInfo *info) { - Sync(); -} - -void Mapper179_Init(CartInfo *info) -{ - info->Power=M179Power; - info->Close=M179Close; - GameStateRestore=StateRestore; + info->Power=UNLKS7012Power; + info->Reset=UNLKS7012Reset; + info->Close=UNLKS7012Close; 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; - } + GameStateRestore=StateRestore; AddExState(&StateRegs, ~0, 0, 0); }