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#include "xrange.hh"
15
16namespace openmsx {
17
19 : Rom8kBBlocks(config, std::move(rom_))
20{
21 RomAscii8kB::reset(EmuTime::dummy());
22}
23
24void RomAscii8kB::reset(EmuTime::param /*time*/)
25{
26 setUnmapped(0);
27 setUnmapped(1);
28 for (auto i : xrange(2, 6)) {
29 setRom(i, 0);
30 }
31 setUnmapped(6);
32 setUnmapped(7);
33}
34
35void 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
53
54} // namespace openmsx
static byte unmappedWrite[0x10000]
Definition: MSXDevice.hh:302
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:35
RomAscii8kB(const DeviceConfig &config, Rom &&rom)
Definition: RomAscii8kB.cc:18
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomAscii8kB.cc:24
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomAscii8kB.cc:43
void setRom(byte region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition: RomBlocks.cc:105
void setUnmapped(byte region)
Select 'unmapped' memory for this region.
Definition: RomBlocks.cc:92
This file implemented 3 utility functions:
Definition: Autofire.cc:9
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
STL namespace.
constexpr auto xrange(T e)
Definition: xrange.hh:133