27 [[nodiscard]]
nibble read(EmuTime::param time)
override;
29 template<
typename Archive>
44 const std::string& soundDeviceName);
51 void reset()
override;
54 [[nodiscard]]
nibble read(EmuTime::param time)
override;
56 [[nodiscard]]
byte peekMem(
word address, EmuTime::param time)
const override;
57 void writeMem(
word address,
byte value, EmuTime::param time)
override;
61 template<
typename Archive>
62 void serialize(Archive& ar,
unsigned version);
65 void setBank(
byte value);
66 void setIOPorts(
byte value);
67 void setIOPortsHelper(
byte base,
bool enable);
84 [[nodiscard]]
nibble read(EmuTime::param time)
override;
85 void setSPOFF(
bool value, EmuTime::param time)
override;
87 template<
typename Archive>
143 nibble actual = (outputs & values) | (~outputs &
read(time));
144 audio.y8950.
setEnabled((actual & 8) != 0, time);
145 audio.enableDAC((actual & 1) != 0, time);
162 const std::string& soundDeviceName)
164 , swSwitch(audio.getCommandController(),
tmpStrCat(soundDeviceName,
"_firmware"),
165 "This setting controls the switch on the Panasonic "
166 "MSX-AUDIO module. The switch controls whether the internal "
167 "software of this module must be started or not.",
170 , ram(config, audio.getName() +
" mapped RAM",
171 "MSX-AUDIO mapped RAM", 0x1000)
172 , rom(audio.getName() +
" ROM",
"MSX-AUDIO ROM", config)
192 nibble actual = (outputs & values) | (~outputs &
read(time));
204 if ((bankSelect == 0) && ((address & 0x3FFF) >= 0x3000)) {
205 return ram[(address & 0x3FFF) - 0x3000];
207 return rom[0x8000 * bankSelect + (address & 0x7FFF)];
213 if ((bankSelect == 0) && ((address & 0x3FFF) >= 0x3000)) {
214 return &ram[(address & 0x3FFF) - 0x3000];
216 return &rom[0x8000 * bankSelect + (address & 0x7FFF)];
223 if (address == 0x7FFE) {
225 }
else if (address == 0x7FFF) {
229 if ((bankSelect == 0) && (address >= 0x3000)) {
230 ram[address - 0x3000] = value;
241 if ((bankSelect == 0) && (address >= 0x3000)) {
242 return &ram[address - 0x3000];
248void PanasonicAudioPeriphery::setBank(
byte value)
250 bankSelect = value & 3;
254void PanasonicAudioPeriphery::setIOPorts(
byte value)
256 byte diff = ioPorts ^ value;
258 setIOPortsHelper(0xC0, (value & 1) != 0);
261 setIOPortsHelper(0xC2, (value & 2) != 0);
265void PanasonicAudioPeriphery::setIOPortsHelper(
byte base,
bool enable)
271 cpu.unregister_IO_InOut_range(base, 2, &audio);
275template<
typename Archive>
278 ar.serialize(
"ram", ram,
279 "bankSelect", bankSelect);
280 byte tmpIoPorts = ioPorts;
281 ar.serialize(
"ioPorts", tmpIoPorts);
282 if constexpr (Archive::IS_LOADER) {
283 setIOPorts(tmpIoPorts);
320 const std::string& soundDeviceName)
324 if (cmp(type,
"philips")) {
325 return std::make_unique<MusicModulePeriphery>(audio);
326 }
else if (cmp(type,
"panasonic")) {
327 return std::make_unique<PanasonicAudioPeriphery>(
328 audio, config, soundDeviceName);
329 }
else if (cmp(type,
"toshiba")) {
330 return std::make_unique<ToshibaAudioPeriphery>(audio);
bool getBoolean() const noexcept
std::string_view getChildData(std::string_view name) const
void register_IO_InOut_range(byte port, unsigned num, MSXDevice *device)
void invalidateAllSlotsRWCache(word start, unsigned size)
Invalidate the CPU its cache for the interval [start, start + size) For example MSXMemoryMapper and M...
static std::array< byte, 0x10000 > unmappedRead
static std::array< byte, 0x10000 > unmappedWrite
MSXCPUInterface & getCPUInterface() const
void serialize(Archive &, unsigned)
void write(nibble outputs, nibble values, EmuTime::param time) override
Write to (some of) the pins.
nibble read(EmuTime::param time) override
Read from (some of) the pins Some of the pins might be programmed as output, but this method doesn't ...
MusicModulePeriphery(MSXAudio &audio)
PanasonicAudioPeriphery & operator=(const PanasonicAudioPeriphery &)=delete
PanasonicAudioPeriphery(MSXAudio &audio, const DeviceConfig &config, const std::string &soundDeviceName)
nibble read(EmuTime::param time) override
Read from (some of) the pins Some of the pins might be programmed as output, but this method doesn't ...
byte peekMem(word address, EmuTime::param time) const override
void write(nibble outputs, nibble values, EmuTime::param time) override
Write to (some of) the pins.
~PanasonicAudioPeriphery() override
void writeMem(word address, byte value, EmuTime::param time) override
const byte * getReadCacheLine(word address) const override
void serialize(Archive &ar, unsigned version)
byte * getWriteCacheLine(word address) override
PanasonicAudioPeriphery & operator=(PanasonicAudioPeriphery &&)=delete
PanasonicAudioPeriphery(PanasonicAudioPeriphery &&)=delete
PanasonicAudioPeriphery(const PanasonicAudioPeriphery &)=delete
nibble read(EmuTime::param time) override
Read from (some of) the pins Some of the pins might be programmed as output, but this method doesn't ...
void write(nibble outputs, nibble values, EmuTime::param time) override
Write to (some of) the pins.
void serialize(Archive &, unsigned)
void setSPOFF(bool value, EmuTime::param time) override
SP-OFF bit (bit 3 in Y8950 register 7)
ToshibaAudioPeriphery(MSXAudio &audio)
static std::unique_ptr< Y8950Periphery > create(MSXAudio &audio, const DeviceConfig &config, const std::string &soundDeviceName)
Models the 4 general purpose I/O pins on the Y8950 (controlled by registers r#18 and r#19)
virtual byte peekMem(word address, EmuTime::param time) const
virtual const byte * getReadCacheLine(word start) const
virtual void writeMem(word address, byte value, EmuTime::param time)
virtual byte * getWriteCacheLine(word start)
virtual byte readMem(word address, EmuTime::param time)
virtual void setSPOFF(bool value, EmuTime::param time)
SP-OFF bit (bit 3 in Y8950 register 7)
void setEnabled(bool enabled, EmuTime::param time)
This file implemented 3 utility functions:
uint8_t nibble
4 bit integer
uint16_t word
16 bit unsigned integer
TemporaryString tmpStrCat(Ts &&... ts)