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
19 * 63in1 ghostbusters
\r
24 static uint8 reg[2], bank;
\r
25 static uint8 banks[4] = {0, 0, 1, 2};
\r
26 static uint8 *CHRROM=NULL;
\r
27 static uint32 CHRROMSIZE;
\r
29 static SFORMAT StateRegs[]=
\r
36 static void Sync(void)
\r
40 setprg16r(banks[bank],0x8000,reg[0]&0x1F);
\r
41 setprg16r(banks[bank],0xC000,reg[0]&0x1F);
\r
44 setprg32r(banks[bank],0x8000,(reg[0]>>1)&0x0F);
\r
49 setmirror((reg[0]&0x40)>>6);
\r
52 static DECLFW(BMCGhostbusters63in1Write)
\r
55 bank=((reg[0]&0x80)>>7)|((reg[1]&1)<<1);
\r
56 // FCEU_printf("reg[0]=%02x, reg[1]=%02x, bank=%02x\n",reg[0],reg[1],bank);
\r
60 static DECLFR(BMCGhostbusters63in1Read)
\r
68 static void BMCGhostbusters63in1Power(void)
\r
72 SetReadHandler(0x8000,0xFFFF,BMCGhostbusters63in1Read);
\r
73 SetWriteHandler(0x8000,0xFFFF,BMCGhostbusters63in1Write);
\r
76 static void BMCGhostbusters63in1Reset(void)
\r
81 static void StateRestore(int version)
\r
86 static void BMCGhostbusters63in1Close(void)
\r
93 void BMCGhostbusters63in1_Init(CartInfo *info)
\r
95 info->Reset=BMCGhostbusters63in1Reset;
\r
96 info->Power=BMCGhostbusters63in1Power;
\r
97 info->Close=BMCGhostbusters63in1Close;
\r
99 CHRROMSIZE=8192; // dummy CHRROM, VRAM disable
\r
100 CHRROM=(uint8*)FCEU_gmalloc(CHRROMSIZE);
\r
101 SetupCartPRGMapping(0x10,CHRROM,CHRROMSIZE,0);
\r
102 AddExState(CHRROM, CHRROMSIZE, 0, "CROM");
\r
104 GameStateRestore=StateRestore;
\r
105 AddExState(&StateRegs, ~0, 0, 0);
\r