1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2005 CaH4e3
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
24 static uint8 unromchr;
26 static void BMCFK23CCW(uint32 A, uint8 V)
29 setchr8((EXPREGS[2]&0xFC)|unromchr);
32 uint16 base=(EXPREGS[2]&0x7F)<<3;
36 setchr1(0x0400,EXPREGS[6]|base);
37 setchr1(0x0C00,EXPREGS[7]|base);
42 static void BMCFK23CPW(uint32 A, uint8 V)
45 setprg32(0x8000,EXPREGS[1]>>1);
49 setprg8(A,(V&(0x3F>>(EXPREGS[0]&3)))|(EXPREGS[1]<<1));
54 setprg8(0xC000,EXPREGS[4]);
55 setprg8(0xE000,EXPREGS[5]);
60 static DECLFW(BMCFK23C8003Write)
69 if((A==0x8001)&&(EXPREGS[3]&2&&MMC3_cmd&8))
71 EXPREGS[4|(MMC3_cmd&3)]=V;
80 static DECLFW(BMCFK23CWrite)
87 static void BMCFK23CReset(void)
89 EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
90 EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
94 static void BMCFK23CPower(void)
96 EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
97 EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
99 SetWriteHandler(0x5ff0,0x5fff,BMCFK23CWrite);
100 SetWriteHandler(0x8000,0x8003,BMCFK23C8003Write);
103 void BMCFK23C_Init(CartInfo *info)
105 GenMMC3_Init(info, 512, 256, 8, 0);
108 info->Power=BMCFK23CPower;
109 info->Reset=BMCFK23CReset;
110 AddExState(EXPREGS, 8, 0, "EXPR");
111 AddExState(&unromchr, 1, 0, "UNCHR");