view src/gb/gbMemory.h @ 52:ee70875e0d3e

working on the API
author Robert McIntyre <rlm@mit.edu>
date Wed, 07 Mar 2012 02:12:59 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 #ifndef VBA_GB_MEMORY_H
2 #define VBA_GB_MEMORY_H
4 #if _MSC_VER > 1000
5 #pragma once
6 #endif // _MSC_VER > 1000
8 #include "../Port.h"
10 struct mapperMBC1
11 {
12 int32 mapperRAMEnable;
13 int32 mapperROMBank;
14 int32 mapperRAMBank;
15 int32 mapperMemoryModel;
16 int32 mapperROMHighAddress;
17 int32 mapperRAMAddress;
18 };
20 struct mapperMBC2
21 {
22 int32 mapperRAMEnable;
23 int32 mapperROMBank;
24 };
26 struct mapperMBC3
27 {
28 int32 mapperRAMEnable;
29 int32 mapperROMBank;
30 int32 mapperRAMBank;
31 int32 mapperRAMAddress;
32 int32 mapperClockLatch;
33 int32 mapperClockRegister;
34 int32 mapperSeconds;
35 int32 mapperMinutes;
36 int32 mapperHours;
37 int32 mapperDays;
38 int32 mapperControl;
39 int32 mapperLSeconds;
40 int32 mapperLMinutes;
41 int32 mapperLHours;
42 int32 mapperLDays;
43 int32 mapperLControl;
44 //time_t mapperLastTime;
45 u32 mapperLastTime;
46 };
48 struct mapperMBC5
49 {
50 int32 mapperRAMEnable;
51 int32 mapperROMBank;
52 int32 mapperRAMBank;
53 int32 mapperROMHighAddress;
54 int32 mapperRAMAddress;
55 int32 isRumbleCartridge;
56 };
58 struct mapperMBC7
59 {
60 int32 mapperRAMEnable;
61 int32 mapperROMBank;
62 int32 mapperRAMBank;
63 int32 mapperRAMAddress;
64 int32 cs;
65 int32 sk;
66 int32 state;
67 int32 buffer;
68 int32 idle;
69 int32 count;
70 int32 code;
71 int32 address;
72 int32 writeEnable;
73 int32 value;
74 };
76 struct mapperHuC1
77 {
78 int32 mapperRAMEnable;
79 int32 mapperROMBank;
80 int32 mapperRAMBank;
81 int32 mapperMemoryModel;
82 int32 mapperROMHighAddress;
83 int32 mapperRAMAddress;
84 };
86 struct mapperHuC3
87 {
88 int32 mapperRAMEnable;
89 int32 mapperROMBank;
90 int32 mapperRAMBank;
91 int32 mapperRAMAddress;
92 int32 mapperAddress;
93 int32 mapperRAMFlag;
94 int32 mapperRAMValue;
95 int32 mapperRegister1;
96 int32 mapperRegister2;
97 int32 mapperRegister3;
98 int32 mapperRegister4;
99 int32 mapperRegister5;
100 int32 mapperRegister6;
101 int32 mapperRegister7;
102 int32 mapperRegister8;
103 };
105 extern mapperMBC1 gbDataMBC1;
106 extern mapperMBC2 gbDataMBC2;
107 extern mapperMBC3 gbDataMBC3;
108 extern mapperMBC5 gbDataMBC5;
109 extern mapperHuC1 gbDataHuC1;
110 extern mapperHuC3 gbDataHuC3;
112 void mapperMBC1ROM(u16, u8);
113 void mapperMBC1RAM(u16, u8);
114 void mapperMBC2ROM(u16, u8);
115 void mapperMBC2RAM(u16, u8);
116 void mapperMBC3ROM(u16, u8);
117 void mapperMBC3RAM(u16, u8);
118 u8 mapperMBC3ReadRAM(u16);
119 void mapperMBC5ROM(u16, u8);
120 void mapperMBC5RAM(u16, u8);
121 void mapperMBC7ROM(u16, u8);
122 void mapperMBC7RAM(u16, u8);
123 u8 mapperMBC7ReadRAM(u16);
124 void mapperHuC1ROM(u16, u8);
125 void mapperHuC1RAM(u16, u8);
126 void mapperHuC3ROM(u16, u8);
127 void mapperHuC3RAM(u16, u8);
128 u8 mapperHuC3ReadRAM(u16);
130 //extern void (*mapper)(u16,u8);
131 //extern void (*mapperRAM)(u16,u8);
132 //extern u8 (*mapperReadRAM)(u16);
134 extern void memoryUpdateMapMBC1();
135 extern void memoryUpdateMapMBC2();
136 extern void memoryUpdateMapMBC3();
137 extern void memoryUpdateMapMBC5();
138 extern void memoryUpdateMapMBC7();
139 extern void memoryUpdateMapHuC1();
140 extern void memoryUpdateMapHuC3();
142 #endif // VBA_GB_MEMORY