merge mappers from FCEU-mm
[fceu.git] / boards / 120.c
CommitLineData
386f5371 1/* FCE Ultra - NES/Famicom Emulator\r
2 *\r
3 * Copyright notice for this file:\r
4 * Copyright (C) 2007 CaH4e3\r
5 *\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
10 *\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
15 *\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
43725da7 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
19 *\r
20 * FDS Conversion\r
21 *\r
386f5371 22 */\r
23\r
24#include "mapinc.h"\r
25\r
26static uint8 reg;\r
27\r
28static SFORMAT StateRegs[]=\r
29{\r
30 {&reg, 1, "REG"},\r
31 {0}\r
32};\r
33\r
34static void Sync(void)\r
35{\r
36 setprg8(0x6000,reg);\r
37 setprg32(0x8000,2);\r
38 setchr8(0);\r
39}\r
40\r
41static DECLFW(M120Write)\r
42{\r
43 if(A==0x41FF)\r
44 {\r
45 reg=V&7;\r
46 Sync();\r
47 }\r
48}\r
49\r
50static void M120Power(void)\r
51{\r
52 reg=0;\r
53 Sync();\r
43725da7 54 SetReadHandler(0x6000,0xFFFF,CartBR);\r
386f5371 55 SetWriteHandler(0x4100,0x5FFF,M120Write);\r
56}\r
57\r
58static void StateRestore(int version)\r
59{\r
60 Sync();\r
61}\r
62\r
63void Mapper120_Init(CartInfo *info)\r
64{\r
65 info->Power=M120Power;\r
66 GameStateRestore=StateRestore;\r
67 AddExState(&StateRegs, ~0, 0, 0);\r
68}\r