-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSnapshot.h
90 lines (83 loc) · 3.26 KB
/
Snapshot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//---------------------------------------------------------------------------
#ifndef SnapshotH
#define SnapshotH
//---------------------------------------------------------------------------
// Z80 little endian
// 6502 little endian
// 68K big endian
// Intel big endian
enum CpuEndianness { LittleEndian, BigEndian };
//---------------------------------------------------------------------------
class Snapshot
{
protected:
struct Locations
{
unsigned int Font;
unsigned int Map;
unsigned int Window;
unsigned int NumberOfScreens;
unsigned int Pointers;
unsigned int PointersA;
unsigned int PointersB;
unsigned int Keys;
unsigned int KeysA;
unsigned int KeysB;
unsigned int JumpTable;
unsigned int JumpTableA;
unsigned int JumpTableB;
unsigned int StartScreenA;
unsigned int StartScreenB;
unsigned int StartScreen;
unsigned int SpriteSize;
unsigned int StuffToSkip;
};
std::vector<unsigned char> m_Memory;
CpuEndianness m_Endianness; // defaults to little endian
unsigned char m_Version; // AGD Version
String m_Snapshoter; // the class managing the snapshot
Locations m_Locations;
unsigned int m_SnapshotSize; // the required size of the snapshot
void __fastcall ReadBytes(const String& file, std::vector<unsigned char>& contents) const;
protected:
virtual bool __fastcall ValidateSize(const std::vector<unsigned char>& memory);
public:
__fastcall Snapshot(CpuEndianness endianness, unsigned int snapshotSize);
virtual bool __fastcall Load(const String& file);
UInt8 __fastcall Byte(unsigned int address) const;
UInt16 __fastcall Word(unsigned int address) const;
CpuEndianness __property Endianness = { read = m_Endianness };
unsigned char __property Version = { read = m_Version };
Locations __property Location = { read = m_Locations };
};
//---------------------------------------------------------------------------
class ZXSpectrum48KSnapshot : public Snapshot
{
public:
__fastcall ZXSpectrum48KSnapshot();
};
//---------------------------------------------------------------------------
class ZXSpectrumZ80 : public Snapshot
{
private:
unsigned int m_Header;
bool __fastcall ValidateSize(const std::vector<unsigned char>& memory);
public:
__fastcall ZXSpectrumZ80();
};
//---------------------------------------------------------------------------
class ZXSpectrum128KSnapshot : public ZXSpectrum48KSnapshot
{
public:
__fastcall ZXSpectrum128KSnapshot();
};
//---------------------------------------------------------------------------
class AmstradCPCSnapshot : public Snapshot
{
public:
__fastcall AmstradCPCSnapshot();
};
//---------------------------------------------------------------------------
// TODO: Amstrad CPC snapshot
//---------------------------------------------------------------------------
#endif