openMSX
RomMatraInk.cc
Go to the documentation of this file.
1 #include "RomMatraInk.hh"
2 #include "serialize.hh"
3 
4 namespace openmsx {
5 
7  : MSXRom(config, std::move(rom_))
8  , flash(rom, std::vector<AmdFlash::SectorInfo>(2, {0x10000, false}),
9  0x01A4, false, config, false) // don't load/save
10 {
11  reset(EmuTime::dummy());
12 }
13 
14 void RomMatraInk::reset(EmuTime::param /*time*/)
15 {
16  flash.reset();
17 }
18 
19 byte RomMatraInk::peekMem(word address, EmuTime::param /*time*/) const
20 {
21  return flash.peek(address);
22 }
23 
24 byte RomMatraInk::readMem(word address, EmuTime::param /*time*/)
25 {
26  return flash.read(address);
27 }
28 
29 void RomMatraInk::writeMem(word address, byte value, EmuTime::param /*time*/)
30 {
31  flash.write(address + 0x10000, value);
32 }
33 
34 const byte* RomMatraInk::getReadCacheLine(word address) const
35 {
36  return flash.getReadCacheLine(address);
37 }
38 
39 byte* RomMatraInk::getWriteCacheLine(word /*address*/) const
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 }
53 REGISTER_MSXDEVICE(RomMatraInk, "RomMatraInk");
54 
55 } // namespace openmsx
openmsx::RomMatraInk::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: RomMatraInk.cc:29
serialize.hh
openmsx::RomMatraInk::RomMatraInk
RomMatraInk(const DeviceConfig &config, Rom &&rom)
Definition: RomMatraInk.cc:6
openmsx::RomMatraInk::peekMem
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: RomMatraInk.cc:19
openmsx::RomMatraInk::readMem
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: RomMatraInk.cc:24
openmsx::AmdFlash
Definition: AmdFlash.hh:17
openmsx::DeviceConfig
Definition: DeviceConfig.hh:19
openmsx::YM2413NukeYKT::rom
constexpr Rom rom
Definition: YM2413NukeYKT.cc:71
openmsx::RomMatraInk::serialize
void serialize(Archive &ar, unsigned version)
Definition: RomMatraInk.cc:45
openmsx::AmdFlash::getReadCacheLine
const byte * getReadCacheLine(unsigned address) const
Definition: AmdFlash.cc:259
openmsx::REGISTER_MSXDEVICE
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
openmsx::MSXRom
Definition: MSXRom.hh:9
openmsx::AmdFlash::write
void write(unsigned address, byte value)
Definition: AmdFlash.cc:271
openmsx::AmdFlash::peek
byte peek(unsigned address) const
Definition: AmdFlash.cc:216
INSTANTIATE_SERIALIZE_METHODS
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981
RomMatraInk.hh
openmsx::RomMatraInk::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomMatraInk.cc:39
openmsx::Rom
Definition: Rom.hh:20
openmsx::AmdFlash::reset
void reset()
Definition: AmdFlash.cc:203
openmsx::RomMatraInk::getReadCacheLine
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: RomMatraInk.cc:34
openmsx::RomMatraInk
Definition: RomMatraInk.hh:9
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::AmdFlash::read
byte read(unsigned address)
Definition: AmdFlash.cc:253
openmsx::RomMatraInk::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomMatraInk.cc:14
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5