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) 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:36
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:47
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:27
void reset(EmuTime::param time) override
This method is called on reset.
Definition MSXMusic.cc:22
void writePort(bool port, byte value, EmuTime::param time)
Definition MSXMusic.cc:32
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition MSXMusic.cc:42
~MSXMusicBase() override=default
void serialize(Archive &ar, unsigned version)
Definition MSXMusic.cc:56
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition MSXMusic.cc:37
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:131
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition MSXMusic.cc:115
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:142
void serialize(Archive &ar, unsigned version)
Definition MSXMusic.cc:160
void reset(EmuTime::param time) override
This method is called on reset.
Definition MSXMusic.cc:109
byte * getWriteCacheLine(word start) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition MSXMusic.cc:150
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition MSXMusic.cc:126
void serialize(Archive &ar, unsigned version)
Definition MSXMusic.cc:80
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29
#define SERIALIZE_CLASS_VERSION(CLASS, VERSION)