openMSX
|
#include <MSXCPUInterface.hh>
Public Types | |
using | BreakPoints = std::vector< BreakPoint > |
using | WatchPoints = std::vector< std::shared_ptr< WatchPoint > > |
using | Conditions = std::vector< DebugCondition > |
Public Member Functions | |
MSXCPUInterface (const MSXCPUInterface &)=delete | |
MSXCPUInterface & | operator= (const MSXCPUInterface &)=delete |
MSXCPUInterface (MSXMotherBoard &motherBoard) | |
~MSXCPUInterface () | |
void | register_IO_In (byte port, MSXDevice *device) |
Devices can register their In ports. More... | |
void | unregister_IO_In (byte port, MSXDevice *device) |
void | register_IO_Out (byte port, MSXDevice *device) |
Devices can register their Out ports. More... | |
void | unregister_IO_Out (byte port, MSXDevice *device) |
bool | replace_IO_In (byte port, MSXDevice *oldDevice, MSXDevice *newDevice) |
These methods replace a previously registered device with a new one. More... | |
bool | replace_IO_Out (byte port, MSXDevice *oldDevice, MSXDevice *newDevice) |
void | registerMemDevice (MSXDevice &device, int ps, int ss, int base, int size) |
Devices can register themself in the MSX slotstructure. More... | |
void | unregisterMemDevice (MSXDevice &device, int ps, int ss, int base, int size) |
void | registerGlobalWrite (MSXDevice &device, word address) |
(Un)register global writes. More... | |
void | unregisterGlobalWrite (MSXDevice &device, word address) |
void | registerGlobalRead (MSXDevice &device, word address) |
(Un)register global read. More... | |
void | unregisterGlobalRead (MSXDevice &device, word address) |
void | reset () |
Reset (the slot state) More... | |
byte | readMem (word address, EmuTime::param time) |
This reads a byte from the currently selected device. More... | |
void | writeMem (word address, byte value, EmuTime::param time) |
This writes a byte to the currently selected device. More... | |
byte | readIO (word port, EmuTime::param time) |
This read a byte from the given IO-port. More... | |
void | writeIO (word port, byte value, EmuTime::param time) |
This writes a byte to the given IO-port. More... | |
const byte * | getReadCacheLine (word start) const |
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading. More... | |
byte * | getWriteCacheLine (word start) const |
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing. More... | |
byte | readIRQVector () |
CPU uses this method to read 'extra' data from the databus used in interrupt routines. More... | |
void | setPrimarySlots (byte value) |
void | invalidateRWCache (word start, unsigned size, int ps, int ss) |
void | invalidateRCache (word start, unsigned size, int ps, int ss) |
void | invalidateWCache (word start, unsigned size, int ps, int ss) |
void | fillRWCache (unsigned start, unsigned size, const byte *rData, byte *wData, int ps, int ss) |
void | fillRCache (unsigned start, unsigned size, const byte *rData, int ps, int ss) |
void | fillWCache (unsigned start, unsigned size, byte *wData, int ps, int ss) |
byte | peekMem (word address, EmuTime::param time) const |
Peek memory location. More... | |
byte | peekSlottedMem (unsigned address, EmuTime::param time) const |
byte | readSlottedMem (unsigned address, EmuTime::param time) |
void | writeSlottedMem (unsigned address, byte value, EmuTime::param time) |
void | setExpanded (int ps) |
void | unsetExpanded (int ps) |
void | testUnsetExpanded (int ps, std::vector< MSXDevice * > allowed) const |
bool | isExpanded (int ps) const |
void | changeExpanded (bool newExpanded) |
DummyDevice & | getDummyDevice () |
void | setWatchPoint (const std::shared_ptr< WatchPoint > &watchPoint) |
void | removeWatchPoint (std::shared_ptr< WatchPoint > watchPoint) |
const WatchPoints & | getWatchPoints () const |
void | doBreak () |
void | doStep () |
void | doContinue () |
void | setFastForward (bool fastForward_) |
bool | isFastForward () const |
template<typename Archive > | |
void | serialize (Archive &ar, unsigned version) |
![]() | |
~ProfileCounters () | |
void | tick (CacheLineCounters e) const |
Static Public Member Functions | |
static void | insertBreakPoint (BreakPoint bp) |
static void | removeBreakPoint (const BreakPoint &bp) |
static const BreakPoints & | getBreakPoints () |
static void | setCondition (DebugCondition cond) |
static void | removeCondition (const DebugCondition &cond) |
static const Conditions & | getConditions () |
static bool | isBreaked () |
static bool | anyBreakPoints () |
static bool | checkBreakPoints (unsigned pc, MSXMotherBoard &motherBoard) |
static void | cleanup () |
Definition at line 63 of file MSXCPUInterface.hh.
using openmsx::MSXCPUInterface::BreakPoints = std::vector<BreakPoint> |
Definition at line 255 of file MSXCPUInterface.hh.
using openmsx::MSXCPUInterface::Conditions = std::vector<DebugCondition> |
Definition at line 266 of file MSXCPUInterface.hh.
using openmsx::MSXCPUInterface::WatchPoints = std::vector<std::shared_ptr<WatchPoint> > |
Definition at line 261 of file MSXCPUInterface.hh.
|
delete |
|
explicit |
Definition at line 77 of file MSXCPUInterface.cc.
References openmsx::DeviceFactory::createVDPIODelay(), ranges::fill(), openmsx::Reactor::getCommandController(), openmsx::MSXMotherBoard::getMachineConfig(), openmsx::MSXMotherBoard::getReactor(), openmsx::MSXMotherBoard::isTurboR(), openmsx::HardwareConfig::parseSlotMap(), reset(), openmsx::MSXCPU::setInterface(), and xrange().
openmsx::MSXCPUInterface::~MSXCPUInterface | ( | ) |
Definition at line 137 of file MSXCPUInterface.cc.
References openmsx::MSXDevice::getName(), isExpanded(), openmsx::MSXCPU::setInterface(), UNREACHABLE, and xrange().
|
inlinestatic |
Definition at line 275 of file MSXCPUInterface.hh.
void openmsx::MSXCPUInterface::changeExpanded | ( | bool | newExpanded | ) |
Definition at line 312 of file MSXCPUInterface.cc.
References openmsx::CacheLine::HIGH, openmsx::MSXCPU::invalidateAllSlotsRWCache(), and openmsx::SECONDARY_SLOT_BIT.
Referenced by setExpanded(), setPrimarySlots(), and unsetExpanded().
|
inlinestatic |
Definition at line 279 of file MSXCPUInterface.hh.
References ranges::equal_range(), and isBreaked().
|
static |
Definition at line 1035 of file MSXCPUInterface.cc.
Referenced by openmsx::Interpreter::~Interpreter().
void openmsx::MSXCPUInterface::doBreak | ( | ) |
Definition at line 998 of file MSXCPUInterface.cc.
References openmsx::Reactor::block(), openmsx::EventDistributor::distributeEvent(), openmsx::MSXCPU::exitCPULoopSync(), openmsx::Reactor::getCliComm(), openmsx::Reactor::getEventDistributor(), isFastForward(), openmsx::OPENMSX_BREAK_EVENT, openmsx::CliComm::STATUS, and openmsx::CliComm::update().
void openmsx::MSXCPUInterface::doContinue | ( | ) |
Definition at line 1021 of file MSXCPUInterface.cc.
References openmsx::Reactor::getCliComm(), isFastForward(), openmsx::CliComm::STATUS, openmsx::Reactor::unblock(), and openmsx::CliComm::update().
Referenced by doStep().
void openmsx::MSXCPUInterface::doStep | ( | ) |
Definition at line 1013 of file MSXCPUInterface.cc.
References doContinue(), isFastForward(), and setCondition().
void openmsx::MSXCPUInterface::fillRCache | ( | unsigned | start, |
unsigned | size, | ||
const byte * | rData, | ||
int | ps, | ||
int | ss | ||
) |
Definition at line 636 of file MSXCPUInterface.cc.
References openmsx::MSXCPU::fillRCache(), openmsx::FillRead, utf8::unchecked::size(), and ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick().
Referenced by openmsx::MSXDevice::fillDeviceRCache().
void openmsx::MSXCPUInterface::fillRWCache | ( | unsigned | start, |
unsigned | size, | ||
const byte * | rData, | ||
byte * | wData, | ||
int | ps, | ||
int | ss | ||
) |
Definition at line 631 of file MSXCPUInterface.cc.
References openmsx::FillReadWrite, openmsx::MSXCPU::fillRWCache(), utf8::unchecked::size(), and ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick().
Referenced by openmsx::MSXDevice::fillDeviceRWCache().
void openmsx::MSXCPUInterface::fillWCache | ( | unsigned | start, |
unsigned | size, | ||
byte * | wData, | ||
int | ps, | ||
int | ss | ||
) |
Definition at line 641 of file MSXCPUInterface.cc.
References openmsx::MSXCPU::fillWCache(), openmsx::FillWrite, utf8::unchecked::size(), and ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick().
Referenced by openmsx::MSXDevice::fillDeviceWCache().
|
inlinestatic |
Definition at line 256 of file MSXCPUInterface.hh.
|
inlinestatic |
Definition at line 267 of file MSXCPUInterface.hh.
|
inline |
Definition at line 251 of file MSXCPUInterface.hh.
Referenced by openmsx::VDPIODelay::VDPIODelay().
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. An interval will never cross a 16KB border. An interval will never contain the address 0xffff.
Definition at line 185 of file MSXCPUInterface.hh.
References openmsx::CacheLine::BITS, openmsx::GetReadCacheLine, openmsx::MSXDevice::getReadCacheLine(), ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick(), and unlikely.
|
inline |
Definition at line 262 of file MSXCPUInterface.hh.
Referenced by openmsx::Debugger::transfer().
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
If it is, a pointer to a buffer containing this interval must be returned. If not, a null pointer must be returned. Cacheable for writing means the data may be written directly to the buffer, thus bypassing the writeMem() method, and thus also ignoring EmuTime. The default implementation always returns a null pointer. An interval will never cross a 16KB border. An interval will never contain the address 0xffff.
Definition at line 205 of file MSXCPUInterface.hh.
References openmsx::CacheLine::BITS, openmsx::GetWriteCacheLine, openmsx::MSXDevice::getWriteCacheLine(), ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick(), and unlikely.
|
static |
Definition at line 782 of file MSXCPUInterface.cc.
References ranges::upper_bound().
void openmsx::MSXCPUInterface::invalidateRCache | ( | word | start, |
unsigned | size, | ||
int | ps, | ||
int | ss | ||
) |
Definition at line 620 of file MSXCPUInterface.cc.
References openmsx::MSXCPU::invalidateRCache(), openmsx::InvalidateRead, utf8::unchecked::size(), and ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick().
Referenced by openmsx::MSXDevice::invalidateDeviceRCache().
void openmsx::MSXCPUInterface::invalidateRWCache | ( | word | start, |
unsigned | size, | ||
int | ps, | ||
int | ss | ||
) |
Definition at line 615 of file MSXCPUInterface.cc.
References openmsx::InvalidateReadWrite, openmsx::MSXCPU::invalidateRWCache(), utf8::unchecked::size(), and ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick().
Referenced by openmsx::MSXDevice::invalidateDeviceRWCache().
void openmsx::MSXCPUInterface::invalidateWCache | ( | word | start, |
unsigned | size, | ||
int | ps, | ||
int | ss | ||
) |
Definition at line 625 of file MSXCPUInterface.cc.
References openmsx::MSXCPU::invalidateWCache(), openmsx::InvalidateWrite, utf8::unchecked::size(), and ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick().
Referenced by openmsx::MSXDevice::invalidateDeviceWCache().
|
inlinestatic |
Definition at line 269 of file MSXCPUInterface.hh.
Referenced by checkBreakPoints().
|
inline |
Definition at line 248 of file MSXCPUInterface.hh.
Referenced by openmsx::HardwareConfig::parseSlots(), peekMem(), peekSlottedMem(), readSlottedMem(), registerMemDevice(), setExpanded(), setPrimarySlots(), testUnsetExpanded(), unsetExpanded(), writeSlottedMem(), and ~MSXCPUInterface().
|
inline |
Definition at line 297 of file MSXCPUInterface.hh.
Referenced by doBreak(), doContinue(), and doStep().
|
delete |
Peek memory location.
Definition at line 721 of file MSXCPUInterface.cc.
References isExpanded(), and openmsx::MSXDevice::peekMem().
Referenced by openmsx::dasm().
byte openmsx::MSXCPUInterface::peekSlottedMem | ( | unsigned | address, |
EmuTime::param | time | ||
) | const |
Definition at line 730 of file MSXCPUInterface.cc.
References isExpanded(), and openmsx::MSXDevice::peekMem().
Referenced by openmsx::MSXMirrorDevice::peekMem().
This read a byte from the given IO-port.
Definition at line 161 of file MSXCPUInterface.hh.
References openmsx::MSXDevice::readIO().
byte openmsx::MSXCPUInterface::readIRQVector | ( | ) |
CPU uses this method to read 'extra' data from the databus used in interrupt routines.
In MSX this returns always 255.
Definition at line 655 of file MSXCPUInterface.cc.
References openmsx::MSXMotherBoard::readIRQVector().
This reads a byte from the currently selected device.
Definition at line 137 of file MSXCPUInterface.hh.
References openmsx::CacheLine::BITS, openmsx::MSXDevice::readMem(), openmsx::SlowRead, ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick(), and unlikely.
byte openmsx::MSXCPUInterface::readSlottedMem | ( | unsigned | address, |
EmuTime::param | time | ||
) |
Definition at line 747 of file MSXCPUInterface.cc.
References isExpanded(), and openmsx::MSXDevice::peekMem().
Referenced by openmsx::MSXMirrorDevice::readMem().
Devices can register their In ports.
This is normally done in their constructor. Once device are registered, their readIO() method can get called.
Definition at line 337 of file MSXCPUInterface.cc.
Referenced by openmsx::ColecoSuperGameModule::ColecoSuperGameModule(), openmsx::MSXMotherBoard::createMapperIO(), openmsx::MSXDeviceSwitch::registerDevice(), openmsx::RomArc::RomArc(), openmsx::RomKonamiKeyboardMaster::RomKonamiKeyboardMaster(), and openmsx::RomManbow2::RomManbow2().
Devices can register their Out ports.
This is normally done in their constructor. Once device are registered, their writeIO() method can get called.
Definition at line 349 of file MSXCPUInterface.cc.
Referenced by openmsx::ColecoSuperGameModule::ColecoSuperGameModule(), openmsx::MSXMotherBoard::createMapperIO(), openmsx::MegaFlashRomSCCPlus::MegaFlashRomSCCPlus(), openmsx::MegaFlashRomSCCPlusSD::MegaFlashRomSCCPlusSD(), openmsx::MSXMidi::MSXMidi(), openmsx::MSXDeviceSwitch::registerDevice(), openmsx::ReproCartridgeV1::ReproCartridgeV1(), openmsx::ReproCartridgeV2::ReproCartridgeV2(), openmsx::RomArc::RomArc(), openmsx::RomKonamiKeyboardMaster::RomKonamiKeyboardMaster(), openmsx::RomManbow2::RomManbow2(), and openmsx::RomZemina90in1::RomZemina90in1().
(Un)register global read.
Definition at line 578 of file MSXCPUInterface.cc.
References openmsx::CacheLine::BITS, openmsx::GLOBAL_RW_BIT, openmsx::CacheLine::HIGH, and openmsx::MSXCPU::invalidateAllSlotsRWCache().
Referenced by openmsx::GlobalReadClient< MSXDEVICE, CT_INTERVALS >::GlobalReadClient().
(Un)register global writes.
Definition at line 554 of file MSXCPUInterface.cc.
References openmsx::CacheLine::BITS, openmsx::GLOBAL_RW_BIT, openmsx::CacheLine::HIGH, and openmsx::MSXCPU::invalidateAllSlotsRWCache().
Referenced by openmsx::GlobalWriteClient< MSXDEVICE, CT_INTERVALS >::GlobalWriteClient().
void openmsx::MSXCPUInterface::registerMemDevice | ( | MSXDevice & | device, |
int | ps, | ||
int | ss, | ||
int | base, | ||
int | size | ||
) |
Devices can register themself in the MSX slotstructure.
This is normally done in their constructor. Once devices are registered their readMem() / writeMem() methods can get called.
Definition at line 512 of file MSXCPUInterface.cc.
References isExpanded(), gl::min(), and utf8::unchecked::size().
|
static |
Definition at line 788 of file MSXCPUInterface.cc.
References ranges::equal_range(), find_if_unguarded(), and openmsx::BreakPoint::getAddress().
|
static |
Definition at line 916 of file MSXCPUInterface.cc.
References rfind_if_unguarded().
void openmsx::MSXCPUInterface::removeWatchPoint | ( | std::shared_ptr< WatchPoint > | watchPoint | ) |
Definition at line 884 of file MSXCPUInterface.cc.
References end(), ranges::find(), openmsx::WatchPoint::READ_IO, openmsx::WatchPoint::READ_MEM, UNREACHABLE, openmsx::WatchPoint::WRITE_IO, and openmsx::WatchPoint::WRITE_MEM.
bool openmsx::MSXCPUInterface::replace_IO_In | ( | byte | port, |
MSXDevice * | oldDevice, | ||
MSXDevice * | newDevice | ||
) |
These methods replace a previously registered device with a new one.
This method checks whether the current device is the same as the 'oldDevice' parameter.
The intention is that devices using these methods extend (=wrap) the functionality of a previously registered device. Typically the destructor of the wrapping device will perform the inverse replacement.
Definition at line 406 of file MSXCPUInterface.cc.
bool openmsx::MSXCPUInterface::replace_IO_Out | ( | byte | port, |
MSXDevice * | oldDevice, | ||
MSXDevice * | newDevice | ||
) |
Definition at line 417 of file MSXCPUInterface.cc.
void openmsx::MSXCPUInterface::reset | ( | ) |
Reset (the slot state)
Definition at line 647 of file MSXCPUInterface.cc.
References setPrimarySlots(), and xrange().
Referenced by openmsx::MSXMotherBoard::doReset(), MSXCPUInterface(), and openmsx::MSXMotherBoard::powerUp().
void openmsx::MSXCPUInterface::serialize | ( | Archive & | ar, |
unsigned | version | ||
) |
Definition at line 1248 of file MSXCPUInterface.cc.
References setPrimarySlots(), and xrange().
|
static |
Definition at line 911 of file MSXCPUInterface.cc.
Referenced by doStep().
void openmsx::MSXCPUInterface::setExpanded | ( | int | ps | ) |
Definition at line 244 of file MSXCPUInterface.cc.
References changeExpanded(), isExpanded(), and xrange().
|
inline |
Definition at line 296 of file MSXCPUInterface.hh.
void openmsx::MSXCPUInterface::setPrimarySlots | ( | byte | value | ) |
Definition at line 660 of file MSXCPUInterface.cc.
References changeExpanded(), isExpanded(), and unlikely.
Referenced by reset(), and serialize().
void openmsx::MSXCPUInterface::setWatchPoint | ( | const std::shared_ptr< WatchPoint > & | watchPoint | ) |
Definition at line 844 of file MSXCPUInterface.cc.
References openmsx::WatchPoint::READ_IO, openmsx::WatchPoint::READ_MEM, UNREACHABLE, openmsx::WatchPoint::WRITE_IO, and openmsx::WatchPoint::WRITE_MEM.
void openmsx::MSXCPUInterface::testUnsetExpanded | ( | int | ps, |
std::vector< MSXDevice * > | allowed | ||
) | const |
Definition at line 258 of file MSXCPUInterface.cc.
References begin(), end(), isExpanded(), ranges::set_difference(), ranges::sort(), strAppend(), strCat(), ranges::unique(), and xrange().
Referenced by openmsx::HardwareConfig::testRemove(), and unsetExpanded().
Definition at line 343 of file MSXCPUInterface.cc.
Referenced by openmsx::MSXMotherBoard::destroyMapperIO(), openmsx::MSXDeviceSwitch::unregisterDevice(), openmsx::ColecoSuperGameModule::~ColecoSuperGameModule(), openmsx::RomArc::~RomArc(), openmsx::RomKonamiKeyboardMaster::~RomKonamiKeyboardMaster(), and openmsx::RomManbow2::~RomManbow2().
Definition at line 355 of file MSXCPUInterface.cc.
Referenced by openmsx::MSXMotherBoard::destroyMapperIO(), openmsx::MSXDeviceSwitch::unregisterDevice(), openmsx::ColecoSuperGameModule::~ColecoSuperGameModule(), openmsx::MegaFlashRomSCCPlus::~MegaFlashRomSCCPlus(), openmsx::MegaFlashRomSCCPlusSD::~MegaFlashRomSCCPlusSD(), openmsx::MSXMidi::~MSXMidi(), openmsx::ReproCartridgeV1::~ReproCartridgeV1(), openmsx::ReproCartridgeV2::~ReproCartridgeV2(), openmsx::RomArc::~RomArc(), openmsx::RomKonamiKeyboardMaster::~RomKonamiKeyboardMaster(), openmsx::RomManbow2::~RomManbow2(), and openmsx::RomZemina90in1::~RomZemina90in1().
Definition at line 586 of file MSXCPUInterface.cc.
References openmsx::CacheLine::BITS, g, openmsx::GLOBAL_RW_BIT, openmsx::CacheLine::HIGH, openmsx::MSXCPU::invalidateAllSlotsRWCache(), move_pop_back(), and rfind_unguarded().
Referenced by openmsx::GlobalReadClient< MSXDEVICE, CT_INTERVALS >::~GlobalReadClient().
Definition at line 562 of file MSXCPUInterface.cc.
References openmsx::CacheLine::BITS, g, openmsx::GLOBAL_RW_BIT, openmsx::CacheLine::HIGH, openmsx::MSXCPU::invalidateAllSlotsRWCache(), move_pop_back(), and rfind_unguarded().
Referenced by openmsx::GlobalWriteClient< MSXDEVICE, CT_INTERVALS >::~GlobalWriteClient().
void openmsx::MSXCPUInterface::unregisterMemDevice | ( | MSXDevice & | device, |
int | ps, | ||
int | ss, | ||
int | base, | ||
int | size | ||
) |
Definition at line 542 of file MSXCPUInterface.cc.
References gl::min(), and utf8::unchecked::size().
void openmsx::MSXCPUInterface::unsetExpanded | ( | int | ps | ) |
Definition at line 298 of file MSXCPUInterface.cc.
References changeExpanded(), isExpanded(), testUnsetExpanded(), and UNREACHABLE.
Referenced by openmsx::HardwareConfig::~HardwareConfig().
This writes a byte to the given IO-port.
Definition at line 169 of file MSXCPUInterface.hh.
References openmsx::MSXDevice::writeIO().
This writes a byte to the currently selected device.
Definition at line 148 of file MSXCPUInterface.hh.
References openmsx::CacheLine::BITS, openmsx::SlowWrite, ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick(), unlikely, and openmsx::MSXDevice::writeMem().
void openmsx::MSXCPUInterface::writeSlottedMem | ( | unsigned | address, |
byte | value, | ||
EmuTime::param | time | ||
) |
Definition at line 764 of file MSXCPUInterface.cc.
References isExpanded(), and openmsx::MSXDevice::writeMem().
Referenced by openmsx::MSXMirrorDevice::writeMem().