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 "serialize.hh"
14 
15 namespace openmsx {
16 
18  : Rom8kBBlocks(config, std::move(rom_))
19 {
20  RomAscii8kB::reset(EmuTime::dummy());
21 }
22 
23 void RomAscii8kB::reset(EmuTime::param /*time*/)
24 {
25  setUnmapped(0);
26  setUnmapped(1);
27  for (int i = 2; i < 6; i++) {
28  setRom(i, 0);
29  }
30  setUnmapped(6);
31  setUnmapped(7);
32 }
33 
34 void RomAscii8kB::writeMem(word address, byte value, EmuTime::param /*time*/)
35 {
36  if ((0x6000 <= address) && (address < 0x8000)) {
37  byte region = ((address >> 11) & 3) + 2;
38  setRom(region, value);
39  }
40 }
41 
43 {
44  if ((0x6000 <= address) && (address < 0x8000)) {
45  return nullptr;
46  } else {
47  return unmappedWrite;
48  }
49 }
50 
51 REGISTER_MSXDEVICE(RomAscii8kB, "RomAscii8kB");
52 
53 } // 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
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: RomAscii8kB.cc:34
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
STL namespace.
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomAscii8kB.cc:23
RomAscii8kB(const DeviceConfig &config, Rom &&rom)
Definition: RomAscii8kB.cc:17
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing...
Definition: RomAscii8kB.cc:42
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