1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2005 CaH4e3
\r
5 * Copyright (C) 2009 qeed
\r
7 * This program is free software; you can redistribute it and/or modify
\r
8 * it under the terms of the GNU General Public License as published by
\r
9 * the Free Software Foundation; either version 2 of the License, or
\r
10 * (at your option) any later version.
\r
12 * This program is distributed in the hope that it will be useful,
\r
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 * GNU General Public License for more details.
\r
17 * You should have received a copy of the GNU General Public License
\r
18 * along with this program; if not, write to the Free Software
\r
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
21 * BMC 42-in-1 "reset switch" + "select switch"
\r
27 static uint8 isresetbased = 0;
\r
28 static uint8 latche[2], reset;
\r
29 static SFORMAT StateRegs[]=
\r
32 {latche, 2, "LATC"},
\r
36 static void Sync(void)
\r
40 bank = (latche[0]&0x1f)|(reset<<5)|((latche[1]&1)<<6);
\r
42 bank = (latche[0]&0x1f)|((latche[0]&0x80)>>2)|((latche[1]&1)<<6);
\r
43 if(!(latche[0] & 0x20))
\r
44 setprg32(0x8000,bank >> 1);
\r
47 setprg16(0x8000,bank);
\r
48 setprg16(0xC000,bank);
\r
50 setmirror((latche[0]>>6)&1);
\r
54 static DECLFW(M226Write)
\r
60 static void M226Power(void)
\r
62 latche[0] = latche[1] = reset = 0;
\r
64 SetWriteHandler(0x8000,0xFFFF,M226Write);
\r
65 SetReadHandler(0x8000,0xFFFF,CartBR);
\r
68 static void StateRestore(int version)
\r
73 void Mapper226_Init(CartInfo *info)
\r
76 info->Power=M226Power;
\r
77 AddExState(&StateRegs, ~0, 0, 0);
\r
78 GameStateRestore=StateRestore;
\r
81 static void BMC42in1Reset(void)
\r
87 void BMC42in1r_Init(CartInfo *info)
\r
90 info->Power=M226Power;
\r
91 info->Reset=BMC42in1Reset;
\r
92 AddExState(&StateRegs, ~0, 0, 0);
\r
93 GameStateRestore=StateRestore;
\r