openMSX
RomMajutsushi.cc
Go to the documentation of this file.
1 // Mapper for "Hai no Majutsushi" from Konami.
2 // It's a Konami mapper with a DAC.
3 
4 #include "RomMajutsushi.hh"
5 #include "serialize.hh"
6 
7 namespace openmsx {
8 
10  : RomKonami(config, std::move(rom_))
11  , dac("Majutsushi-DAC", "Hai no Majutsushi's DAC", config)
12 {
13 }
14 
15 void RomMajutsushi::reset(EmuTime::param time)
16 {
17  RomKonami::reset(time);
18  dac.reset(time);
19 }
20 
21 void RomMajutsushi::writeMem(word address, byte value, EmuTime::param time)
22 {
23  if (0x5000 <= address && address < 0x6000) {
24  dac.writeDAC(value, time);
25  } else {
26  RomKonami::writeMem(address, value, time);
27  }
28 }
29 
31 {
32  return (0x5000 <= address && address < 0x6000)
33  ? nullptr : RomKonami::getWriteCacheLine(address);
34 }
35 
36 template<typename Archive>
37 void RomMajutsushi::serialize(Archive& ar, unsigned /*version*/)
38 {
39  ar.template serializeBase<RomKonami>(*this);
40  ar.serialize("DAC", dac);
41 }
43 REGISTER_MSXDEVICE(RomMajutsushi, "RomMajutsushi");
44 
45 } // namespace openmsx
RomMajutsushi.hh
openmsx::RomMajutsushi::serialize
void serialize(Archive &ar, unsigned version)
Definition: RomMajutsushi.cc:37
serialize.hh
openmsx::DeviceConfig
Definition: DeviceConfig.hh:19
openmsx::RomMajutsushi::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomMajutsushi.cc:15
openmsx::RomMajutsushi
Definition: RomMajutsushi.hh:9
openmsx::RomMajutsushi::RomMajutsushi
RomMajutsushi(const DeviceConfig &config, Rom &&rom)
Definition: RomMajutsushi.cc:9
openmsx::REGISTER_MSXDEVICE
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
openmsx::RomMajutsushi::writeMem
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.
Definition: RomMajutsushi.cc:21
openmsx::RomKonami::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomKonami.cc:37
INSTANTIATE_SERIALIZE_METHODS
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981
openmsx::Rom
Definition: Rom.hh:20
openmsx::RomMajutsushi::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomMajutsushi.cc:30
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::RomKonami::writeMem
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.
Definition: RomKonami.cc:48
openmsx::DACSound8U::writeDAC
void writeDAC(uint8_t value, EmuTime::param time)
Definition: DACSound8U.cc:16
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::RomKonami
Definition: RomKonami.hh:8
openmsx::RomKonami::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomKonami.cc:56
openmsx::DACSound16S::reset
void reset(EmuTime::param time)
Definition: DACSound16S.cc:29