51 , ymf262(
getName() +
" FM", config, true)
53 config.getChildDataAsInt(
"sampleram", 512),
55 , ymf278LoadTime(getCurrentTime())
56 , ymf278BusyTime(getCurrentTime())
75 ymf278BusyTime = time;
76 ymf278LoadTime = time;
81 if ((port & 0xFF) < 0xC0) {
83 switch (port & 0x01) {
91 if ((3 <= opl4latch) && (opl4latch <= 6)) {
102 return ymf278.
readReg(opl4latch);
108 switch (port & 0x03) {
111 return ymf262.
readStatus() | readYMF278Status(time);
114 return ymf262.
readReg(opl3latch);
123 if ((port & 0xFF) < 0xC0) {
125 switch (port & 0x01) {
129 return ymf278.
peekReg(opl4latch);
135 switch (port & 0x03) {
138 return ymf262.
peekStatus() | readYMF278Status(time);
141 return ymf262.
peekReg(opl3latch);
150 if ((port & 0xFF) < 0xC0) {
153 switch (port & 0x01) {
159 if ((0x08 <= opl4latch) && (opl4latch <= 0x1F)) {
162 if ((3 <= opl4latch) && (opl4latch <= 6)) {
174 if (opl4latch == 0xf8) {
176 }
else if (opl4latch == 0xf9) {
179 ymf278.
writeReg(opl4latch, value, time);
191 switch (port & 0x03) {
197 opl3latch = value | 0x100;
203 ymf262.
writeReg(opl3latch, value, time);
211 bool MSXMoonSound::getNew2()
const
213 return (ymf262.
peekReg(0x105) & 0x02) != 0;
216 byte MSXMoonSound::readYMF278Status(EmuTime::param time)
const
219 if (time < ymf278BusyTime) result |= 0x01;
220 if (time < ymf278LoadTime) result |= 0x02;
228 template<
typename Archive>
231 ar.template serializeBase<MSXDevice>(*
this);
232 ar.serialize(
"ymf262", ymf262,
234 "opl3latch", opl3latch,
235 "opl4latch", opl4latch);
236 if (ar.versionAtLeast(version, 3)) {
237 ar.serialize(
"loadTime", ymf278LoadTime,
238 "busyTime", ymf278BusyTime);
240 assert(Archive::IS_LOADER);
Represents a clock with a fixed frequency.
static constexpr EmuDuration duration(unsigned ticks)
Calculates the duration of the given number of ticks at this clock's frequency.
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
EmuTime::param getCurrentTime() const
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
MSXMoonSound(const DeviceConfig &config)
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.
void serialize(Archive &ar, unsigned version)
void reset(EmuTime::param time) override
This method is called on reset.
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
void reset(EmuTime::param time)
void setMixLevel(uint8_t x, EmuTime::param time)
byte readReg(unsigned reg)
void writeReg(unsigned r, byte v, EmuTime::param time)
byte peekReg(unsigned reg) const
void writeReg(byte reg, byte data, EmuTime::param time)
void setMixLevel(uint8_t x, EmuTime::param time)
void reset(EmuTime::param time)
byte peekReg(byte reg) const
std::string getName(KeyCode keyCode)
Translate key code to key name.
This file implemented 3 utility functions:
constexpr auto MEM_WRITE_DELAY
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
constexpr auto LOAD_DELAY
constexpr auto WAVE_REG_SELECT_DELAY
constexpr auto FM_REG_WRITE_DELAY
uint16_t word
16 bit unsigned integer
constexpr auto FM_REG_SELECT_DELAY
constexpr auto WAVE_REG_WRITE_DELAY
constexpr auto MEM_READ_DELAY
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)