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 prg_reg;
\r
25 static uint8 chr_reg;
\r
26 static uint8 hrd_flag;
\r
28 static SFORMAT StateRegs[]=
\r
30 {&hrd_flag, 1, "DPSW"},
\r
31 {&prg_reg, 1, "PRG"},
\r
32 {&chr_reg, 1, "CHR"},
\r
36 static void Sync(void)
\r
39 setprg32(0x8000,prg_reg>>6);
\r
42 setprg16(0x8000,(prg_reg>>5)&3);
\r
43 setprg16(0xC000,(prg_reg>>5)&3);
\r
45 setmirror((prg_reg&8)>>3);
\r
46 setchr8((chr_reg&3)|(prg_reg&7)|((prg_reg&0x10)>>1));
\r
49 static DECLFR(M57Read)
\r
54 static DECLFW(M57Write)
\r
56 if((A&0x8800)==0x8800)
\r
63 static void M57Power(void)
\r
68 SetReadHandler(0x8000,0xFFFF,CartBR);
\r
69 SetWriteHandler(0x8000,0xFFFF,M57Write);
\r
70 SetReadHandler(0x6000,0x6000,M57Read);
\r
74 static void M57Reset()
\r
78 FCEU_printf("Select Register = %02x\n",hrd_flag);
\r
81 static void StateRestore(int version)
\r
86 void Mapper57_Init(CartInfo *info)
\r
88 info->Power=M57Power;
\r
89 info->Reset=M57Reset;
\r
90 GameStateRestore=StateRestore;
\r
91 AddExState(&StateRegs, ~0, 0, 0);
\r