openMSX
RomZemina126in1.cc
Go to the documentation of this file.
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
11namespace openmsx {
12
14 const DeviceConfig& config, Rom&& rom_)
15 : Rom16kBBlocks(config, std::move(rom_))
16{
17 reset(EmuTime::dummy());
18}
19
20void RomZemina126in1::reset(EmuTime::param /*time*/)
21{
22 setUnmapped(0);
23 setRom(1, 0);
24 setRom(2, 1);
25 setUnmapped(3);
26}
27
28void RomZemina126in1::writeMem(word address, byte value, EmuTime::param /*time*/)
29{
30 if (address == 0x4000) {
31 setRom(1, value);
32 } else if (address == 0x4001) {
33 setRom(2, value);
34 }
35}
36
38{
39 if (address == (0x4000 & CacheLine::HIGH)) {
40 return nullptr;
41 } else {
42 return unmappedWrite.data();
43 }
44}
45
47
48} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:354
static std::array< byte, 0x10000 > unmappedWrite
Definition MSXDevice.hh:305
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 reset(EmuTime::param time) override
This method is called on reset.
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
RomZemina126in1(const DeviceConfig &config, Rom &&rom)
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.
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.