OXYGENHUB
◆ main openmsx / src / memory / PanasonicMemory.hh
1.1 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef PANASONICMEMORY_HH
2
#define PANASONICMEMORY_HH
3
4
#include "Rom.hh"
5
6
#include <cstdint>
7
#include <optional>
8
9
namespace openmsx {
10
11
class MSXMotherBoard;
12
class MSXCPU;
13
class Ram;
14
15
class PanasonicMemory
16
{
17
public:
18
	explicit PanasonicMemory(MSXMotherBoard& motherBoard);
19
20
	/**
21
	 * Pass reference of the actual Ram block for use in DRAM mode and RAM
22
	 * access via the ROM mapper. Note that this is always unchecked Ram!
23
	 */
24
	void registerRam(Ram& ram);
25
	[[nodiscard]] std::span<const uint8_t, 0x2000> getRomBlock(unsigned block) const;
26
	[[nodiscard]] std::span<const uint8_t> getRomRange(unsigned first, unsigned last) const;
27
	/**
28
	 * Note that this is always unchecked RAM! There is no UMR detection
29
	 * when accessing Ram in DRAM mode or via the ROM mapper!
30
	 */
31
	[[nodiscard]] uint8_t* getRamBlock(unsigned block);
32
	[[nodiscard]] unsigned getRamSize() const { return ramSize; }
33
	void setDRAM(bool dram);
34
	[[nodiscard]] bool isWritable(unsigned address) const;
35
36
private:
37
	MSXCPU& msxcpu;
38
39
	const std::optional<Rom> rom; // can be nullptr
40
	uint8_t* ram = nullptr;
41
	unsigned ramSize = 0;
42
	bool dram = false;
43
};
44
45
} // namespace openmsx
46
47
#endif