openMSX
|
#include <RomBlocks.hh>
Public Member Functions | |
unsigned | getBaseSizeAlignment () const override |
The 'base' and 'size' attribute values need to be at least aligned to CacheLine::SIZE. | |
byte | readMem (word address, EmuTime::param time) override |
Read a byte from a location at a certain time from this device. | |
byte | peekMem (word address, EmuTime::param time) const override |
Read a byte from a given memory location. | |
const byte * | getReadCacheLine (word address) const override |
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading. | |
template<typename Archive > | |
void | serialize (Archive &ar, unsigned version) |
Public Member Functions inherited from openmsx::MSXRom | |
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. | |
byte * | getWriteCacheLine (word address) override |
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing. | |
void | getExtraDeviceInfo (TclObject &result) const override |
void | getInfo (TclObject &result) const |
Add dict values with info to result. | |
RomType | getRomType () const |
Public Member Functions inherited from openmsx::MSXDevice | |
MSXDevice (const MSXDevice &)=delete | |
MSXDevice (MSXDevice &&)=delete | |
MSXDevice & | operator= (const MSXDevice &)=delete |
MSXDevice & | operator= (MSXDevice &&)=delete |
virtual | ~MSXDevice ()=0 |
const HardwareConfig & | getHardwareConfig () const |
Returns the hardwareconfig this device belongs to. | |
void | testRemove (std::span< const std::unique_ptr< MSXDevice > > removed) const |
Checks whether this device can be removed (no other device has a reference to it). | |
virtual void | reset (EmuTime::param time) |
This method is called on reset. | |
virtual byte | readIRQVector () |
Gets IRQ vector used in IM2. | |
virtual void | powerDown (EmuTime::param time) |
This method is called when MSX is powered down. | |
virtual void | powerUp (EmuTime::param time) |
This method is called when MSX is powered up. | |
virtual const std::string & | getName () const |
Returns a human-readable name for this device. | |
virtual void | getNameList (TclObject &result) const |
Returns list of name(s) of this device. | |
void | getDeviceInfo (TclObject &result) const |
Get device info. | |
void | getVisibleMemRegion (unsigned &base, unsigned &size) const |
Returns the range where this device is visible in memory. | |
virtual byte | readIO (word port, EmuTime::param time) |
Read a byte from an IO port at a certain time from this device. | |
virtual void | writeIO (word port, byte value, EmuTime::param time) |
Write a byte to a given IO port at a certain time to this device. | |
virtual byte | peekIO (word port, EmuTime::param time) const |
Read a byte from a given IO port. | |
virtual void | globalWrite (word address, byte value, EmuTime::param time) |
Global writes. | |
virtual void | globalRead (word address, EmuTime::param time) |
Global reads. | |
void | invalidateDeviceRWCache () |
Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is located in. | |
void | invalidateDeviceRCache () |
void | invalidateDeviceWCache () |
void | invalidateDeviceRWCache (unsigned start, unsigned size) |
void | invalidateDeviceRCache (unsigned start, unsigned size) |
void | invalidateDeviceWCache (unsigned start, unsigned size) |
void | fillDeviceRWCache (unsigned start, unsigned size, byte *rwData) |
Calls MSXCPUInterface::fillXXCache() for the specific (part of) the slot that this device is located in. | |
void | fillDeviceRWCache (unsigned start, unsigned size, const byte *rData, byte *wData) |
void | fillDeviceRCache (unsigned start, unsigned size, const byte *rData) |
void | fillDeviceWCache (unsigned start, unsigned size, byte *wData) |
MSXMotherBoard & | getMotherBoard () const |
Get the mother board this device belongs to. | |
const XMLElement & | getDeviceConfig () const |
Get the configuration section for this device. | |
const DeviceConfig & | getDeviceConfig2 () const |
const Devices & | getReferences () const |
Get the device references that are specified for this device. | |
EmuTime::param | getCurrentTime () const |
MSXCPU & | getCPU () const |
MSXCPUInterface & | getCPUInterface () const |
Scheduler & | getScheduler () const |
MSXCliComm & | getCliComm () const |
Reactor & | getReactor () const |
CommandController & | getCommandController () const |
PluggingController & | getPluggingController () const |
LedStatus & | getLedStatus () const |
template<typename Archive > | |
void | serialize (Archive &ar, unsigned version) |
Static Public Attributes | |
static constexpr unsigned | BANK_SIZE = BANK_SIZE_ |
static constexpr unsigned | NUM_BANKS = 0x10000 / BANK_SIZE |
static constexpr unsigned | BANK_MASK = BANK_SIZE - 1 |
Static Public Attributes inherited from openmsx::MSXDevice | |
static std::array< byte, 0x10000 > | unmappedRead |
static std::array< byte, 0x10000 > | unmappedWrite |
Protected Member Functions | |
RomBlocks (const DeviceConfig &config, Rom &&rom, unsigned debugBankSizeShift=0) | |
Constructor. | |
~RomBlocks () override | |
void | setUnmapped (unsigned region) |
Select 'unmapped' memory for this region. | |
void | setBank (unsigned region, const byte *adr, byte block) |
Sets the memory visible for reading in a certain region. | |
void | setRom (unsigned region, unsigned block) |
Selects a block of the ROM image for reading in a certain region. | |
void | setBlockMask (int mask) |
Sets a mask for the block numbers. | |
void | setExtraMemory (std::span< const byte > mem) |
Inform this base class of extra mappable memory block. | |
Protected Member Functions inherited from openmsx::MSXRom | |
MSXRom (const DeviceConfig &config, Rom &&rom) | |
Protected Member Functions inherited from openmsx::MSXDevice | |
MSXDevice (const DeviceConfig &config, std::string_view name) | |
Every MSXDevice has a config entry; this constructor gets some device properties from that config entry. | |
MSXDevice (const DeviceConfig &config) | |
virtual void | init () |
virtual bool | allowUnaligned () const |
By default we don't allow unaligned <mem> specifications in the config file. | |
byte | getPrimarySlot () const |
Protected Attributes | |
std::array< const byte *, NUM_BANKS > | bankPtr |
std::unique_ptr< SRAM > | sram |
std::array< byte, NUM_BANKS > | blockNr |
Protected Attributes inherited from openmsx::MSXRom | |
Rom | rom |
Protected Attributes inherited from openmsx::MSXDevice | |
std::string | deviceName |
Additional Inherited Members | |
Public Types inherited from openmsx::MSXDevice | |
using | Devices = std::vector< MSXDevice * > |
Definition at line 14 of file RomBlocks.hh.
|
protected |
Constructor.
config | |
rom | |
debugBankSizeShift | Sometimes the mapper is implemented with a smaller block size than the blocks that get logically switched. For example RomGameMaster2 is implemented as a 4kB mapper but blocks get switched in 8kB chunks (done like this because there is only 4kB SRAM, that needs to be mirrored in a 8kB chunk). This parameter indicates how much bigger the logical blocks are compared to the implementation block size, it's only used to correctly implement the 'romblocks' debuggable. |
Definition at line 16 of file RomBlocks.cc.
References openmsx::Rom::addPadding(), openmsx::RomBlocks< BANK_SIZE_ >::BANK_SIZE, openmsx::DeviceConfig::findChild(), openmsx::DeviceConfig::getCliComm(), openmsx::XMLElement::getData(), openmsx::Rom::getOriginalSHA1(), openmsx::RomBlocks< BANK_SIZE_ >::NUM_BANKS, openmsx::CliComm::printWarning(), openmsx::MSXRom::rom, openmsx::RomBlocks< BANK_SIZE_ >::setRom(), openmsx::Rom::size(), and xrange().
|
overrideprotecteddefault |
|
overridevirtual |
The 'base' and 'size' attribute values need to be at least aligned to CacheLine::SIZE.
Though some devices may need a stricter alignment. In that case they must override this method.
Reimplemented from openmsx::MSXDevice.
Reimplemented in openmsx::RomPlain.
Definition at line 54 of file RomBlocks.cc.
|
overridevirtual |
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
If it is, a pointer to a buffer containing this interval must be returned. If not, a null pointer must be returned. Cacheable for reading means the data may be read directly from the buffer, thus bypassing the readMem() method, and thus also ignoring EmuTime. The default implementation always returns a null pointer. The start of the interval is CacheLine::SIZE aligned.
Reimplemented from openmsx::MSXDevice.
Reimplemented in openmsx::RomFSA1FM2, openmsx::RomHalnote, openmsx::RomKonamiSCC, openmsx::RomMitsubishiMLTS2, openmsx::RomNational, openmsx::RomPanasonic, openmsx::RomPlayBall, and openmsx::RomColecoMegaCart.
Definition at line 72 of file RomBlocks.cc.
Referenced by openmsx::RomAscii16_2::getReadCacheLine(), openmsx::RomAscii8_8::getReadCacheLine(), openmsx::RomFSA1FM2::getReadCacheLine(), openmsx::RomHalnote::getReadCacheLine(), openmsx::RomKonamiSCC::getReadCacheLine(), openmsx::RomMitsubishiMLTS2::getReadCacheLine(), openmsx::RomNational::getReadCacheLine(), openmsx::RomPanasonic::getReadCacheLine(), openmsx::RomPlayBall::getReadCacheLine(), and openmsx::RomColecoMegaCart::getReadCacheLine().
|
overridevirtual |
Read a byte from a given memory location.
Reading memory via this method has no side effects (doesn't change the device status). If save reading is not possible this method returns 0xFF. This method is not used by the emulation. It can however be used by a debugger. The default implementation uses the cache mechanism (getReadCacheLine() method). If a certain region is not cacheable you cannot read it by default, Override this method if you want to improve this behaviour.
Reimplemented from openmsx::MSXDevice.
Reimplemented in openmsx::RomFSA1FM2, openmsx::RomKonamiSCC, openmsx::RomMitsubishiMLTS2, openmsx::RomNational, openmsx::RomPanasonic, and openmsx::RomPlayBall.
Definition at line 60 of file RomBlocks.cc.
Referenced by openmsx::RomFSA1FM2::peekMem(), openmsx::RomKonamiSCC::peekMem(), openmsx::RomMitsubishiMLTS2::peekMem(), openmsx::RomNational::peekMem(), openmsx::RomPanasonic::peekMem(), openmsx::RomPlayBall::peekMem(), and openmsx::RomBlocks< BANK_SIZE_ >::readMem().
|
overridevirtual |
Read a byte from a location at a certain time from this device.
The default implementation returns 255.
Reimplemented from openmsx::MSXDevice.
Reimplemented in openmsx::RomColecoMegaCart, openmsx::RomFSA1FM2, openmsx::RomHalnote, openmsx::RomKonamiSCC, openmsx::RomMitsubishiMLTS2, openmsx::RomNational, openmsx::RomPanasonic, and openmsx::RomPlayBall.
Definition at line 66 of file RomBlocks.cc.
References openmsx::RomBlocks< BANK_SIZE_ >::peekMem().
Referenced by openmsx::RomAscii16_2::readMem(), openmsx::RomAscii8_8::readMem(), openmsx::RomColecoMegaCart::readMem(), and openmsx::RomKonamiSCC::readMem().
void openmsx::RomBlocks< BANK_SIZE >::serialize | ( | Archive & | ar, |
unsigned | version | ||
) |
Definition at line 121 of file RomBlocks.cc.
References UNREACHABLE, and xrange().
|
protected |
Sets the memory visible for reading in a certain region.
region | number of 8kB region in Z80 address space (region i starts at Z80 address i * 0x2000) |
adr | pointer to memory, area must be at least 0x2000 bytes long |
block | Block number, only used for the 'romblock' debuggable, limited to 8-bit. |
Definition at line 78 of file RomBlocks.cc.
Referenced by openmsx::RomAscii8_8::writeMem(), openmsx::RomGameMaster2::writeMem(), and openmsx::RomHalnote::writeMem().
|
inlineprotected |
Sets a mask for the block numbers.
On every call to setRom, the given block number is AND-ed with this mask; if the resulting number if outside of the ROM, unmapped memory is selected. By default the mask is set up to wrap at the end of the ROM image, meaning the entire ROM is reachable and there is no unmapped memory.
Definition at line 74 of file RomBlocks.hh.
Referenced by openmsx::RomKonami::RomKonami().
|
protected |
Inform this base class of extra mappable memory block.
This is needed for serialization of mappings in this block. Should only be called from subclass constructor. (e.g. used by RomPanasonic)
Definition at line 98 of file RomBlocks.cc.
Referenced by openmsx::RomPanasonic::RomPanasonic().
|
protected |
Selects a block of the ROM image for reading in a certain region.
region | number of 8kB region in Z80 address space (region i starts at Z80 address i * 0x2000) |
block | number of 8kB block in the ROM image (block i starts at ROM image offset i * 0x2000) |
Definition at line 104 of file RomBlocks.cc.
Referenced by openmsx::RomSuperLodeRunner::globalWrite(), openmsx::RomColecoMegaCart::readMem(), openmsx::RomAscii16kB::reset(), openmsx::RomAscii8_8::reset(), openmsx::RomAscii8kB::reset(), openmsx::RomColecoMegaCart::reset(), openmsx::RomGameMaster2::reset(), openmsx::RomGeneric16kB::reset(), openmsx::RomGeneric8kB::reset(), openmsx::RomHalnote::reset(), openmsx::RomHarryFox::reset(), openmsx::RomHolyQuran::reset(), openmsx::RomMatraCompilation::reset(), openmsx::RomMitsubishiMLTS2::reset(), openmsx::RomMSXDOS2::reset(), openmsx::RomMSXWrite::reset(), openmsx::RomMultiRom::reset(), openmsx::RomNational::reset(), openmsx::RomNeo16::reset(), openmsx::RomNeo8::reset(), openmsx::RomNettouYakyuu::reset(), openmsx::RomPadial16kB::reset(), openmsx::RomPadial8kB::reset(), openmsx::RomPanasonic::reset(), openmsx::RomRType::reset(), openmsx::RomSuperLodeRunner::reset(), openmsx::RomSuperSwangi::reset(), openmsx::RomZemina126in1::reset(), openmsx::RomZemina80in1::reset(), openmsx::RomArc::RomArc(), openmsx::RomBlocks< BANK_SIZE_ >::RomBlocks(), openmsx::RomKonamiKeyboardMaster::RomKonamiKeyboardMaster(), openmsx::RomPageNN::RomPageNN(), openmsx::RomPlain::RomPlain(), openmsx::RomPlayBall::RomPlayBall(), openmsx::RomSynthesizer::RomSynthesizer(), openmsx::RomAlAlamiah30in1::writeIO(), openmsx::RomRetroHard31in1::writeIO(), openmsx::RomZemina90in1::writeIO(), openmsx::RomAscii16_2::writeMem(), openmsx::RomAscii16kB::writeMem(), openmsx::RomAscii8_8::writeMem(), openmsx::RomAscii8kB::writeMem(), openmsx::RomCrossBlaim::writeMem(), openmsx::RomGameMaster2::writeMem(), openmsx::RomGeneric16kB::writeMem(), openmsx::RomGeneric8kB::writeMem(), openmsx::RomHalnote::writeMem(), openmsx::RomHarryFox::writeMem(), openmsx::RomHolyQuran::writeMem(), openmsx::RomMatraCompilation::writeMem(), openmsx::RomMitsubishiMLTS2::writeMem(), openmsx::RomMSXDOS2::writeMem(), openmsx::RomMSXWrite::writeMem(), openmsx::RomNational::writeMem(), openmsx::RomNeo16::writeMem(), openmsx::RomNeo8::writeMem(), openmsx::RomNettouYakyuu::writeMem(), openmsx::RomRType::writeMem(), openmsx::RomSuperSwangi::writeMem(), openmsx::RomZemina126in1::writeMem(), openmsx::RomZemina25in1::writeMem(), and openmsx::RomZemina80in1::writeMem().
|
protected |
Select 'unmapped' memory for this region.
Reads from this region will return 0xff.
Definition at line 92 of file RomBlocks.cc.
Referenced by openmsx::RomAscii16kB::reset(), openmsx::RomAscii8_8::reset(), openmsx::RomAscii8kB::reset(), openmsx::RomColecoMegaCart::reset(), openmsx::RomFSA1FM2::reset(), openmsx::RomGameMaster2::reset(), openmsx::RomGeneric16kB::reset(), openmsx::RomGeneric8kB::reset(), openmsx::RomHalnote::reset(), openmsx::RomHarryFox::reset(), openmsx::RomHolyQuran::reset(), openmsx::RomMatraCompilation::reset(), openmsx::RomMSXDOS2::reset(), openmsx::RomMSXWrite::reset(), openmsx::RomNeo16::reset(), openmsx::RomNeo8::reset(), openmsx::RomNettouYakyuu::reset(), openmsx::RomPadial16kB::reset(), openmsx::RomPadial8kB::reset(), openmsx::RomRType::reset(), openmsx::RomSuperLodeRunner::reset(), openmsx::RomSuperSwangi::reset(), openmsx::RomZemina126in1::reset(), openmsx::RomZemina80in1::reset(), openmsx::RomZemina90in1::reset(), openmsx::RomArc::RomArc(), openmsx::RomKonamiKeyboardMaster::RomKonamiKeyboardMaster(), openmsx::RomPageNN::RomPageNN(), openmsx::RomPlain::RomPlain(), openmsx::RomPlayBall::RomPlayBall(), openmsx::RomSynthesizer::RomSynthesizer(), openmsx::RomCrossBlaim::writeMem(), openmsx::RomHalnote::writeMem(), and openmsx::RomNettouYakyuu::writeMem().
|
staticconstexpr |
Definition at line 19 of file RomBlocks.hh.
Referenced by openmsx::RomAscii8_8::getReadCacheLine(), openmsx::RomAscii8_8::readMem(), and openmsx::RomAscii8_8::writeMem().
|
staticconstexpr |
Definition at line 17 of file RomBlocks.hh.
Referenced by openmsx::RomAscii8_8::getReadCacheLine(), openmsx::RomAscii8_8::getWriteCacheLine(), openmsx::RomAscii8_8::readMem(), openmsx::RomBlocks< BANK_SIZE_ >::RomBlocks(), and openmsx::RomAscii8_8::writeMem().
|
protected |
Definition at line 84 of file RomBlocks.hh.
Referenced by openmsx::RomPanasonic::getWriteCacheLine(), and openmsx::RomPanasonic::writeMem().
|
protected |
Definition at line 86 of file RomBlocks.hh.
Referenced by openmsx::RomMatraCompilation::writeMem().
|
staticconstexpr |
Definition at line 18 of file RomBlocks.hh.
Referenced by openmsx::RomBlocks< BANK_SIZE_ >::RomBlocks().
|
protected |
Definition at line 85 of file RomBlocks.hh.
Referenced by openmsx::RomAscii16_2::getReadCacheLine(), openmsx::RomAscii8_8::getReadCacheLine(), openmsx::RomPanasonic::getWriteCacheLine(), openmsx::RomNational::peekMem(), openmsx::RomAscii16_2::readMem(), openmsx::RomAscii8_8::readMem(), openmsx::RomAscii16_2::RomAscii16_2(), openmsx::RomAscii8_8::RomAscii8_8(), openmsx::RomGameMaster2::RomGameMaster2(), openmsx::RomHalnote::RomHalnote(), openmsx::RomNational::RomNational(), openmsx::RomPanasonic::RomPanasonic(), openmsx::RomAscii16_2::writeMem(), openmsx::RomAscii8_8::writeMem(), openmsx::RomGameMaster2::writeMem(), openmsx::RomHalnote::writeMem(), openmsx::RomNational::writeMem(), and openmsx::RomPanasonic::writeMem().