openMSX
RomMSXWrite.cc
Go to the documentation of this file.
1// Japanese MSX Write (1)
2// Identical to ASCII 16kB cartridges, but with 2 extra switch addresses:
3// 0x6FFF and 0x7FFF
4
5#include "RomMSXWrite.hh"
6#include "CacheLine.hh"
7#include "one_of.hh"
8#include "serialize.hh"
9
10namespace openmsx {
11
13 : Rom16kBBlocks(config, std::move(rom_))
14{
15 reset(EmuTime::dummy());
16}
17
18void RomMSXWrite::reset(EmuTime::param /*time*/)
19{
20 setUnmapped(0);
21 setRom(1, 0);
22 setRom(2, 0);
23 setUnmapped(3);
24}
25
26void RomMSXWrite::writeMem(word address, byte value, EmuTime::param /*time*/)
27{
28 if (((0x6000 <= address) && (address < 0x7800) && !(address & 0x0800)) ||
29 (address == one_of(0x6FFF, 0x7FFF))) {
30 byte region = ((address >> 12) & 1) + 1;
31 setRom(region, value);
32 }
33}
34
36{
37 if (((0x6000 <= address) && (address < 0x7800) && !(address & 0x0800)) ||
38 (address == one_of(0x6FFF & CacheLine::HIGH, 0x7FFF & CacheLine::HIGH))) {
39 return nullptr;
40 } else {
41 return unmappedWrite.data();
42 }
43}
44
46
47} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:356
static std::array< byte, 0x10000 > unmappedWrite
Definition MSXDevice.hh:307
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
RomMSXWrite(const DeviceConfig &config, Rom &&rom)
byte * getWriteCacheLine(word address) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
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.
void reset(EmuTime::param time) override
This method is called on reset.
constexpr unsigned HIGH
Definition CacheLine.hh:10
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29
STL namespace.