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
7namespace openmsx {
8
10 : RomKonami(config, std::move(rom_))
11 , dac("Majutsushi-DAC", "Hai no Majutsushi's DAC", config)
12{
13}
14
15void RomMajutsushi::reset(EmuTime::param time)
16{
17 RomKonami::reset(time);
18 dac.reset(time);
19}
20
21void 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
36template<typename Archive>
37void RomMajutsushi::serialize(Archive& ar, unsigned /*version*/)
38{
39 ar.template serializeBase<RomKonami>(*this);
40 ar.serialize("DAC", dac);
41}
44
45} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:354
void reset(EmuTime::param time)
void writeDAC(uint8_t value, EmuTime::param time)
Definition DACSound8U.cc:17
void reset(EmuTime::param time) override
This method is called on reset.
Definition RomKonami.cc:54
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:61
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition RomKonami.cc:69
RomMajutsushi(const DeviceConfig &config, Rom &&rom)
void reset(EmuTime::param time) override
This method is called on reset.
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)
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.
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29
STL namespace.
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)