openMSX
SVIPSG.hh
Go to the documentation of this file.
1 #ifndef SVIPSG_HH
2 #define SVIPSG_HH
3 
4 #include "MSXDevice.hh"
5 #include "AY8910.hh"
6 #include "AY8910Periphery.hh"
7 #include <array>
8 
9 namespace openmsx {
10 
11 class JoystickPortIf;
12 
13 class SVIPSG final : public MSXDevice, public AY8910Periphery
14 {
15 public:
16  SVIPSG(const DeviceConfig& config);
17  ~SVIPSG() override;
18 
19  void reset(EmuTime::param time) override;
20  void powerDown(EmuTime::param time) override;
21  [[nodiscard]] byte readIO(word port, EmuTime::param time) override;
22  [[nodiscard]] byte peekIO(word port, EmuTime::param time) const override;
23  void writeIO(word port, byte value, EmuTime::param time) override;
24 
25  template<typename Archive>
26  void serialize(Archive& ar, unsigned version);
27 
28 private:
29  // AY8910Periphery: port A input, port B output
30  [[nodiscard]] byte readA(EmuTime::param time) override;
31  void writeB(byte value, EmuTime::param time) override;
32 
33 private:
34  std::array<JoystickPortIf*, 2> ports;
35  AY8910 ay8910; // must come after ports
36  int registerLatch;
37  byte prev;
38 };
39 
40 } // namespace openmsx
41 
42 #endif
Models the general purpose I/O ports of the AY8910.
This class implements the AY-3-8910 sound chip.
Definition: AY8910.hh:20
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:33
void powerDown(EmuTime::param time) override
This method is called when MSX is powered down.
Definition: SVIPSG.cc:69
SVIPSG(const DeviceConfig &config)
Definition: SVIPSG.cc:49
~SVIPSG() override
Definition: SVIPSG.cc:58
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition: SVIPSG.cc:79
void serialize(Archive &ar, unsigned version)
Definition: SVIPSG.cc:139
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Definition: SVIPSG.cc:74
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.
Definition: SVIPSG.cc:84
void reset(EmuTime::param time) override
This method is called on reset.
Definition: SVIPSG.cc:63
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29