more menu work, scalers, sound
[fceu.git] / boards / karaoke.c
CommitLineData
c62d2810 1/* FCE Ultra - NES/Famicom Emulator
2 *
3 * Copyright notice for this file:
d97315ac 4 * Copyright (C) 2002 Xodnizel
c62d2810 5 *
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.
10 *
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.
15 *
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
19 */
20
21#include "mapinc.h"
22
d97315ac 23static uint8 DReg;
24static SFORMAT StateRegs[]=
c62d2810 25{
d97315ac 26 {&DReg, 1, "DREG"},
27 {0}
28};
29
30static void Sync(void)
31{
32 if(DReg)
33 {
34 if(DReg & 0x10)
35 setprg16(0x8000,(DReg&7));
36 else
37 setprg16(0x8000,(DReg&7)|8);
38 }
39 else
40 setprg16(0x8000,7);
c62d2810 41}
d97315ac 42
43static void StateRestore(int version)
c62d2810 44{
d97315ac 45 Sync();
c62d2810 46}
47
d97315ac 48static DECLFW(M188Write)
c62d2810 49{
d97315ac 50 DReg=V;
51 Sync();
c62d2810 52}
53
d97315ac 54static DECLFR(testr)
55{
56 return(3);
57}
58
59
60static void Power(void)
61{
62 setchr8(0);
63 setprg8(0xc000,0xE);
64 setprg8(0xe000,0xF);
65 DReg = 0;
66 Sync();
67 SetReadHandler(0x6000,0x7FFF,testr);
68 SetReadHandler(0x8000,0xFFFF,CartBR);
69 SetWriteHandler(0x8000,0xFFFF,M188Write);
70}
71
72
73void Mapper188_Init(CartInfo *info)
74{
75 info->Power=Power;
76 GameStateRestore=StateRestore;
77 AddExState(&StateRegs, ~0, 0, 0);
78}