1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2009 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 * YOKO Mortal Kombat V Pro, VRC7 pirate clone
\r
25 static uint8 prg[3], chr[8], mirr;
\r
26 static uint8 IRQLatch, IRQa, IRQd;
\r
27 static uint32 IRQCount, CycleCount;
\r
29 static SFORMAT StateRegs[]=
\r
36 {&IRQLatch, 1, "IRQC"},
\r
37 {&IRQCount, 4, "IRQC"},
\r
38 {&CycleCount, 4, "CYCC"},
\r
42 static void Sync(void)
\r
45 setprg8(0x8000,prg[0]);
\r
46 setprg8(0xa000,prg[1]);
\r
47 setprg8(0xc000,prg[2]);
\r
50 setchr1(i<<10,chr[i]);
\r
53 case 0: setmirror(MI_V); break;
\r
54 case 1: setmirror(MI_H); break;
\r
55 case 2: setmirror(MI_0); break;
\r
56 case 3: setmirror(MI_1); break;
\r
60 static DECLFW(UNLVRC7Write)
\r
64 case 0x8000: prg[0]=V; Sync(); break;
\r
65 case 0x8008: prg[1]=V; Sync(); break;
\r
66 case 0x9000: prg[2]=V; Sync(); break;
\r
67 case 0xa000: chr[0]=V; Sync(); break;
\r
68 case 0xa008: chr[1]=V; Sync(); break;
\r
69 case 0xb000: chr[2]=V; Sync(); break;
\r
70 case 0xb008: chr[3]=V; Sync(); break;
\r
71 case 0xc000: chr[4]=V; Sync(); break;
\r
72 case 0xc008: chr[5]=V; Sync(); break;
\r
73 case 0xd000: chr[6]=V; Sync(); break;
\r
74 case 0xd008: chr[7]=V; Sync(); break;
\r
75 case 0xe000: mirr=V; Sync(); break;
\r
78 X6502_IRQEnd(FCEU_IQEXT);
\r
86 X6502_IRQEnd(FCEU_IQEXT);
\r
93 X6502_IRQEnd(FCEU_IQEXT);
\r
98 static void UNLVRC7Power(void)
\r
101 SetReadHandler(0x8000,0xFFFF,CartBR);
\r
102 SetWriteHandler(0x8000,0xFFFF,UNLVRC7Write);
\r
105 static void UNLVRC7IRQHook(int a)
\r
110 while(CycleCount>=341)
\r
116 X6502_IRQBegin(FCEU_IQEXT);
\r
123 static void StateRestore(int version)
\r
128 void UNLVRC7_Init(CartInfo *info)
\r
130 info->Power=UNLVRC7Power;
\r
131 MapIRQHook=UNLVRC7IRQHook;
\r
132 GameStateRestore=StateRestore;
\r
133 AddExState(&StateRegs, ~0, 0, 0);
\r