1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 1998 BERO
5 * Copyright (C) 2002 Ben Parnell
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 static DECLFW(Mapper2_write)
32 void Mapper2_init(void)
34 SetWriteHandler(0x8000,0xFFFF,Mapper2_write);
35 AddExState(&latche, 1, 0, "LATC");
38 static DECLFW(Mapper3_write)
44 void Mapper3_init(void)
46 SetWriteHandler(0x8000,0xFFFF,Mapper3_write);
47 AddExState(&latche, 1, 0, "LATC");
57 void Mapper7_init(void)
61 SetWriteHandler(0x8000,0xFFFF,Mapper7_write);
62 AddExState(&latche, 1, 0, "LATC");
65 DECLFW(Mapper11_write)
72 void Mapper11_init(void)
75 SetWriteHandler(0x8000,0xFFFF,Mapper11_write);
76 AddExState(&latche, 1, 0, "LATC");
79 static DECLFW(Mapper13_write)
81 setchr4r(0x10,0x1000,V&3);
82 setprg32(0x8000,(V>>4)&3);
86 static void Mapper13_StateRestore(int version)
88 setchr4r(0x10,0x0000,0);
89 setchr4r(0x10,0x1000,latche&3);
90 setprg32(0x8000,(latche>>4)&3);
93 void Mapper13_init(void)
95 SetWriteHandler(0x8000,0xFFFF,Mapper13_write);
96 GameStateRestore=Mapper13_StateRestore;
97 AddExState(&latche, 1, 0, "LATC");
98 AddExState(MapperExRAM, 16384, 0, "CHRR");
99 SetupCartCHRMapping(0x10, MapperExRAM, 16384, 1);
102 Mapper13_StateRestore(VERSION_NUMERIC);
105 DECLFW(Mapper34_write)
109 case 0x7FFD:ROM_BANK32(V);break;
110 case 0x7FFE:VROM_BANK4(0x0000,V);break;
111 case 0x7fff:VROM_BANK4(0x1000,V);break;
117 void Mapper34_init(void)
119 SetWriteHandler(0x7ffd,0xffff,Mapper34_write);
122 DECLFW(Mapper66_write)
129 void Mapper66_init(void)
132 SetWriteHandler(0x6000,0xffff,Mapper66_write);
133 AddExState(&latche, 1, 0, "LATC");
136 DECLFW(Mapper152_write)
138 ROM_BANK16(0x8000,(V>>4)&0x7);
140 onemir((V>>7)&1); /* Saint Seiya...hmm. */
144 void Mapper152_init(void)
147 SetWriteHandler(0x6000,0xffff,Mapper152_write);
148 AddExState(&latche, 1, 0, "LATC");
151 static DECLFW(Mapper70_write)
153 ROM_BANK16(0x8000,V>>4);
158 void Mapper70_init(void)
160 SetWriteHandler(0x6000,0xffff,Mapper70_write);
161 AddExState(&latche, 1, 0, "LATC");
163 /* Should be two separate emulation functions for this "mapper". Sigh. URGE TO KILL RISING. */
164 static DECLFW(Mapper78_write)
166 //printf("$%04x:$%02x\n",A,V);
167 ROM_BANK16(0x8000,V&0x7);
173 void Mapper78_init(void)
175 SetWriteHandler(0x8000,0xffff,Mapper78_write);
176 AddExState(&latche, 1, 0, "LATC");
179 DECLFW(Mapper87_write)
185 void Mapper87_init(void)
187 SetWriteHandler(0x6000,0xffff,Mapper87_write);
188 AddExState(&latche, 1, 0, "LATC");
191 DECLFW(Mapper93_write)
193 ROM_BANK16(0x8000,V>>4);
198 void Mapper93_init(void)
200 SetWriteHandler(0x8000,0xffff,Mapper93_write);
201 AddExState(&latche, 1, 0, "LATC");
205 DECLFW(Mapper94_write)
207 ROM_BANK16(0x8000,V>>2);
211 void Mapper94_init(void)
213 SetWriteHandler(0x8000,0xffff,Mapper94_write);
214 AddExState(&latche, 1, 0, "LATC");
217 /* I might want to add some code to the mapper 96 PPU hook function
218 to not change CHR banks if the attribute table is being accessed,
219 if I make emulation a little more accurate in the future.
223 static DECLFW(Mapper96_write)
226 setprg32(0x8000,V&3);
227 setchr4r(0x10,0x0000,(latche&4)|M96LA);
228 setchr4r(0x10,0x1000,(latche&4)|3);
231 static void FP_FASTAPASS(1) M96Hook(uint32 A)
233 if((A&0x3000)!=0x2000)
236 setchr4r(0x10,0x0000,(latche&4)|M96LA);
239 static void M96Sync()
241 setprg32(0x8000,latche&3);
242 setchr4r(0x10,0x0000,(latche&4)|M96LA);
243 setchr4r(0x10,0x1000,(latche&4)|3);
246 void Mapper96_init(void)
248 SetWriteHandler(0x8000,0xffff,Mapper96_write);
250 AddExState(&latche, 1, 0, "LATC");
251 AddExState(&M96LA, 1, 0, "LAVA");
252 SetupCartCHRMapping(0x10, MapperExRAM, 32768, 1);
255 GameStateRestore=M96Sync;
258 static DECLFW(Mapper140_write)
261 ROM_BANK32((V>>4)&0xF);
264 void Mapper140_init(void)
267 SetWriteHandler(0x6000,0x7FFF,Mapper140_write);
270 static void M185Sync()
275 // if(!(mapbyte1[0]==0x21))
278 setchr1r(0x10,x<<10,0);
284 static DECLFW(Mapper185_write)
288 // printf("Wr: $%04x:$%02x\n",A,V);
291 void Mapper185_init(void)
293 memset(MapperExRAM,0xFF,1024);
294 MapStateRestore=M185Sync;
298 SetupCartCHRMapping(0x10,MapperExRAM,1024,0);
299 SetWriteHandler(0x8000,0xFFFF,Mapper185_write);