openMSX
MSXMoonSound.hh
Go to the documentation of this file.
1 #ifndef MSXMOONSOUND_HH
2 #define MSXMOONSOUND_HH
3 
4 #include "MSXDevice.hh"
5 #include "serialize_meta.hh"
6 #include <memory>
7 
8 namespace openmsx {
9 
10 class YMF262;
11 class YMF278;
12 
13 class MSXMoonSound : public MSXDevice
14 {
15 public:
16  explicit MSXMoonSound(const DeviceConfig& config);
17  virtual ~MSXMoonSound();
18 
19  virtual void powerUp(EmuTime::param time);
20  virtual void reset(EmuTime::param time);
21  virtual byte readIO(word port, EmuTime::param time);
22  virtual byte peekIO(word port, EmuTime::param time) const;
23  virtual void writeIO(word port, byte value, EmuTime::param time);
24 
25  template<typename Archive>
26  void serialize(Archive& ar, unsigned version);
27 
28 private:
29  bool getNew2() const;
30  byte readYMF278Status(EmuTime::param time) const;
31 
32  const std::unique_ptr<YMF262> ymf262;
33  const std::unique_ptr<YMF278> ymf278;
34 
36  EmuTime ymf278LoadTime;
38  EmuTime ymf278BusyTime;
39 
40  int opl3latch;
41  byte opl4latch;
42  bool alreadyReadID;
43 };
45 
46 } // namespace openmsx
47 
48 #endif