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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
\r
22 * it seems now, mapper not reset-based,
\r
23 * tested on real hardware and it does menus switch by pressing just Select, not Reset
\r
24 * new registers behaviour proven this too
\r
30 static uint8 latche[2];
\r
31 static SFORMAT StateRegs[]=
\r
33 {&latche, sizeof(latche), "LATCHE"},
\r
37 static void Sync(void)
\r
39 uint8 bank = (latche[0]&0x1f)|((latche[0]&0x80)>>2)|((latche[1]&1))<<6;
\r
40 if(!(latche[0] & 0x20))
\r
41 setprg32(0x8000,bank >> 1);
\r
44 setprg16(0x8000,bank);
\r
45 setprg16(0xC000,bank);
\r
47 setmirror((latche[0]>>6)&1);
\r
51 static DECLFW(M226Write)
\r
57 static void M226Power(void)
\r
59 latche[0] = latche[1] = 0;
\r
61 SetWriteHandler(0x8000,0xFFFF,M226Write);
\r
62 SetReadHandler(0x8000,0xFFFF,CartBR);
\r
65 static void StateRestore(int version)
\r
70 void Mapper226_Init(CartInfo *info)
\r
72 info->Power=M226Power;
\r
73 AddExState(&StateRegs, ~0, 0, 0);
\r
74 GameStateRestore=StateRestore;
\r