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 
35 {
36  return flash.getReadCacheLine(address);
37 }
38 
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
byte read(unsigned address)
Definition: AmdFlash.cc:252
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
const byte * getReadCacheLine(unsigned address) const
Definition: AmdFlash.cc:258
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: RomMatraInk.cc:19
STL namespace.
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
byte peek(unsigned address) const
Definition: AmdFlash.cc:215
void serialize(Archive &ar, unsigned version)
Definition: RomMatraInk.cc:45
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
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
void write(unsigned address, byte value)
Definition: AmdFlash.cc:270
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
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981
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
RomMatraInk(const DeviceConfig &config, Rom &&rom)
Definition: RomMatraInk.cc:6
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomMatraInk.cc:14