1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2008 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
21 // T-227-1, 820632, MMC3 based, multimenu, 60000in1 (0010) dip switches
\r
26 static uint8 reset_flag = 0x07;
\r
28 static void BMCT2271CW(uint32 A, uint8 V)
\r
34 va|=(EXPREGS[0]&0x10)<<4;
\r
39 va|=(EXPREGS[0]&0x18)<<4;
\r
44 static void BMCT2271PW(uint32 A, uint8 V)
\r
46 uint32 va = V & 0x3F;
\r
51 va|=(EXPREGS[0]&0x10)<<1;
\r
56 va|=(EXPREGS[0]&0x18)<<1;
\r
58 switch(EXPREGS[0]&3)
\r
60 case 0x00: setprg8(A,va); break;
\r
63 va=(va&0xFD)|((EXPREGS[0]&4)>>1);
\r
66 setprg16(0x8000,va >> 1);
\r
67 setprg16(0xC000,va >> 1);
\r
72 case 0x03: if(A<0xC000) setprg32(0x8000,va >> 2); break;
\r
77 static DECLFW(BMCT2271LoWrite)
\r
79 if(!(EXPREGS[0]&0x80))
\r
80 EXPREGS[0] = A & 0xFF;
\r
81 FixMMC3PRG(MMC3_cmd);
\r
82 FixMMC3CHR(MMC3_cmd);
\r
85 static DECLFR(BMCT2271HiRead)
\r
88 if(EXPREGS[0]&0x40) av = (av & 0xFFF0)|reset_flag;
\r
92 static void BMCT2271Reset(void)
\r
100 static void BMCT2271Power(void)
\r
104 SetWriteHandler(0x6000,0x7FFF,BMCT2271LoWrite);
\r
105 SetReadHandler(0x8000,0xFFFF,BMCT2271HiRead);
\r
108 void BMCT2271_Init(CartInfo *info)
\r
110 GenMMC3_Init(info, 128, 128, 8, 0);
\r
113 info->Power=BMCT2271Power;
\r
114 info->Reset=BMCT2271Reset;
\r
115 AddExState(EXPREGS, 1, 0, "EXPR");
\r