OXYGENHUB
◆ main openmsx / src / sound / SVIPSG.hh
993 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef SVIPSG_HH
2
#define SVIPSG_HH
3
4
#include "AY8910.hh"
5
#include "AY8910Periphery.hh"
6
7
#include "MSXDevice.hh"
8
9
#include <array>
10
11
namespace openmsx {
12
13
class JoystickPortIf;
14
15
class SVIPSG final : public MSXDevice, public AY8910Periphery
16
{
17
public:
18
	explicit SVIPSG(const DeviceConfig& config);
19
	~SVIPSG() override;
20
21
	void reset(EmuTime time) override;
22
	void powerDown(EmuTime time) override;
23
	[[nodiscard]] byte readIO(uint16_t port, EmuTime time) override;
24
	[[nodiscard]] byte peekIO(uint16_t port, EmuTime time) const override;
25
	void writeIO(uint16_t port, byte value, EmuTime time) override;
26
27
	template<typename Archive>
28
	void serialize(Archive& ar, unsigned version);
29
30
private:
31
	// AY8910Periphery: port A input, port B output
32
	[[nodiscard]] byte readA(EmuTime time) override;
33
	void writeB(byte value, EmuTime time) override;
34
35
private:
36
	std::array<JoystickPortIf*, 2> ports;
37
	AY8910 ay8910; // must come after ports
38
	int registerLatch;
39
	byte prev = 255;
40
};
41
42
} // namespace openmsx
43
44
#endif