1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2007 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
26 static uint8 reg0, reg1, reg2;
\r
27 static uint8 *WRAM=NULL;
\r
28 static uint32 WRAMSIZE;
\r
30 static SFORMAT StateRegs[]=
\r
38 static void Sync(void)
\r
41 setprg8(0x8000,0xc);
\r
42 setprg8(0xe000,0xf);
\r
45 setprg8(0x6000,reg0);
\r
46 setprg8(0xa000,0xd);
\r
47 setprg8(0xc000,0xe);
\r
51 setprg8r(0x10,0x6000,0);
\r
52 setprg4(0xa000,(0xd<<1));
\r
53 setprg2(0xb000,(0xd<<2)+2);
\r
54 setprg2r(0x10,0xb800,4);
\r
55 setprg2r(0x10,0xc000,5);
\r
56 setprg2r(0x10,0xc800,6);
\r
57 setprg2r(0x10,0xd000,7);
\r
58 setprg2(0xd800,(0xe<<2)+3);
\r
63 static DECLFW(M103RamWrite0)
\r
68 static DECLFW(M103RamWrite1)
\r
70 WRAM[0x2000+((A-0xB800)&0x1FFF)]=V;
\r
73 static DECLFW(M103Write0)
\r
79 static DECLFW(M103Write1)
\r
85 static DECLFW(M103Write2)
\r
91 static void M103Power(void)
\r
93 reg0=reg1=0; reg2=0;
\r
95 SetReadHandler(0x6000,0x7FFF,CartBR);
\r
96 SetWriteHandler(0x6000,0x7FFF,M103RamWrite0);
\r
97 SetReadHandler(0x8000,0xFFFF,CartBR);
\r
98 SetWriteHandler(0xB800,0xD7FF,M103RamWrite1);
\r
99 SetWriteHandler(0x8000,0x8FFF,M103Write0);
\r
100 SetWriteHandler(0xE000,0xEFFF,M103Write1);
\r
101 SetWriteHandler(0xF000,0xFFFF,M103Write2);
\r
104 static void M103Close(void)
\r
111 static void StateRestore(int version)
\r
116 void Mapper103_Init(CartInfo *info)
\r
118 info->Power=M103Power;
\r
119 info->Close=M103Close;
\r
120 GameStateRestore=StateRestore;
\r
123 WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
\r
124 SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
\r
125 AddExState(WRAM, WRAMSIZE, 0, "WRAM");
\r
127 AddExState(&StateRegs, ~0, 0, 0);
\r