openMSX
RomSuperSwangi.cc
Go to the documentation of this file.
1 #include "RomSuperSwangi.hh"
2 #include "CacheLine.hh"
3 #include "serialize.hh"
4 
5 namespace openmsx {
6 
8  : Rom16kBBlocks(config, std::move(rom_))
9 {
10  reset(EmuTime::dummy());
11 }
12 
13 void RomSuperSwangi::reset(EmuTime::param /*time*/)
14 {
15  setUnmapped(0);
16  setRom(1, 0);
17  setRom(2, 0);
18  setUnmapped(3);
19 }
20 
21 void RomSuperSwangi::writeMem(word address, byte value, EmuTime::param /*time*/)
22 {
23  if (address == 0x8000) {
24  setRom(2, value >> 1);
25  }
26 }
27 
29 {
30  if (address == (0x8000 & CacheLine::HIGH)) return nullptr;
31  return unmappedWrite;
32 }
33 
34 REGISTER_MSXDEVICE(RomSuperSwangi, "RomSuperSwangi");
35 
36 } // namespace openmsx
serialize.hh
openmsx::DeviceConfig
Definition: DeviceConfig.hh:19
openmsx::MSXDevice::unmappedWrite
static byte unmappedWrite[0x10000]
Definition: MSXDevice.hh:293
openmsx::CacheLine::HIGH
constexpr unsigned HIGH
Definition: CacheLine.hh:10
openmsx::REGISTER_MSXDEVICE
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
openmsx::RomSuperSwangi::writeMem
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: RomSuperSwangi.cc:21
openmsx::RomBlocks::setRom
void setRom(byte region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition: RomBlocks.cc:104
openmsx::RomSuperSwangi::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomSuperSwangi.cc:28
openmsx::RomBlocks::setUnmapped
void setUnmapped(byte region)
Select 'unmapped' memory for this region.
Definition: RomBlocks.cc:91
openmsx::RomBlocks
Definition: RomBlocks.hh:13
CacheLine.hh
RomSuperSwangi.hh
openmsx::Rom
Definition: Rom.hh:20
openmsx::RomSuperSwangi::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomSuperSwangi.cc:13
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::RomSuperSwangi::RomSuperSwangi
RomSuperSwangi(const DeviceConfig &config, Rom &&rom)
Definition: RomSuperSwangi.cc:7
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::RomSuperSwangi
Definition: RomSuperSwangi.hh:8