mirror of https://github.com/stella-emu/stella.git
display of current timer divider to debugger added
This commit is contained in:
parent
a6ea393905
commit
4e3b26cea9
|
@ -68,10 +68,14 @@ string Base::toString(int value, Common::Base::Format outputBase)
|
|||
std::snprintf(vToS_buf, 6, "%5d", value);
|
||||
break;
|
||||
|
||||
case Base::F_10_2: // base 10: 2 digits
|
||||
case Base::F_10_02: // base 10: 2 digits (with leading zero)
|
||||
std::snprintf(vToS_buf, 3, "%02d", value);
|
||||
break;
|
||||
|
||||
case Base::F_10_4: // base 10: 4 digits
|
||||
std::snprintf(vToS_buf, 5, "%4d", value);
|
||||
break;
|
||||
|
||||
case Base::F_16_1: // base 16: 1 byte wide
|
||||
std::snprintf(vToS_buf, 2, myFmt[0], value);
|
||||
break;
|
||||
|
|
|
@ -47,7 +47,8 @@ class Base
|
|||
F_16_4, // base 16: 4 bytes wide
|
||||
F_16_8, // base 16: 8 bytes wide
|
||||
F_10, // base 10: 3 or 5 bytes (depending on value)
|
||||
F_10_2, // base 10: 2 digits
|
||||
F_10_02, // base 10: 02 digits
|
||||
F_10_4, // base 10: 4 digits
|
||||
F_2, // base 2: 8 or 16 bits (depending on value)
|
||||
F_2_8, // base 2: 1 byte (8 bits) wide
|
||||
F_2_16, // base 2: 2 bytes (16 bits) wide
|
||||
|
|
|
@ -66,6 +66,7 @@ const DebuggerState& RiotDebug::getState()
|
|||
myState.TIMINT = timint();
|
||||
myState.TIMCLKS = timClocks();
|
||||
myState.INTIMCLKS = intimClocks();
|
||||
myState.TIMDIV = timDivider();
|
||||
|
||||
return myState;
|
||||
}
|
||||
|
@ -107,6 +108,7 @@ void RiotDebug::saveOldState()
|
|||
myOldState.TIMINT = timint();
|
||||
myOldState.TIMCLKS = timClocks();
|
||||
myOldState.INTIMCLKS = intimClocks();
|
||||
myOldState.TIMDIV = timDivider();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -223,6 +225,12 @@ Int32 RiotDebug::intimClocks() const
|
|||
return mySystem.m6532().intimClocks();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Int32 RiotDebug::timDivider() const
|
||||
{
|
||||
return mySystem.m6532().myDivider;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Controller& RiotDebug::controller(Controller::Jack jack) const
|
||||
{
|
||||
|
@ -362,6 +370,7 @@ string RiotDebug::toString()
|
|||
<< " 285/TIMINT=" << myDebugger.invIfChanged(state.TIMINT, oldstate.TIMINT)
|
||||
<< " Timer_Clocks=" << myDebugger.invIfChanged(state.TIMCLKS, oldstate.TIMCLKS)
|
||||
<< " INTIM_Clocks=" << myDebugger.invIfChanged(state.INTIMCLKS, oldstate.INTIMCLKS)
|
||||
<< " Divider=" << myDebugger.invIfChanged(state.TIMDIV, oldstate.TIMDIV)
|
||||
<< endl
|
||||
|
||||
<< "Left/P0diff: " << diffP0String() << " Right/P1diff: " << diffP0String()
|
||||
|
|
|
@ -36,7 +36,7 @@ class RiotState : public DebuggerState
|
|||
BoolArray swbcntBits;
|
||||
|
||||
uInt8 TIM1T, TIM8T, TIM64T, T1024T, INTIM, TIMINT;
|
||||
Int32 TIMCLKS, INTIMCLKS;
|
||||
Int32 TIMCLKS, INTIMCLKS, TIMDIV;
|
||||
|
||||
// These are actually from the TIA, but are I/O related
|
||||
uInt8 INPT0, INPT1, INPT2, INPT3, INPT4, INPT5;
|
||||
|
@ -74,6 +74,7 @@ class RiotDebug : public DebuggerSystem
|
|||
uInt8 timint() const;
|
||||
Int32 timClocks() const;
|
||||
Int32 intimClocks() const;
|
||||
Int32 timDivider() const;
|
||||
|
||||
/* Controller ports */
|
||||
Controller& controller(Controller::Jack jack) const;
|
||||
|
|
|
@ -115,9 +115,9 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
|
|||
addFocusWidget(myTimWrite);
|
||||
|
||||
// Timer registers (RO)
|
||||
const char* const readNames[] = { "INTIM", "TIMINT", "Total Clks", "INTIM Clks" };
|
||||
xpos = 10; ypos += myTimWrite->getHeight() + lineHeight;
|
||||
for(int row = 0; row < 4; ++row)
|
||||
const char* const readNames[] = { "INTIM", "TIMINT", "Total Clks", "INTIM Clks", "Divider" };
|
||||
xpos = 10; ypos += myTimWrite->getHeight() + lineHeight / 2;
|
||||
for(int row = 0; row < 5; ++row)
|
||||
{
|
||||
t = new StaticTextWidget(boss, lfont, xpos, ypos + row*lineHeight + 2,
|
||||
10*fontWidth, fontHeight, readNames[row], TextAlign::Left);
|
||||
|
@ -127,6 +127,11 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
|
|||
myTimRead->setTarget(this);
|
||||
myTimRead->setEditable(false);
|
||||
|
||||
ypos += myTimRead->getHeight() - 1;
|
||||
myTimDivider = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 4, 32, Common::Base::F_10_4);
|
||||
myTimDivider->setTarget(this);
|
||||
myTimDivider->setEditable(false);
|
||||
|
||||
// Controller ports
|
||||
const RiotDebug& riot = instance().debugger().riotDebug();
|
||||
xpos = col; ypos = 10;
|
||||
|
@ -315,6 +320,11 @@ void RiotWidget::loadConfig()
|
|||
changed.push_back(state.INTIMCLKS != oldstate.INTIMCLKS);
|
||||
myTimRead->setList(alist, vlist, changed);
|
||||
|
||||
alist.clear(); vlist.clear(); changed.clear();
|
||||
alist.push_back(0); vlist.push_back(state.TIMDIV);
|
||||
changed.push_back(state.TIMDIV != oldstate.TIMDIV);
|
||||
myTimDivider->setList(alist, vlist, changed);
|
||||
|
||||
// Console switches (inverted, since 'selected' in the UI
|
||||
// means 'grounded' in the system)
|
||||
myP0Diff->setSelectedIndex(riot.diffP0(), state.swchbReadBits[1] != oldstate.swchbReadBits[1]);
|
||||
|
|
|
@ -59,6 +59,7 @@ class RiotWidget : public Widget, public CommandSender
|
|||
|
||||
DataGridWidget* myTimWrite;
|
||||
DataGridWidget* myTimRead;
|
||||
DataGridWidget* myTimDivider;
|
||||
|
||||
ControllerWidget *myLeftControl, *myRightControl;
|
||||
PopUpWidget *myP0Diff, *myP1Diff;
|
||||
|
|
|
@ -336,9 +336,9 @@ string TimeMachineDialog::getTimeString(uInt64 cycles)
|
|||
uInt32 frames = cycles / (scanlines * 76);
|
||||
|
||||
stringstream time;
|
||||
time << Common::Base::toString(minutes, Common::Base::F_10_2) << ":";
|
||||
time << Common::Base::toString(seconds, Common::Base::F_10_2) << ".";
|
||||
time << Common::Base::toString(frames, Common::Base::F_10_2);
|
||||
time << Common::Base::toString(minutes, Common::Base::F_10_02) << ":";
|
||||
time << Common::Base::toString(seconds, Common::Base::F_10_02) << ".";
|
||||
time << Common::Base::toString(frames, Common::Base::F_10_02);
|
||||
|
||||
return time.str();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue