openMSX
RomCrossBlaim.cc
Go to the documentation of this file.
1// Thanks to hap (enen) for buying the real cartridge and
2// investigating it in detail. See his results on:
3//
4// http://www.msx.org/forumtopicl8629.html
5//
6// To summarize:
7// The whole 0x0000-0xffff region acts as a single switch region. Only
8// the lower 2 bits of the written value have any effect. The mapping
9// is like the table below. The initial state is 00.
10//
11// | 0x | 10 | 11
12// --------------+----+----+----
13// 0x0000-0x3fff | 1 | x | x (x means unmapped, reads as 0xff)
14// 0x4000-0x7fff | 0 | 0 | 0
15// 0x8000-0xbfff | 1 | 2 | 3
16// 0xc000-0xffff | 1 | x | x
17
18#include "RomCrossBlaim.hh"
19#include "serialize.hh"
20
21namespace openmsx {
22
24 : Rom16kBBlocks(config, std::move(rom_))
25{
26 reset(EmuTime::dummy());
27}
28
29void RomCrossBlaim::reset(EmuTime::param time)
30{
31 writeMem(0, 0, time);
32}
33
34void RomCrossBlaim::writeMem(word /*address*/, byte value, EmuTime::param /*time*/)
35{
36 switch (value & 3) {
37 case 0:
38 case 1:
39 setRom(0, 1);
40 setRom(1, 0);
41 setRom(2, 1);
42 setRom(3, 1);
43 break;
44 case 2:
45 setUnmapped(0);
46 setRom(1, 0);
47 setRom(2, 2);
48 setUnmapped(3);
49 break;
50 case 3:
51 setUnmapped(0);
52 setRom(1, 0);
53 setRom(2, 3);
54 setUnmapped(3);
55 break;
56 }
57}
58
59byte* RomCrossBlaim::getWriteCacheLine(word /*address*/) const
60{
61 return nullptr;
62}
63
65
66} // namespace openmsx
void setRom(byte region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition: RomBlocks.cc:103
void setUnmapped(byte region)
Select 'unmapped' memory for this region.
Definition: RomBlocks.cc:91
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
RomCrossBlaim(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.
void reset(EmuTime::param time) override
This method is called on reset.
This file implemented 3 utility functions:
Definition: Autofire.cc:9
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
STL namespace.