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 "DACSound8U.hh"
21 #include "CacheLine.hh"
22 #include "Rom.hh"
23 #include "serialize.hh"
24 #include "memory.hh"
25 
26 namespace openmsx {
27 
28 RomSynthesizer::RomSynthesizer(const DeviceConfig& config, std::unique_ptr<Rom> rom)
29  : Rom16kBBlocks(config, std::move(rom))
30  , dac(make_unique<DACSound8U>(
31  "Synthesizer-DAC", "Konami Synthesizer's DAC", config))
32 {
33  setUnmapped(0);
34  setRom(1, 0);
35  setRom(2, 1);
36  setUnmapped(3);
37 
39 }
40 
42 {
43 }
44 
46 {
47  dac->reset(time);
48 }
49 
51 {
52  if ((address & 0xC010) == 0x4000) {
53  dac->writeDAC(value, time);
54  }
55 }
56 
58 {
59  if ((address & 0xC010 & CacheLine::HIGH) == 0x4000) {
60  return nullptr;
61  } else {
62  return unmappedWrite;
63  }
64 }
65 
66 template<typename Archive>
67 void RomSynthesizer::serialize(Archive& ar, unsigned /*version*/)
68 {
69  ar.template serializeBase<Rom16kBBlocks>(*this);
70  ar.serialize("DAC", *dac);
71 }
73 REGISTER_MSXDEVICE(RomSynthesizer, "RomSynthesizer");
74 
75 } // namespace openmsx