27 [[nodiscard]]
nibble read(EmuTime::param time)
override;
29 template<
typename Archive>
44 const std::string& soundDeviceName);
49 void reset()
override;
52 [[nodiscard]]
nibble read(EmuTime::param time)
override;
54 [[nodiscard]]
byte peekMem(
word address, EmuTime::param time)
const override;
55 void writeMem(
word address,
byte value, EmuTime::param time)
override;
59 template<
typename Archive>
60 void serialize(Archive& ar,
unsigned version);
63 void setBank(
byte value);
64 void setIOPorts(
byte value);
65 void setIOPortsHelper(
byte base,
bool enable);
82 [[nodiscard]]
nibble read(EmuTime::param time)
override;
83 void setSPOFF(
bool value, EmuTime::param time)
override;
85 template<
typename Archive>
142 audio.y8950.
setEnabled((actual & 8) != 0, time);
143 audio.enableDAC((actual & 1) != 0, time);
160 const std::string& soundDeviceName)
162 , swSwitch(audio.getCommandController(),
tmpStrCat(soundDeviceName,
"_firmware"),
163 "This setting controls the switch on the Panasonic "
164 "MSX-AUDIO module. The switch controls whether the internal "
165 "software of this module must be started or not.",
168 , ram(config, audio.getName() +
" mapped RAM",
169 "MSX-AUDIO mapped RAM", 0x1000)
170 , rom(audio.getName() +
" ROM",
"MSX-AUDIO ROM", config)
202 if ((bankSelect == 0) && ((address & 0x3FFF) >= 0x3000)) {
203 return ram[(address & 0x3FFF) - 0x3000];
205 return rom[0x8000 * bankSelect + (address & 0x7FFF)];
211 if ((bankSelect == 0) && ((address & 0x3FFF) >= 0x3000)) {
212 return &ram[(address & 0x3FFF) - 0x3000];
214 return &rom[0x8000 * bankSelect + (address & 0x7FFF)];
221 if (address == 0x7FFE) {
223 }
else if (address == 0x7FFF) {
227 if ((bankSelect == 0) && (address >= 0x3000)) {
228 ram[address - 0x3000] = value;
239 if ((bankSelect == 0) && (address >= 0x3000)) {
240 return const_cast<byte*
>(&ram[address - 0x3000]);
246void PanasonicAudioPeriphery::setBank(
byte value)
248 bankSelect = value & 3;
252void PanasonicAudioPeriphery::setIOPorts(
byte value)
254 byte diff = ioPorts ^ value;
256 setIOPortsHelper(0xC0, (value & 1) != 0);
259 setIOPortsHelper(0xC2, (value & 2) != 0);
263void PanasonicAudioPeriphery::setIOPortsHelper(
byte base,
bool enable)
268 cpu.register_IO_In (base + 1, &audio);
269 cpu.register_IO_Out(base + 0, &audio);
270 cpu.register_IO_Out(base + 1, &audio);
272 cpu.unregister_IO_In (base + 0, &audio);
273 cpu.unregister_IO_In (base + 1, &audio);
274 cpu.unregister_IO_Out(base + 0, &audio);
275 cpu.unregister_IO_Out(base + 1, &audio);
279template<
typename Archive>
282 ar.serialize(
"ram", ram,
283 "bankSelect", bankSelect);
284 byte tmpIoPorts = ioPorts;
285 ar.serialize(
"ioPorts", tmpIoPorts);
286 if constexpr (Archive::IS_LOADER) {
287 setIOPorts(tmpIoPorts);
324 const std::string& soundDeviceName)
328 if (cmp(type,
"philips")) {
329 return std::make_unique<MusicModulePeriphery>(audio);
330 }
else if (cmp(type,
"panasonic")) {
331 return std::make_unique<PanasonicAudioPeriphery>(
332 audio, config, soundDeviceName);
333 }
else if (cmp(type,
"toshiba")) {
334 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
byte * getWriteCacheLine(word address) const override
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)
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 byte * getWriteCacheLine(word start) const
virtual const byte * getReadCacheLine(word start) const
virtual void writeMem(word address, byte value, EmuTime::param time)
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:
REGISTER_POLYMORPHIC_INITIALIZER(Pluggable, CassettePlayer, "CassettePlayer")
uint8_t nibble
4 bit integer
uint16_t word
16 bit unsigned integer
constexpr auto values(Map &&map)
TemporaryString tmpStrCat(Ts &&... ts)