1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2002 Ben Parnell
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
23 #define CHRRAM (GameMemBlock)
29 setvram4(0x1000,CHRRAM+((V&3)<<12));
32 static void CPROMReset(void)
36 SetReadHandler(0x8000,0xFFFF,CartBR);
37 SetWriteHandler(0x8000,0xffff,CPROMWrite);
40 static void CPROMRestore(int version)
42 setvram4(0x1000,CHRRAM+((latche)<<12));
47 BoardPower=CPROMReset;
48 GameStateRestore=CPROMRestore;
49 AddExState(&latche, 1, 0, "LATC");
58 static void CNROMReset(void)
62 SetReadHandler(0x8000,0xFFFF,CartBR);
63 SetWriteHandler(0x8000,0xffff,CNROMWrite);
66 static void CNROMRestore(int version)
73 BoardPower=CNROMReset;
74 GameStateRestore=CNROMRestore;
75 AddExState(&latche, 1, 0, "LATC");
78 static void NROM128Reset(void)
83 SetReadHandler(0x8000,0xFFFF,CartBR);
86 static void NROM256Reset(void)
91 SetReadHandler(0x8000,0xFFFF,CartBR);
93 void NROM128_Init(void)
95 BoardPower=NROM128Reset;
98 void NROM256_Init(void)
100 BoardPower=NROM256Reset;
103 static DECLFW(MHROMWrite)
105 setprg32(0x8000,V>>4);
111 static void MHROMReset(void)
116 SetReadHandler(0x8000,0xFFFF,CartBR);
119 static void MHROMRestore(int version)
121 setprg32(0x8000,latche);
123 SetWriteHandler(0x8000,0xffff,MHROMWrite);
126 void MHROM_Init(void)
128 BoardPower=MHROMReset;
129 AddExState(&latche, 1, 0,"LATC");
132 GameStateRestore=MHROMRestore;
135 static void UNROMRestore(int version)
137 setprg16(0x8000,latche);
140 static DECLFW(UNROMWrite)
147 static void UNROMReset(void)
152 SetWriteHandler(0x8000,0xffff,UNROMWrite);
153 SetReadHandler(0x8000,0xFFFF,CartBR);
157 void UNROM_Init(void)
159 BoardPower=UNROMReset;
161 AddExState(&latche, 1, 0, "LATC");
162 AddExState(CHRRAM, 8192, 0, "CHRR");
163 GameStateRestore=UNROMRestore;