openMSX
RomGeneric8kB.cc
Go to the documentation of this file.
1#include "RomGeneric8kB.hh"
2#include "serialize.hh"
3#include "xrange.hh"
4
5namespace openmsx {
6
8 : Rom8kBBlocks(config, std::move(rom_))
9{
10 reset(EmuTime::dummy());
11}
12
13void RomGeneric8kB::reset(EmuTime::param /*time*/)
14{
15 setUnmapped(0);
16 setUnmapped(1);
17 for (auto i : xrange(2, 6)) {
18 setRom(i, i - 2);
19 }
20 setUnmapped(6);
21 setUnmapped(7);
22}
23
24void RomGeneric8kB::writeMem(word address, byte value, EmuTime::param /*time*/)
25{
26 setRom(address >> 13, value);
27}
28
30{
31 if ((0x4000 <= address) && (address < 0xC000)) {
32 return nullptr;
33 } else {
34 return unmappedWrite;
35 }
36}
37
39
40} // namespace openmsx
static byte unmappedWrite[0x10000]
Definition: MSXDevice.hh:302
void setRom(byte region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition: RomBlocks.cc:105
void setUnmapped(byte region)
Select 'unmapped' memory for this region.
Definition: RomBlocks.cc:92
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
RomGeneric8kB(const DeviceConfig &config, Rom &&rom)
Definition: RomGeneric8kB.cc:7
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.
void reset(EmuTime::param time) override
This method is called on reset.
This file implemented 3 utility functions:
Definition: Autofire.cc:9
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
STL namespace.
constexpr auto xrange(T e)
Definition: xrange.hh:133