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;
42 }
43}
44
46
47} // namespace openmsx
Definition: one_of.hh:7
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
RomMSXWrite(const DeviceConfig &config, Rom &&rom)
Definition: RomMSXWrite.cc:12
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:26
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomMSXWrite.cc:18
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomMSXWrite.cc:35
constexpr unsigned HIGH
Definition: CacheLine.hh:10
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.