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
23 static uint8 reg[4], IRQa;
\r
24 static int16 IRQCount, IRQPause;
\r
26 static int16 Count = 0x0000;
\r
28 static SFORMAT StateRegs[]=
\r
32 {&IRQCount, 2, "IRQC"},
\r
36 static void Sync(void)
\r
42 //#define Count 0x1800
\r
45 static DECLFW(UNL3DBlockWrite)
\r
53 case 0x4800: reg[0]=V; break;
\r
54 case 0x4900: reg[1]=V; break;
\r
55 case 0x4a00: reg[2]=V; break;
\r
56 case 0x4e00: reg[3]=V; IRQCount=Count; IRQPause=Pause; IRQa=1; X6502_IRQEnd(FCEU_IQEXT); break;
\r
60 static void UNL3DBlockPower(void)
\r
63 SetReadHandler(0x8000,0xFFFF,CartBR);
\r
64 SetWriteHandler(0x4800,0x4E00,UNL3DBlockWrite);
\r
67 static void UNL3DBlockReset(void)
\r
70 FCEU_printf("Count=%04x\n",Count);
\r
73 static void FP_FASTAPASS(1) UNL3DBlockIRQHook(int a)
\r
86 X6502_IRQBegin(FCEU_IQEXT);
\r
92 X6502_IRQEnd(FCEU_IQEXT);
\r
98 static void StateRestore(int version)
\r
103 void UNL3DBlock_Init(CartInfo *info)
\r
105 info->Power=UNL3DBlockPower;
\r
106 info->Reset=UNL3DBlockReset;
\r
107 MapIRQHook=UNL3DBlockIRQHook;
\r
108 GameStateRestore=StateRestore;
\r
109 AddExState(&StateRegs, ~0, 0, 0);
\r