annotate src/gb/gbMemory.h @ 68:86093f2ce7d1

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