openMSX
RomHarryFox.cc
Go to the documentation of this file.
1 // This mapper is used for the game "Harry Fox Yki no Maoh"
2 
10 #include "RomHarryFox.hh"
11 #include "Rom.hh"
12 #include "serialize.hh"
13 
14 namespace openmsx {
15 
16 RomHarryFox::RomHarryFox(const DeviceConfig& config, std::unique_ptr<Rom> rom)
17  : Rom16kBBlocks(config, std::move(rom))
18 {
20 }
21 
23 {
24  setUnmapped(0);
25  setRom(1, 0);
26  setRom(2, 1);
27  setUnmapped(3);
28 }
29 
30 void RomHarryFox::writeMem(word address, byte value, EmuTime::param /*time*/)
31 {
32  if ((0x6000 <= address) && (address < 0x7000)) {
33  setRom(1, 2 * (value & 1) + 0);
34  } else if ((0x7000 <= address) && (address < 0x8000)) {
35  setRom(2, 2 * (value & 1) + 1);
36  }
37 }
38 
40 {
41  if ((0x6000 <= address) && (address < 0x8000)) {
42  return nullptr;
43  } else {
44  return unmappedWrite;
45  }
46 }
47 
48 REGISTER_MSXDEVICE(RomHarryFox, "RomHarryFox");
49 
50 } // namespace openmsx
void setRom(byte region, int block)
Selects a block of the ROM image for reading in a certain region.
Definition: RomBlocks.cc:89
REGISTER_MSXDEVICE(DebugDevice,"DebugDevice")
static param dummy()
Definition: EmuTime.hh:21
RomHarryFox(const DeviceConfig &config, std::unique_ptr< Rom > rom)
Definition: RomHarryFox.cc:16
unsigned char byte
8 bit unsigned integer
Definition: openmsx.hh:33
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomHarryFox.cc:22
unsigned short word
16 bit unsigned integer
Definition: openmsx.hh:38
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: RomHarryFox.cc:30
static byte unmappedWrite[0x10000]
Definition: MSXDevice.hh:267
void setUnmapped(byte region)
Select 'unmapped' memory for this region.
Definition: RomBlocks.cc:76
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing...
Definition: RomHarryFox.cc:39