X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=boards%2F178.c;h=0c6892f18c00ea8d484a6155a89450261a8fc994;hp=19e1b8dcdb20bd19e654823add3b333d43483a63;hb=43725da7349c85fa13e828fdbf20cc7ac8d298d6;hpb=386f5371eb984fb9c2860c83e740890a75cd45c1 diff --git a/boards/178.c b/boards/178.c index 19e1b8d..0c6892f 100644 --- a/boards/178.c +++ b/boards/178.c @@ -15,57 +15,60 @@ * * 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 + * + * San Guo Zhong Lie Zhuan (Ch) + * win200, etc + * */ #include "mapinc.h" -static uint8 reg[3]; +static uint8 reg[4]; static uint8 *WRAM=NULL; static uint32 WRAMSIZE; static SFORMAT StateRegs[]= { - {reg, 3, "REGS"}, + {reg, 4, "REGS"}, {0} }; static void Sync(void) { - setmirror(reg[0]); + uint8 bank = (reg[2]&3)<<3; + setmirror((reg[0]&1)^1); setprg8r(0x10,0x6000,0); setchr8(0); - setprg32(0x8000,(reg[1]+reg[2])); -} - -static DECLFW(M178Write0) -{ - reg[0]=(V&1)^1; - Sync(); -} - -static DECLFW(M178Write1) -{ - reg[1]=(V>>1)&0xf; - Sync(); + if(reg[0]&2) + { + setprg16(0x8000,(reg[1]&7)|bank); + setprg16(0xC000,((~0)&7)|bank); + } + else + { + setprg16(0x8000,(reg[1]&6)|bank); + setprg16(0xC000,(reg[1]&6)|bank|1); + } } -static DECLFW(M178Write2) +static DECLFW(M178Write) { - reg[2]=(V<<2); + reg[A&3]=V; Sync(); } static void M178Power(void) { - reg[0]=1; reg[1]=0; reg[2]=0; + reg[0]=1; + reg[1]=0; + reg[2]=0; + reg[3]=0; Sync(); SetReadHandler(0x6000,0x7FFF,CartBR); SetWriteHandler(0x6000,0x7FFF,CartBW); SetReadHandler(0x8000,0xFFFF,CartBR); - SetWriteHandler(0x4800,0x4800,M178Write0); - SetWriteHandler(0x4801,0x4801,M178Write1); - SetWriteHandler(0x4802,0x4802,M178Write2); + SetWriteHandler(0x4800,0x4803,M178Write); } static void M178Close(void)