diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 0884948c0..4056683a9 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -22,13 +22,17 @@ #include "FSNode.hxx" #include "DiStella.hxx" #include "Debugger.hxx" +#include "DebuggerParser.hxx" #include "CpuDebug.hxx" #include "OSystem.hxx" #include "Settings.hxx" #include "Version.hxx" +#include "Cart.hxx" #include "CartDebug.hxx" #include "CartDebugWidget.hxx" #include "CartRamWidget.hxx" +#include "System.hxx" +#include "Base.hxx" using Common::Base; using std::hex; using std::dec; @@ -179,6 +183,18 @@ int CartDebug::readFromWritePort() return 0; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartDebug::lastReadBaseAddress() +{ + return mySystem.m6502().lastReadBaseAddress(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartDebug::lastWriteBaseAddress() +{ + return mySystem.m6502().lastWriteBaseAddress(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string CartDebug::toString() { @@ -513,6 +529,18 @@ bool CartDebug::addDirective(CartDebug::DisasmType type, return true; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartDebug::getBank() +{ + return myConsole.cartridge().getBank(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartDebug::bankCount() const +{ + return myConsole.cartridge().bankCount(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartDebug::addLabel(const string& label, uInt16 address) { diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index cce9e600b..5c24d86a1 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -26,11 +26,7 @@ class CartDebugWidget; #include #include "bspf.hxx" -#include "Base.hxx" -#include "Cart.hxx" #include "DebuggerSystem.hxx" -#include "System.hxx" -#include "M6502.hxx" // Function type for CartDebug instance methods class CartDebug; @@ -122,9 +118,9 @@ class CartDebug : public DebuggerSystem int readFromWritePort(); // Return the base (= non-mirrored) address of the last CPU read - int lastReadBaseAddress() { return mySystem.m6502().lastReadBaseAddress(); } + int lastReadBaseAddress(); // Return the base (= non-mirrored) address of the last CPU write - int lastWriteBaseAddress() { return mySystem.m6502().lastWriteBaseAddress(); } + int lastWriteBaseAddress(); // The following two methods are meant to be used together // First, a call is made to disassemble(), which updates the disassembly @@ -190,17 +186,12 @@ class CartDebug : public DebuggerSystem Get the current bank in use by the cartridge (non-const because of use in YaccParser) */ - int getBank() { return myConsole.cartridge().getBank(); } + int getBank(); /** Get the total number of banks supported by the cartridge. */ - int bankCount() const { return myConsole.cartridge().bankCount(); } - - /** - Get the name/type of the cartridge. // FIXME - dead code - */ - string getCartType() const { return myConsole.cartridge().name(); } + int bankCount() const; /** Add a label and associated address. @@ -293,19 +284,6 @@ class CartDebug : public DebuggerSystem DirectiveList directiveList; // overrides for automatic code determination BankInfo() : start(0), end(0), offset(0), size(0) { } -#if 0 - friend ostream& operator<<(ostream& os, const BankInfo& b) - { - os << "start=$" << Common::Base::HEX4 << b.start - << ", end=$" << Common::Base::HEX4 << b.end - << ", offset=$" << Common::Base::HEX4 << b.offset - << ", size=" << dec << b.size << endl - << "addrlist: "; - for(const auto& i: b.addressList) - os << Common::Base::HEX4 << i << " "; - return os; - } -#endif }; // Address type information determined by Distella diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 491bf90ea..34271d827 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -29,6 +29,7 @@ #include "Settings.hxx" #include "DebuggerDialog.hxx" #include "DebuggerParser.hxx" +#include "StateManager.hxx" #include "Console.hxx" #include "System.hxx" @@ -179,6 +180,24 @@ string Debugger::autoExec(StringList* history) return buf.str(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +PackedBitArray& Debugger::breakPoints() const +{ + return mySystem.m6502().breakPoints(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +TrapArray& Debugger::readTraps() const +{ + return mySystem.m6502().readTraps(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +TrapArray& Debugger::writeTraps() const +{ + return mySystem.m6502().writeTraps(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const string Debugger::run(const string& command) { @@ -512,6 +531,12 @@ string Debugger::showWatches() return myParser->showWatches(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int Debugger::stringToValue(const string& stringval) +{ + return myParser->decipher_arg(stringval); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Debugger::patchROM(uInt16 addr, uInt8 value) { diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 97222c892..48fafee1d 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -27,23 +27,23 @@ class EditTextWidget; class RomWidget; class Expression; class PackedBitArray; +class TrapArray; class PromptWidget; class ButtonWidget; +class CartDebug; +class CpuDebug; +class RiotDebug; +class TIADebug; +class DebuggerParser; +class RewindManager; + #include #include "Base.hxx" #include "DialogContainer.hxx" #include "DebuggerDialog.hxx" -#include "DebuggerParser.hxx" -#include "StateManager.hxx" -#include "M6502.hxx" #include "System.hxx" -#include "Stack.hxx" -#include "CartDebug.hxx" -#include "CpuDebug.hxx" -#include "RiotDebug.hxx" -#include "TIADebug.hxx" #include "bspf.hxx" using FunctionMap = std::map>; @@ -146,9 +146,9 @@ class Debugger : public DialogContainer RomWidget& rom() const { return myDialog->rom(); } TiaOutputWidget& tiaOutput() const { return myDialog->tiaOutput(); } - PackedBitArray& breakPoints() const { return mySystem.m6502().breakPoints(); } - TrapArray& readTraps() const { return mySystem.m6502().readTraps(); } - TrapArray& writeTraps() const { return mySystem.m6502().writeTraps(); } + PackedBitArray& breakPoints() const; + TrapArray& readTraps() const; + TrapArray& writeTraps() const; /** Run the debugger command and return the result. @@ -163,8 +163,7 @@ class Debugger : public DialogContainer Convert between string->integer and integer->string, taking into account the current base format. */ - int stringToValue(const string& stringval) - { return myParser->decipher_arg(stringval); } + int stringToValue(const string& stringval); /* Convenience methods to get/set bit(s) in an 8-bit register */ static uInt8 set_bit(uInt8 input, uInt8 bit, bool on) diff --git a/src/debugger/gui/DelayQueueWidget.cxx b/src/debugger/gui/DelayQueueWidget.cxx index 5da8c6d70..658434548 100644 --- a/src/debugger/gui/DelayQueueWidget.cxx +++ b/src/debugger/gui/DelayQueueWidget.cxx @@ -20,6 +20,8 @@ #include "OSystem.hxx" #include "TIATypes.hxx" #include "Debugger.hxx" +#include "CartDebug.hxx" +#include "TIADebug.hxx" #include "Base.hxx" #include "TIA.hxx"