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
25 //------------------ CPROM ---------------------------
27 static DECLFW(CPROMWrite)
30 setchr4(0x1000,latche);
33 static void CPROMReset(void)
37 SetReadHandler(0x8000,0xFFFF,CartBR);
38 SetWriteHandler(0x8000,0xffff,CPROMWrite);
41 static void CPROMRestore(int version)
43 setchr4(0x1000,latche);
46 void CPROM_Init(CartInfo *info)
48 info->Power=CPROMReset;
49 GameStateRestore=CPROMRestore;
50 AddExState(&latche, 1, 0, "LATC");
53 //------------------ CNROM ---------------------------
61 static void CNROMReset(void)
65 SetReadHandler(0x8000,0xFFFF,CartBR);
66 SetWriteHandler(0x8000,0xffff,CNROMWrite);
69 static void CNROMRestore(int version)
74 void CNROM_Init(CartInfo *info)
76 info->Power=CNROMReset;
77 GameStateRestore=CNROMRestore;
78 AddExState(&latche, 1, 0, "LATC");
81 //------------------ NROM128 ---------------------------
83 static void NROM128Reset(void)
88 SetReadHandler(0x8000,0xFFFF,CartBR);
91 void NROM128_Init(CartInfo *info)
93 info->Power=NROM128Reset;
96 //------------------ NROM256 ---------------------------
98 static void NROM256Reset(void)
103 SetReadHandler(0x8000,0xFFFF,CartBR);
106 void NROM256_Init(CartInfo *info)
108 info->Power=NROM256Reset;
111 //------------------ MHROM ---------------------------
113 static DECLFW(MHROMWrite)
115 setprg32(0x8000,V>>4);
120 static void MHROMReset(void)
125 SetReadHandler(0x8000,0xFFFF,CartBR);
128 static void MHROMRestore(int version)
130 setprg32(0x8000,latche);
132 SetWriteHandler(0x8000,0xffff,MHROMWrite);
135 void MHROM_Init(CartInfo *info)
137 info->Power=MHROMReset;
138 AddExState(&latche, 1, 0,"LATC");
141 GameStateRestore=MHROMRestore;
144 //------------------ UNROM ---------------------------
146 static void UNROMRestore(int version)
148 setprg16(0x8000,latche);
151 static DECLFW(UNROMWrite)
157 static void UNROMReset(void)
162 SetWriteHandler(0x8000,0xffff,UNROMWrite);
163 SetReadHandler(0x8000,0xFFFF,CartBR);
167 void UNROM_Init(CartInfo *info)
169 info->Power=UNROMReset;
171 AddExState(&latche, 1, 0, "LATC");
172 GameStateRestore=UNROMRestore;
175 //------------------ GNROM ---------------------------
177 static void GNROMSync()
180 setprg32(0x8000,(latche>>4)&3);
183 static DECLFW(GNROMWrite)
189 static void GNROMStateRestore(int version)
194 static void GNROMReset(void)
198 SetWriteHandler(0x8000,0xffff,GNROMWrite);
199 SetReadHandler(0x8000,0xFFFF,CartBR);
202 void GNROM_Init(CartInfo *info)
204 info->Power=GNROMReset;
205 AddExState(&latche, 1, 0, "LATC");
206 GameStateRestore=GNROMStateRestore;