openMSX
RomZemina80in1.cc
Go to the documentation of this file.
1 // Zemina 80-in-1 cartridge
2 //
3 // Information obtained by studying MESS sources:
4 // 0x4000 : 0x4000-0x5FFF
5 // 0x4001 : 0x6000-0x7FFF
6 // 0x4002 : 0x8000-0x9FFF
7 // 0x4003 : 0xA000-0xBFFF
8 
9 #include "RomZemina80in1.hh"
10 #include "CacheLine.hh"
11 #include "serialize.hh"
12 
13 namespace openmsx {
14 
16  : Rom8kBBlocks(config, std::move(rom_))
17 {
18  reset(EmuTime::dummy());
19 }
20 
21 void RomZemina80in1::reset(EmuTime::param /*time*/)
22 {
23  setUnmapped(0);
24  setUnmapped(1);
25  for (int i = 2; i < 6; i++) {
26  setRom(i, i - 2);
27  }
28  setUnmapped(6);
29  setUnmapped(7);
30 }
31 
32 void RomZemina80in1::writeMem(word address, byte value, EmuTime::param /*time*/)
33 {
34  if ((0x4000 <= address) && (address < 0x4004)) {
35  setRom(2 + (address - 0x4000), value);
36  }
37 }
38 
40 {
41  if (address == (0x4000 & CacheLine::HIGH)) {
42  return nullptr;
43  } else {
44  return unmappedWrite;
45  }
46 }
47 
48 REGISTER_MSXDEVICE(RomZemina80in1, "RomZemina80in1");
49 
50 } // 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.
constexpr unsigned HIGH
Definition: CacheLine.hh:10
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing...
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
void reset(EmuTime::param time) override
This method is called on reset.
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.
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
RomZemina80in1(const DeviceConfig &config, Rom &&rom)
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