16 unsigned beginAddr_,
unsigned endAddr_,
18 bool once_,
unsigned newId )
19 :
WatchPoint(std::move(command_), std::move(condition_), type_, beginAddr_, endAddr_, once_, newId)
20 , motherboard(motherboard_)
22 for (
unsigned i =
byte(beginAddr_); i <=
byte(endAddr_); ++i) {
23 ios.push_back(std::make_unique<MSXWatchIODevice>(
31 return *ios[port -
begin];
34 void WatchIO::doReadCallback(
unsigned port)
37 if (cpuInterface.isFastForward())
return;
45 auto keepAlive = shared_from_this();
48 cpuInterface.removeWatchPoint(keepAlive);
51 interp.unsetVariable(
"wp_last_address");
54 void WatchIO::doWriteCallback(
unsigned port,
unsigned value)
57 if (cpuInterface.isFastForward())
return;
61 interp.
setVariable(TclObject(
"wp_last_address"), TclObject(
int(port)));
62 interp.setVariable(TclObject(
"wp_last_value"), TclObject(
int(value)));
65 auto keepAlive = shared_from_this();
68 cpuInterface.removeWatchPoint(keepAlive);
71 interp.unsetVariable(
"wp_last_address");
72 interp.unsetVariable(
"wp_last_value");
86 std::string MSXWatchIODevice::getName()
const
92 byte MSXWatchIODevice::peekIO(
word port, EmuTime::param time)
const
95 return device->
peekIO(port, time);
98 byte MSXWatchIODevice::readIO(
word port, EmuTime::param time)
103 watchIO.doReadCallback(port);
104 return device->
readIO(port, time);
107 void MSXWatchIODevice::writeIO(
word port,
byte value, EmuTime::param time)
112 device->
writeIO(port, value, time);
113 watchIO.doWriteCallback(port, value);
void 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 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.
MSXCPUInterface & getCPUInterface()
const HardwareConfig * getMachineConfig() const
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:
uint8_t byte
8 bit unsigned integer
uint16_t word
16 bit unsigned integer
constexpr auto begin(const zstring_view &x)