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