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)
270 cpu.register_IO_In (base + 1, &audio);
271 cpu.register_IO_Out(base + 0, &audio);
272 cpu.register_IO_Out(base + 1, &audio);
274 cpu.unregister_IO_In (base + 0, &audio);
275 cpu.unregister_IO_In (base + 1, &audio);
276 cpu.unregister_IO_Out(base + 0, &audio);
277 cpu.unregister_IO_Out(base + 1, &audio);
281template<
typename Archive>
284 ar.serialize(
"ram", ram,
285 "bankSelect", bankSelect);
286 byte tmpIoPorts = ioPorts;
287 ar.serialize(
"ioPorts", tmpIoPorts);
288 if constexpr (Archive::IS_LOADER) {
289 setIOPorts(tmpIoPorts);
326 const std::string& soundDeviceName)
330 if (cmp(type,
"philips")) {
331 return std::make_unique<MusicModulePeriphery>(audio);
332 }
else if (cmp(type,
"panasonic")) {
333 return std::make_unique<PanasonicAudioPeriphery>(
334 audio, config, soundDeviceName);
335 }
else if (cmp(type,
"toshiba")) {
336 return std::make_unique<ToshibaAudioPeriphery>(audio);
bool getBoolean() const noexcept
std::string_view getChildData(std::string_view name) const
void register_IO_In(byte port, MSXDevice *device)
Devices can register their In ports.
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)