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 
22 namespace openmsx {
23 
25  : Rom8kBBlocks(config, std::move(rom_))
26 {
27  reset(EmuTime::dummy());
28 }
29 
30 void RomZemina25in1::reset(EmuTime::param time)
31 {
32  writeMem(0, 0x3F, time);
33 }
34 
35 void 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;
55  }
56 }
57 
59 
60 } // namespace openmsx
serialize.hh
openmsx::DeviceConfig
Definition: DeviceConfig.hh:20
openmsx::RomZemina25in1::writeMem
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.
Definition: RomZemina25in1.cc:35
openmsx::MSXDevice::unmappedWrite
static byte unmappedWrite[0x10000]
Definition: MSXDevice.hh:301
openmsx::CacheLine::HIGH
constexpr unsigned HIGH
Definition: CacheLine.hh:10
openmsx::REGISTER_MSXDEVICE
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
openmsx::RomZemina25in1::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomZemina25in1.cc:30
openmsx::RomBlocks::setRom
void setRom(byte region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition: RomBlocks.cc:104
openmsx::RomZemina25in1::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomZemina25in1.cc:49
openmsx::RomBlocks
Definition: RomBlocks.hh:14
openmsx::RomZemina25in1
Definition: RomZemina25in1.hh:9
CacheLine.hh
openmsx::Rom
Definition: Rom.hh:21
RomZemina25in1.hh
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::RomZemina25in1::RomZemina25in1
RomZemina25in1(const DeviceConfig &config, Rom &&rom)
Definition: RomZemina25in1.cc:24
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5