openMSX
MSXMusic.hh
Go to the documentation of this file.
1 #ifndef MSXMUSIC_HH
2 #define MSXMUSIC_HH
3 
4 #include "MSXDevice.hh"
5 #include "Rom.hh"
6 #include "YM2413.hh"
7 #include "serialize_meta.hh"
8 
9 namespace openmsx {
10 
11 class MSXMusicBase : public MSXDevice
12 {
13 public:
14  void reset(EmuTime::param time) override;
15  void writeIO(word port, byte value, EmuTime::param time) override;
16  byte peekMem(word address, EmuTime::param time) const override;
17  byte readMem(word address, EmuTime::param time) override;
18  const byte* getReadCacheLine(word start) const override;
19 
20  template<typename Archive>
21  void serialize(Archive& ar, unsigned version);
22 
23 protected:
24  explicit MSXMusicBase(const DeviceConfig& config);
25  ~MSXMusicBase() override = default;
26 
27  void writeRegisterPort(byte value, EmuTime::param time);
28  void writeDataPort(byte value, EmuTime::param time);
29 
32 
33 private:
34  int registerLatch;
35 };
37 
38 
39 class MSXMusic : public MSXMusicBase
40 {
41 public:
42  explicit MSXMusic(const DeviceConfig& config);
43 
44  template<typename Archive>
45  void serialize(Archive& ar, unsigned version);
46 };
47 SERIALIZE_CLASS_VERSION(MSXMusic, 2); // must be same as MSXMusicBase
48 
49 
50 // Variant used in Panasonic_FS-A1WX and Panasonic_FS-A1WSX
51 class MSXMusicWX : public MSXMusicBase
52 {
53 public:
54  explicit MSXMusicWX(const DeviceConfig& config);
55 
56  void reset(EmuTime::param time) override;
57  byte peekMem(word address, EmuTime::param time) const override;
58  byte readMem(word address, EmuTime::param time) override;
59  const byte* getReadCacheLine(word start) const override;
60  void writeMem(word address, byte value, EmuTime::param time) override;
61  byte* getWriteCacheLine(word start) const override;
62 
63  template<typename Archive>
64  void serialize(Archive& ar, unsigned version);
65 
66 private:
67  byte control;
68 };
69 SERIALIZE_CLASS_VERSION(MSXMusicWX, 2); // must be same as MSXMusicBase
70 
71 } // namespace openmsx
72 
73 #endif
~MSXMusicBase() override=default
virtual byte * getWriteCacheLine(word start) const
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing...
Definition: MSXDevice.cc:453
void writeDataPort(byte value, EmuTime::param time)
Definition: MSXMusic.cc:46
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
virtual void writeMem(word address, byte value, EmuTime::param time)
Write a given byte to a given location at a certain time to this device.
Definition: MSXDevice.cc:424
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX...
Definition: MSXDevice.hh:31
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
void reset(EmuTime::param time) override
This method is called on reset.
Definition: MSXMusic.cc:23
void writeRegisterPort(byte value, EmuTime::param time)
Definition: MSXMusic.cc:41
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading...
Definition: MSXMusic.cc:61
void serialize(Archive &ar, unsigned version)
Definition: MSXMusic.cc:69
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: MSXMusic.cc:51
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: MSXMusic.cc:56
MSXMusicBase(const DeviceConfig &config)
Definition: MSXMusic.cc:11
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: MSXMusic.cc:29