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)
33 void Mapper2_init(void)
35 SetWriteHandler(0x8000,0xFFFF,Mapper2_write);
36 AddExState(&latche, 1, 0, "LATC");
39 static DECLFW(Mapper3_write)
45 void Mapper3_init(void)
47 SetWriteHandler(0x8000,0xFFFF,Mapper3_write);
48 AddExState(&latche, 1, 0, "LATC");
59 void Mapper7_init(void)
63 SetWriteHandler(0x8000,0xFFFF,Mapper7_write);
64 AddExState(&latche, 1, 0, "LATC");
67 DECLFW(Mapper11_write)
75 void Mapper11_init(void)
78 SetWriteHandler(0x8000,0xFFFF,Mapper11_write);
79 AddExState(&latche, 1, 0, "LATC");
82 static DECLFW(Mapper13_write)
84 setchr4r(0x10,0x1000,V&3);
85 setprg32(0x8000,(V>>4)&3);
90 static void Mapper13_StateRestore(int version)
92 setchr4r(0x10,0x0000,0);
93 setchr4r(0x10,0x1000,latche&3);
94 setprg32(0x8000,(latche>>4)&3);
98 void Mapper13_init(void)
100 SetWriteHandler(0x8000,0xFFFF,Mapper13_write);
101 GameStateRestore=Mapper13_StateRestore;
102 AddExState(&latche, 1, 0, "LATC");
103 AddExState(MapperExRAM, 16384, 0, "CHRR");
104 SetupCartCHRMapping(0x10, MapperExRAM, 16384, 1);
107 Mapper13_StateRestore(VERSION_NUMERIC);
110 DECLFW(Mapper34_write)
114 case 0x7FFD:ROM_BANK32(V);
115 X6502_Rebase();break;
116 case 0x7FFE:VROM_BANK4(0x0000,V);break;
117 case 0x7fff:VROM_BANK4(0x1000,V);break;
126 void Mapper34_init(void)
128 SetWriteHandler(0x7ffd,0xffff,Mapper34_write);
131 DECLFW(Mapper66_write)
139 void Mapper66_init(void)
142 SetWriteHandler(0x6000,0xffff,Mapper66_write);
143 AddExState(&latche, 1, 0, "LATC");
146 DECLFW(Mapper152_write)
148 ROM_BANK16(0x8000,(V>>4)&0x7);
150 onemir((V>>7)&1); /* Saint Seiya...hmm. */
155 void Mapper152_init(void)
158 SetWriteHandler(0x6000,0xffff,Mapper152_write);
159 AddExState(&latche, 1, 0, "LATC");
162 static DECLFW(Mapper70_write)
164 ROM_BANK16(0x8000,V>>4);
170 void Mapper70_init(void)
172 SetWriteHandler(0x6000,0xffff,Mapper70_write);
173 AddExState(&latche, 1, 0, "LATC");
175 /* Should be two separate emulation functions for this "mapper". Sigh. URGE TO KILL RISING. */
176 static DECLFW(Mapper78_write)
178 //printf("$%04x:$%02x\n",A,V);
179 ROM_BANK16(0x8000,V&0x7);
186 void Mapper78_init(void)
188 SetWriteHandler(0x8000,0xffff,Mapper78_write);
189 AddExState(&latche, 1, 0, "LATC");
192 DECLFW(Mapper87_write)
198 void Mapper87_init(void)
200 SetWriteHandler(0x6000,0xffff,Mapper87_write);
201 AddExState(&latche, 1, 0, "LATC");
204 DECLFW(Mapper93_write)
206 ROM_BANK16(0x8000,V>>4);
212 void Mapper93_init(void)
214 SetWriteHandler(0x8000,0xffff,Mapper93_write);
215 AddExState(&latche, 1, 0, "LATC");
219 DECLFW(Mapper94_write)
221 ROM_BANK16(0x8000,V>>2);
226 void Mapper94_init(void)
228 SetWriteHandler(0x8000,0xffff,Mapper94_write);
229 AddExState(&latche, 1, 0, "LATC");
232 /* I might want to add some code to the mapper 96 PPU hook function
233 to not change CHR banks if the attribute table is being accessed,
234 if I make emulation a little more accurate in the future.
238 static DECLFW(Mapper96_write)
241 setprg32(0x8000,V&3);
242 setchr4r(0x10,0x0000,(latche&4)|M96LA);
243 setchr4r(0x10,0x1000,(latche&4)|3);
247 static void FP_FASTAPASS(1) M96Hook(uint32 A)
249 if((A&0x3000)!=0x2000)
252 setchr4r(0x10,0x0000,(latche&4)|M96LA);
255 static void M96Sync()
257 setprg32(0x8000,latche&3);
258 setchr4r(0x10,0x0000,(latche&4)|M96LA);
259 setchr4r(0x10,0x1000,(latche&4)|3);
263 void Mapper96_init(void)
265 SetWriteHandler(0x8000,0xffff,Mapper96_write);
267 AddExState(&latche, 1, 0, "LATC");
268 AddExState(&M96LA, 1, 0, "LAVA");
269 SetupCartCHRMapping(0x10, MapperExRAM, 32768, 1);
272 GameStateRestore=M96Sync;
275 static DECLFW(Mapper140_write)
278 ROM_BANK32((V>>4)&0xF);
282 void Mapper140_init(void)
285 SetWriteHandler(0x6000,0x7FFF,Mapper140_write);
288 static void M185Sync()
293 // if(!(mapbyte1[0]==0x21))
296 setchr1r(0x10,x<<10,0);
302 static DECLFW(Mapper185_write)
306 // printf("Wr: $%04x:$%02x\n",A,V);
309 void Mapper185_init(void)
311 memset(MapperExRAM,0xFF,1024);
312 MapStateRestore=M185Sync;
316 SetupCartCHRMapping(0x10,MapperExRAM,1024,0);
317 SetWriteHandler(0x8000,0xFFFF,Mapper185_write);