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 writePort(bool port, byte value, EmuTime::param time);
28 
31 };
33 
34 
35 class MSXMusic : public MSXMusicBase
36 {
37 public:
38  explicit MSXMusic(const DeviceConfig& config);
39 
40  template<typename Archive>
41  void serialize(Archive& ar, unsigned version);
42 };
43 SERIALIZE_CLASS_VERSION(MSXMusic, 3); // must be same as MSXMusicBase
44 
45 
46 // Variant used in Panasonic_FS-A1WX and Panasonic_FS-A1WSX
47 class MSXMusicWX : public MSXMusicBase
48 {
49 public:
50  explicit MSXMusicWX(const DeviceConfig& config);
51 
52  void reset(EmuTime::param time) override;
53  byte peekMem(word address, EmuTime::param time) const override;
54  byte readMem(word address, EmuTime::param time) override;
55  const byte* getReadCacheLine(word start) const override;
56  void writeMem(word address, byte value, EmuTime::param time) override;
57  byte* getWriteCacheLine(word start) const override;
58 
59  template<typename Archive>
60  void serialize(Archive& ar, unsigned version);
61 
62 private:
63  byte control;
64 };
65 SERIALIZE_CLASS_VERSION(MSXMusicWX, 3); // must be same as MSXMusicBase
66 
67 } // namespace openmsx
68 
69 #endif
openmsx::MSXDevice
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:32
openmsx::MSXMusicBase
Definition: MSXMusic.hh:12
openmsx::MSXMusicWX::readMem
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: MSXMusic.cc:127
openmsx::MSXMusicWX::peekMem
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: MSXMusic.cc:116
Rom.hh
openmsx::MSXMusicWX
Definition: MSXMusic.hh:48
openmsx::DeviceConfig
Definition: DeviceConfig.hh:20
serialize_meta.hh
openmsx::MSXMusicBase::MSXMusicBase
MSXMusicBase(const DeviceConfig &config)
Definition: MSXMusic.cc:11
openmsx::SERIALIZE_CLASS_VERSION
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
openmsx::MSXMusicBase::getReadCacheLine
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:48
openmsx::MSXMusicBase::writePort
void writePort(bool port, byte value, EmuTime::param time)
Definition: MSXMusic.cc:33
openmsx::MSXMusicBase::serialize
void serialize(Archive &ar, unsigned version)
Definition: MSXMusic.cc:57
MSXDevice.hh
openmsx::MSXMusicBase::writeIO
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:28
openmsx::YM2413
Definition: YM2413.hh:16
openmsx::Rom
Definition: Rom.hh:21
openmsx::MSXMusicBase::readMem
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: MSXMusic.cc:43
YM2413.hh
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::MSXMusicWX::MSXMusicWX
MSXMusicWX(const DeviceConfig &config)
Definition: MSXMusic.cc:104
openmsx::MSXMusicBase::~MSXMusicBase
~MSXMusicBase() override=default
openmsx::MSXMusicWX::getReadCacheLine
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:132
openmsx::MSXMusicBase::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: MSXMusic.cc:23
openmsx::MSXMusicWX::writeMem
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
Definition: MSXMusic.cc:143
openmsx::MSXMusic
Definition: MSXMusic.hh:36
openmsx::MSXMusicWX::getWriteCacheLine
byte * getWriteCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: MSXMusic.cc:151
openmsx::MSXMusicWX::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: MSXMusic.cc:110
openmsx::MSXMusic::serialize
void serialize(Archive &ar, unsigned version)
Definition: MSXMusic.cc:81
openmsx::MSXMusicBase::peekMem
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: MSXMusic.cc:38
openmsx::MSXMusic::MSXMusic
MSXMusic(const DeviceConfig &config)
Definition: MSXMusic.cc:75
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::MSXMusicWX::serialize
void serialize(Archive &ar, unsigned version)
Definition: MSXMusic.cc:161
openmsx::MSXMusicBase::rom
Rom rom
Definition: MSXMusic.hh:29
openmsx::MSXMusicBase::ym2413
YM2413 ym2413
Definition: MSXMusic.hh:30