1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2005 CaH4e3
\r
6 * This program is free software; you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation; either version 2 of the License, or
\r
9 * (at your option) any later version.
\r
11 * This program is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with this program; if not, write to the Free Software
\r
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
\r
24 static void M187CW(uint32 A, uint8 V)
\r
26 if((A&0x1000)==((MMC3_cmd&0x80)<<5))
\r
32 static void M187PW(uint32 A, uint8 V)
\r
36 uint8 bank=EXPREGS[0]&0x1F;
\r
38 setprg32(0x8000,bank>>2);
\r
41 setprg16(0x8000,bank);
\r
42 setprg16(0xC000,bank);
\r
49 static DECLFW(M187Write8000)
\r
55 static DECLFW(M187Write8001)
\r
61 static DECLFW(M187Write8003)
\r
64 if(V==0x28)setprg8(0xC000,0x17);
\r
65 else if(V==0x2A)setprg8(0xA000,0x0F);
\r
69 static DECLFW(M187WriteLo)
\r
75 FixMMC3PRG(MMC3_cmd);
\r
79 static uint8 prot_data[4] = { 0x83, 0x83, 0x42, 0x00 };
\r
80 static DECLFR(M187Read)
\r
82 return prot_data[EXPREGS[1]&3];
\r
85 static void M187Power(void)
\r
87 EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=0;
\r
89 SetReadHandler(0x5000,0x5FFF,M187Read);
\r
90 SetWriteHandler(0x5000,0x5FFF,M187WriteLo);
\r
91 SetWriteHandler(0x8000,0x8000,M187Write8000);
\r
92 SetWriteHandler(0x8001,0x8001,M187Write8001);
\r
93 SetWriteHandler(0x8003,0x8003,M187Write8003);
\r
96 void Mapper187_Init(CartInfo *info)
\r
98 GenMMC3_Init(info, 256, 256, 0, 0);
\r
101 info->Power=M187Power;
\r
102 AddExState(EXPREGS, 3, 0, "EXPR");
\r