X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=boards%2F185.c;fp=boards%2F185.c;h=49b63dce4cbb8d3a816c7bf5620f78375cbde5b2;hb=e2d0dd92bfad989cce4270fc0ac5a712476c7c50;hp=0000000000000000000000000000000000000000;hpb=971a1d07d2f5b5a6f991ed5712275c04b933734f;p=fceu.git diff --git a/boards/185.c b/boards/185.c new file mode 100644 index 0000000..49b63dc --- /dev/null +++ b/boards/185.c @@ -0,0 +1,116 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * 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 + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Family Study Box by Fukutake Shoten + */ + +#include "mapinc.h" + +static uint8 *DummyCHR=NULL; +static uint8 datareg; +static void(*Sync)(void); + + +static SFORMAT StateRegs[]= +{ + {&datareg, 1, "DREG"}, + {0} +}; + +// on off +//1 0x0F, 0xF0 - Bird Week +//2 0x33, 0x00 - B-Wings +//3 0x11, 0x00 - Mighty Bomb Jack +//4 0x22, 0x20 - Sansuu 1 Nen, Sansuu 2 Nen +//5 0xFF, 0x00 - Sansuu 3 Nen +//6 0x21, 0x13 - Spy vs Spy +//7 0x20, 0x21 - Seicross + +static void Sync185(void) +{ + // little dirty eh? ;_) + if((datareg&3)&&(datareg!=0x13)) // 1, 2, 3, 4, 5, 6 + setchr8(0); + else + setchr8r(0x10,0); +} + +static void Sync181(void) +{ + if(!(datareg&1)) // 7 + setchr8(0); + else + setchr8r(0x10,0); +} + +static DECLFW(MWrite) +{ + datareg=V; + Sync(); +} + +static void MPower(void) +{ + datareg=0; + Sync(); + setprg16(0x8000,0); + setprg16(0xC000,~0); + SetWriteHandler(0x8000,0xFFFF,MWrite); + SetReadHandler(0x8000,0xFFFF,CartBR); +} + +static void MClose(void) +{ + if(DummyCHR) + FCEU_gfree(DummyCHR); + DummyCHR=NULL; +} + +static void MRestore(int version) +{ + Sync(); +} + +void Mapper185_Init(CartInfo *info) +{ + Sync=Sync185; + info->Power=MPower; + info->Close=MClose; + GameStateRestore=MRestore; + DummyCHR=(uint8*)FCEU_gmalloc(8192); + int x; + for(x=0;x<8192;x++) + DummyCHR[x]=0xff; + SetupCartCHRMapping(0x10,DummyCHR,8192,0); + AddExState(StateRegs, ~0, 0, 0); +} + +void Mapper181_Init(CartInfo *info) +{ + Sync=Sync181; + info->Power=MPower; + info->Close=MClose; + GameStateRestore=MRestore; + DummyCHR=(uint8*)FCEU_gmalloc(8192); + int x; + for(x=0;x<8192;x++) + DummyCHR[x]=0xff; + SetupCartCHRMapping(0x10,DummyCHR,8192,0); + AddExState(StateRegs, ~0, 0, 0); +}