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 
23 RomCrossBlaim::RomCrossBlaim(const DeviceConfig& config, Rom&& rom_)
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 
64 REGISTER_MSXDEVICE(RomCrossBlaim, "RomCrossBlaim");
65 
66 } // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition: MSXDevice.hh:307