21 unsigned beginAddr_,
unsigned endAddr_,
23 bool once_,
unsigned newId )
24 :
WatchPoint(
std::move(command_),
std::move(condition_), type_, beginAddr_, endAddr_, once_, newId)
25 , motherboard(motherboard_)
27 for (
unsigned i = narrow_cast<byte>(beginAddr_); i <= narrow_cast<byte>(endAddr_); ++i) {
28 ios.push_back(std::make_unique<MSXWatchIODevice>(
36 return *ios[port -
begin];
39void WatchIO::doReadCallback(
unsigned port)
42 if (cpuInterface.isFastForward())
return;
50 auto keepAlive = shared_from_this();
53 cpuInterface.removeWatchPoint(keepAlive);
56 interp.unsetVariable(
"wp_last_address");
59void WatchIO::doWriteCallback(
unsigned port,
unsigned value)
62 if (cpuInterface.isFastForward())
return;
66 interp.
setVariable(TclObject(
"wp_last_address"), TclObject(
int(port)));
67 interp.setVariable(TclObject(
"wp_last_value"), TclObject(
int(value)));
70 auto keepAlive = shared_from_this();
73 cpuInterface.removeWatchPoint(keepAlive);
76 interp.unsetVariable(
"wp_last_address");
77 interp.unsetVariable(
"wp_last_value");
90const std::string& MSXWatchIODevice::getName()
const
96byte MSXWatchIODevice::peekIO(
word port, EmuTime::param time)
const
99 return device->
peekIO(port, time);
102byte MSXWatchIODevice::readIO(
word port, EmuTime::param time)
107 watchIO.doReadCallback(port);
108 return device->
readIO(port, time);
111void MSXWatchIODevice::writeIO(
word port,
byte value, EmuTime::param time)
116 device->
writeIO(port, value, time);
117 watchIO.doWriteCallback(port, value);
bool checkAndExecute(GlobalCliComm &cliComm, Interpreter &interp)
void setVariable(const TclObject &name, const TclObject &value)
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 const std::string & getName() const
Returns a human-readable name for this device.
virtual byte readIO(word port, EmuTime::param time)
Read a byte from an IO port at a certain time from this device.
const HardwareConfig * getMachineConfig() const
MSXCPUInterface & getCPUInterface()
StateChangeDistributor & getStateChangeDistributor()
MSXWatchIODevice(const HardwareConfig &hwConf, WatchIO &watchIO)
GlobalCliComm & getGlobalCliComm()
Interpreter & getInterpreter()
auto tempBlockNewEventsDuringReplay()
MSXWatchIODevice & getDevice(byte port)
WatchIO(MSXMotherBoard &motherboard, WatchPoint::Type type, unsigned beginAddr, unsigned endAddr, TclObject command, TclObject condition, bool once, unsigned newId=-1)
Base class for CPU breakpoints.
unsigned getBeginAddress() const
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
auto remove(ForwardRange &&range, const T &value)
constexpr auto begin(const zstring_view &x)