openMSX
SimpleDebuggable.cc
Go to the documentation of this file.
1 #include "SimpleDebuggable.hh"
2 #include "MSXMotherBoard.hh"
3 #include "Debugger.hh"
4 #include "unreachable.hh"
5 
6 namespace openmsx {
7 
9  MSXMotherBoard& motherBoard_, std::string name_,
10  std::string description_, unsigned size_)
11  : motherBoard(motherBoard_)
12  , name(std::move(name_))
13  , description(std::move(description_))
14  , size(size_)
15 {
16  motherBoard.getDebugger().registerDebuggable(name, *this);
17 }
18 
20 {
21  motherBoard.getDebugger().unregisterDebuggable(name, *this);
22 }
23 
24 unsigned SimpleDebuggable::getSize() const
25 {
26  return size;
27 }
28 
29 const std::string& SimpleDebuggable::getDescription() const
30 {
31  return description;
32 }
33 
34 byte SimpleDebuggable::read(unsigned address)
35 {
36  return read(address, motherBoard.getCurrentTime());
37 }
38 
39 byte SimpleDebuggable::read(unsigned /*address*/, EmuTime::param /*time*/)
40 {
41  UNREACHABLE; return 0;
42 }
43 
44 void SimpleDebuggable::write(unsigned address, byte value)
45 {
46  write(address, value, motherBoard.getCurrentTime());
47 }
48 
49 void SimpleDebuggable::write(unsigned /*address*/, byte /*value*/,
50  EmuTime::param /*time*/)
51 {
52  // does nothing
53 }
54 
55 } // namespace openmsx
openmsx::MSXMotherBoard::getCurrentTime
EmuTime::param getCurrentTime()
Convenience method: This is the same as getScheduler().getCurrentTime().
Definition: MSXMotherBoard.cc:490
utf8::unchecked::size
size_t size(std::string_view utf8)
Definition: utf8_unchecked.hh:227
openmsx::SimpleDebuggable::~SimpleDebuggable
~SimpleDebuggable()
Definition: SimpleDebuggable.cc:19
openmsx::Debugger::registerDebuggable
void registerDebuggable(std::string name, Debuggable &debuggable)
Definition: Debugger.cc:48
UNREACHABLE
#define UNREACHABLE
Definition: unreachable.hh:38
openmsx::MSXMotherBoard
Definition: MSXMotherBoard.hh:59
openmsx::SimpleDebuggable::write
void write(unsigned address, byte value) override
Definition: SimpleDebuggable.cc:44
SimpleDebuggable.hh
openmsx::SimpleDebuggable::getDescription
const std::string & getDescription() const final override
Definition: SimpleDebuggable.cc:29
openmsx::SimpleDebuggable::getSize
unsigned getSize() const final override
Definition: SimpleDebuggable.cc:24
unreachable.hh
openmsx::MSXMotherBoard::getDebugger
Debugger & getDebugger()
Definition: MSXMotherBoard.hh:123
openmsx::SimpleDebuggable::SimpleDebuggable
SimpleDebuggable(MSXMotherBoard &motherBoard, std::string name, std::string description, unsigned size)
Definition: SimpleDebuggable.cc:8
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
MSXMotherBoard.hh
openmsx::SimpleDebuggable::read
byte read(unsigned address) override
Definition: SimpleDebuggable.cc:34
Debugger.hh
openmsx::Debugger::unregisterDebuggable
void unregisterDebuggable(std::string_view name, Debuggable &debuggable)
Definition: Debugger.cc:54