43 : ymf262(name +
" FM", config, true)
44 , ymf278(name +
" wave", ramSize, config,
std::move(setupMemPtrs))
45 , ymf278LoadTime(time)
46 , ymf278BusyTime(time)
65 ymf278BusyTime = time;
66 ymf278LoadTime = time;
71 if ((port & 0xFF) < 0xC0) {
73 switch (port & 0x01) {
81 if ((3 <= opl4latch) && (opl4latch <= 6)) {
90 ymf278BusyTime = time + MEM_READ_DELAY;
92 return ymf278.
readReg(opl4latch);
98 switch (port & 0x03) {
101 return ymf262.
readStatus() | readYMF278Status(time);
104 return ymf262.
readReg(opl3latch);
113 if ((port & 0xFF) < 0xC0) {
115 switch (port & 0x01) {
119 return ymf278.
peekReg(opl4latch);
125 switch (port & 0x03) {
128 return ymf262.
peekStatus() | readYMF278Status(time);
131 return ymf262.
peekReg(opl3latch);
140 if ((port & 0xFF) < 0xC0) {
143 switch (port & 0x01) {
145 ymf278BusyTime = time + WAVE_REG_SELECT_DELAY;
149 if ((0x08 <= opl4latch) && (opl4latch <= 0x1F)) {
150 ymf278LoadTime = time + LOAD_DELAY;
152 if ((3 <= opl4latch) && (opl4latch <= 6)) {
157 ymf278BusyTime = time + MEM_WRITE_DELAY;
162 ymf278BusyTime = time + WAVE_REG_WRITE_DELAY;
164 if (opl4latch == 0xf8) {
166 }
else if (opl4latch == 0xf9) {
169 ymf278.
writeReg(opl4latch, value, time);
181 switch (port & 0x03) {
184 ymf278BusyTime = time + FM_REG_SELECT_DELAY;
187 opl3latch = value | 0x100;
188 ymf278BusyTime = time + FM_REG_SELECT_DELAY;
192 ymf278BusyTime = time + FM_REG_WRITE_DELAY;
193 ymf262.
writeReg(opl3latch, value, time);
201bool YMF278B::getNew2()
const
203 return (ymf262.
peekReg(0x105) & 0x02) != 0;
206byte YMF278B::readYMF278Status(EmuTime::param time)
const
209 if (time < ymf278BusyTime) result |= 0x01;
210 if (time < ymf278LoadTime) result |= 0x02;
228 "opl3latch", opl3latch,
229 "opl4latch", opl4latch);
232 "busyTime", ymf278BusyTime);
238 ymf278LoadTime = time;
239 ymf278BusyTime = time;
244template<
typename Archive>
247 ar.serialize(
"ymf262", ymf262,
249 "opl3latch", opl3latch,
250 "opl4latch", opl4latch,
251 "loadTime", ymf278LoadTime,
252 "busyTime", ymf278BusyTime);
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.
uint8_t readReg(unsigned reg) const
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
void serialize(Archive &ar, unsigned version)
void setupMemoryPointers()
void writeIO(word port, byte value, EmuTime::param time)
void powerUp(EmuTime::param time)
YMF278B(const std::string &name, size_t ramSize, const DeviceConfig &config, YMF278::SetupMemPtrFunc setupMemPtrs, EmuTime::param time)
void serialize_bw_compat(XmlInputArchive &ar, unsigned version, EmuTime::param time)
byte readIO(word port, EmuTime::param time)
byte peekIO(word port, EmuTime::param time) const
void reset(EmuTime::param time)
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)
void setupMemoryPointers()
std::function< void(bool, std::span< const uint8_t >, std::span< const uint8_t >, std::span< YMF278::Block128, 32 >)> SetupMemPtrFunc
uint8_t peekReg(uint8_t reg) const
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)