openMSX
RomAscii8kB.cc
Go to the documentation of this file.
1 // ASCII 8kB cartridges
2 //
3 // this type is used in many japanese-only cartridges.
4 // example of cartridges: Valis(Fantasm Soldier), Dragon Slayer, Outrun,
5 // Ashguine 2, ...
6 // The address to change banks:
7 // bank 1: 0x6000 - 0x67ff (0x6000 used)
8 // bank 2: 0x6800 - 0x6fff (0x6800 used)
9 // bank 3: 0x7000 - 0x77ff (0x7000 used)
10 // bank 4: 0x7800 - 0x7fff (0x7800 used)
11 
12 #include "RomAscii8kB.hh"
13 #include "Rom.hh"
14 #include "serialize.hh"
15 
16 namespace openmsx {
17 
18 RomAscii8kB::RomAscii8kB(const DeviceConfig& config, std::unique_ptr<Rom> rom)
19  : Rom8kBBlocks(config, std::move(rom))
20 {
22 }
23 
25 {
26  setUnmapped(0);
27  setUnmapped(1);
28  for (int i = 2; i < 6; i++) {
29  setRom(i, 0);
30  }
31  setUnmapped(6);
32  setUnmapped(7);
33 }
34 
35 void RomAscii8kB::writeMem(word address, byte value, EmuTime::param /*time*/)
36 {
37  if ((0x6000 <= address) && (address < 0x8000)) {
38  byte region = ((address >> 11) & 3) + 2;
39  setRom(region, value);
40  }
41 }
42 
44 {
45  if ((0x6000 <= address) && (address < 0x8000)) {
46  return nullptr;
47  } else {
48  return unmappedWrite;
49  }
50 }
51 
52 REGISTER_MSXDEVICE(RomAscii8kB, "RomAscii8kB");
53 
54 } // namespace openmsx