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];
25 static SFORMAT StateRegs[]=
32 static void Sync(void)
34 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)
77 SetReadHandler(0x8000,0xFFFF,CartBR);
78 SetWriteHandler(0x4020,0xFFFF,Write);
79 SetReadHandler(0x6000,0x7FFF,AWRAM);
80 SetWriteHandler(0x6000,0x7FFF,BWRAM);
84 static void M163HB(void)
86 if(scanline==127&&DRegs[1]&0x80)
91 static void Power2(void)
96 SetReadHandler(0x8000,0xFFFF,CartBR);
97 SetWriteHandler(0x4020,0xFFFF,Write2);
98 SetReadHandler(0x6000,0x7FFF,AWRAM);
99 SetWriteHandler(0x6000,0x7FFF,BWRAM);
103 void Mapper164_Init(CartInfo *info)
106 GameStateRestore=StateRestore;
107 AddExState(&StateRegs, ~0, 0, 0);
110 void Mapper163_Init(CartInfo *info)
113 GameHBIRQHook=M163HB;
114 GameStateRestore=StateRestore;
115 AddExState(&StateRegs, ~0, 0, 0);