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
23 #define MMC4reg mapbyte1
24 #define latcha1 mapbyte2[0]
25 #define latcha2 mapbyte2[1]
28 static void FP_FASTAPASS(1) latchcheck(uint32 VAddr)
34 if(h>=0x20 || ((h&0xF)!=0xF))
43 VROM_BANK4(0x0000,MMC4reg[0]);
48 VROM_BANK4(0x0000,MMC4reg[1]);
56 VROM_BANK4(0x1000,MMC4reg[2]);
61 VROM_BANK4(0x1000,MMC4reg[3]);
67 DECLFW(Mapper9_write) // $Axxx
72 DECLFW(Mapper10_write)
77 DECLFW(Mapper9and10_write)
82 if(latcha1==0xFD) { VROM_BANK4(0x0000,V);}
86 if(latcha1==0xFE) {VROM_BANK4(0x0000,V);}
90 if(latcha2==0xFD) {VROM_BANK4(0x1000,V);}
94 if(latcha2==0xFE) {VROM_BANK4(0x1000,V);}
103 void Mapper9_init(void)
107 ROM_BANK8(0xA000,~2);
109 SetWriteHandler(0xA000,0xAFFF,Mapper9_write);
110 SetWriteHandler(0xB000,0xFFFF,Mapper9and10_write);
114 void Mapper10_init(void)
116 latcha1=latcha2=0xFE;
117 SetWriteHandler(0xA000,0xAFFF,Mapper10_write);
118 SetWriteHandler(0xB000,0xFFFF,Mapper9and10_write);