17 unsigned beginAddr_,
unsigned endAddr_,
19 bool once_,
unsigned newId )
20 :
WatchPoint(
std::move(command_),
std::move(condition_), type_, beginAddr_, endAddr_, once_, newId)
21 , motherboard(motherboard_)
23 for (
unsigned i = narrow_cast<byte>(beginAddr_); i <= narrow_cast<byte>(endAddr_); ++i) {
24 ios.push_back(std::make_unique<MSXWatchIODevice>(
32 return *ios[port -
begin];
35void WatchIO::doReadCallback(
unsigned port)
38 if (cpuInterface.isFastForward())
return;
46 auto keepAlive = shared_from_this();
49 cpuInterface.removeWatchPoint(keepAlive);
52 interp.unsetVariable(
"wp_last_address");
55void WatchIO::doWriteCallback(
unsigned port,
unsigned value)
58 if (cpuInterface.isFastForward())
return;
62 interp.
setVariable(TclObject(
"wp_last_address"), TclObject(
int(port)));
63 interp.setVariable(TclObject(
"wp_last_value"), TclObject(
int(value)));
66 auto keepAlive = shared_from_this();
69 cpuInterface.removeWatchPoint(keepAlive);
72 interp.unsetVariable(
"wp_last_address");
73 interp.unsetVariable(
"wp_last_value");
86const std::string& MSXWatchIODevice::getName()
const
92byte MSXWatchIODevice::peekIO(
word port, EmuTime::param time)
const
95 return device->
peekIO(port, time);
98byte MSXWatchIODevice::readIO(
word port, EmuTime::param time)
103 watchIO.doReadCallback(port);
104 return device->
readIO(port, time);
107void MSXWatchIODevice::writeIO(
word port,
byte value, EmuTime::param time)
112 device->
writeIO(port, value, time);
113 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()
MSXWatchIODevice(const HardwareConfig &hwConf, WatchIO &watchIO)
GlobalCliComm & getGlobalCliComm()
Interpreter & getInterpreter()
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)