openMSX
RomMultiRom.cc
Go to the documentation of this file.
1 //
2 // Manuel Pazos MultiROM Collection
3 //
4 
5 #include "RomMultiRom.hh"
6 #include "serialize.hh"
7 
8 namespace openmsx {
9 
11  : Rom16kBBlocks(config, std::move(rom_))
12 {
13  counter = 0;
14  for (int i = 0; i < 4; ++i) {
15  setRom(i, counter * 4 + i);
16  }
17 }
18 
19 void RomMultiRom::reset(EmuTime::param /*time*/)
20 {
21  ++counter &= 7;
22  for (int i = 0; i < 4; ++i) {
23  setRom(i, counter * 4 + i);
24  }
25 }
26 
27 template<typename Archive>
28 void RomMultiRom::serialize(Archive& ar, unsigned /*version*/)
29 {
30  ar.template serializeBase<Rom16kBBlocks>(*this);
31  ar.serialize("counter", counter);
32 }
34 REGISTER_MSXDEVICE(RomMultiRom, "RomMultiRom");
35 
36 } // namespace openmsx
void setRom(byte region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition: RomBlocks.cc:98
STL namespace.
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
void serialize(Archive &ar, unsigned version)
Definition: RomMultiRom.cc:28
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomMultiRom.cc:19
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981
RomMultiRom(const DeviceConfig &config, Rom &&rom)
Definition: RomMultiRom.cc:10