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