1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2005 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
24 static uint8 DRegs[4];
\r
26 static SFORMAT StateRegs[]=
\r
32 static void Sync(void)
\r
35 base = ((DRegs[0]^DRegs[1])&0x10)<<1;
\r
36 bank = (DRegs[2]^DRegs[3])&0x1f;
\r
43 setprg16(0x8000,base+bank+1);
\r
44 setprg16(0xC000,base+bank+0);
\r
48 setprg16(0x8000,base+bank+0);
\r
49 setprg16(0xC000,base+bank+1);
\r
56 setprg16(0x8000,0x1f);
\r
57 setprg16(0xC000,base+bank);
\r
61 setprg16(0x8000,base+bank);
\r
63 setprg16(0xC000,0x20);
\r
65 setprg16(0xC000,0x07);
\r
70 static DECLFW(Mapper167_write)
\r
72 DRegs[(A>>13)&0x03]=V;
\r
76 static void StateRestore(int version)
\r
81 void Mapper166_init(void)
\r
84 DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
\r
86 SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
\r
87 GameStateRestore=StateRestore;
\r
88 AddExState(&StateRegs, ~0, 0, 0);
\r
91 void Mapper167_init(void)
\r
94 DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
\r
96 SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
\r
97 GameStateRestore=StateRestore;
\r
98 AddExState(&StateRegs, ~0, 0, 0);
\r