OXYGENHUB
◆ main openmsx / src / memory / RomMatraInk.cc
1.1 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#include "RomMatraInk.hh"
2
3
#include "serialize.hh"
4
5
namespace openmsx {
6
7
RomMatraInk::RomMatraInk(DeviceConfig& config, Rom&& rom_)
8
        : MSXRom(config, std::move(rom_))
9
        , flash(rom, AmdFlashChip::AM29F040B, {}, config)
10
{
11
	reset(EmuTime::dummy());
12
}
13
14
void RomMatraInk::reset(EmuTime /*time*/)
15
{
16
	flash.reset();
17
}
18
19
byte RomMatraInk::peekMem(uint16_t address, EmuTime time) const
20
{
21
	return flash.peek(address, time);
22
}
23
24
byte RomMatraInk::readMem(uint16_t address, EmuTime time)
25
{
26
	return flash.read(address, time);
27
}
28
29
void RomMatraInk::writeMem(uint16_t address, byte value, EmuTime time)
30
{
31
	flash.write(address + 0x10000, value, time);
32
}
33
34
const byte* RomMatraInk::getReadCacheLine(uint16_t address) const
35
{
36
	return flash.getReadCacheLine(address);
37
}
38
39
byte* RomMatraInk::getWriteCacheLine(uint16_t /*address*/)
40
{
41
	return nullptr;
42
}
43
44
template<typename Archive>
45
void RomMatraInk::serialize(Archive& ar, unsigned /*version*/)
46
{
47
	// skip MSXRom base class
48
	ar.template serializeBase<MSXDevice>(*this);
49
50
	ar.serialize("flash", flash);
51
}
52
INSTANTIATE_SERIALIZE_METHODS(RomMatraInk);
53
REGISTER_MSXDEVICE(RomMatraInk, "RomMatraInk");
54
55
} // namespace openmsx