1 // -*- C++ -*-
2 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
3 // Copyright (C) 1999-2003 Forgotten
4 // Copyright (C) 2004 Forgotten and the VBA development team
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, or(at your option)
9 // 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 Foundation,
18 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 
20 #include <time.h>
21 
22 struct mapperMBC1 {
23   int mapperRAMEnable;
24   int mapperROMBank;
25   int mapperRAMBank;
26   int mapperMemoryModel;
27   int mapperROMHighAddress;
28   int mapperRAMAddress;
29 };
30 
31 struct mapperMBC2 {
32   int mapperRAMEnable;
33   int mapperROMBank;
34 };
35 
36 struct mapperMBC3 {
37   int mapperRAMEnable;
38   int mapperROMBank;
39   int mapperRAMBank;
40   int mapperRAMAddress;
41   int mapperClockLatch;
42   int mapperClockRegister;
43   int mapperSeconds;
44   int mapperMinutes;
45   int mapperHours;
46   int mapperDays;
47   int mapperControl;
48   int mapperLSeconds;
49   int mapperLMinutes;
50   int mapperLHours;
51   int mapperLDays;
52   int mapperLControl;
53   time_t mapperLastTime;
54 };
55 
56 struct mapperMBC5 {
57   int mapperRAMEnable;
58   int mapperROMBank;
59   int mapperRAMBank;
60   int mapperROMHighAddress;
61   int mapperRAMAddress;
62   int isRumbleCartridge;
63 };
64 
65 struct mapperMBC7 {
66   int mapperRAMEnable;
67   int mapperROMBank;
68   int mapperRAMBank;
69   int mapperRAMAddress;
70   int cs;
71   int sk;
72   int state;
73   int buffer;
74   int idle;
75   int count;
76   int code;
77   int address;
78   int writeEnable;
79   int value;
80 };
81 
82 struct mapperHuC1 {
83   int mapperRAMEnable;
84   int mapperROMBank;
85   int mapperRAMBank;
86   int mapperMemoryModel;
87   int mapperROMHighAddress;
88   int mapperRAMAddress;
89 };
90 
91 struct mapperHuC3 {
92   int mapperRAMEnable;
93   int mapperROMBank;
94   int mapperRAMBank;
95   int mapperRAMAddress;
96   int mapperAddress;
97   int mapperRAMFlag;
98   int mapperRAMValue;
99   int mapperRegister1;
100   int mapperRegister2;
101   int mapperRegister3;
102   int mapperRegister4;
103   int mapperRegister5;
104   int mapperRegister6;
105   int mapperRegister7;
106   int mapperRegister8;
107 };
108 
109 extern mapperMBC1 gbDataMBC1;
110 extern mapperMBC2 gbDataMBC2;
111 extern mapperMBC3 gbDataMBC3;
112 extern mapperMBC5 gbDataMBC5;
113 extern mapperHuC1 gbDataHuC1;
114 extern mapperHuC3 gbDataHuC3;
115 
116 void mapperMBC1ROM(u16,u8);
117 void mapperMBC1RAM(u16,u8);
118 void mapperMBC2ROM(u16,u8);
119 void mapperMBC2RAM(u16,u8);
120 void mapperMBC3ROM(u16,u8);
121 void mapperMBC3RAM(u16,u8);
122 u8 mapperMBC3ReadRAM(u16);
123 void mapperMBC5ROM(u16,u8);
124 void mapperMBC5RAM(u16,u8);
125 void mapperMBC7ROM(u16,u8);
126 void mapperMBC7RAM(u16,u8);
127 u8 mapperMBC7ReadRAM(u16);
128 void mapperHuC1ROM(u16,u8);
129 void mapperHuC1RAM(u16,u8);
130 void mapperHuC3ROM(u16,u8);
131 void mapperHuC3RAM(u16,u8);
132 u8 mapperHuC3ReadRAM(u16);
133 
134 //extern void (*mapper)(u16,u8);
135 //extern void (*mapperRAM)(u16,u8);
136 //extern u8 (*mapperReadRAM)(u16);
137 
138 extern void memoryUpdateMapMBC1();
139 extern void memoryUpdateMapMBC2();
140 extern void memoryUpdateMapMBC3();
141 extern void memoryUpdateMapMBC5();
142 extern void memoryUpdateMapMBC7();
143 extern void memoryUpdateMapHuC1();
144 extern void memoryUpdateMapHuC3();
145 
146 
147 
148 
149 
150