1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2005 CaH4e3
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 static uint8 mirror, cmd, is154;
26 static SFORMAT StateRegs[]=
34 static void Sync(void)
36 setchr2(0x0000,reg[0]>>1);
37 setchr2(0x0800,reg[1]>>1);
38 setchr1(0x1000,reg[2]|0x40);
39 setchr1(0x1400,reg[3]|0x40);
40 setchr1(0x1800,reg[4]|0x40);
41 setchr1(0x1C00,reg[5]|0x40);
42 setprg8(0x8000,reg[6]);
43 setprg8(0xA000,reg[7]);
46 static void MSync(void)
48 if(is154)setmirror(MI_0+(mirror&1));
51 static DECLFW(M88Write)
55 case 0x8000: cmd=V&7; mirror=V>>6; MSync(); break;
56 case 0x8001: reg[cmd]=V; Sync(); break;
60 static void M88Power(void)
63 SetReadHandler(0x8000,0xFFFF,CartBR);
64 SetWriteHandler(0x8000,0xFFFF,M88Write);
67 static void StateRestore(int version)
73 void Mapper88_Init(CartInfo *info)
77 GameStateRestore=StateRestore;
78 AddExState(&StateRegs, ~0, 0, 0);
81 void Mapper154_Init(CartInfo *info)
85 GameStateRestore=StateRestore;
86 AddExState(&StateRegs, ~0, 0, 0);