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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
27 static uint32 IRQCount, IRQa;
\r
29 static SFORMAT StateRegs[]=
\r
31 {&IRQCount, 4, "IRQC"},
\r
37 static void Sync(void)
\r
39 setprg4(0x5000,16); // Only YS-612 advdnced version
\r
43 setprg8(0xc000,reg);
\r
48 static DECLFW(M43Write)
\r
50 // int transo[8]={4,3,4,4,4,7,5,6};
\r
51 int transo[8]={4,3,5,3,6,3,7,3}; // According to hardware tests
\r
54 case 0x4022: reg=transo[V&7]; Sync(); break;
\r
55 case 0x8122: // hacked version
\r
56 case 0x4122: IRQa=V&1; X6502_IRQEnd(FCEU_IQEXT); IRQCount=0; break; // original version
\r
60 static void M43Power(void)
\r
64 SetReadHandler(0x5000,0xffff,CartBR);
\r
65 SetWriteHandler(0x4020,0xffff,M43Write);
\r
68 static void M43Reset(void)
\r
72 static void FP_FASTAPASS(1) M43IRQHook(int a)
\r
79 X6502_IRQBegin(FCEU_IQEXT);
\r
83 static void StateRestore(int version)
\r
88 void Mapper43_Init(CartInfo *info)
\r
90 info->Reset=M43Reset;
\r
91 info->Power=M43Power;
\r
92 MapIRQHook=M43IRQHook;
\r
93 GameStateRestore=StateRestore;
\r
94 AddExState(&StateRegs, ~0, 0, 0);
\r