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
9namespace openmsx {
10
11class MSXMusicBase : public MSXDevice
12{
13public:
14 void reset(EmuTime::param time) override;
15 void writeIO(word port, byte value, EmuTime::param time) override;
16 [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
17 [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
18 [[nodiscard]] const byte* getReadCacheLine(word start) const override;
19
20 template<typename Archive>
21 void serialize(Archive& ar, unsigned version);
22
23protected:
24 explicit MSXMusicBase(const DeviceConfig& config);
25 ~MSXMusicBase() override = default;
26
27 void writePort(bool port, byte value, EmuTime::param time);
28
29protected:
32};
34
35
36class MSXMusic final : public MSXMusicBase
37{
38public:
39 explicit MSXMusic(const DeviceConfig& config);
40
41 template<typename Archive>
42 void serialize(Archive& ar, unsigned version);
43};
44SERIALIZE_CLASS_VERSION(MSXMusic, 3); // must be same as MSXMusicBase
45
46
47// Variant used in Panasonic_FS-A1WX and Panasonic_FS-A1WSX
48class MSXMusicWX final : public MSXMusicBase
49{
50public:
51 explicit MSXMusicWX(const DeviceConfig& config);
52
53 void reset(EmuTime::param time) override;
54 [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
55 [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
56 [[nodiscard]] const byte* getReadCacheLine(word start) const override;
57 void writeMem(word address, byte value, EmuTime::param time) override;
58 [[nodiscard]] byte* getWriteCacheLine(word start) const override;
59
60 template<typename Archive>
61 void serialize(Archive& ar, unsigned version);
62
63private:
64 byte control;
65};
66SERIALIZE_CLASS_VERSION(MSXMusicWX, 3); // must be same as MSXMusicBase
67
68} // namespace openmsx
69
70#endif
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:33
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
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
void reset(EmuTime::param time) override
This method is called on reset.
Definition: MSXMusic.cc:23
void writePort(bool port, byte value, EmuTime::param time)
Definition: MSXMusic.cc:33
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
~MSXMusicBase() override=default
void serialize(Archive &ar, unsigned version)
Definition: MSXMusic.cc:57
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: MSXMusic.cc:38
MSXMusicBase(const DeviceConfig &config)
Definition: MSXMusic.cc:11
MSXMusicWX(const DeviceConfig &config)
Definition: MSXMusic.cc:104
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
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: MSXMusic.cc:116
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
void serialize(Archive &ar, unsigned version)
Definition: MSXMusic.cc:161
void reset(EmuTime::param time) override
This method is called on reset.
Definition: MSXMusic.cc:110
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
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
MSXMusic(const DeviceConfig &config)
Definition: MSXMusic.cc:75
void serialize(Archive &ar, unsigned version)
Definition: MSXMusic.cc:81
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)