Show queued GRPx / ENABL shuffles in delay queue widget.

This commit is contained in:
Christian Speckner 2017-04-24 23:42:44 +02:00
parent b0bb4bda29
commit f51c6c983b
4 changed files with 50 additions and 29 deletions

View File

@ -21,6 +21,7 @@
#include "TIATypes.hxx" #include "TIATypes.hxx"
#include "Debugger.hxx" #include "Debugger.hxx"
#include "Base.hxx" #include "Base.hxx"
#include "TIA.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DelayQueueWidget::DelayQueueWidget( DelayQueueWidget::DelayQueueWidget(
@ -32,9 +33,9 @@ DelayQueueWidget::DelayQueueWidget(
_textcolor = kTextColor; _textcolor = kTextColor;
_w = 20 * font.getMaxCharWidth() + 6; _w = 20 * font.getMaxCharWidth() + 6;
_h = 3 * font.getLineHeight() + 6; _h = lineCount * font.getLineHeight() + 6;
myLines[0] = myLines[1] = myLines[2]; for (auto&& line : myLines) line = "";
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -43,23 +44,41 @@ void DelayQueueWidget::loadConfig() {
instance().debugger().tiaDebug().delayQueueIterator(); instance().debugger().tiaDebug().delayQueueIterator();
using Common::Base; using Common::Base;
for (uInt8 i = 0; i < 3; i++) { for (auto&& line : myLines) {
if (delayQueueIterator->isValid() && delayQueueIterator->address() < 64) { if (!delayQueueIterator->isValid()) {
stringstream ss; line = "";
continue;
};
ss stringstream ss;
<< int(delayQueueIterator->delay()) const auto address = delayQueueIterator->address();
<< " clk, $" const int delay = delayQueueIterator->delay();
<< Base::toString(delayQueueIterator->value(), Base::Format::F_16_2)
<< " -> "
<< instance().debugger().cartDebug().getLabel(
delayQueueIterator->address(), false);
myLines[i] = ss.str(); switch (address) {
delayQueueIterator->next(); case TIA::DummyRegisters::shuffleP0:
ss << delay << " clk, shuffle GRP0";
break;
case TIA::DummyRegisters::shuffleP1:
ss << delay << " clk, shuffle GRP1";
break;
case TIA::DummyRegisters::shuffleBL:
ss << delay << " clk, shuffle ENABL";
break;
default:
if (address < 64) ss
<< delay
<< " clk, $"
<< Base::toString(delayQueueIterator->value(), Base::Format::F_16_2)
<< " -> "
<< instance().debugger().cartDebug().getLabel(delay, false);
break;
} }
else
myLines[i] = ""; line = ss.str();
delayQueueIterator->next();
} }
} }
@ -83,11 +102,9 @@ void DelayQueueWidget::drawWidget(bool hilite)
y += 2; y += 2;
x += 2; x += 2;
w -= 3; w -= 3;
surface.drawString(_font, myLines[0], x, y, w, _textcolor);
y += lineHeight; for (const auto& line : myLines) {
surface.drawString(_font, myLines[1], x, y, w, _textcolor); surface.drawString(_font, line, x, y, w, _textcolor);
y += lineHeight;
y += lineHeight; }
surface.drawString(_font, myLines[2], x, y, w, _textcolor);
} }

View File

@ -36,7 +36,9 @@ class DelayQueueWidget : public Widget
void drawWidget(bool hilite) override; void drawWidget(bool hilite) override;
private: private:
string myLines[3]; static constexpr uInt8 lineCount = 4;
string myLines[lineCount];
private: private:
DelayQueueWidget() = delete; DelayQueueWidget() = delete;

View File

@ -49,12 +49,6 @@ enum Delay: uInt8 {
vblank = 1 vblank = 1
}; };
enum DummyRegisters: uInt8 {
shuffleP0 = 0xF0,
shuffleP1 = 0xF1,
shuffleBL = 0xF2
};
enum ResxCounter: uInt8 { enum ResxCounter: uInt8 {
hblank = 159, hblank = 159,
lateHblank = 158, lateHblank = 158,

View File

@ -51,6 +51,14 @@
*/ */
class TIA : public Device class TIA : public Device
{ {
public:
enum DummyRegisters: uInt8 {
shuffleP0 = 0xF0,
shuffleP1 = 0xF1,
shuffleBL = 0xF2
};
public: public:
friend class TIADebug; friend class TIADebug;
friend class RiotDebug; friend class RiotDebug;