openMSX
RomZemina25in1.cc
Go to the documentation of this file.
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
22namespace openmsx {
23
25 : Rom8kBBlocks(config, std::move(rom_))
26{
27 reset(EmuTime::dummy());
28}
29
30void RomZemina25in1::reset(EmuTime::param time)
31{
32 writeMem(0, 0x3F, time);
33}
34
35void RomZemina25in1::writeMem(word address, byte value, EmuTime::param /*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
50{
51 if (address == (0x0000 & CacheLine::HIGH)) {
52 return nullptr;
53 } else {
54 return unmappedWrite.data();
55 }
56}
57
59
60} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:354
static std::array< byte, 0x10000 > unmappedWrite
Definition MSXDevice.hh:305
void setRom(unsigned region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition RomBlocks.cc:104
void reset(EmuTime::param time) override
This method is called on reset.
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.
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
RomZemina25in1(const DeviceConfig &config, Rom &&rom)
constexpr unsigned HIGH
Definition CacheLine.hh:10
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29
STL namespace.