X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=boards%2F175.c;fp=boards%2F175.c;h=283058456be00acadd77ff859cb3c7645902dd1e;hb=386f5371eb984fb9c2860c83e740890a75cd45c1;hp=0000000000000000000000000000000000000000;hpb=eec2623f6183dd0f9494b99065a16bf90f2a1ccf;p=fceu.git diff --git a/boards/175.c b/boards/175.c new file mode 100644 index 0000000..2830584 --- /dev/null +++ b/boards/175.c @@ -0,0 +1,88 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2007 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + */ + +#include "mapinc.h" + +static uint8 reg, delay, mirr; + +static SFORMAT StateRegs[]= +{ + {®, 1, "REG"}, + {&mirr, 1, "MIRR"}, + {0} +}; + +static void Sync(void) +{ + setchr8(reg); + if(!delay) + { + setprg16(0x8000,reg); + setprg8(0xC000,reg << 1); + } + setprg8(0xE000,(reg << 1) + 1); + setmirror(((mirr&4)>>2)^1); +} + +static DECLFW(M175Write1) +{ + mirr = V; + delay = 1; + Sync(); +} + +static DECLFW(M175Write2) +{ + reg = V & 0x0F; + delay = 1; + Sync(); +} + +static DECLFR(M175Read) +{ + if(A==0xFFFC) + { + delay = 0; + Sync(); + } + return CartBR(A); +} + +static void M175Power(void) +{ + reg = mirr = delay = 0; + SetReadHandler(0x8000,0xFFFF,M175Read); + SetWriteHandler(0x8000,0x8000,M175Write1); + SetWriteHandler(0xA000,0xA000,M175Write2); + Sync(); +} + +static void StateRestore(int version) +{ + Sync(); +} + +void Mapper175_Init(CartInfo *info) +{ + info->Power=M175Power; + GameStateRestore=StateRestore; + + AddExState(&StateRegs, ~0, 0, 0); +}