openMSX
MSXCPUInterface.hh
Go to the documentation of this file.
1 #ifndef MSXCPUINTERFACE_HH
2 #define MSXCPUINTERFACE_HH
3 
4 #include "DebugCondition.hh"
5 #include "SimpleDebuggable.hh"
6 #include "InfoTopic.hh"
7 #include "CacheLine.hh"
8 #include "MSXDevice.hh"
9 #include "BreakPoint.hh"
10 #include "WatchPoint.hh"
11 #include "ProfileCounters.hh"
12 #include "openmsx.hh"
13 #include "likely.hh"
14 #include "ranges.hh"
15 #include <bitset>
16 #include <vector>
17 #include <memory>
18 
19 namespace openmsx {
20 
21 class VDPIODelay;
22 class DummyDevice;
23 class MSXMotherBoard;
24 class MSXCPU;
25 class CliComm;
26 class BreakPoint;
27 class CartridgeSlotManager;
28 
30  bool operator()(const BreakPoint& x, const BreakPoint& y) const {
31  return x.getAddress() < y.getAddress();
32  }
33  bool operator()(const BreakPoint& x, word y) const {
34  return x.getAddress() < y;
35  }
36  bool operator()(word x, const BreakPoint& y) const {
37  return x < y.getAddress();
38  }
39 };
40 
41 constexpr bool PROFILE_CACHELINES = false;
58  NUM // must be last
59 };
60 std::ostream& operator<<(std::ostream& os, EnumTypeName<CacheLineCounters>);
61 std::ostream& operator<<(std::ostream& os, EnumValueName<CacheLineCounters> evn);
62 
63 class MSXCPUInterface : public ProfileCounters<PROFILE_CACHELINES, CacheLineCounters>
64 {
65 public:
66  MSXCPUInterface(const MSXCPUInterface&) = delete;
67  MSXCPUInterface& operator=(const MSXCPUInterface&) = delete;
68 
69  explicit MSXCPUInterface(MSXMotherBoard& motherBoard);
71 
77  void register_IO_In(byte port, MSXDevice* device);
78  void unregister_IO_In(byte port, MSXDevice* device);
79 
85  void register_IO_Out(byte port, MSXDevice* device);
86  void unregister_IO_Out(byte port, MSXDevice* device);
87 
103  bool replace_IO_In (byte port, MSXDevice* oldDevice, MSXDevice* newDevice);
104  bool replace_IO_Out(byte port, MSXDevice* oldDevice, MSXDevice* newDevice);
105 
112  void registerMemDevice(MSXDevice& device,
113  int ps, int ss, int base, int size);
114  void unregisterMemDevice(MSXDevice& device,
115  int ps, int ss, int base, int size);
116 
120  void registerGlobalWrite(MSXDevice& device, word address);
121  void unregisterGlobalWrite(MSXDevice& device, word address);
122 
126  void registerGlobalRead(MSXDevice& device, word address);
127  void unregisterGlobalRead(MSXDevice& device, word address);
128 
132  void reset();
133 
137  inline byte readMem(word address, EmuTime::param time) {
139  if (unlikely(disallowReadCache[address >> CacheLine::BITS])) {
140  return readMemSlow(address, time);
141  }
142  return visibleDevices[address >> 14]->readMem(address, time);
143  }
144 
148  inline void writeMem(word address, byte value, EmuTime::param time) {
150  if (unlikely(disallowWriteCache[address >> CacheLine::BITS])) {
151  writeMemSlow(address, value, time);
152  return;
153  }
154  visibleDevices[address>>14]->writeMem(address, value, time);
155  }
156 
161  inline byte readIO(word port, EmuTime::param time) {
162  return IO_In[port & 0xFF]->readIO(port, time);
163  }
164 
169  inline void writeIO(word port, byte value, EmuTime::param time) {
170  IO_Out[port & 0xFF]->writeIO(port, value, time);
171  }
172 
185  inline const byte* getReadCacheLine(word start) const {
187  if (unlikely(disallowReadCache[start >> CacheLine::BITS])) {
188  return nullptr;
189  }
190  return visibleDevices[start >> 14]->getReadCacheLine(start);
191  }
192 
205  inline byte* getWriteCacheLine(word start) const {
207  if (unlikely(disallowWriteCache[start >> CacheLine::BITS])) {
208  return nullptr;
209  }
210  return visibleDevices[start >> 14]->getWriteCacheLine(start);
211  }
212 
217  byte readIRQVector();
218 
219  /*
220  * Should only be used by PPI
221  * TODO: make private / friend
222  */
223  void setPrimarySlots(byte value);
224 
226  void invalidateRWCache(word start, unsigned size, int ps, int ss);
227  void invalidateRCache (word start, unsigned size, int ps, int ss);
228  void invalidateWCache (word start, unsigned size, int ps, int ss);
229 
231  void fillRWCache(unsigned start, unsigned size, const byte* rData, byte* wData, int ps, int ss);
232  void fillRCache (unsigned start, unsigned size, const byte* rData, int ps, int ss);
233  void fillWCache (unsigned start, unsigned size, byte* wData, int ps, int ss);
234 
239  byte peekMem(word address, EmuTime::param time) const;
240  byte peekSlottedMem(unsigned address, EmuTime::param time) const;
241  byte readSlottedMem(unsigned address, EmuTime::param time);
242  void writeSlottedMem(unsigned address, byte value,
243  EmuTime::param time);
244 
245  void setExpanded(int ps);
246  void unsetExpanded(int ps);
247  void testUnsetExpanded(int ps, std::vector<MSXDevice*> allowed) const;
248  inline bool isExpanded(int ps) const { return expanded[ps] != 0; }
249  void changeExpanded(bool newExpanded);
250 
251  DummyDevice& getDummyDevice() { return *dummyDevice; }
252 
253  static void insertBreakPoint(BreakPoint bp);
254  static void removeBreakPoint(const BreakPoint& bp);
255  using BreakPoints = std::vector<BreakPoint>;
256  static const BreakPoints& getBreakPoints() { return breakPoints; }
257 
258  void setWatchPoint(const std::shared_ptr<WatchPoint>& watchPoint);
259  void removeWatchPoint(std::shared_ptr<WatchPoint> watchPoint);
260  // note: must be shared_ptr (not unique_ptr), see WatchIO::doReadCallback()
261  using WatchPoints = std::vector<std::shared_ptr<WatchPoint>>;
262  const WatchPoints& getWatchPoints() const { return watchPoints; }
263 
264  static void setCondition(DebugCondition cond);
265  static void removeCondition(const DebugCondition& cond);
266  using Conditions = std::vector<DebugCondition>;
267  static const Conditions& getConditions() { return conditions; }
268 
269  static bool isBreaked() { return breaked; }
270  void doBreak();
271  void doStep();
272  void doContinue();
273 
274  // breakpoint methods used by CPUCore
275  static bool anyBreakPoints()
276  {
277  return !breakPoints.empty() || !conditions.empty();
278  }
279  static bool checkBreakPoints(unsigned pc, MSXMotherBoard& motherBoard)
280  {
281  auto range = ranges::equal_range(breakPoints, pc, CompareBreakpoints());
282  if (conditions.empty() && (range.first == range.second)) {
283  return false;
284  }
285 
286  // slow path non-inlined
287  checkBreakPoints(range, motherBoard);
288  return isBreaked();
289  }
290 
291  // cleanup global variables
292  static void cleanup();
293 
294  // In fast-forward mode, breakpoints, watchpoints and conditions should
295  // not trigger.
296  void setFastForward(bool fastForward_) { fastForward = fastForward_; }
297  bool isFastForward() const { return fastForward; }
298 
299  template<typename Archive>
300  void serialize(Archive& ar, unsigned version);
301 
302 private:
303  byte readMemSlow(word address, EmuTime::param time);
304  void writeMemSlow(word address, byte value, EmuTime::param time);
305 
306  MSXDevice*& getDevicePtr(byte port, bool isIn);
307 
308  void register_IO (int port, bool isIn,
309  MSXDevice*& devicePtr, MSXDevice* device);
310  void unregister_IO(MSXDevice*& devicePtr, MSXDevice* device);
311  void testRegisterSlot(MSXDevice& device,
312  int ps, int ss, int base, int size);
313  void registerSlot(MSXDevice& device,
314  int ps, int ss, int base, int size);
315  void unregisterSlot(MSXDevice& device,
316  int ps, int ss, int base, int size);
317 
318 
319  static void checkBreakPoints(std::pair<BreakPoints::const_iterator,
320  BreakPoints::const_iterator> range,
321  MSXMotherBoard& motherBoard);
322  static void removeBreakPoint(unsigned id);
323  static void removeCondition(unsigned id);
324 
325  void removeAllWatchPoints();
326  void registerIOWatch (WatchPoint& watchPoint, MSXDevice** devices);
327  void unregisterIOWatch(WatchPoint& watchPoint, MSXDevice** devices);
328  void updateMemWatch(WatchPoint::Type type);
329  void executeMemWatch(WatchPoint::Type type, unsigned address,
330  unsigned value = ~0u);
331 
332  struct MemoryDebug final : SimpleDebuggable {
333  explicit MemoryDebug(MSXMotherBoard& motherBoard);
334  byte read(unsigned address, EmuTime::param time) override;
335  void write(unsigned address, byte value, EmuTime::param time) override;
336  } memoryDebug;
337 
338  struct SlottedMemoryDebug final : SimpleDebuggable {
339  explicit SlottedMemoryDebug(MSXMotherBoard& motherBoard);
340  byte read(unsigned address, EmuTime::param time) override;
341  void write(unsigned address, byte value, EmuTime::param time) override;
342  } slottedMemoryDebug;
343 
344  struct IODebug final : SimpleDebuggable {
345  explicit IODebug(MSXMotherBoard& motherBoard);
346  byte read(unsigned address, EmuTime::param time) override;
347  void write(unsigned address, byte value, EmuTime::param time) override;
348  } ioDebug;
349 
350  struct SlotInfo final : InfoTopic {
351  explicit SlotInfo(InfoCommand& machineInfoCommand);
352  void execute(span<const TclObject> tokens,
353  TclObject& result) const override;
354  std::string help(const std::vector<std::string>& tokens) const override;
355  } slotInfo;
356 
357  struct SubSlottedInfo final : InfoTopic {
358  explicit SubSlottedInfo(InfoCommand& machineInfoCommand);
359  void execute(span<const TclObject> tokens,
360  TclObject& result) const override;
361  std::string help(const std::vector<std::string>& tokens) const override;
362  } subSlottedInfo;
363 
364  struct ExternalSlotInfo final : InfoTopic {
365  explicit ExternalSlotInfo(InfoCommand& machineInfoCommand);
366  void execute(span<const TclObject> tokens,
367  TclObject& result) const override;
368  std::string help(const std::vector<std::string>& tokens) const override;
369  } externalSlotInfo;
370 
371  struct IOInfo : InfoTopic {
372  IOInfo(InfoCommand& machineInfoCommand, const char* name);
373  void helper(span<const TclObject> tokens,
374  TclObject& result, MSXDevice** devices) const;
375  std::string help(const std::vector<std::string>& tokens) const override;
376  protected:
377  ~IOInfo() = default;
378  };
379  struct IInfo final : IOInfo {
380  explicit IInfo(InfoCommand& machineInfoCommand)
381  : IOInfo(machineInfoCommand, "input_port") {}
382  void execute(span<const TclObject> tokens,
383  TclObject& result) const override;
384  } inputPortInfo;
385  struct OInfo final : IOInfo {
386  explicit OInfo(InfoCommand& machineInfoCommand)
387  : IOInfo(machineInfoCommand, "output_port") {}
388  void execute(span<const TclObject> tokens,
389  TclObject& result) const override;
390  } outputPortInfo;
391 
398  void updateVisible(int page);
399  inline void updateVisible(int page, int ps, int ss);
400  void setSubSlot(byte primSlot, byte value);
401 
402  std::unique_ptr<DummyDevice> dummyDevice;
403  MSXCPU& msxcpu;
404  CliComm& cliComm;
405  MSXMotherBoard& motherBoard;
406 
407  std::unique_ptr<VDPIODelay> delayDevice; // can be nullptr
408 
409  byte disallowReadCache [CacheLine::NUM];
410  byte disallowWriteCache[CacheLine::NUM];
411  std::bitset<CacheLine::SIZE> readWatchSet [CacheLine::NUM];
412  std::bitset<CacheLine::SIZE> writeWatchSet[CacheLine::NUM];
413 
414  struct GlobalRwInfo {
415  MSXDevice* device;
416  word addr;
417  bool operator==(const GlobalRwInfo& rhs) const {
418  return (device == rhs.device) &&
419  (addr == rhs.addr);
420  }
421  };
422  std::vector<GlobalRwInfo> globalReads;
423  std::vector<GlobalRwInfo> globalWrites;
424 
425  MSXDevice* IO_In [256];
426  MSXDevice* IO_Out[256];
427  MSXDevice* slotLayout[4][4][4];
428  MSXDevice* visibleDevices[4];
429  byte subSlotRegister[4];
430  byte primarySlotState[4];
431  byte secondarySlotState[4];
432  byte initialPrimarySlots;
433  unsigned expanded[4];
434 
435  bool fastForward; // no need to serialize
436 
437  // All CPUs (Z80 and R800) of all MSX machines share this state.
438  static inline BreakPoints breakPoints; // sorted on address
439  WatchPoints watchPoints; // ordered in creation order, TODO must also be static
440  static inline Conditions conditions; // ordered in creation order
441  static inline bool breaked = false;
442 };
443 
444 
445 // Compile-Time Interval (half-open).
446 // TODO possibly move this to utils/
447 template<unsigned BEGIN, unsigned END = BEGIN + 1>
449 {
450  unsigned begin() const { return BEGIN; } // inclusive
451  unsigned end() const { return END; } // exclusive
452 };
453 
454 // Execute an 'action' for every element in the given interval(s).
455 template<typename ACTION, typename CT_INTERVAL>
456 inline void foreach_ct_interval(ACTION action, CT_INTERVAL interval)
457 {
458  for (auto i = interval.begin(); i != interval.end(); ++i) {
459  action(i);
460  }
461 }
462 template<typename ACTION, typename CT_INTERVAL, typename... CT_INTERVALS>
463 inline void foreach_ct_interval(ACTION action, CT_INTERVAL front, CT_INTERVALS... tail)
464 {
465  foreach_ct_interval(action, front);
466  foreach_ct_interval(action, tail...);
467 }
468 
469 
470 template<typename MSXDEVICE, typename... CT_INTERVALS>
472 {
473  template<typename ACTION>
474  void execute(ACTION action)
475  {
476  auto& dev = static_cast<MSXDEVICE&>(*this);
477  auto& cpu = dev.getCPUInterface();
479  [&](unsigned addr) { action(cpu, dev, addr); },
480  CT_INTERVALS()...);
481  }
482 };
483 
484 template<typename MSXDEVICE, typename... CT_INTERVALS>
485 struct GlobalWriteClient : GlobalRWHelper<MSXDEVICE, CT_INTERVALS...>
486 {
488  {
489  this->execute([](MSXCPUInterface& cpu, MSXDevice& dev, unsigned addr) {
490  cpu.registerGlobalWrite(dev, addr);
491  });
492  }
493 
495  {
496  this->execute([](MSXCPUInterface& cpu, MSXDevice& dev, unsigned addr) {
497  cpu.unregisterGlobalWrite(dev, addr);
498  });
499  }
500 };
501 
502 template<typename MSXDEVICE, typename... CT_INTERVALS>
503 struct GlobalReadClient : GlobalRWHelper<MSXDEVICE, CT_INTERVALS...>
504 {
506  {
507  this->execute([](MSXCPUInterface& cpu, MSXDevice& dev, unsigned addr) {
508  cpu.registerGlobalRead(dev, addr);
509  });
510  }
511 
513  {
514  this->execute([](MSXCPUInterface& cpu, MSXDevice& dev, unsigned addr) {
515  cpu.unregisterGlobalRead(dev, addr);
516  });
517  }
518 };
519 
520 } // namespace openmsx
521 
522 #endif
openmsx::CacheLineCounters
CacheLineCounters
Definition: MSXCPUInterface.hh:42
openmsx::BreakPoint
Base class for CPU breakpoints.
Definition: BreakPoint.hh:13
openmsx::VDPIODelay
VDPIODelay
Definition: VDPIODelay.cc:75
openmsx::MSXDevice
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:31
openmsx.hh
openmsx::GlobalReadClient::~GlobalReadClient
~GlobalReadClient()
Definition: MSXCPUInterface.hh:512
openmsx::GlobalWriteClient::GlobalWriteClient
GlobalWriteClient()
Definition: MSXCPUInterface.hh:487
openmsx::FillReadWrite
@ FillReadWrite
Definition: MSXCPUInterface.hh:55
openmsx::SlowRead
@ SlowRead
Definition: MSXCPUInterface.hh:47
openmsx::MSXCPUInterface::WatchPoints
std::vector< std::shared_ptr< WatchPoint > > WatchPoints
Definition: MSXCPUInterface.hh:261
openmsx::MSXCPUInterface::doStep
void doStep()
Definition: MSXCPUInterface.cc:1015
unlikely
#define unlikely(x)
Definition: likely.hh:15
openmsx::MSXDevice::writeIO
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.
Definition: MSXDevice.cc:414
openmsx::MSXDevice::getReadCacheLine
virtual const byte * getReadCacheLine(word start) const
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: MSXDevice.cc:431
openmsx::NonCachedRead
@ NonCachedRead
Definition: MSXCPUInterface.hh:43
openmsx::MSXCPUInterface::getConditions
static const Conditions & getConditions()
Definition: MSXCPUInterface.hh:267
openmsx::GetWriteCacheLine
@ GetWriteCacheLine
Definition: MSXCPUInterface.hh:46
openmsx::CT_Interval::end
unsigned end() const
Definition: MSXCPUInterface.hh:451
openmsx::MSXCPUInterface::setPrimarySlots
void setPrimarySlots(byte value)
Definition: MSXCPUInterface.cc:661
openmsx::InvalidateReadWrite
@ InvalidateReadWrite
Definition: MSXCPUInterface.hh:52
openmsx::MSXDevice::readMem
virtual byte readMem(word address, EmuTime::param time)
Read a byte from a location at a certain time from this device.
Definition: MSXDevice.cc:425
openmsx::MSXDevice::getWriteCacheLine
virtual byte * getWriteCacheLine(word start) const
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: MSXDevice.cc:465
utf8::unchecked::size
size_t size(std::string_view utf8)
Definition: utf8_unchecked.hh:227
openmsx::MSXCPUInterface::register_IO_Out
void register_IO_Out(byte port, MSXDevice *device)
Devices can register their Out ports.
Definition: MSXCPUInterface.cc:350
openmsx::CT_Interval::begin
unsigned begin() const
Definition: MSXCPUInterface.hh:450
openmsx::GlobalWriteClient
Definition: MSXCPUInterface.hh:485
openmsx::WatchPoint
Base class for CPU breakpoints.
Definition: WatchPoint.hh:13
openmsx::MSXCPUInterface::isFastForward
bool isFastForward() const
Definition: MSXCPUInterface.hh:297
openmsx::SimpleDebuggable
Definition: SimpleDebuggable.hh:11
openmsx::MSXCPUInterface::~MSXCPUInterface
~MSXCPUInterface()
Definition: MSXCPUInterface.cc:138
openmsx::MSXCPUInterface::operator=
MSXCPUInterface & operator=(const MSXCPUInterface &)=delete
openmsx::MSXCPUInterface::isExpanded
bool isExpanded(int ps) const
Definition: MSXCPUInterface.hh:248
ranges.hh
openmsx::MSXCPUInterface::MSXCPUInterface
MSXCPUInterface(const MSXCPUInterface &)=delete
openmsx::MSXCPUInterface::peekSlottedMem
byte peekSlottedMem(unsigned address, EmuTime::param time) const
Definition: MSXCPUInterface.cc:731
openmsx::MSXCPUInterface::invalidateRCache
void invalidateRCache(word start, unsigned size, int ps, int ss)
Definition: MSXCPUInterface.cc:621
DebugCondition.hh
openmsx::BreakPoint::getAddress
word getAddress() const
Definition: BreakPoint.hh:21
openmsx::MSXCPUInterface::invalidateWCache
void invalidateWCache(word start, unsigned size, int ps, int ss)
Definition: MSXCPUInterface.cc:626
EnumValueName
Definition: ProfileCounters.hh:18
openmsx::MSXDevice::writeMem
virtual void writeMem(word address, byte value, EmuTime::param time)
Write a given byte to a given location at a certain time to this device.
Definition: MSXDevice.cc:436
openmsx::MSXCPU
MSXCPU
Definition: MSXCPU.cc:563
openmsx::MSXCPUInterface::readIO
byte readIO(word port, EmuTime::param time)
This read a byte from the given IO-port.
Definition: MSXCPUInterface.hh:161
openmsx::FillRead
@ FillRead
Definition: MSXCPUInterface.hh:56
openmsx::MSXCPUInterface::writeMem
void writeMem(word address, byte value, EmuTime::param time)
This writes a byte to the currently selected device.
Definition: MSXCPUInterface.hh:148
WatchPoint.hh
openmsx::GlobalRWHelper::execute
void execute(ACTION action)
Definition: MSXCPUInterface.hh:474
openmsx::MSXCPUInterface
Definition: MSXCPUInterface.hh:63
openmsx::GlobalRWHelper
Definition: MSXCPUInterface.hh:471
openmsx::MSXCPUInterface::setCondition
static void setCondition(DebugCondition cond)
Definition: MSXCPUInterface.cc:879
openmsx::SlowWrite
@ SlowWrite
Definition: MSXCPUInterface.hh:48
openmsx::MSXCPUInterface::checkBreakPoints
static bool checkBreakPoints(unsigned pc, MSXMotherBoard &motherBoard)
Definition: MSXCPUInterface.hh:279
span
Definition: span.hh:34
likely.hh
openmsx::MSXCPUInterface::readMem
byte readMem(word address, EmuTime::param time)
This reads a byte from the currently selected device.
Definition: MSXCPUInterface.hh:137
openmsx::DisallowCacheRead
@ DisallowCacheRead
Definition: MSXCPUInterface.hh:49
openmsx::InvalidateAllSlots
@ InvalidateAllSlots
Definition: MSXCPUInterface.hh:51
openmsx::InvalidateWrite
@ InvalidateWrite
Definition: MSXCPUInterface.hh:54
openmsx::MSXCPUInterface::getBreakPoints
static const BreakPoints & getBreakPoints()
Definition: MSXCPUInterface.hh:256
openmsx::MSXCPUInterface::registerMemDevice
void registerMemDevice(MSXDevice &device, int ps, int ss, int base, int size)
Devices can register themself in the MSX slotstructure.
Definition: MSXCPUInterface.cc:513
openmsx::MSXCPUInterface::testUnsetExpanded
void testUnsetExpanded(int ps, std::vector< MSXDevice * > allowed) const
Definition: MSXCPUInterface.cc:259
openmsx::MSXCPUInterface::setFastForward
void setFastForward(bool fastForward_)
Definition: MSXCPUInterface.hh:296
EnumTypeName
Definition: ProfileCounters.hh:12
openmsx::CacheLine::NUM
constexpr unsigned NUM
Definition: CacheLine.hh:8
openmsx::WatchPoint::Type
Type
Definition: WatchPoint.hh:16
openmsx::MSXCPUInterface::registerGlobalRead
void registerGlobalRead(MSXDevice &device, word address)
(Un)register global read.
Definition: MSXCPUInterface.cc:579
openmsx::MSXCPUInterface::insertBreakPoint
static void insertBreakPoint(BreakPoint bp)
Definition: MSXCPUInterface.cc:783
openmsx::MSXCPUInterface::cleanup
static void cleanup()
Definition: MSXCPUInterface.cc:1037
openmsx::MSXCPUInterface::readIRQVector
byte readIRQVector()
CPU uses this method to read 'extra' data from the databus used in interrupt routines.
Definition: MSXCPUInterface.cc:656
openmsx::MSXCPUInterface::registerGlobalWrite
void registerGlobalWrite(MSXDevice &device, word address)
(Un)register global writes.
Definition: MSXCPUInterface.cc:555
openmsx::CompareBreakpoints
Definition: MSXCPUInterface.hh:29
openmsx::CompareBreakpoints::operator()
bool operator()(word x, const BreakPoint &y) const
Definition: MSXCPUInterface.hh:36
openmsx::NonCachedWrite
@ NonCachedWrite
Definition: MSXCPUInterface.hh:44
openmsx::MSXMotherBoard
Definition: MSXMotherBoard.hh:59
openmsx::MSXCPUInterface::isBreaked
static bool isBreaked()
Definition: MSXCPUInterface.hh:269
openmsx::MSXCPUInterface::replace_IO_In
bool replace_IO_In(byte port, MSXDevice *oldDevice, MSXDevice *newDevice)
These methods replace a previously registered device with a new one.
Definition: MSXCPUInterface.cc:407
MSXDevice.hh
openmsx::SimpleDebuggable::write
void write(unsigned address, byte value) override
Definition: SimpleDebuggable.cc:44
openmsx::PROFILE_CACHELINES
constexpr bool PROFILE_CACHELINES
Definition: MSXCPUInterface.hh:41
openmsx::MSXCPUInterface::setWatchPoint
void setWatchPoint(const std::shared_ptr< WatchPoint > &watchPoint)
Definition: MSXCPUInterface.cc:832
BreakPoint.hh
openmsx::MSXCPUInterface::writeSlottedMem
void writeSlottedMem(unsigned address, byte value, EmuTime::param time)
Definition: MSXCPUInterface.cc:765
openmsx::GlobalWriteClient::~GlobalWriteClient
~GlobalWriteClient()
Definition: MSXCPUInterface.hh:494
CacheLine.hh
openmsx::CT_Interval
Definition: MSXCPUInterface.hh:448
openmsx::operator<<
std::ostream & operator<<(std::ostream &os, EnumTypeName< CacheLineCounters >)
Definition: MSXCPUInterface.cc:50
openmsx::MSXCPUInterface::fillWCache
void fillWCache(unsigned start, unsigned size, byte *wData, int ps, int ss)
Definition: MSXCPUInterface.cc:642
openmsx::MSXCPUInterface::reset
void reset()
Reset (the slot state)
Definition: MSXCPUInterface.cc:648
openmsx::MSXCPUInterface::register_IO_In
void register_IO_In(byte port, MSXDevice *device)
Devices can register their In ports.
Definition: MSXCPUInterface.cc:338
openmsx::GlobalReadClient::GlobalReadClient
GlobalReadClient()
Definition: MSXCPUInterface.hh:505
SimpleDebuggable.hh
openmsx::MSXCPUInterface::changeExpanded
void changeExpanded(bool newExpanded)
Definition: MSXCPUInterface.cc:313
openmsx::DebugCondition
General debugger condition Like breakpoints, but not tied to a specifc address.
Definition: DebugCondition.hh:11
openmsx::MSXCPUInterface::unregister_IO_In
void unregister_IO_In(byte port, MSXDevice *device)
Definition: MSXCPUInterface.cc:344
openmsx::DummyDevice
Definition: DummyDevice.hh:8
openmsx::MSXCPUInterface::doBreak
void doBreak()
Definition: MSXCPUInterface.cc:1000
openmsx::x
constexpr KeyMatrixPosition x
Keyboard bindings.
Definition: Keyboard.cc:1419
openmsx::MSXCPUInterface::getDummyDevice
DummyDevice & getDummyDevice()
Definition: MSXCPUInterface.hh:251
openmsx::MSXCPUInterface::fillRWCache
void fillRWCache(unsigned start, unsigned size, const byte *rData, byte *wData, int ps, int ss)
Definition: MSXCPUInterface.cc:632
openmsx::MSXDevice::readIO
virtual byte readIO(word port, EmuTime::param time)
Read a byte from an IO port at a certain time from this device.
Definition: MSXDevice.cc:408
ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick
void tick(CacheLineCounters e) const
Definition: ProfileCounters.hh:97
openmsx::MSXCPUInterface::anyBreakPoints
static bool anyBreakPoints()
Definition: MSXCPUInterface.hh:275
ProfileCounters
Definition: ProfileCounters.hh:85
openmsx::CacheLine::BITS
constexpr unsigned BITS
Definition: CacheLine.hh:6
openmsx::MSXCPUInterface::removeWatchPoint
void removeWatchPoint(std::shared_ptr< WatchPoint > watchPoint)
Definition: MSXCPUInterface.cc:852
openmsx::MSXCPUInterface::getReadCacheLine
const byte * getReadCacheLine(word start) const
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: MSXCPUInterface.hh:185
openmsx::CompareBreakpoints::operator()
bool operator()(const BreakPoint &x, word y) const
Definition: MSXCPUInterface.hh:33
openmsx::MSXCPUInterface::getWriteCacheLine
byte * getWriteCacheLine(word start) const
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: MSXCPUInterface.hh:205
openmsx::GlobalReadClient
Definition: MSXCPUInterface.hh:503
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::MSXCPUInterface::serialize
void serialize(Archive &ar, unsigned version)
Definition: MSXCPUInterface.cc:1250
openmsx::MSXCPUInterface::readSlottedMem
byte readSlottedMem(unsigned address, EmuTime::param time)
Definition: MSXCPUInterface.cc:748
openmsx::MSXCPUInterface::unregisterGlobalRead
void unregisterGlobalRead(MSXDevice &device, word address)
Definition: MSXCPUInterface.cc:587
openmsx::MSXCPUInterface::unsetExpanded
void unsetExpanded(int ps)
Definition: MSXCPUInterface.cc:299
operator==
constexpr bool operator==(const uint128 &a, const uint128 &b)
Definition: uint128.hh:238
openmsx::MSXDevice
MSXDevice
Definition: MSXDevice.cc:538
InfoTopic.hh
openmsx::MSXCPUInterface::getWatchPoints
const WatchPoints & getWatchPoints() const
Definition: MSXCPUInterface.hh:262
openmsx::MSXCPUInterface::Conditions
std::vector< DebugCondition > Conditions
Definition: MSXCPUInterface.hh:266
openmsx::NUM
@ NUM
Definition: MSXCPUInterface.hh:58
openmsx::CompareBreakpoints::operator()
bool operator()(const BreakPoint &x, const BreakPoint &y) const
Definition: MSXCPUInterface.hh:30
openmsx::MSXCPUInterface::unregister_IO_Out
void unregister_IO_Out(byte port, MSXDevice *device)
Definition: MSXCPUInterface.cc:356
openmsx::MSXCPUInterface::invalidateRWCache
void invalidateRWCache(word start, unsigned size, int ps, int ss)
Definition: MSXCPUInterface.cc:616
openmsx::MSXCPUInterface::unregisterMemDevice
void unregisterMemDevice(MSXDevice &device, int ps, int ss, int base, int size)
Definition: MSXCPUInterface.cc:543
openmsx::MSXCPUInterface::setExpanded
void setExpanded(int ps)
Definition: MSXCPUInterface.cc:245
openmsx::MSXCPUInterface::unregisterGlobalWrite
void unregisterGlobalWrite(MSXDevice &device, word address)
Definition: MSXCPUInterface.cc:563
openmsx::GetReadCacheLine
@ GetReadCacheLine
Definition: MSXCPUInterface.hh:45
openmsx::MSXCPUInterface::replace_IO_Out
bool replace_IO_Out(byte port, MSXDevice *oldDevice, MSXDevice *newDevice)
Definition: MSXCPUInterface.cc:418
ranges::equal_range
auto equal_range(ForwardRange &&range, const T &value)
Definition: ranges.hh:95
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::MSXCPUInterface::fillRCache
void fillRCache(unsigned start, unsigned size, const byte *rData, int ps, int ss)
Definition: MSXCPUInterface.cc:637
openmsx::MSXCPUInterface::removeCondition
static void removeCondition(const DebugCondition &cond)
Definition: MSXCPUInterface.cc:884
openmsx::MSXCPUInterface::removeBreakPoint
static void removeBreakPoint(const BreakPoint &bp)
Definition: MSXCPUInterface.cc:789
ProfileCounters.hh
openmsx::MSXCPUInterface::peekMem
byte peekMem(word address, EmuTime::param time) const
Peek memory location.
Definition: MSXCPUInterface.cc:722
openmsx::SimpleDebuggable::read
byte read(unsigned address) override
Definition: SimpleDebuggable.cc:34
openmsx::MSXCPUInterface::BreakPoints
std::vector< BreakPoint > BreakPoints
Definition: MSXCPUInterface.hh:255
openmsx::DisallowCacheWrite
@ DisallowCacheWrite
Definition: MSXCPUInterface.hh:50
openmsx::InvalidateRead
@ InvalidateRead
Definition: MSXCPUInterface.hh:53
openmsx::foreach_ct_interval
void foreach_ct_interval(ACTION action, CT_INTERVAL interval)
Definition: MSXCPUInterface.hh:456
openmsx::MSXCPUInterface::doContinue
void doContinue()
Definition: MSXCPUInterface.cc:1023
openmsx::MSXCPUInterface::writeIO
void writeIO(word port, byte value, EmuTime::param time)
This writes a byte to the given IO-port.
Definition: MSXCPUInterface.hh:169
openmsx::FillWrite
@ FillWrite
Definition: MSXCPUInterface.hh:57