X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=boards%2F108.c;fp=boards%2Fbmcgk192.c;h=fc3aebdb9ff825cac901e97daaaaf5e4f1b6c37d;hp=b66d831e6ad2eaf09135ff28bd2017a05a4006d3;hb=386f5371eb984fb9c2860c83e740890a75cd45c1;hpb=eec2623f6183dd0f9494b99065a16bf90f2a1ccf diff --git a/boards/bmcgk192.c b/boards/108.c similarity index 57% rename from boards/bmcgk192.c rename to boards/108.c index b66d831..fc3aebd 100644 --- a/boards/bmcgk192.c +++ b/boards/108.c @@ -1,67 +1,62 @@ -/* 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 - */ - -#include "mapinc.h" - -static uint16 addrlatche; - -static void Sync(void) -{ - if(addrlatche&0x40) - { - setprg16(0x8000,addrlatche&7); - setprg16(0xC000,addrlatche&7); - } - else - setprg32(0x8000,(addrlatche>>1)&3); - setchr8((addrlatche>>3)&7); - setmirror(((addrlatche&0x80)>>7)^1); -} - -static DECLFW(BMCGK192Write) -{ - addrlatche=A; - Sync(); -} - -static void BMCGK192Reset(void) -{ - setprg32(0x8000,0); -} - -static void BMCGK192Power(void) -{ - setprg32(0x8000,0); - SetReadHandler(0x8000,0xFFFF,CartBR); - SetWriteHandler(0x8000,0xffff,BMCGK192Write); -} - -static void StateRestore(int version) -{ - Sync(); -} - -void Mapper58_Init(CartInfo *info) -{ - info->Power=BMCGK192Power; - info->Reset=BMCGK192Reset; - GameStateRestore=StateRestore; - AddExState(&addrlatche, 2, 0, "ALATC"); -} +/* 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; + +static SFORMAT StateRegs[]= +{ + {®, 1, "REG"}, + {0} +}; + +static void Sync(void) +{ + setprg8(0x6000,reg); + setprg32(0x8000,~0); + setchr8(0); +} + +static DECLFW(M108Write) +{ + reg=V; + Sync(); +} + +static void M108Power(void) +{ + Sync(); + SetReadHandler(0x6000,0x7FFF,CartBR); + SetReadHandler(0x8000,0xFFFF,CartBR); + SetWriteHandler(0x8FFF,0x8FFF,M108Write); +} + +static void StateRestore(int version) +{ + Sync(); +} + +void Mapper108_Init(CartInfo *info) +{ + info->Power=M108Power; + GameStateRestore=StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +}