1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2002 Xodnizel
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 static uint8 DRegs[8];
26 static SFORMAT StateRegs[]=
33 static void Sync(void)
35 setprg32(0x8000,(DRegs[0]<<4)|(DRegs[1]&0xF));
38 static void StateRestore(int version)
47 case 0x5100: DRegs[0]=V; Sync(); break;
48 case 0x5000: DRegs[1]=V; Sync(); break;
56 case 0x5200: DRegs[0]=V; Sync(); break;
57 case 0x5000: DRegs[1]=V; Sync(); break;
61 static uint8 WRAM[8192];
64 return(WRAM[A-0x6000]);
72 static void Power(void)
78 SetReadHandler(0x8000,0xFFFF,CartBR);
79 SetWriteHandler(0x4020,0xFFFF,Write);
80 SetReadHandler(0x6000,0x7FFF,AWRAM);
81 SetWriteHandler(0x6000,0x7FFF,BWRAM);
85 static void Power2(void)
91 SetReadHandler(0x8000,0xFFFF,CartBR);
92 SetWriteHandler(0x4020,0xFFFF,Write2);
93 SetReadHandler(0x6000,0x7FFF,AWRAM);
94 SetWriteHandler(0x6000,0x7FFF,BWRAM);
98 void Mapper164_Init(CartInfo *info)
101 GameStateRestore=StateRestore;
102 AddExState(&StateRegs, ~0, 0, 0);
105 void Mapper163_Init(CartInfo *info)
108 GameStateRestore=StateRestore;
109 AddExState(&StateRegs, ~0, 0, 0);