32 template<
typename Archive>
47 const string& soundDeviceName);
60 template<
typename Archive>
61 void serialize(Archive& ar,
unsigned version);
64 void setBank(
byte value);
65 void setIOPorts(
byte value);
66 void setIOPortsHelper(
unsigned base,
bool enable);
70 const std::unique_ptr<Ram> ram;
71 const std::unique_ptr<Rom> rom;
85 template<
typename Archive>
145 nibble actual = (outputs & values) | (~outputs &
read(time));
146 audio.y8950->setEnabled((actual & 8) != 0, time);
147 audio.enableDAC((actual & 1) != 0, time);
164 const string& soundDeviceName)
166 , swSwitch(audio.getCommandController(), soundDeviceName +
"_firmware",
167 "This setting controls the switch on the Panasonic "
168 "MSX-AUDIO module. The switch controls whether the internal "
169 "software of this module must be started or not.",
173 config, audio.
getName() +
" mapped RAM",
174 "MSX-AUDIO mapped RAM", 0x1000))
176 audio.
getName() +
" ROM",
"MSX-AUDIO ROM", config))
197 nibble actual = (outputs & values) | (~outputs &
read(time));
198 audio.y8950->setEnabled(!(actual & 8), time);
204 return swSwitch.
getValue() ? 0x4 : 0x0;
209 if ((bankSelect == 0) && ((address & 0x3FFF) >= 0x3000)) {
210 return (*ram)[(address & 0x3FFF) - 0x3000];
212 return (*rom)[0x8000 * bankSelect + (address & 0x7FFF)];
218 if ((bankSelect == 0) && ((address & 0x3FFF) >= 0x3000)) {
219 return &(*ram)[(address & 0x3FFF) - 0x3000];
221 return &(*rom)[0x8000 * bankSelect + (address & 0x7FFF)];
228 if (address == 0x7FFE) {
230 }
else if (address == 0x7FFF) {
234 if ((bankSelect == 0) && (address >= 0x3000)) {
235 (*ram)[address - 0x3000] = value;
242 if (address == (0x7FFE & CacheLine::HIGH)) {
246 if ((bankSelect == 0) && (address >= 0x3000)) {
247 return const_cast<byte*
>(&(*ram)[address - 0x3000]);
253 void PanasonicAudioPeriphery::setBank(
byte value)
255 bankSelect = value & 3;
259 void PanasonicAudioPeriphery::setIOPorts(
byte value)
261 byte diff = ioPorts ^ value;
263 setIOPortsHelper(0xC0, (value & 1) != 0);
266 setIOPortsHelper(0xC2, (value & 2) != 0);
270 void PanasonicAudioPeriphery::setIOPortsHelper(
unsigned base,
bool enable)
275 cpu.register_IO_In (base + 1, &audio);
276 cpu.register_IO_Out(base + 0, &audio);
277 cpu.register_IO_Out(base + 1, &audio);
279 cpu.unregister_IO_In (base + 0, &audio);
280 cpu.unregister_IO_In (base + 1, &audio);
281 cpu.unregister_IO_Out(base + 0, &audio);
282 cpu.unregister_IO_Out(base + 1, &audio);
286 template<
typename Archive>
289 ar.serialize(
"ram", *ram);
290 ar.serialize(
"bankSelect", bankSelect);
291 byte tmpIoPorts = ioPorts;
292 ar.serialize(
"ioPorts", tmpIoPorts);
294 setIOPorts(tmpIoPorts);
323 audio.y8950->setEnabled(!value, time);
331 const std::string& soundDeviceName)
334 if (type ==
"philips") {
335 return make_unique<MusicModulePeriphery>(audio);
336 }
else if (type ==
"panasonic") {
337 return make_unique<PanasonicAudioPeriphery>(
338 audio, config, soundDeviceName);
339 }
else if (type ==
"toshiba") {
340 return make_unique<ToshibaAudioPeriphery>(audio);