1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2012 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
20 * Many-in-one hacked mapper crap.
\r
22 * Original BNROM is actually AxROM variations without mirroring control,
\r
23 * and haven't SRAM on-board, so it must be removed from here
\r
25 * Difficult banking is what NINA board doing, most hacks for 34 mapper are
\r
26 * NINA hacks, so this is actually 34 mapper
\r
32 static uint8 regs[3];
\r
33 static uint8 *WRAM=NULL;
\r
34 static uint32 WRAMSIZE;
\r
36 static SFORMAT StateRegs[]=
\r
42 static void Sync(void)
\r
44 setprg8r(0x10,0x6000,0);
\r
45 setprg32(0x8000,regs[0]);
\r
46 setchr4(0x0000,regs[1]);
\r
47 setchr4(0x1000,regs[2]);
\r
50 static DECLFW(M34Write)
\r
57 case 0x7ffd: regs[0] = V; break;
\r
58 case 0x7ffe: regs[1] = V; break;
\r
59 case 0x7fff: regs[2] = V; break;
\r
64 static void M34Power(void)
\r
68 SetReadHandler(0x6000,0x7ffc,CartBR);
\r
69 SetWriteHandler(0x6000,0x7ffc,CartBW);
\r
70 SetReadHandler(0x8000,0xffff,CartBR);
\r
71 SetWriteHandler(0x7ffd,0xffff,M34Write);
\r
74 static void M34Close(void)
\r
81 static void StateRestore(int version)
\r
86 void Mapper34_Init(CartInfo *info)
\r
88 info->Power=M34Power;
\r
89 info->Close=M34Close;
\r
90 GameStateRestore=StateRestore;
\r
93 WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
\r
94 SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
\r
95 AddExState(WRAM, WRAMSIZE, 0, "WRAM");
\r
97 AddExState(&StateRegs, ~0, 0, 0);
\r