9 auto variant = config.getChildData(
"variant",
"YM2151");
12 throw MSXException(
"Invalid variant '", variant,
"', expected 'YM2151' or 'YM2164'.");
17 , rom(getName() +
" ROM",
"rom", config)
18 , ym2151(getName(),
"Yamaha SFG-01/05", config, getCurrentTime(), parseVariant(config))
19 , ym2148(getName(), getMotherBoard())
35 word maskedAddress = address & 0x3FFF;
36 switch (maskedAddress) {
38 writeRegisterPort(value, time);
41 writeDataPort(value, time);
48 irqVector2148 = value;
73 return ym2148.
pendingIRQ() ? irqVector2148 : irqVector;
76void MSXYamahaSFG::writeRegisterPort(
byte value, EmuTime::param )
78 registerLatch = value;
81void MSXYamahaSFG::writeDataPort(
byte value, EmuTime::param time)
83 ym2151.
writeReg(registerLatch, value, time);
88 word maskedAddress = address & 0x3FFF;
89 if (maskedAddress < 0x3FF0 || maskedAddress >= 0x3FF8) {
92 switch (maskedAddress) {
107 word maskedAddress = address & 0x3FFF;
108 if (maskedAddress < 0x3FF0 || maskedAddress >= 0x3FF8) {
110 return rom[address & (rom.
size() - 1)];
112 switch (maskedAddress) {
133 return &rom[start & (rom.
size() - 1)];
138template<
typename Archive>
141 ar.serialize(
"YM2151", ym2151,
143 "registerLatch", registerLatch,
144 "irqVector", irqVector);
145 if (ar.versionAtLeast(version, 2)) {
146 ar.serialize(
"irqVector2148", irqVector2148);
#define REGISTER_MSXDEVICE(CLASS, NAME)
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
static std::array< byte, 0x10000 > unmappedWrite
EmuTime::param getCurrentTime() const
void reset(EmuTime::param time) override
This method is called on reset.
MSXYamahaSFG(const DeviceConfig &config)
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
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.
byte * getWriteCacheLine(word start) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
byte readIRQVector() override
Gets IRQ vector used in IM2.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
void serialize(Archive &ar, unsigned version)
byte readData(EmuTime::param time)
void writeCommand(byte value)
byte peekData(EmuTime::param time) const
byte readStatus(EmuTime::param time) const
byte peekStatus(EmuTime::param time) const
void writeData(byte value, EmuTime::param time)
uint8_t readStatus() const
void reset(EmuTime::param time)
void writeReg(uint8_t r, uint8_t v, EmuTime::param time)
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)