OXYGENHUB
◆ main openmsx / src / MSXS1985.hh
1011 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
/*
2
 * This class implements the
3
 *   backup RAM
4
 *   bitmap function
5
 * of the S1985 MSX-engine
6
 *
7
 *  TODO explanation
8
 */
9
10
#ifndef S1985_HH
11
#define S1985_HH
12
13
#include "MSXDevice.hh"
14
#include "MSXSwitchedDevice.hh"
15
#include <memory>
16
17
namespace openmsx {
18
19
using uint4_t = uint8_t;
20
21
class SRAM;
22
23
class MSXS1985 final : public MSXDevice, public MSXSwitchedDevice
24
{
25
public:
26
	explicit MSXS1985(const DeviceConfig& config);
27
	~MSXS1985() override;
28
29
	// MSXDevice
30
	void reset(EmuTime time) override;
31
32
	// MSXSwitchedDevice
33
	[[nodiscard]] uint8_t readSwitchedIO(uint16_t port, EmuTime time) override;
34
	[[nodiscard]] uint8_t peekSwitchedIO(uint16_t port, EmuTime time) const override;
35
	void writeSwitchedIO(uint16_t port, uint8_t value, EmuTime time) override;
36
37
	template<typename Archive>
38
	void serialize(Archive& ar, unsigned version);
39
40
private:
41
	std::unique_ptr<SRAM> sram;
42
	uint4_t address;
43
	uint8_t color1;
44
	uint8_t color2;
45
	uint8_t pattern;
46
};
47
SERIALIZE_CLASS_VERSION(MSXS1985, 2);
48
49
} // namespace openmsx
50
51
#endif