OXYGENHUB
◆ main openmsx / src / sound / AY8910Periphery.hh
1.4 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef AY8910PERIPHERY_HH
2
#define AY8910PERIPHERY_HH
3
4
#include "EmuTime.hh"
5
6
#include <cstdint>
7
8
namespace openmsx {
9
10
/** Models the general purpose I/O ports of the AY8910.
11
  * The default implementation handles an empty periphery:
12
  * nothing is connected to the I/O ports.
13
  * This class can be overridden to connect peripherals.
14
  */
15
class AY8910Periphery
16
{
17
public:
18
	/** Reads the state of the peripheral on port A.
19
	  * Since the AY8910 doesn't have control lines for the I/O ports,
20
	  * a peripheral is not aware that it is read, which means that
21
	  * "peek" and "read" are equivalent.
22
	  * @param time The moment in time the peripheral's state is read.
23
	  *   On subsequent calls, the time will always be increasing.
24
	  * @return the value read; unconnected bits should be 1
25
	  */
26
	[[nodiscard]] virtual uint8_t readA(EmuTime time);
27
28
	/** Similar to readA, but reads port B. */
29
	[[nodiscard]] virtual uint8_t readB(EmuTime time);
30
31
	/** Writes to the peripheral on port A.
32
	  * @param value The value to write.
33
	  * @param time The moment in time the value is written.
34
	  *   On subsequent calls, the time will always be increasing.
35
	  */
36
	virtual void writeA(uint8_t value, EmuTime time);
37
38
	/** Similar to writeA, but writes port B. */
39
	virtual void writeB(uint8_t value, EmuTime time);
40
41
protected:
42
	AY8910Periphery() = default;
43
	~AY8910Periphery() = default;
44
};
45
46
} // namespace openmsx
47
48
#endif // AY8910PERIPHERY_HH