1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2009 CaH4e3
\r
6 * This program is free software; you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation; either version 2 of the License, or
\r
9 * (at your option) any later version.
\r
11 * This program is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with this program; if not, write to the Free Software
\r
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
20 * 7-in-1 Darkwing Duck, Snake, MagicBlock (PCB marked as "12 in 1")
\r
25 static uint8 reg[4];
\r
26 static SFORMAT StateRegs[]=
\r
32 static void Sync(void)
\r
34 uint8 bank = (reg[3]&3)<<3;
\r
35 setchr4(0x0000, (reg[1]>>3)|(bank<<2));
\r
36 setchr4(0x1000, (reg[2]>>3)|(bank<<2));
\r
39 setprg32(0x8000,((reg[2]&7)>>1)|bank);
\r
43 setprg16(0x8000, (reg[1]&7)|bank);
\r
44 setprg16(0xc000, 7|bank);
\r
46 setmirror(((reg[3]&4)>>2)^1);
\r
49 static DECLFW(BMC12IN1Write)
\r
53 case 0xafff: reg[0] = V; break;
\r
54 case 0xbfff: reg[1] = V; break;
\r
55 case 0xdfff: reg[2] = V; break;
\r
56 case 0xefff: reg[3] = V; break;
\r
61 static void BMC12IN1Power(void)
\r
63 reg[0]=reg[1]=reg[2]=reg[3]=0;
\r
65 SetReadHandler(0x8000,0xFFFF,CartBR);
\r
66 SetWriteHandler(0x8000,0xFFFF,BMC12IN1Write);
\r
69 static void StateRestore(int version)
\r
74 void BMC12IN1_Init(CartInfo *info)
\r
76 info->Power=BMC12IN1Power;
\r
77 GameStateRestore=StateRestore;
\r
78 AddExState(&StateRegs, ~0, 0, 0);
\r