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 "Rom.hh"
20 #include "serialize.hh"
21 
22 namespace openmsx {
23 
24 RomCrossBlaim::RomCrossBlaim(const DeviceConfig& config, std::unique_ptr<Rom> rom)
25  : Rom16kBBlocks(config, std::move(rom))
26 {
28 }
29 
31 {
32  writeMem(0, 0, dummy);
33 }
34 
35 void RomCrossBlaim::writeMem(word /*address*/, byte value, EmuTime::param /*time*/)
36 {
37  switch (value & 3) {
38  case 0:
39  case 1:
40  setRom(0, 1);
41  setRom(1, 0);
42  setRom(2, 1);
43  setRom(3, 1);
44  break;
45  case 2:
46  setUnmapped(0);
47  setRom(1, 0);
48  setRom(2, 2);
49  setUnmapped(3);
50  break;
51  case 3:
52  setUnmapped(0);
53  setRom(1, 0);
54  setRom(2, 3);
55  setUnmapped(3);
56  break;
57  }
58 }
59 
61 {
62  return nullptr;
63 }
64 
65 REGISTER_MSXDEVICE(RomCrossBlaim, "RomCrossBlaim");
66 
67 } // namespace openmsx