openMSX
RomAscii16kB.cc
Go to the documentation of this file.
1 // ASCII 16kB cartridges
2 //
3 // this type is used in a few cartridges.
4 // example of cartridges: Xevious, Fantasy Zone 2,
5 // Return of Ishitar, Androgynus, Gallforce ...
6 //
7 // The address to change banks:
8 // first 16kb: 0x6000 - 0x67ff (0x6000 used)
9 // second 16kb: 0x7000 - 0x77ff (0x7000 and 0x77ff used)
10 
11 #include "RomAscii16kB.hh"
12 #include "serialize.hh"
13 
14 namespace openmsx {
15 
17  : Rom16kBBlocks(config, std::move(rom_))
18 {
19  RomAscii16kB::reset(EmuTime::dummy());
20 }
21 
22 void RomAscii16kB::reset(EmuTime::param /*time*/)
23 {
24  setUnmapped(0);
25  setRom(1, 0);
26  setRom(2, 0);
27  setUnmapped(3);
28 }
29 
30 void RomAscii16kB::writeMem(word address, byte value, EmuTime::param /*time*/)
31 {
32  if ((0x6000 <= address) && (address < 0x7800) && !(address & 0x0800)) {
33  byte region = ((address >> 12) & 1) + 1;
34  setRom(region, value);
35  }
36 }
37 
39 {
40  if ((0x6000 <= address) && (address < 0x7800) && !(address & 0x0800)) {
41  return nullptr;
42  } else {
43  return unmappedWrite;
44  }
45 }
46 
48 
49 } // namespace openmsx
serialize.hh
openmsx::DeviceConfig
Definition: DeviceConfig.hh:20
openmsx::MSXDevice::unmappedWrite
static byte unmappedWrite[0x10000]
Definition: MSXDevice.hh:301
openmsx::RomAscii16kB
Definition: RomAscii16kB.hh:9
openmsx::REGISTER_MSXDEVICE
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
openmsx::RomAscii16kB::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomAscii16kB.cc:22
RomAscii16kB.hh
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
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::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::RomAscii16kB::RomAscii16kB
RomAscii16kB(const DeviceConfig &config, Rom &&rom)
Definition: RomAscii16kB.cc:16
openmsx::RomAscii16kB::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: RomAscii16kB.cc:30
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::RomAscii16kB::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomAscii16kB.cc:38