1
/* FCE Ultra - NES/Famicom Emulator
3
* Copyright notice for this file:
4
* Copyright (C) 2007 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
23
static uint8 reg0, reg1, reg2;
24
static uint8 *WRAM=NULL;
25
static uint32 WRAMSIZE;
27
static SFORMAT StateRegs[]=
35
static void Sync(void)
48
setprg8r(0x10,0x6000,0);
49
setprg4(0xa000,(0xd<<1));
50
setprg2(0xb000,(0xd<<2)+2);
51
setprg2r(0x10,0xb800,4);
52
setprg2r(0x10,0xc000,5);
53
setprg2r(0x10,0xc800,6);
54
setprg2r(0x10,0xd000,7);
55
setprg2(0xd800,(0xe<<2)+3);
60
static DECLFW(M103RamWrite0)
65
static DECLFW(M103RamWrite1)
67
WRAM[0x2000+((A-0xB800)&0x1FFF)]=V;
70
static DECLFW(M103Write0)
76
static DECLFW(M103Write1)
82
static DECLFW(M103Write2)
88
static void M103Power(void)
92
SetReadHandler(0x6000,0x7FFF,CartBR);
93
SetWriteHandler(0x6000,0x7FFF,M103RamWrite0);
94
SetReadHandler(0x8000,0xFFFF,CartBR);
95
SetWriteHandler(0xB800,0xD7FF,M103RamWrite1);
96
SetWriteHandler(0x8000,0x8FFF,M103Write0);
97
SetWriteHandler(0xE000,0xEFFF,M103Write1);
98
SetWriteHandler(0xF000,0xFFFF,M103Write2);
101
static void M103Close(void)
108
static void StateRestore(int version)
113
void Mapper103_Init(CartInfo *info)
115
info->Power=M103Power;
116
info->Close=M103Close;
117
GameStateRestore=StateRestore;
120
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
121
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
122
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
124
AddExState(&StateRegs, ~0, 0, 0);