OXYGENHUB
◆ main openmsx / src / memory / RomZemina80in1.cc
1.0 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
// Zemina 80-in-1 cartridge
2
//
3
// Information obtained by studying MESS sources:
4
//   0x4000 : 0x4000-0x5FFF
5
//   0x4001 : 0x6000-0x7FFF
6
//   0x4002 : 0x8000-0x9FFF
7
//   0x4003 : 0xA000-0xBFFF
8
9
#include "RomZemina80in1.hh"
10
#include "CacheLine.hh"
11
#include "serialize.hh"
12
#include "xrange.hh"
13
14
namespace openmsx {
15
16
RomZemina80in1::RomZemina80in1(const DeviceConfig& config, Rom&& rom_)
17
	: Rom8kBBlocks(config, std::move(rom_))
18
{
19
	reset(EmuTime::dummy());
20
}
21
22
void RomZemina80in1::reset(EmuTime /*time*/)
23
{
24
	setUnmapped(0);
25
	setUnmapped(1);
26
	for (auto i : xrange(2, 6)) {
27
		setRom(i, i - 2);
28
	}
29
	setUnmapped(6);
30
	setUnmapped(7);
31
}
32
33
void RomZemina80in1::writeMem(uint16_t address, byte value, EmuTime /*time*/)
34
{
35
	if ((0x4000 <= address) && (address < 0x4004)) {
36
		setRom(2 + (address - 0x4000), value);
37
	}
38
}
39
40
byte* RomZemina80in1::getWriteCacheLine(uint16_t address)
41
{
42
	if (address == (0x4000 & CacheLine::HIGH)) {
43
		return nullptr;
44
	} else {
45
		return unmappedWrite.data();
46
	}
47
}
48
49
REGISTER_MSXDEVICE(RomZemina80in1, "RomZemina80in1");
50
51
} // namespace openmsx