openMSX
RomZemina80in1.cc
Go to the documentation of this file.
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
14namespace openmsx {
15
17 : Rom8kBBlocks(config, std::move(rom_))
18{
19 reset(EmuTime::dummy());
20}
21
22void RomZemina80in1::reset(EmuTime::param /*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
33void RomZemina80in1::writeMem(word address, byte value, EmuTime::param /*time*/)
34{
35 if ((0x4000 <= address) && (address < 0x4004)) {
36 setRom(2 + (address - 0x4000), value);
37 }
38}
39
41{
42 if (address == (0x4000 & CacheLine::HIGH)) {
43 return nullptr;
44 } else {
45 return unmappedWrite.data();
46 }
47}
48
50
51} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:356
static std::array< byte, 0x10000 > unmappedWrite
Definition MSXDevice.hh:307
void setUnmapped(unsigned region)
Select 'unmapped' memory for this region.
Definition RomBlocks.cc:92
void setRom(unsigned region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition RomBlocks.cc:104
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.
RomZemina80in1(const DeviceConfig &config, Rom &&rom)
void reset(EmuTime::param time) override
This method is called on reset.
byte * getWriteCacheLine(word address) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
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.
constexpr auto xrange(T e)
Definition xrange.hh:132