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)) {
100 ymf278BusyTime = time + MEM_READ_DELAY;
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) {
155 ymf278BusyTime = time + WAVE_REG_SELECT_DELAY;
159 if ((0x08 <= opl4latch) && (opl4latch <= 0x1F)) {
160 ymf278LoadTime = time + LOAD_DELAY;
162 if ((3 <= opl4latch) && (opl4latch <= 6)) {
167 ymf278BusyTime = time + MEM_WRITE_DELAY;
172 ymf278BusyTime = time + WAVE_REG_WRITE_DELAY;
174 if (opl4latch == 0xf8) {
176 }
else if (opl4latch == 0xf9) {
179 ymf278.
writeReg(opl4latch, value, time);
191 switch (port & 0x03) {
194 ymf278BusyTime = time + FM_REG_SELECT_DELAY;
197 opl3latch = value | 0x100;
198 ymf278BusyTime = time + FM_REG_SELECT_DELAY;
202 ymf278BusyTime = time + FM_REG_WRITE_DELAY;
203 ymf262.
writeReg(opl3latch, value, time);
211bool MSXMoonSound::getNew2()
const
213 return (ymf262.
peekReg(0x105) & 0x02) != 0;
216byte MSXMoonSound::readYMF278Status(EmuTime::param time)
const
219 if (time < ymf278BusyTime) result |= 0x01;
220 if (time < ymf278LoadTime) result |= 0x02;
228template<
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)
uint8_t peekStatus() const
void setMixLevel(uint8_t x, EmuTime::param time)
void writeReg(unsigned r, uint8_t v, EmuTime::param time)
uint8_t peekReg(unsigned reg) const
uint8_t readReg(unsigned reg)
uint8_t readReg(uint8_t reg)
void writeReg(uint8_t reg, uint8_t data, EmuTime::param time)
void setMixLevel(uint8_t x, EmuTime::param time)
void reset(EmuTime::param time)
uint8_t peekReg(uint8_t reg) const
std::string getName(KeyCode keyCode)
Translate key code to key name.
This file implemented 3 utility functions:
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)