openMSX
RomRetroHard31in1.cc
Go to the documentation of this file.
1// Retrohard 31-in-1 cartridge
2//
3// 31 in 1 cartridges use Port &H94 for mapping 32kB games at their respective
4// offsets into 0x4000-0xBFFF
5
7#include "MSXCPUInterface.hh"
8#include "serialize.hh"
9#include "unreachable.hh"
10
11namespace openmsx {
12
14 : Rom16kBBlocks(config, std::move(rom_))
15{
16 reset(EmuTime::dummy());
17 getCPUInterface().register_IO_Out(0x94, this);
18}
19
24
25void RomRetroHard31in1::reset(EmuTime::param time)
26{
27 writeIO(0x94, 0, time);
28}
29
30void RomRetroHard31in1::writeIO(word /*port*/, byte value, EmuTime::param /*time*/)
31{
32 byte page = 2 * (value & 0x1F);
33 // note: we use a mirrored configuration here on purpose.
34 // Without this, H.E.R.O. doesn't work from the dump I got.
35 setRom(0, page + 1);
36 setRom(1, page + 0);
37 setRom(2, page + 1);
38 setRom(3, page + 0);
39}
40
42{
43 return unmappedWrite.data();
44}
45
47
48} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:356
void register_IO_Out(byte port, MSXDevice *device)
Devices can register their Out ports.
void unregister_IO_Out(byte port, MSXDevice *device)
static std::array< byte, 0x10000 > unmappedWrite
Definition MSXDevice.hh:307
MSXCPUInterface & getCPUInterface() const
Definition MSXDevice.cc:133
void setRom(unsigned region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition RomBlocks.cc:104
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.
RomRetroHard31in1(const DeviceConfig &config, Rom &&rom)
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.
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29
STL namespace.