Fixed some minor issues with DelayQueueWidget.

- Removed redundant code to get TIA write address labels
  - Added '$' to indicate hex output
  - Added newlines to affected files.
This commit is contained in:
Stephen Anthony 2017-04-04 17:38:45 -02:30
parent 3df449603e
commit d3b50b5194
4 changed files with 12 additions and 161 deletions

View File

@ -22,149 +22,6 @@
#include "Debugger.hxx" #include "Debugger.hxx"
#include "Base.hxx" #include "Base.hxx"
static const string formatRegister(uInt8 address)
{
switch (address) {
case WSYNC:
return "WSYNC";
case RSYNC:
return "RSYNC";
case VSYNC:
return "VSYNC";
case VBLANK:
return "VBLANK";
case AUDV0:
return "AUDV0";
case AUDV1:
return "AUDV1";
case AUDF0:
return "AUDF0";
case AUDF1:
return "AUDF1";
case AUDC0:
return "AUDC0";
case AUDC1:
return "AUDC1";
case HMOVE:
return "HMOVE";
case COLUBK:
return "COLUBK";
case COLUP0:
return "COLUP0";
case COLUP1:
return "COLUP1";
case COLUPF:
return "COLUPF";
case CTRLPF:
return "CTRLPF";
case PF0:
return "PF0";
case PF1:
return "PF1";
case PF2:
return "PF2";
case ENAM0:
return "ENAM0";
case ENAM1:
return "ENAM1";
case RESM0:
return "RESM0";
case RESM1:
return "RESM1";
case RESMP0:
return "RESMP0";
case RESMP1:
return "RESMP1";
case RESP0:
return "RESP0";
case RESP1:
return "RESP1";
case RESBL:
return "RESBL";
case NUSIZ0:
return "NUSIZ0";
case NUSIZ1:
return "NUSIZ1";
case HMM0:
return "HMM0";
case HMM1:
return "HMM1";
case HMP0:
return "HMP0";
case HMP1:
return "HMP1";
case HMBL:
return "HMBL";
case HMCLR:
return "HMCLR";
case GRP0:
return "GRP0";
case GRP1:
return "GRP1";
case REFP0:
return "REFP0";
case REFP1:
return "REFP1";
case VDELP0:
return "VDELP0";
case VDELP1:
return "VDELP1";
case VDELBL:
return "VDELBL";
case ENABL:
return "ENABL";
case CXCLR:
return "CXCLR";
default:
return Common::Base::toString(address, Common::Base::Format::F_16_2);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DelayQueueWidget::DelayQueueWidget( DelayQueueWidget::DelayQueueWidget(
GuiObject* boss, GuiObject* boss,
@ -182,18 +39,21 @@ DelayQueueWidget::DelayQueueWidget(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DelayQueueWidget::loadConfig() { void DelayQueueWidget::loadConfig() {
shared_ptr<DelayQueueIterator> delayQueueIterator = instance().debugger().tiaDebug().delayQueueIterator(); shared_ptr<DelayQueueIterator> delayQueueIterator =
instance().debugger().tiaDebug().delayQueueIterator();
using Common::Base;
for (uInt8 i = 0; i < 3; i++) { for (uInt8 i = 0; i < 3; i++) {
if (delayQueueIterator->isValid() && delayQueueIterator->address() < 64) { if (delayQueueIterator->isValid() && delayQueueIterator->address() < 64) {
stringstream ss; stringstream ss;
ss ss
<< int(delayQueueIterator->delay()) << int(delayQueueIterator->delay())
<< " clk, " << " clk, $"
<< Common::Base::toString(delayQueueIterator->value(), Common::Base::Format::F_16_2) << Base::toString(delayQueueIterator->value(), Base::Format::F_16_2)
<< " -> " << " -> "
<< formatRegister(delayQueueIterator->address()); << instance().debugger().cartDebug().getLabel(
delayQueueIterator->address(), false);
myLines[i] = ss.str(); myLines[i] = ss.str();
delayQueueIterator->next(); delayQueueIterator->next();
@ -230,4 +90,4 @@ void DelayQueueWidget::drawWidget(bool hilite)
y += lineHeight; y += lineHeight;
surface.drawString(_font, myLines[2], x, y, w, _textcolor); surface.drawString(_font, myLines[2], x, y, w, _textcolor);
} }

View File

@ -22,33 +22,28 @@
class DelayQueueWidget : public Widget class DelayQueueWidget : public Widget
{ {
public: public:
DelayQueueWidget( DelayQueueWidget(
GuiObject* boss, GuiObject* boss,
const GUI::Font& font, const GUI::Font& font,
int x, int y int x, int y
); );
virtual ~DelayQueueWidget() = default;
void loadConfig() override; void loadConfig() override;
protected: protected:
void drawWidget(bool hilite) override; void drawWidget(bool hilite) override;
private: private:
string myLines[3]; string myLines[3];
private: private:
DelayQueueWidget() = delete; DelayQueueWidget() = delete;
DelayQueueWidget(const DelayQueueWidget&) = delete; DelayQueueWidget(const DelayQueueWidget&) = delete;
DelayQueueWidget(DelayQueueWidget&&) = delete; DelayQueueWidget(DelayQueueWidget&&) = delete;
DelayQueueWidget& operator=(const DelayQueueWidget&); DelayQueueWidget& operator=(const DelayQueueWidget&);
DelayQueueWidget& operator=(DelayQueueWidget&&); DelayQueueWidget& operator=(DelayQueueWidget&&);
}; };
#endif // DELAY_QUEUE_WIDGET_HXX #endif // DELAY_QUEUE_WIDGET_HXX

View File

@ -91,4 +91,4 @@ bool DelayQueueIterator::next()
} }
return isValid(); return isValid();
} }

View File

@ -25,7 +25,6 @@
class DelayQueueIterator class DelayQueueIterator
{ {
public: public:
DelayQueueIterator(const DelayQueue&); DelayQueueIterator(const DelayQueue&);
bool isValid() const; bool isValid() const;
@ -39,18 +38,15 @@ class DelayQueueIterator
bool next(); bool next();
private: private:
uInt8 currentIndex() const { uInt8 currentIndex() const {
return (myDelayQueue.myIndex + myDelayCycle) % myDelayQueue.myMembers.size(); return (myDelayQueue.myIndex + myDelayCycle) % myDelayQueue.myMembers.size();
} }
private: private:
const DelayQueue& myDelayQueue; const DelayQueue& myDelayQueue;
uInt8 myDelayCycle; uInt8 myDelayCycle;
DelayQueueMember::iterator myCurrentIterator; DelayQueueMember::iterator myCurrentIterator;
}; };
#endif // TIA_DELAY_QUEUE_ITERATOR #endif // TIA_DELAY_QUEUE_ITERATOR