16 : msxcpu(motherBoard.getCPU())
17 , rom([&]() ->
std::optional<
Rom> {
19 getConfig().findChild(
"PanasonicRom");
20 if (!elem)
return std::nullopt;
24 return std::optional<Rom>(std::in_place,
25 "PanasonicRom",
"Turbor-R main ROM",
34 ramSize = narrow<unsigned>(ram_.
size());
43 (((0x28 <= block) && (block < 0x2C)) ||
44 ((0x38 <= block) && (block < 0x3C)))) {
46 unsigned offset = (block & 0x03) * 0x2000;
47 unsigned ramOffset = (block < 0x30) ? ramSize - 0x10000 :
49 return std::span<const byte, 0x2000>{ram + ramOffset + offset, 0x2000};
51 unsigned offset = block * 0x2000;
52 if (offset >= rom->size()) {
53 offset &= narrow<unsigned>(rom->size() - 1);
55 return subspan<0x2000>(*rom, offset);
65 throw MSXException(
"Error in config file: firstblock must "
66 "be smaller than lastblock");
68 unsigned start = first * 0x2000;
69 if (start >= rom->size()) {
70 throw MSXException(
"Error in config file: firstblock lies "
71 "outside of rom image.");
73 unsigned stop = (last + 1) * 0x2000;
74 if (stop > rom->size()) {
75 throw MSXException(
"Error in config file: lastblock lies "
76 "outside of rom image.");
78 return subspan(*rom, start, stop - start);
83 if (!ram)
return nullptr;
85 unsigned offset = block * 0x2000;
86 if (offset >= ramSize) {
87 offset &= ramSize - 1;
102 return !dram || (address < (ramSize - 0x10000));
void invalidateAllSlotsRWCache(word start, unsigned size)
Invalidate the CPU its cache for the interval [start, start + size) For example MSXMemoryMapper and M...
const HardwareConfig * getMachineConfig() const
void registerRam(Ram &ram)
Pass reference of the actual Ram block for use in DRAM mode and RAM access via the ROM mapper.
bool isWritable(unsigned address) const
PanasonicMemory(MSXMotherBoard &motherBoard)
byte * getRamBlock(unsigned block)
Note that this is always unchecked RAM! There is no UMR detection when accessing Ram in DRAM mode or ...
std::span< const byte, 0x2000 > getRomBlock(unsigned block) const
std::span< const byte > getRomRange(unsigned first, unsigned last) const
This file implemented 3 utility functions:
constexpr auto subspan(Range &&range, size_t offset, size_t count=std::dynamic_extent)