OXYGENHUB
◆ main openmsx / src / memory / RomZemina25in1.cc
1.4 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
// Zemina 25-in-1 cartridge
2
//
3
// BiFi's analysis:
4
// Switch Address: 0x0000, switches 0x4000-0xbfff range
5
// Write to switch address = base offset 8K
6
// 0x4000-0x5fff => switch address block
7
// 0x6000-0x7fff => switch address block -1
8
// 0x2500-0x9fff => switch address block -2
9
// 0xa000-0xbfff => switch address block -3
10
// 0x0000-0x1fff => unchangeable 0x3f
11
// 0x2000-0x3fff => unchangeable 0x3f
12
// switch value at reset 0x3f
13
// page 3 seems to be a mirror of page 1
14
// And for switching only the lower 6 bits matter.
15
// So, data bits... so far we must assume that only address 0 (in the slot
16
// itself) does the switching
17
18
#include "RomZemina25in1.hh"
19
#include "CacheLine.hh"
20
#include "serialize.hh"
21
22
namespace openmsx {
23
24
RomZemina25in1::RomZemina25in1(const DeviceConfig& config, Rom&& rom_)
25
	: Rom8kBBlocks(config, std::move(rom_))
26
{
27
	reset(EmuTime::dummy());
28
}
29
30
void RomZemina25in1::reset(EmuTime time)
31
{
32
	writeMem(0, 0x3F, time);
33
}
34
35
void RomZemina25in1::writeMem(uint16_t address, byte value, EmuTime /*time*/)
36
{
37
	if (address == 0x0000) {
38
		setRom(0, 0x3F);
39
		setRom(1, 0x3F);
40
		setRom(2, value);
41
		setRom(3, value - 1);
42
		setRom(4, value - 2);
43
		setRom(5, value - 3);
44
		setRom(6, value);
45
		setRom(7, value - 1);
46
	}
47
}
48
49
byte* RomZemina25in1::getWriteCacheLine(uint16_t address)
50
{
51
	if (address == (0x0000 & CacheLine::HIGH)) {
52
		return nullptr;
53
	} else {
54
		return unmappedWrite.data();
55
	}
56
}
57
58
REGISTER_MSXDEVICE(RomZemina25in1, "RomZemina25in1");
59
60
} // namespace openmsx