openMSX
RomCrossBlaim.cc
Go to the documentation of this file.
1 // Thanks to hap (enen) for buying the real cartridge and
2 // investigating it in detail. See his results on:
3 //
4 // http://www.msx.org/forumtopicl8629.html
5 //
6 // To summarize:
7 // The whole 0x0000-0xffff region acts as a single switch region. Only
8 // the lower 2 bits of the written value have any effect. The mapping
9 // is like the table below. The initial state is 00.
10 //
11 // | 0x | 10 | 11
12 // --------------+----+----+----
13 // 0x0000-0x3fff | 1 | x | x (x means unmapped, reads as 0xff)
14 // 0x4000-0x7fff | 0 | 0 | 0
15 // 0x8000-0xbfff | 1 | 2 | 3
16 // 0xc000-0xffff | 1 | x | x
17 
18 #include "RomCrossBlaim.hh"
19 #include "serialize.hh"
20 
21 namespace openmsx {
22 
24  : Rom16kBBlocks(config, std::move(rom_))
25 {
26  reset(EmuTime::dummy());
27 }
28 
29 void RomCrossBlaim::reset(EmuTime::param time)
30 {
31  writeMem(0, 0, time);
32 }
33 
34 void RomCrossBlaim::writeMem(word /*address*/, byte value, EmuTime::param /*time*/)
35 {
36  switch (value & 3) {
37  case 0:
38  case 1:
39  setRom(0, 1);
40  setRom(1, 0);
41  setRom(2, 1);
42  setRom(3, 1);
43  break;
44  case 2:
45  setUnmapped(0);
46  setRom(1, 0);
47  setRom(2, 2);
48  setUnmapped(3);
49  break;
50  case 3:
51  setUnmapped(0);
52  setRom(1, 0);
53  setRom(2, 3);
54  setUnmapped(3);
55  break;
56  }
57 }
58 
59 byte* RomCrossBlaim::getWriteCacheLine(word /*address*/) const
60 {
61  return nullptr;
62 }
63 
65 
66 } // namespace openmsx
openmsx::RomCrossBlaim::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomCrossBlaim.cc:59
serialize.hh
openmsx::DeviceConfig
Definition: DeviceConfig.hh:20
openmsx::RomCrossBlaim
Definition: RomCrossBlaim.hh:9
openmsx::REGISTER_MSXDEVICE
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
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
RomCrossBlaim.hh
openmsx::RomBlocks::setUnmapped
void setUnmapped(byte region)
Select 'unmapped' memory for this region.
Definition: RomBlocks.cc:91
openmsx::RomBlocks
Definition: RomBlocks.hh:14
openmsx::Rom
Definition: Rom.hh:21
openmsx::RomCrossBlaim::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomCrossBlaim.cc:29
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::RomCrossBlaim::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: RomCrossBlaim.cc:34
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::RomCrossBlaim::RomCrossBlaim
RomCrossBlaim(const DeviceConfig &config, Rom &&rom)
Definition: RomCrossBlaim.cc:23