1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2002 Xodnizel
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 static uint8 DRegs[8];
26 static uint8 MirCache[8];
28 static SFORMAT DB_StateRegs[]={
35 static void toot(void)
39 MirCache[0]=MirCache[1]=(DRegs[0]>>4)&1;
40 MirCache[2]=MirCache[3]=(DRegs[1]>>4)&1;
43 MirCache[4+x]=(DRegs[2+x]>>5)&1;
44 onemir(MirCache[lastA]);
49 setchr2(0x0000,DRegs[0]&0x1F);
50 setchr2(0x0800,DRegs[1]&0x1F);
51 setchr1(0x1000,DRegs[2]&0x1F);
52 setchr1(0x1400,DRegs[3]&0x1F);
53 setchr1(0x1800,DRegs[4]&0x1F);
54 setchr1(0x1C00,DRegs[5]&0x1F);
55 setprg8(0x8000,DRegs[6]&0x1F);
56 setprg8(0xa000,DRegs[7]&0x1F);
60 static DECLFW(Mapper95_write)
64 case 0x8000: cmd = V; break;
68 case 0: DRegs[0]=(V&0x3F)>>1; break;
69 case 1: DRegs[1]=(V&0x3F)>>1; break;
70 case 2: DRegs[2]=V&0x3F; break;
71 case 3: DRegs[3]=V&0x3F; break;
72 case 4: DRegs[4]=V&0x3F; break;
73 case 5: DRegs[5]=V&0x3F; break;
74 case 6: DRegs[6]=V&0x3F; break;
75 case 7: DRegs[7]=V&0x3F; break;
81 static void FP_FASTAPASS(1) dragonbust_ppu(uint32 A)
98 static void DBPower(void)
100 memset(DRegs,0x3F,8);
101 DRegs[0]=DRegs[1]=0x1F;
105 setprg8(0xc000,0x3E);
106 setprg8(0xe000,0x3F);
108 SetReadHandler(0x8000,0xffff,CartBR);
109 SetWriteHandler(0x8000,0xffff,Mapper95_write);
112 static void StateRestore(int version)
117 void Mapper95_Init(CartInfo *info)
120 AddExState(DB_StateRegs, ~0, 0, 0);
121 PPU_hook=dragonbust_ppu;
122 GameStateRestore=StateRestore;