1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2006 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 //ccording to nestopia, BTL_SMB2_C, otherwise known as UNL-SMB2J
\r
27 static uint32 IRQCount;
\r
29 static SFORMAT StateRegs[]=
\r
31 {&IRQCount, 4, "IRQC"},
\r
37 static void Sync(void)
\r
39 setprg4(0x5000,16);
\r
43 setprg8(0xc000,reg);
\r
48 static DECLFW(M43Write)
\r
50 int transo[8]={4,3,4,4,4,7,5,6};
\r
53 case 0x4022: reg=transo[V&7]; Sync(); break;
\r
54 case 0x8122: IRQa=V&1; IRQCount=0; break;
\r
58 static void M43Power(void)
\r
62 // SetReadHandler(0x5000,0x5fff,CartBR);
\r
63 SetReadHandler(0x5000,0xffff,CartBR);
\r
64 SetWriteHandler(0x4020,0xffff,M43Write);
\r
67 static void M43Reset(void)
\r
71 static void M43IRQHook(int a)
\r
78 X6502_IRQBegin(FCEU_IQEXT);
\r
82 static void StateRestore(int version)
\r
87 void Mapper43_Init(CartInfo *info)
\r
89 info->Reset=M43Reset;
\r
90 info->Power=M43Power;
\r
91 MapIRQHook=M43IRQHook;
\r
92 GameStateRestore=StateRestore;
\r
93 AddExState(&StateRegs, ~0, 0, 0);
\r