OXYGENHUB
◆ main openmsx / src / memory / ESE_RAM.hh
997 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef ESE_RAM_HH
2
#define ESE_RAM_HH
3
4
#include "RomBlockDebuggable.hh"
5
#include "SRAM.hh"
6
7
#include "MSXDevice.hh"
8
9
#include <array>
10
11
namespace openmsx {
12
13
class ESE_RAM final : public MSXDevice
14
{
15
public:
16
	explicit ESE_RAM(const DeviceConfig& config);
17
18
	void reset(EmuTime time) override;
19
20
	[[nodiscard]] byte readMem(uint16_t address, EmuTime time) override;
21
	void writeMem(uint16_t address, byte value, EmuTime time) override;
22
	[[nodiscard]] const byte* getReadCacheLine(uint16_t address) const override;
23
	[[nodiscard]] byte* getWriteCacheLine(uint16_t address) override;
24
25
	template<typename Archive>
26
	void serialize(Archive& ar, unsigned version);
27
28
private:
29
	[[nodiscard]] size_t getSramSize() const;
30
	void setSRAM(unsigned region, byte block);
31
32
private:
33
	SRAM sram;
34
	RomBlockDebuggable romBlockDebug;
35
36
	std::array<bool, 4> isWriteable; // which region is readonly?
37
	std::array<byte, 4> mapped; // which block is mapped in this region?
38
	const byte blockMask;
39
};
40
41
} // namespace openmsx
42
43
#endif