openMSX
RomGeneric16kB.cc
Go to the documentation of this file.
1 #include "RomGeneric16kB.hh"
2 #include "Rom.hh"
3 #include "serialize.hh"
4 
5 namespace openmsx {
6 
7 RomGeneric16kB::RomGeneric16kB(const DeviceConfig& config, std::unique_ptr<Rom> rom)
8  : Rom16kBBlocks(config, std::move(rom))
9 {
11 }
12 
14 {
15  setUnmapped(0);
16  setRom(1, 0);
17  setRom(2, 1);
18  setUnmapped(3);
19 }
20 
21 void RomGeneric16kB::writeMem(word address, byte value, EmuTime::param /*time*/)
22 {
23  setRom(address >> 14, value);
24 }
25 
27 {
28  if ((0x4000 <= address) && (address < 0xC000)) {
29  return nullptr;
30  } else {
31  return unmappedWrite;
32  }
33 }
34 
35 REGISTER_MSXDEVICE(RomGeneric16kB, "RomGeneric16kB");
36 
37 } // namespace openmsx
void setRom(byte region, int block)
Selects a block of the ROM image for reading in a certain region.
Definition: RomBlocks.cc:95
REGISTER_MSXDEVICE(DebugDevice,"DebugDevice")
static param dummy()
Definition: EmuTime.hh:21
unsigned char byte
8 bit unsigned integer
Definition: openmsx.hh:33
virtual byte * getWriteCacheLine(word address) const
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing...
virtual void writeMem(word address, byte value, EmuTime::param time)
Write a given byte to a given location at a certain time to this device.
unsigned short word
16 bit unsigned integer
Definition: openmsx.hh:38
static byte unmappedWrite[0x10000]
Definition: MSXDevice.hh:261
void setUnmapped(byte region)
Select 'unmapped' memory for this region.
Definition: RomBlocks.cc:76
RomGeneric16kB(const DeviceConfig &config, std::unique_ptr< Rom > rom)
virtual void reset(EmuTime::param time)
This method is called on reset.