e2d0dd92 |
1 | /* FCE Ultra - NES/Famicom Emulator |
2 | * |
3 | * Copyright notice for this file: |
4 | * Copyright (C) 2005 CaH4e3 |
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 | * Family Study Box by Fukutake Shoten |
21 | */ |
22 | |
23 | #include "mapinc.h" |
24 | |
25 | static uint8 *DummyCHR=NULL; |
26 | static uint8 datareg; |
27 | static void(*Sync)(void); |
28 | |
29 | |
30 | static SFORMAT StateRegs[]= |
31 | { |
32 | {&datareg, 1, "DREG"}, |
33 | {0} |
34 | }; |
35 | |
36 | // on off |
37 | //1 0x0F, 0xF0 - Bird Week |
38 | //2 0x33, 0x00 - B-Wings |
39 | //3 0x11, 0x00 - Mighty Bomb Jack |
40 | //4 0x22, 0x20 - Sansuu 1 Nen, Sansuu 2 Nen |
41 | //5 0xFF, 0x00 - Sansuu 3 Nen |
42 | //6 0x21, 0x13 - Spy vs Spy |
43 | //7 0x20, 0x21 - Seicross |
44 | |
45 | static void Sync185(void) |
46 | { |
47 | // little dirty eh? ;_) |
48 | if((datareg&3)&&(datareg!=0x13)) // 1, 2, 3, 4, 5, 6 |
49 | setchr8(0); |
50 | else |
51 | setchr8r(0x10,0); |
52 | } |
53 | |
54 | static void Sync181(void) |
55 | { |
56 | if(!(datareg&1)) // 7 |
57 | setchr8(0); |
58 | else |
59 | setchr8r(0x10,0); |
60 | } |
61 | |
62 | static DECLFW(MWrite) |
63 | { |
64 | datareg=V; |
65 | Sync(); |
66 | } |
67 | |
68 | static void MPower(void) |
69 | { |
70 | datareg=0; |
71 | Sync(); |
72 | setprg16(0x8000,0); |
73 | setprg16(0xC000,~0); |
74 | SetWriteHandler(0x8000,0xFFFF,MWrite); |
75 | SetReadHandler(0x8000,0xFFFF,CartBR); |
76 | } |
77 | |
78 | static void MClose(void) |
79 | { |
80 | if(DummyCHR) |
81 | FCEU_gfree(DummyCHR); |
82 | DummyCHR=NULL; |
83 | } |
84 | |
85 | static void MRestore(int version) |
86 | { |
87 | Sync(); |
88 | } |
89 | |
90 | void Mapper185_Init(CartInfo *info) |
91 | { |
92 | Sync=Sync185; |
93 | info->Power=MPower; |
94 | info->Close=MClose; |
95 | GameStateRestore=MRestore; |
96 | DummyCHR=(uint8*)FCEU_gmalloc(8192); |
97 | int x; |
98 | for(x=0;x<8192;x++) |
99 | DummyCHR[x]=0xff; |
100 | SetupCartCHRMapping(0x10,DummyCHR,8192,0); |
101 | AddExState(StateRegs, ~0, 0, 0); |
102 | } |
103 | |
104 | void Mapper181_Init(CartInfo *info) |
105 | { |
106 | Sync=Sync181; |
107 | info->Power=MPower; |
108 | info->Close=MClose; |
109 | GameStateRestore=MRestore; |
110 | DummyCHR=(uint8*)FCEU_gmalloc(8192); |
111 | int x; |
112 | for(x=0;x<8192;x++) |
113 | DummyCHR[x]=0xff; |
114 | SetupCartCHRMapping(0x10,DummyCHR,8192,0); |
115 | AddExState(StateRegs, ~0, 0, 0); |
116 | } |