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.data();
43 }
44}
45
47
48} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:354
static std::array< byte, 0x10000 > unmappedWrite
Definition MSXDevice.hh:305
void setUnmapped(unsigned region)
Select 'unmapped' memory for this region.
Definition RomBlocks.cc:92
void setRom(unsigned region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition RomBlocks.cc:104
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.
RomHolyQuran(const DeviceConfig &config, Rom &&rom)
void reset(EmuTime::param time) override
This method is called on reset.
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
This file implemented 3 utility functions:
Definition Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29
STL namespace.
constexpr auto xrange(T e)
Definition xrange.hh:132