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.data();
35 }
36}
37
39
40} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:356
static std::array< byte, 0x10000 > unmappedWrite
Definition MSXDevice.hh:307
void setUnmapped(unsigned region)
Select 'unmapped' memory for this region.
Definition RomBlocks.cc:92
void setRom(unsigned region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition RomBlocks.cc:104
RomGeneric8kB(const DeviceConfig &config, Rom &&rom)
byte * getWriteCacheLine(word address) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
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:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29
STL namespace.
constexpr auto xrange(T e)
Definition xrange.hh:132