openMSX
MSXMemoryMapper.cc
Go to the documentation of this file.
1#include "MSXMemoryMapper.hh"
2#include "serialize.hh"
3
4namespace openmsx {
5
10
11void MSXMemoryMapper::writeIO(word port, byte value, EmuTime::param time)
12{
13 MSXMemoryMapperBase::writeIOImpl(port, value, time);
14 byte page = port & 3;
15 if (byte* data = checkedRam.getRWCacheLines(segmentOffset(page), 0x4000)) {
16 fillDeviceRWCache(page * 0x4000, 0x4000, data);
17 } else {
18 invalidateDeviceRWCache(page * 0x4000, 0x4000);
19 }
20}
21
22template<typename Archive>
23void MSXMemoryMapper::serialize(Archive& ar, unsigned version)
24{
25 // use serializeInlinedBase instead of serializeBase for bw-compat savestates
26 ar.template serializeInlinedBase<MSXMemoryMapperBase>(*this, version);
27}
28
31
32} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:354
byte * getRWCacheLines(size_t addr, size_t size) const
Definition CheckedRam.cc:51
void fillDeviceRWCache(unsigned start, unsigned size, byte *rwData)
Calls MSXCPUInterface::fillXXCache() for the specific (part of) the slot that this device is located ...
Definition MSXDevice.cc:506
void invalidateDeviceRWCache()
Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is lo...
Definition MSXDevice.hh:212
void writeIOImpl(word port, byte value, EmuTime::param time)
unsigned segmentOffset(byte page) const
MSXMemoryMapper(const DeviceConfig &config)
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.
void serialize(Archive &ar, unsigned version)
This file implemented 3 utility functions:
Definition Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)