openMSX
RomHolyQuran.cc
Go to the documentation of this file.
1 // Holy Qu'ran cartridge
2 // It is like an ASCII 8KB, but using the 5000h, 5400h, 5800h and 5C00h
3 // addresses.
4 
5 #include "RomHolyQuran.hh"
6 #include "serialize.hh"
7 
8 namespace openmsx {
9 
11  : Rom8kBBlocks(config, std::move(rom_))
12 {
13  reset(EmuTime::dummy());
14 }
15 
16 void RomHolyQuran::reset(EmuTime::param /*time*/)
17 {
18  setUnmapped(0);
19  setUnmapped(1);
20  for (int i = 2; i < 6; i++) {
21  setRom(i, 0);
22  }
23  setUnmapped(6);
24  setUnmapped(7);
25 }
26 
27 void RomHolyQuran::writeMem(word address, byte value, EmuTime::param /*time*/)
28 {
29  // TODO are switch addresses mirrored?
30  if ((0x5000 <= address) && (address < 0x6000)) {
31  byte region = ((address >> 10) & 3) + 2;
32  setRom(region, value);
33  }
34 }
35 
37 {
38  if ((0x5000 <= address) && (address < 0x6000)) {
39  return nullptr;
40  } else {
41  return unmappedWrite;
42  }
43 }
44 
45 REGISTER_MSXDEVICE(RomHolyQuran, "RomHolyQuran");
46 
47 } // namespace openmsx
void setRom(byte region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition: RomBlocks.cc:98
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
STL namespace.
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
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: RomHolyQuran.cc:27
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
RomHolyQuran(const DeviceConfig &config, Rom &&rom)
Definition: RomHolyQuran.cc:10
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
static byte unmappedWrite[0x10000]
Definition: MSXDevice.hh:275
void setUnmapped(byte region)
Select &#39;unmapped&#39; memory for this region.
Definition: RomBlocks.cc:85
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomHolyQuran.cc:16
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing...
Definition: RomHolyQuran.cc:36