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 "serialize.hh"
8 
9 namespace openmsx {
10 
12  : Rom16kBBlocks(config, std::move(rom_))
13 {
14  reset(EmuTime::dummy());
15 }
16 
17 void RomMSXWrite::reset(EmuTime::param /*time*/)
18 {
19  setUnmapped(0);
20  setRom(1, 0);
21  setRom(2, 0);
22  setUnmapped(3);
23 }
24 
25 void RomMSXWrite::writeMem(word address, byte value, EmuTime::param /*time*/)
26 {
27  if (((0x6000 <= address) && (address < 0x7800) && !(address & 0x0800)) ||
28  (address == 0x6FFF) || (address == 0x7FFF)) {
29  byte region = ((address >> 12) & 1) + 1;
30  setRom(region, value);
31  }
32 }
33 
35 {
36  if (((0x6000 <= address) && (address < 0x7800) && !(address & 0x0800)) ||
37  (address == (0x6FFF & CacheLine::HIGH)) ||
38  (address == (0x7FFF & CacheLine::HIGH))) {
39  return nullptr;
40  } else {
41  return unmappedWrite;
42  }
43 }
44 
45 REGISTER_MSXDEVICE(RomMSXWrite, "RomMSXWrite");
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.
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: RomMSXWrite.cc:25
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
RomMSXWrite(const DeviceConfig &config, Rom &&rom)
Definition: RomMSXWrite.cc:11
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomMSXWrite.cc:17
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing...
Definition: RomMSXWrite.cc:34
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