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#include "xrange.hh"
8
9namespace openmsx {
10
12 : Rom16kBBlocks(config, std::move(rom_))
13 , counter(7)
14{
15 reset(EmuTime::dummy());
16}
17
18void RomMultiRom::reset(EmuTime::param /*time*/)
19{
20 ++counter &= 7;
21 for (auto i : xrange(4)) {
22 setRom(i, counter * 4 + i);
23 }
24}
25
26template<typename Archive>
27void RomMultiRom::serialize(Archive& ar, unsigned /*version*/)
28{
29 ar.template serializeBase<Rom16kBBlocks>(*this);
30 ar.serialize("counter", counter);
31}
34
35} // namespace openmsx
void setRom(byte region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition: RomBlocks.cc:105
RomMultiRom(const DeviceConfig &config, Rom &&rom)
Definition: RomMultiRom.cc:11
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomMultiRom.cc:18
void serialize(Archive &ar, unsigned version)
Definition: RomMultiRom.cc:27
This file implemented 3 utility functions:
Definition: Autofire.cc:9
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
STL namespace.
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:1009
constexpr auto xrange(T e)
Definition: xrange.hh:133