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 "AY8910Periphery.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  [[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::unique_ptr<AY8910> ay8910;
35  JoystickPortIf* ports[2];
36 
37  int registerLatch;
38  byte prev;
39 };
40 
41 } // namespace openmsx
42 
43 #endif
Models the general purpose I/O ports of the AY8910.
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:32
void powerDown(EmuTime::param time) override
This method is called when MSX is powered down.
Definition: SVIPSG.cc:74
SVIPSG(const DeviceConfig &config)
Definition: SVIPSG.cc:50
~SVIPSG() override
Definition: SVIPSG.cc:63
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition: SVIPSG.cc:84
void serialize(Archive &ar, unsigned version)
Definition: SVIPSG.cc:144
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 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 reset(EmuTime::param time) override
This method is called on reset.
Definition: SVIPSG.cc:68
This file implemented 3 utility functions:
Definition: Autofire.cc:5
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29