X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=boards%2Fbmcgk192.c;fp=mappers%2F235.c;h=b66d831e6ad2eaf09135ff28bd2017a05a4006d3;hp=e54907e5a9a84daa7d2f8701dfd98d1cf3b719b2;hb=e2d0dd92bfad989cce4270fc0ac5a712476c7c50;hpb=971a1d07d2f5b5a6f991ed5712275c04b933734f diff --git a/mappers/235.c b/boards/bmcgk192.c similarity index 51% rename from mappers/235.c rename to boards/bmcgk192.c index e54907e..b66d831 100644 --- a/mappers/235.c +++ b/boards/bmcgk192.c @@ -1,7 +1,7 @@ /* FCE Ultra - NES/Famicom Emulator * * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel + * 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 @@ -20,35 +20,48 @@ #include "mapinc.h" -static DECLFW(Mapper235_write) -{ - uint32 m; - int z; +static uint16 addrlatche; - if(A&0x400) - onemir(0); +static void Sync(void) +{ + if(addrlatche&0x40) + { + setprg16(0x8000,addrlatche&7); + setprg16(0xC000,addrlatche&7); + } else - setmirror(((A>>13)&1)^1); - m=A&0x1f; + setprg32(0x8000,(addrlatche>>1)&3); + setchr8((addrlatche>>3)&7); + setmirror(((addrlatche&0x80)>>7)^1); +} - z=(A>>8)&3; +static DECLFW(BMCGK192Write) +{ + addrlatche=A; + Sync(); +} - if(A&0x800) - { - setprg16r(0x10|z,0x8000,(m<<1)|((A>>12)&1)); - setprg16r(0x10|z,0xC000,(m<<1)|((A>>12)&1)); +static void BMCGK192Reset(void) +{ + setprg32(0x8000,0); +} - } - else - setprg32r(0x10|z,0x8000,m); +static void BMCGK192Power(void) +{ + setprg32(0x8000,0); + SetReadHandler(0x8000,0xFFFF,CartBR); + SetWriteHandler(0x8000,0xffff,BMCGK192Write); +} + +static void StateRestore(int version) +{ + Sync(); } -void Mapper235_init(void) +void Mapper58_Init(CartInfo *info) { - /* Fixme: Possible crashy bug if header is bad. */ - SetupCartPRGMapping(0x10,PRGptr[0],1024*1024,0); - SetupCartPRGMapping(0x12,PRGptr[0]+1024*1024,1024,0); - setprg32r(0x10,0x8000,0); - SetReadHandler(0x8000,0xffff,CartBROB); - SetWriteHandler(0x8000,0xffff,Mapper235_write); + info->Power=BMCGK192Power; + info->Reset=BMCGK192Reset; + GameStateRestore=StateRestore; + AddExState(&addrlatche, 2, 0, "ALATC"); }