Added VDel and togglewidget for new/old ball in debugger TIA tab.

Cleaned up some minor spacing issues in previous CDF commit.
This commit is contained in:
Stephen Anthony 2017-04-30 14:42:06 -02:30
parent 4958ca3d93
commit 2973d03e01
9 changed files with 145 additions and 90 deletions

View File

@ -51,12 +51,14 @@ const DebuggerState& TIADebug::getState()
myState.coluRegs.push_back(coluPF());
myState.coluRegs.push_back(coluBK());
// Player 1 & 2 graphics registers
// Player 0 & 1 and Ball graphics registers
myState.gr.clear();
myState.gr.push_back(myTIA.myPlayer0.getGRPNew());
myState.gr.push_back(myTIA.myPlayer1.getGRPNew());
myState.gr.push_back(myTIA.myPlayer0.getGRPOld());
myState.gr.push_back(myTIA.myPlayer1.getGRPOld());
myState.gr.push_back(myTIA.myBall.getENABLNew());
myState.gr.push_back(myTIA.myBall.getENABLOld());
// Position registers
myState.pos.clear();
@ -114,12 +116,14 @@ void TIADebug::saveOldState()
myOldState.coluRegs.push_back(coluPF());
myOldState.coluRegs.push_back(coluBK());
// Player 1 & 2 graphics registers
// Player 0 & 1 graphics registers
myOldState.gr.clear();
myOldState.gr.push_back(myTIA.myPlayer0.getGRPNew());
myOldState.gr.push_back(myTIA.myPlayer1.getGRPNew());
myOldState.gr.push_back(myTIA.myPlayer0.getGRPOld());
myOldState.gr.push_back(myTIA.myPlayer1.getGRPOld());
myOldState.gr.push_back(myTIA.myBall.getENABLNew());
myOldState.gr.push_back(myTIA.myBall.getENABLOld());
// Position registers
myOldState.pos.clear();

View File

