openMSX
RomZemina126in1.cc
Go to the documentation of this file.
1 // Zemina 126-in-1 cartridge
2 //
3 // Information obtained by studying MESS sources:
4 // 0x4001 : 0x4000-0x7FFF
5 // 0x4002 : 0x8000-0xBFFF
6 
7 #include "RomZemina126in1.hh"
8 #include "CacheLine.hh"
9 #include "serialize.hh"
10 
11 namespace openmsx {
12 
14  const DeviceConfig& config, Rom&& rom_)
15  : Rom16kBBlocks(config, std::move(rom_))
16 {
17  reset(EmuTime::dummy());
18 }
19 
20 void RomZemina126in1::reset(EmuTime::param /*time*/)
21 {
22  setUnmapped(0);
23  setRom(1, 0);
24  setRom(2, 1);
25  setUnmapped(3);
26 }
27 
28 void RomZemina126in1::writeMem(word address, byte value, EmuTime::param /*time*/)
29 {
30  if (address == 0x4000) {
31  setRom(1, value);
32  } else if (address == 0x4001) {
33  setRom(2, value);
34  }
35 }
36 
38 {
39  if (address == (0x4000 & CacheLine::HIGH)) {
40  return nullptr;
41  } else {
42  return unmappedWrite;
43  }
44 }
45 
46 REGISTER_MSXDEVICE(RomZemina126in1, "RomZemina126in1");
47 
48 } // 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.
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing...
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
static byte unmappedWrite[0x10000]
Definition: MSXDevice.hh:275
void setUnmapped(byte region)
Select 'unmapped' memory for this region.
Definition: RomBlocks.cc:85
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.
RomZemina126in1(const DeviceConfig &config, Rom &&rom)