OXYGENHUB
◆ main openmsx / src / memory / RomManbow2.hh
1.4 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef ROMMANBOW2_HH
2
#define ROMMANBOW2_HH
3
4
#include "AmdFlash.hh"
5
#include "MSXRom.hh"
6
#include "RomBlockDebuggable.hh"
7
#include "RomTypes.hh"
8
9
#include "serialize_meta.hh"
10
11
#include <array>
12
#include <memory>
13
14
namespace openmsx {
15
16
class AY8910;
17
class SCC;
18
19
class RomManbow2 final : public MSXRom
20
{
21
public:
22
	RomManbow2(DeviceConfig& config, Rom&& rom, RomType type);
23
	~RomManbow2() override;
24
25
	void powerUp(EmuTime time) override;
26
	void reset(EmuTime time) override;
27
	[[nodiscard]] byte peekMem(uint16_t address, EmuTime time) const override;
28
	[[nodiscard]] byte readMem(uint16_t address, EmuTime time) override;
29
	void writeMem(uint16_t address, byte value, EmuTime time) override;
30
	[[nodiscard]] const byte* getReadCacheLine(uint16_t address) const override;
31
	[[nodiscard]] byte* getWriteCacheLine(uint16_t address) override;
32
33
	[[nodiscard]] byte readIO(uint16_t port, EmuTime time) override;
34
	[[nodiscard]] byte peekIO(uint16_t port, EmuTime time) const override;
35
	void writeIO(uint16_t port, byte value, EmuTime time) override;
36
37
	template<typename Archive>
38
	void serialize(Archive& ar, unsigned version);
39
40
private:
41
	void setRom(unsigned region, byte block);
42
43
private:
44
	const std::unique_ptr<SCC> scc;    // can be nullptr
45
	const std::unique_ptr<AY8910> psg; // can be nullptr
46
	AmdFlash flash;
47
	RomBlockDebuggable romBlockDebug;
48
	byte psgLatch;
49
	std::array<byte, 4> bank;
50
	bool sccEnabled;
51
};
52
SERIALIZE_CLASS_VERSION(RomManbow2, 3);
53
54
} // namespace openmsx
55
56
#endif