@ -80,11 +80,11 @@ CartridgeCDFWidget::CartridgeCDFWidget(
myDatastreamPointers = new DataGridWidget(boss, _nfont, DS_X, ypos+myLineHeight-2, 4, 8, 6, 32, Common::Base::F_16_3_2);
myDatastreamPointers->setTarget(this);
myDatastreamPointers->setEditable(false);
myDatastreamPointers2 = new DataGridWidget(boss, _nfont, DS_X + myDatastreamPointers->getWidth() * 3 / 4, ypos+myLineHeight-2 + 8*myLineHeight, 1, 2, 6, 32, Common::Base::F_16_3_2);
myDatastreamPointers2->setTarget(this);
myDatastreamPointers2->setEditable(false);
uInt32 row;
for(row = 0; row < 8; ++row)
@ -106,7 +106,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
ypos+myLineHeight-2 + 9*myLineHeight + 2,
lwidth, myFontHeight, "Jump Data (stream 21)", kTextAlignLeft);
// myDatastreamLabels[row]->setLabel(Common::Base::toString(row * 4, Common::Base::F_16_2));
// Datastream Increments
xpos = DS_X + myDatastreamPointers->getWidth() + 20;
new StaticTextWidget(boss, _font, xpos, ypos, lwidth,
@ -115,7 +115,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
myDatastreamIncrements = new DataGridWidget(boss, _nfont, xpos, ypos+myLineHeight-2, 4, 8, 5, 32, Common::Base::F_16_2_2);
myDatastreamIncrements->setTarget(this);
myDatastreamIncrements->setEditable(false);
myDatastreamIncrements2 = new DataGridWidget(boss, _nfont, xpos, ypos+myLineHeight-2 + 8*myLineHeight, 1, 2, 5, 32, Common::Base::F_16_2_2);
myDatastreamIncrements2->setTarget(this);
myDatastreamIncrements2->setEditable(false);
@ -154,11 +154,11 @@ CartridgeCDFWidget::CartridgeCDFWidget(
int lwidth2 = _font.getStringWidth("Sample Pointer ");
new StaticTextWidget(boss, _font, xpossp, ypos, lwidth2,
myFontHeight, "Sample Pointer ", kTextAlignLeft);
mySamplePointer = new DataGridWidget(boss, _nfont, xpossp + lwidth2, ypos-2, 1, 1, 8, 32, Common::Base::F_16_8);
mySamplePointer->setTarget(this);
mySamplePointer->setEditable(false);
// Music waveform sizes
xpos = 10; ypos += myLineHeight + 4;
new StaticTextWidget(boss, _font, xpos, ypos, lwidth,
@ -174,7 +174,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
myFastFetch = new CheckboxWidget(boss, _font, xpos, ypos, "Fast Fetcher enabled");
myFastFetch->setTarget(this);
myFastFetch->setEditable(false);
myDigitalSample = new CheckboxWidget(boss, _font, xpossp, ypos, "Digital Sample mode");
myDigitalSample->setTarget(this);
myDigitalSample->setEditable(false);
@ -225,7 +225,7 @@ void CartridgeCDFWidget::saveOldState()
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myCDFRAM[i]);
myOldState.samplepointer.push_back(myCart.getSample());
}
@ -266,7 +266,7 @@ void CartridgeCDFWidget::loadConfig()
changed.push_back(pointervalue != myOldState.datastreampointers[i]);
}
myDatastreamPointers2->setList(alist, vlist, changed);
alist.clear(); vlist.clear(); changed.clear();
for(int i = 0; i < 32; ++i)
{
@ -284,7 +284,7 @@ void CartridgeCDFWidget::loadConfig()
changed.push_back(incrementvalue != myOldState.datastreamincrements[i]);
}
myDatastreamIncrements2->setList(alist, vlist, changed);
alist.clear(); vlist.clear(); changed.clear();
for(int i = 0; i < 3; ++i)
{
@ -321,10 +321,10 @@ void CartridgeCDFWidget::loadConfig()
alist.push_back(0); vlist.push_back(myCart.getSample());
changed.push_back((myCart.getSample()) != uInt32(myOldState.samplepointer[0]));
mySamplePointer->setList(alist, vlist, changed);
myFastFetch->setState((myCart.myMode & 0x0f) == 0);
myDigitalSample->setState((myCart.myMode & 0xf0) == 0);
if ((myCart.myMode & 0xf0) == 0)
{
myMusicWaveforms->setCrossed(true);

View File

@ -64,7 +64,7 @@ class CartridgeCDFWidget : public CartDebugWidget
DataGridWidget* myMusicWaveformSizes;
DataGridWidget* mySamplePointer;
StaticTextWidget* myDatastreamLabels[10];
// done differently than in DPC+, need to rethink debugger support
CheckboxWidget* myFastFetch;
CheckboxWidget* myDigitalSample;

View File

@ -636,11 +636,11 @@ void DataGridWidget::drawWidget(bool hilite)
// Draw the scrollbar
if(_scrollBar)
_scrollBar->recalc(); // takes care of the draw
// Cross out the grid?
if (_crossGrid)
for (row = 0; row < 4; ++row)
s.hLine(_x, _y + (row * lineheight/4), _x + linewidth, kColor);
s.hLine(_x, _y + (row * lineheight/4), _x + linewidth, kColor);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -81,7 +81,7 @@ class DataGridWidget : public EditableWidget
int colWidth() { return _colWidth; }
void setOpsWidget(DataGridOpsWidget* w) { _opsWidget = w; }
void setCrossed(bool enable) { _crossGrid = enable; }
protected:

View File

@ -256,7 +256,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
// P1 register info
////////////////////////////
// grP1 (new)
xpos = 10; ypos += 2*lineHeight;
xpos = 10; ypos += lineHeight + 12;
new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight,
"P1", kTextAlignLeft);
xpos += 2*fontWidth + 5;
@ -333,14 +333,14 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
// M0 register info
////////////////////////////
// enaM0
xpos = 10; ypos += 2*lineHeight;
xpos = 10; ypos += lineHeight + 12;
new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight,
"M0", kTextAlignLeft);
xpos += 2*fontWidth + 8;
myEnaM0 = new CheckboxWidget(boss, lfont, xpos, ypos+2,
"Enable", kCheckActionCmd);
xpos += 2*fontWidth + 5;
myEnaM0 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1);
myEnaM0->setTarget(this);
myEnaM0->setID(kEnaM0ID);
myEnaM0->setBackgroundColor(-1);
addFocusWidget(myEnaM0);
// posM0
@ -380,7 +380,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
// M0 reset
xpos += myNusizM0->getWidth() + 15;
myResMP0 = new CheckboxWidget(boss, lfont, xpos, ypos+1,
"Reset", kCheckActionCmd);
"Reset to P0", kCheckActionCmd);
myResMP0->setTarget(this);
myResMP0->setID(kResMP0ID);
addFocusWidget(myResMP0);
@ -389,14 +389,14 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
// M1 register info
////////////////////////////
// enaM1
xpos = 10; ypos += lineHeight + 6;
xpos = 10; ypos += lineHeight + 4;
new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight,
"M1", kTextAlignLeft);
xpos += 2*fontWidth + 8;
myEnaM1 = new CheckboxWidget(boss, lfont, xpos, ypos+2,
"Enable", kCheckActionCmd);
xpos += 2*fontWidth + 5;
myEnaM1 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1);
myEnaM1->setTarget(this);
myEnaM1->setID(kEnaM1ID);
myEnaM1->setBackgroundColor(-1);
addFocusWidget(myEnaM1);
// posM0
@ -436,7 +436,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
// M1 reset
xpos += myNusizM1->getWidth() + 15;
myResMP1 = new CheckboxWidget(boss, lfont, xpos, ypos+1,
"Reset", kCheckActionCmd);
"Reset to P1", kCheckActionCmd);
myResMP1->setTarget(this);
myResMP1->setID(kResMP1ID);
addFocusWidget(myResMP1);
@ -445,14 +445,14 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
// BL register info
////////////////////////////
// enaBL
xpos = 10; ypos += lineHeight + 6;
xpos = 10; ypos += lineHeight + 4;
new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight,
"BL", kTextAlignLeft);
xpos += 2*fontWidth + 8;
myEnaBL = new CheckboxWidget(boss, lfont, xpos, ypos+2,
"Enable", kCheckActionCmd);
xpos += 2*fontWidth + 5;
myEnaBL = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1);
myEnaBL->setTarget(this);
myEnaBL->setID(kEnaBLID);
myEnaBL->setBackgroundColor(-1);
addFocusWidget(myEnaBL);
// posBL
@ -489,10 +489,17 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
mySizeBL->setID(kSizeBLID);
addFocusWidget(mySizeBL);
xpos = 10 + 2*fontWidth + 5; ypos += myEnaBL->getHeight() + 5;
myEnaBLOld = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1);
myEnaBLOld->setTarget(this);
myEnaBLOld->setID(kEnaBLOldID);
myEnaBLOld->setBackgroundColor(-1);
addFocusWidget(myEnaBLOld);
// BL delay
xpos += mySizeBL->getWidth() + 15;
xpos += myEnaBLOld->getWidth() + 12;
myDelBL = new CheckboxWidget(boss, lfont, xpos, ypos+1,
"Delay", kCheckActionCmd);
"VDel", kCheckActionCmd);
myDelBL->setTarget(this);
myDelBL->setID(kDelBLID);
addFocusWidget(myDelBL);
@ -580,8 +587,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
xpos = 10;
ypos += 2 * lineHeight;
t = new StaticTextWidget(boss, lfont, xpos, ypos, 14*fontWidth, fontHeight,
"Queued Writes:", kTextAlignLeft);
t = new StaticTextWidget(boss, lfont, xpos, ypos, 13*fontWidth, fontHeight,
"Queued Writes", kTextAlignLeft);
xpos += t->getWidth() + 10;
myDelayQueueWidget = new DelayQueueWidget(boss, lfont, xpos, ypos);
@ -740,6 +747,22 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
tia.setGRP1Old(myGRP1Old->getIntState());
break;
case kEnaM0ID:
tia.enaM0(myEnaM0->getIntState());
break;
case kEnaM1ID:
tia.enaM1(myEnaM1->getIntState());
break;
case kEnaBLID:
tia.enaBL(myEnaBL->getIntState());
break;
case kEnaBLOldID:
tia.setENABLOld(myEnaBLOld->getIntState() != 0);
break;
case kPF0ID:
tia.pf0(myPF[0]->getIntState());
break;
@ -919,7 +942,16 @@ void TiaWidget::loadConfig()
// M0 register info
////////////////////////////
// enaM0
myEnaM0->setState(tia.enaM0());
if(tia.enaM0())
{
myEnaM0->setColor(state.coluRegs[0]);
myEnaM0->setIntState(1, false);
}
else
{
myEnaM0->setColor(kBGColorLo);
myEnaM0->setIntState(0, false);
}
// posM0
myPosM0->setList(0, state.pos[M0], state.pos[M0] != oldstate.pos[M0]);
@ -937,7 +969,16 @@ void TiaWidget::loadConfig()
// M1 register info
////////////////////////////
// enaM1
myEnaM1->setState(tia.enaM1());
if(tia.enaM1())
{
myEnaM1->setColor(state.coluRegs[1]);
myEnaM1->setIntState(1, false);
}
else
{
myEnaM1->setColor(kBGColorLo);
myEnaM1->setIntState(0, false);
}
// posM1
myPosM1->setList(0, state.pos[M1], state.pos[M1] != oldstate.pos[M1]);
@ -954,8 +995,21 @@ void TiaWidget::loadConfig()
////////////////////////////
// BL register info
////////////////////////////
// enaBL
myEnaBL->setState(tia.enaBL());
// enaBL (new and old)
if(tia.vdelBL())
{
myEnaBL->setColor(kBGColorLo);
myEnaBLOld->setColor(state.coluRegs[2]);
myEnaBLOld->setCrossed(false);
}
else
{
myEnaBL->setColor(state.coluRegs[2]);
myEnaBLOld->setColor(kBGColorLo);
myEnaBLOld->setCrossed(true);
}
myEnaBL->setIntState(state.gr[4], false);
myEnaBLOld->setIntState(state.gr[5], false);
// posBL
myPosBL->setList(0, state.pos[BL], state.pos[BL] != oldstate.pos[BL]);

