openMSX
RomSynthesizer.cc
Go to the documentation of this file.
1 /* On Sat, 3 Apr 2004, Manuel Pazos wrote:
2  *
3  * As you know, the cartridge has an 8bit D/A, accessed through
4  * memory-mapped at address #4000 by the program. openMSX also uses that
5  * address to access it. But examining the cartridge board I found that the
6  * address is decoded by a LS138 in this way:
7  *
8  * /WR = L
9  * A15 = L
10  * A4 = L
11  * /MERQ = L
12  * /SLT = L
13  * A14 = H
14  *
15  * So any value equal to %01xxxxxxxxx0xxxx should work (i.e.: #4000, #4020,
16  * #7C00, etc.)
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_)
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::param time)
38 {
39  dac.reset(time);
40 }
41 
42 void RomSynthesizer::writeMem(word address, byte value, EmuTime::param time)
43 {
44  if ((address & 0xC010) == 0x4000) {
45  dac.writeDAC(value, time);
46  }
47 }
48 
49 byte* RomSynthesizer::getWriteCacheLine(word address) const
50 {
51  if ((address & 0xC010 & CacheLine::HIGH) == 0x4000) {
52  return nullptr;
53  } else {
54  return unmappedWrite;
55  }
56 }
57 
58 template<typename Archive>
59 void RomSynthesizer::serialize(Archive& ar, unsigned /*version*/)
60 {
61  ar.template serializeBase<Rom16kBBlocks>(*this);
62  ar.serialize("DAC", dac);
63 }
65 REGISTER_MSXDEVICE(RomSynthesizer, "RomSynthesizer");
66 
67 } // namespace openmsx
bool getEnum() const noexcept
Definition: EnumSetting.hh:96
void reset(EmuTime::param time) override
This method is called on reset.
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
RomSynthesizer(const DeviceConfig &config, Rom &&rom)
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition: MSXDevice.hh:307
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing...
void serialize(Archive &ar, unsigned version)
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981