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#include "xrange.hh"
8
9namespace openmsx {
10
12 : Rom8kBBlocks(config, std::move(rom_))
13{
14 reset(EmuTime::dummy());
15}
16
17void RomHolyQuran::reset(EmuTime::param /*time*/)
18{
19 setUnmapped(0);
20 setUnmapped(1);
21 for (auto i : xrange(2, 6)) {
22 setRom(i, 0);
23 }
24 setUnmapped(6);
25 setUnmapped(7);
26}
27
28void RomHolyQuran::writeMem(word address, byte value, EmuTime::param /*time*/)
29{
30 // TODO are switch addresses mirrored?
31 if ((0x5000 <= address) && (address < 0x6000)) {
32 byte region = ((address >> 10) & 3) + 2;
33 setRom(region, value);
34 }
35}
36
38{
39 if ((0x5000 <= address) && (address < 0x6000)) {
40 return nullptr;
41 } else {
42 return unmappedWrite;
43 }
44}
45
47
48} // namespace openmsx
static byte unmappedWrite[0x10000]
Definition: MSXDevice.hh:302
void setRom(byte region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition: RomBlocks.cc:105
void setUnmapped(byte region)
Select 'unmapped' memory for this region.
Definition: RomBlocks.cc:92
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:28
RomHolyQuran(const DeviceConfig &config, Rom &&rom)
Definition: RomHolyQuran.cc:11
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomHolyQuran.cc:17
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomHolyQuran.cc:37
This file implemented 3 utility functions:
Definition: Autofire.cc:9
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
STL namespace.
constexpr auto xrange(T e)
Definition: xrange.hh:133