View File

@ -77,9 +77,10 @@ class TiaWidget : public Widget, public CommandSender
CheckboxWidget* myDelP1;
CheckboxWidget* myDelBL;
CheckboxWidget* myEnaM0;
CheckboxWidget* myEnaM1;
CheckboxWidget* myEnaBL;
TogglePixelWidget* myEnaM0;
TogglePixelWidget* myEnaM1;
TogglePixelWidget* myEnaBL;
TogglePixelWidget* myEnaBLOld;
CheckboxWidget* myResMP0;
CheckboxWidget* myResMP1;
@ -117,7 +118,7 @@ class TiaWidget : public Widget, public CommandSender
kDelP0ID, kDelP1ID, kDelBLID,
kNusizP0ID, kNusizP1ID,
kNusizM0ID, kNusizM1ID, kSizeBLID,
kEnaM0ID, kEnaM1ID, kEnaBLID,
kEnaM0ID, kEnaM1ID, kEnaBLID, kEnaBLOldID,
kResMP0ID, kResMP1ID,
kPF0ID, kPF1ID, kPF2ID,
kRefPFID, kScorePFID, kPriorityPFID

View File

@ -98,14 +98,14 @@ void CartridgeCDF::setInitialState()
for (int i=0; i < 3; ++i)
myMusicWaveformSize[i] = 27;
// CDF always starts in bank 6
myStartBank = 6;
// Assuming mode starts out with Fast Fetch off and 3-Voice music,
// need to confirm with Chris
myMode = 0xFF;
myFastJumpActive = 0;
}
@ -152,15 +152,11 @@ inline void CartridgeCDF::updateMusicModeDataFetchers()
myFractionalClocks = clocks - double(wholeClocks);
if(wholeClocks <= 0)
{
return;
}
// Let's update counters and flags of the music mode data fetchers
for(int x = 0; x <= 2; ++x)
{
myMusicCounters[x] += myMusicFrequencies[x] * wholeClocks;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -205,20 +201,20 @@ uInt8 CartridgeCDF::peek(uInt16 address)
// anything that can change the internal state of the cart
if(bankLocked())
return peekvalue;
// implement JMP FASTJMP which fetches the destination address from stream 33
if (myFastJumpActive)
{
uInt32 pointer;
uInt8 value;
myFastJumpActive--;
pointer = getDatastreamPointer(JUMPSTREAM);
value = myDisplayImage[ pointer >> 20 ];
pointer += 0x100000; // always increment by 1
setDatastreamPointer(JUMPSTREAM, pointer);
return value;
}
@ -240,13 +236,13 @@ uInt8 CartridgeCDF::peek(uInt16 address)
if (peekvalue == AMPLITUDE)
{
updateMusicModeDataFetchers();
if DIGITAL_AUDIO_ON
{
// retrieve packed sample (max size is 2K, or 4K of unpacked data)
address = getSample() + (myMusicCounters[0] >> 21);
peekvalue = myImage[address];
//
if ((myMusicCounters[0] & (1<<20)) == 0)
peekvalue >>= 4;
@ -274,44 +270,44 @@ uInt8 CartridgeCDF::peek(uInt16 address)
// Set the current bank to the first 4k bank
bank(0);
break;
case 0x0FF6:
// Set the current bank to the second 4k bank
bank(1);
break;
case 0x0FF7:
// Set the current bank to the third 4k bank
bank(2);
break;
case 0x0FF8:
// Set the current bank to the fourth 4k bank
bank(3);
break;
case 0x0FF9:
// Set the current bank to the fifth 4k bank
bank(4);
break;
case 0x0FFA:
// Set the current bank to the sixth 4k bank
bank(5);
break;
case 0x0FFB:
// Set the current bank to the last 4k bank
bank(6);
break;
default:
break;
}
if(FAST_FETCH_ON && peekvalue == 0xA9)
myLDAimmediateOperandAddress = address + 1;
return peekvalue;
}
@ -319,7 +315,7 @@ uInt8 CartridgeCDF::peek(uInt16 address)
bool CartridgeCDF::poke(uInt16 address, uInt8 value)
{
uInt32 pointer;
address &= 0x0FFF;
// Switch banks if necessary
@ -331,7 +327,7 @@ bool CartridgeCDF::poke(uInt16 address, uInt8 value)
pointer += 0x100000; // always increment by 1 when writing
setDatastreamPointer(WRITESTREAM, pointer);
break;
case 0xFF1: // DSPTR
pointer = getDatastreamPointer(WRITESTREAM);
pointer <<=8;
@ -339,50 +335,50 @@ bool CartridgeCDF::poke(uInt16 address, uInt8 value)
pointer |= (value << 20);
setDatastreamPointer(WRITESTREAM, pointer);
break;
case 0xFF2: // SETMODE
myMode = value;
break;
case 0xFF3: // CALLFN
callFunction(value);
break;
case 0xFF5:
// Set the current bank to the first 4k bank
bank(0);
break;
case 0x0FF6:
// Set the current bank to the second 4k bank
bank(1);
break;
case 0x0FF7:
// Set the current bank to the third 4k bank
bank(2);
break;
case 0x0FF8:
// Set the current bank to the fourth 4k bank
bank(3);
break;
case 0x0FF9:
// Set the current bank to the fifth 4k bank
bank(4);
break;
case 0x0FFA:
// Set the current bank to the sixth 4k bank
bank(5);
break;
case 0x0FFB:
// Set the current bank to the last 4k bank
bank(6);
break;
default:
break;
}
@ -490,13 +486,13 @@ bool CartridgeCDF::save(Serializer& out) const
// Indicates current mode
out.putByte(myMode);
// State of FastJump
out.putByte(myFastJumpActive);
// Address of LDA # operand
out.putShort(myLDAimmediateOperandAddress);
// Harmony RAM
out.putByteArray(myCDFRAM, 8192);
@ -504,7 +500,7 @@ bool CartridgeCDF::save(Serializer& out) const
out.putIntArray(myMusicCounters, 3);
out.putIntArray(myMusicFrequencies, 3);
out.putByteArray(myMusicWaveformSize, 3);
// Save cycles and clocks
out.putInt(myAudioCycles);
out.putInt((uInt32)(myFractionalClocks * 100000000.0));
@ -529,19 +525,19 @@ bool CartridgeCDF::load(Serializer& in)
// Indicates which bank is currently active
myCurrentBank = in.getShort();
// Indicates current mode
myMode = in.getByte();
// State of FastJump
myFastJumpActive = in.getByte();
// Address of LDA # operand
myLDAimmediateOperandAddress = in.getShort();
// Harmony RAM
in.getByteArray(myCDFRAM, 8192);
// Audio info
in.getIntArray(myMusicCounters, 3);
in.getIntArray(myMusicFrequencies, 3);
@ -625,12 +621,12 @@ uInt32 CartridgeCDF::getWaveform(uInt8 index) const
uInt32 CartridgeCDF::getSample()
{
uInt32 result;
result = myCDFRAM[WAVEFORM + 0] + // low byte
(myCDFRAM[WAVEFORM + 1] << 8) +
(myCDFRAM[WAVEFORM + 2] << 16) +
(myCDFRAM[WAVEFORM + 3] << 24); // high byte
return result;
}

View File

@ -258,7 +258,7 @@ class CartridgeCDF : public Cartridge
r12 = channel1 frequency
r13 = channel2 frequency
r14 = timer base */
// The music counters, ARM FIQ shadow registers r8, r9, r10
uInt32 myMusicCounters[3];
@ -282,7 +282,7 @@ class CartridgeCDF : public Cartridge
uInt16 myLDAimmediateOperandAddress;
TIA* myTIA;
uInt8 myFastJumpActive;
private: