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)
60 SetWriteHandler(0x8000,0xFFFF,Mapper7_write);
61 AddExState(&latche, 1, 0, "LATC");
64 DECLFW(Mapper11_write)
71 void Mapper11_init(void)
74 SetWriteHandler(0x8000,0xFFFF,Mapper11_write);
75 AddExState(&latche, 1, 0, "LATC");
78 static DECLFW(Mapper13_write)
80 setchr4r(0x10,0x1000,V&3);
81 setprg32(0x8000,(V>>4)&3);
85 static void Mapper13_StateRestore(int version)
87 setchr4r(0x10,0x0000,0);
88 setchr4r(0x10,0x1000,latche&3);
89 setprg32(0x8000,(latche>>4)&3);
92 void Mapper13_init(void)
94 SetWriteHandler(0x8000,0xFFFF,Mapper13_write);
95 GameStateRestore=Mapper13_StateRestore;
96 AddExState(&latche, 1, 0, "LATC");
97 AddExState(MapperExRAM, 16384, 0, "CHRR");
98 SetupCartCHRMapping(0x10, MapperExRAM, 16384, 1);
101 Mapper13_StateRestore(VERSION_NUMERIC);
104 DECLFW(Mapper34_write)
108 case 0x7FFD:ROM_BANK32(V);break;
109 case 0x7FFE:VROM_BANK4(0x0000,V);break;
110 case 0x7fff:VROM_BANK4(0x1000,V);break;
116 void Mapper34_init(void)
118 SetWriteHandler(0x7ffd,0xffff,Mapper34_write);
121 DECLFW(Mapper66_write)
128 void Mapper66_init(void)
131 SetWriteHandler(0x6000,0xffff,Mapper66_write);
132 AddExState(&latche, 1, 0, "LATC");
135 DECLFW(Mapper152_write)
137 ROM_BANK16(0x8000,(V>>4)&0x7);
139 onemir((V>>7)&1); /* Saint Seiya...hmm. */
143 void Mapper152_init(void)
146 SetWriteHandler(0x6000,0xffff,Mapper152_write);
147 AddExState(&latche, 1, 0, "LATC");
150 static DECLFW(Mapper70_write)
152 ROM_BANK16(0x8000,V>>4);
157 void Mapper70_init(void)
159 SetWriteHandler(0x6000,0xffff,Mapper70_write);
160 AddExState(&latche, 1, 0, "LATC");
162 /* Should be two separate emulation functions for this "mapper". Sigh. URGE TO KILL RISING. */
163 static DECLFW(Mapper78_write)
165 //printf("$%04x:$%02x\n",A,V);
166 ROM_BANK16(0x8000,V&0x7);
172 void Mapper78_init(void)
174 SetWriteHandler(0x8000,0xffff,Mapper78_write);
175 AddExState(&latche, 1, 0, "LATC");
178 DECLFW(Mapper87_write)
184 void Mapper87_init(void)
186 SetWriteHandler(0x6000,0xffff,Mapper87_write);
187 AddExState(&latche, 1, 0, "LATC");
190 DECLFW(Mapper93_write)
192 ROM_BANK16(0x8000,V>>4);
197 void Mapper93_init(void)
199 SetWriteHandler(0x8000,0xffff,Mapper93_write);
200 AddExState(&latche, 1, 0, "LATC");
204 DECLFW(Mapper94_write)
206 ROM_BANK16(0x8000,V>>2);
210 void Mapper94_init(void)
212 SetWriteHandler(0x8000,0xffff,Mapper94_write);
213 AddExState(&latche, 1, 0, "LATC");
216 /* I might want to add some code to the mapper 96 PPU hook function
217 to not change CHR banks if the attribute table is being accessed,
218 if I make emulation a little more accurate in the future.
222 static DECLFW(Mapper96_write)
225 setprg32(0x8000,V&3);
226 setchr4r(0x10,0x0000,(latche&4)|M96LA);
227 setchr4r(0x10,0x1000,(latche&4)|3);
230 static void FP_FASTAPASS(1) M96Hook(uint32 A)
235 setchr4r(0x10,0x0000,(latche&4)|M96LA);
238 static void M96Sync()
240 setprg32(0x8000,latche&3);
241 setchr4r(0x10,0x0000,(latche&4)|M96LA);
242 setchr4r(0x10,0x1000,(latche&4)|3);
245 void Mapper96_init(void)
247 SetWriteHandler(0x8000,0xffff,Mapper96_write);
249 AddExState(&latche, 1, 0, "LATC");
250 AddExState(&M96LA, 1, 0, "LAVA");
251 SetupCartCHRMapping(0x10, MapperExRAM, 32768, 1);
254 GameStateRestore=M96Sync;
257 static DECLFW(Mapper140_write)
260 ROM_BANK32((V>>4)&0xF);
263 void Mapper140_init(void)
266 SetWriteHandler(0x6000,0x7FFF,Mapper140_write);
269 static void M185Sync()
274 // if(!(mapbyte1[0]==0x21))
277 setchr1r(0x10,x<<10,0);
283 static DECLFW(Mapper185_write)
287 // printf("Wr: $%04x:$%02x\n",A,V);
290 void Mapper185_init(void)
292 memset(MapperExRAM,0xFF,1024);
293 MapStateRestore=M185Sync;
297 SetupCartCHRMapping(0x10,MapperExRAM,1024,0);
298 SetWriteHandler(0x8000,0xFFFF,Mapper185_write);