1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2005 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
24 static uint8 *CHRRAM = NULL;
\r
25 static uint8 resetmode;
\r
26 static int masko8[8]={63,31,15,1,3,0,0,0};
\r
28 static void Super24PW(uint32 A, uint8 V)
\r
30 uint32 NV=V&masko8[EXPREGS[0]&7];
\r
31 NV|=(EXPREGS[1]<<1);
\r
32 setprg8r((NV>>6)&0xF,A,NV);
\r
35 static void Super24CW(uint32 A, uint8 V)
\r
41 uint32 NV=V|(EXPREGS[2]<<3);
\r
42 setchr1r((NV>>9)&0xF,A,NV);
\r
46 static DECLFW(Super24Write)
\r
50 case 0x5FF0: EXPREGS[0]=V;
\r
51 FixMMC3PRG(MMC3_cmd);
\r
52 FixMMC3CHR(MMC3_cmd);
\r
54 case 0x5FF1: EXPREGS[1]=V;
\r
55 FixMMC3PRG(MMC3_cmd);
\r
57 case 0x5FF2: EXPREGS[2]=V;
\r
58 FixMMC3CHR(MMC3_cmd);
\r
63 static DECLFW(Super24IRQ)
\r
67 case 0xc000: IRQLatch=V;
\r
71 case 0xc001: resetmode=1;
\r
74 case 0xE000: IRQa=0;
\r
75 X6502_IRQEnd(FCEU_IQEXT);
\r
79 case 0xE001: IRQa=1;
\r
86 static void Super24HB(void)
\r
97 X6502_IRQBegin(FCEU_IQEXT);
\r
103 static void Super24Power(void)
\r
109 SetWriteHandler(0x5000,0x7FFF,Super24Write);
\r
110 SetWriteHandler(0xC000,0xFFFF,Super24IRQ);
\r
111 SetReadHandler(0x8000,0xFFFF,CartBR);
\r
114 static void Super24Reset(void)
\r
122 static void Super24Close(void)
\r
125 FCEU_gfree(CHRRAM);
\r
129 void Super24_Init(CartInfo *info)
\r
131 info->Power=Super24Power;
\r
132 info->Reset=Super24Reset;
\r
133 info->Close=Super24Close;
\r
136 CHRRAM=(uint8*)FCEU_gmalloc(8192);
\r
137 SetupCartCHRMapping(0x10, CHRRAM, 8192, 1);
\r
138 GameHBIRQHook=Super24HB;
\r
139 AddExState(CHRRAM, 8192, 0, "CHRR");
\r
140 AddExState(EXPREGS, 3, 0, "BIG2");
\r