| e8555c89 Andy McCall |
1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#include "RomSynthesizer.hh" |
| 20 |
#include "CacheLine.hh" |
| 21 |
#include "serialize.hh" |
| 22 |
|
| 23 |
namespace openmsx { |
| 24 |
|
| 25 |
RomSynthesizer::RomSynthesizer(const DeviceConfig& config, Rom&& rom_) |
| 26 |
: Rom16kBBlocks(config, std::move(rom_)) |
| 27 |
, dac("Synthesizer-DAC", "Konami Synthesizer's DAC", config) |
| 28 |
{ |
| 29 |
setUnmapped(0); |
| 30 |
setRom(1, 0); |
| 31 |
setRom(2, 1); |
| 32 |
setUnmapped(3); |
| 33 |
|
| 34 |
reset(getCurrentTime()); |
| 35 |
} |
| 36 |
|
| 37 |
void RomSynthesizer::reset(EmuTime time) |
| 38 |
{ |
| 39 |
dac.reset(time); |
| 40 |
} |
| 41 |
|
| 42 |
void RomSynthesizer::writeMem(uint16_t address, byte value, EmuTime time) |
| 43 |
{ |
| 44 |
if ((address & 0xC010) == 0x4000) { |
| 45 |
dac.writeDAC(value, time); |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
byte* RomSynthesizer::getWriteCacheLine(uint16_t address) |
| 50 |
{ |
| 51 |
if ((address & 0xC010 & CacheLine::HIGH) == 0x4000) { |
| 52 |
return nullptr; |
| 53 |
} else { |
| 54 |
return unmappedWrite.data(); |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
template<typename Archive> |
| 59 |
void RomSynthesizer::serialize(Archive& ar, unsigned ) |
| 60 |
{ |
| 61 |
ar.template serializeBase<Rom16kBBlocks>(*this); |
| 62 |
ar.serialize("DAC", dac); |
| 63 |
} |
| 64 |
INSTANTIATE_SERIALIZE_METHODS(RomSynthesizer); |
| 65 |
REGISTER_MSXDEVICE(RomSynthesizer, "RomSynthesizer"); |
| 66 |
|
| 67 |
} |