openMSX
SVIPSG.hh
Go to the documentation of this file.
1 #ifndef SVIPSG_HH
2 #define SVIPSG_HH
3 
4 #include "MSXDevice.hh"
6 #include <memory>
7 
8 namespace openmsx {
9 
10 class AY8910;
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  byte readIO(word port, EmuTime::param time) override;
22  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  byte readA(EmuTime::param time) override;
31  void writeB(byte value, EmuTime::param time) override;
32 
33  std::unique_ptr<AY8910> ay8910;
34  JoystickPortIf* ports[2];
35 
36  int registerLatch;
37  byte prev;
38 };
39 
40 } // namespace openmsx
41 
42 #endif
bool getEnum() const noexcept
Definition: EnumSetting.hh:96
void reset(EmuTime::param time) override
This method is called on reset.
Definition: SVIPSG.cc:68
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:79
void powerDown(EmuTime::param time) override
This method is called when MSX is powered down.
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:89
void serialize(Archive &ar, unsigned version)
Definition: SVIPSG.cc:144
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX...
Definition: MSXDevice.hh:31
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition: SVIPSG.cc:84
SVIPSG(const DeviceConfig &config)
Definition: SVIPSG.cc:50
~SVIPSG() override
Definition: SVIPSG.cc:63
Models the general purpose I/O ports of the AY8910.