mirror of https://github.com/stella-emu/stella.git
Added changing of specific bits in the collision register to TIADebug,
and a set of checkboxes to TiaWidget to toggle each bit. I've confirmed that the code correctly changes the bits, but I haven't yet found a ROM where changing these quantities has a noticable effect on the TIA image. Brian, should we be seeing anything here, or should the collision register bits be for info only (or am I doing something wrong)? git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@725 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
a611d0097a
commit
3c331d6e49
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: TIADebug.cxx,v 1.20 2005-08-17 21:38:34 stephena Exp $
|
||||
// $Id: TIADebug.cxx,v 1.21 2005-08-18 16:19:07 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "System.hxx"
|
||||
|
@ -256,6 +256,70 @@ bool TIADebug::refP1(int newVal)
|
|||
return myTIA->myREFP1;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool TIADebug::refPF(int newVal)
|
||||
{
|
||||
if(newVal > -1)
|
||||
{
|
||||
int tmp = myTIA->myCTRLPF;
|
||||
if(newVal)
|
||||
tmp |= 0x01;
|
||||
else
|
||||
tmp &= ~0x01;
|
||||
mySystem->poke(CTRLPF, tmp);
|
||||
}
|
||||
|
||||
return myTIA->myCTRLPF & 0x01;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool TIADebug::scorePF(int newVal)
|
||||
{
|
||||
if(newVal > -1)
|
||||
{
|
||||
int tmp = myTIA->myCTRLPF;
|
||||
if(newVal)
|
||||
tmp |= 0x02;
|
||||
else
|
||||
tmp &= ~0x02;
|
||||
mySystem->poke(CTRLPF, tmp);
|
||||
}
|
||||
|
||||
return myTIA->myCTRLPF & 0x02;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool TIADebug::priorityPF(int newVal)
|
||||
{
|
||||
if(newVal > -1)
|
||||
{
|
||||
int tmp = myTIA->myCTRLPF;
|
||||
if(newVal)
|
||||
tmp |= 0x04;
|
||||
else
|
||||
tmp &= ~0x04;
|
||||
mySystem->poke(CTRLPF, tmp);
|
||||
}
|
||||
|
||||
return myTIA->myCTRLPF & 0x04;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool TIADebug::collision(int collID, int newVal)
|
||||
{
|
||||
unsigned int mask = 1 << collID;
|
||||
|
||||
if(newVal > -1)
|
||||
{
|
||||
if(newVal)
|
||||
myTIA->myCollision |= mask;
|
||||
else
|
||||
myTIA->myCollision &= ~mask;
|
||||
}
|
||||
|
||||
return myTIA->myCollision & mask;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIADebug::audC0(int newVal)
|
||||
{
|
||||
|
@ -464,7 +528,7 @@ uInt8 TIADebug::grP1(int newVal)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIADebug::posP0(int newVal)
|
||||
{
|
||||
if(newVal > -1)
|
||||
if(newVal > -1 && )
|
||||
myTIA->myPOSP0 = newVal;
|
||||
return myTIA->myPOSP0;
|
||||
}
|
||||
|
@ -792,33 +856,30 @@ string TIADebug::state()
|
|||
ret += "/";
|
||||
ret += myDebugger->valueToString(state.pf[2]);
|
||||
ret += "\n ";
|
||||
ret += booleanWithLabel("reflect", myTIA->myCTRLPF & 0x01);
|
||||
ret += booleanWithLabel("reflect", refPF());
|
||||
ret += " ";
|
||||
ret += booleanWithLabel("score", myTIA->myCTRLPF & 0x02);
|
||||
ret += booleanWithLabel("score", scorePF());
|
||||
ret += " ";
|
||||
ret += booleanWithLabel("priority", myTIA->myCTRLPF & 0x04);
|
||||
ret += booleanWithLabel("priority", priorityPF());
|
||||
ret += "\n";
|
||||
|
||||
// Hope Brad never changes this:
|
||||
uInt16 coll = myTIA->myCollision;
|
||||
|
||||
ret += "Collisions: ";
|
||||
ret += booleanWithLabel("m0_p1 ", bool(coll & 0x0001));
|
||||
ret += booleanWithLabel("m0_p0 ", bool(coll & 0x0002));
|
||||
ret += booleanWithLabel("m1_p0 ", bool(coll & 0x0004));
|
||||
ret += booleanWithLabel("m1_p1 ", bool(coll & 0x0008));
|
||||
ret += booleanWithLabel("p0_pf ", bool(coll & 0x0010));
|
||||
ret += booleanWithLabel("p0_bl ", bool(coll & 0x0020));
|
||||
ret += booleanWithLabel("p1_pf ", bool(coll & 0x0040));
|
||||
ret += booleanWithLabel("m0_p1 ", collM0_P1());
|
||||
ret += booleanWithLabel("m0_p0 ", collM0_P0());
|
||||
ret += booleanWithLabel("m1_p0 ", collM1_P0());
|
||||
ret += booleanWithLabel("m1_p1 ", collM1_P1());
|
||||
ret += booleanWithLabel("p0_pf ", collP0_PF());
|
||||
ret += booleanWithLabel("p0_bl ", collP0_BL());
|
||||
ret += booleanWithLabel("p1_pf ", collP1_PF());
|
||||
ret += "\n ";
|
||||
ret += booleanWithLabel("p1_bl ", bool(coll & 0x0080));
|
||||
ret += booleanWithLabel("m0_pf ", bool(coll & 0x0100));
|
||||
ret += booleanWithLabel("m0_bl ", bool(coll & 0x0200));
|
||||
ret += booleanWithLabel("m1_pf ", bool(coll & 0x0400));
|
||||
ret += booleanWithLabel("m1_bl ", bool(coll & 0x0800));
|
||||
ret += booleanWithLabel("bl_pf ", bool(coll & 0x1000));
|
||||
ret += booleanWithLabel("p0_p1 ", bool(coll & 0x2000));
|
||||
ret += booleanWithLabel("m0_m1 ", bool(coll & 0x4000));
|
||||
ret += booleanWithLabel("p1_bl ", collP1_BL());
|
||||
ret += booleanWithLabel("m0_pf ", collM0_PF());
|
||||
ret += booleanWithLabel("m0_bl ", collM0_BL());
|
||||
ret += booleanWithLabel("m1_pf ", collM1_PF());
|
||||
ret += booleanWithLabel("m1_bl ", collM1_BL());
|
||||
ret += booleanWithLabel("bl_pf ", collBL_PF());
|
||||
ret += booleanWithLabel("p0_p1 ", collP0_P1());
|
||||
ret += booleanWithLabel("m0_m1 ", collM0_M1());
|
||||
ret += "\n";
|
||||
|
||||
ret += "AUDF0: ";
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: TIADebug.hxx,v 1.17 2005-08-17 21:38:34 stephena Exp $
|
||||
// $Id: TIADebug.hxx,v 1.18 2005-08-18 16:19:07 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef TIA_DEBUG_HXX
|
||||
|
@ -150,7 +150,7 @@ class TIADebug : public DebuggerSystem
|
|||
uInt8 audV0(int newVal = -1);
|
||||
uInt8 audV1(int newVal = -1);
|
||||
|
||||
/* TIA bool registers */
|
||||
/* TIA bool registers */
|
||||
bool refP0(int newVal = -1);
|
||||
bool refP1(int newVal = -1);
|
||||
bool enaM0(int newVal = -1);
|
||||
|
@ -164,7 +164,26 @@ class TIADebug : public DebuggerSystem
|
|||
bool resMP0(int newVal = -1);
|
||||
bool resMP1(int newVal = -1);
|
||||
|
||||
bool refPF(int newVal = -1);
|
||||
bool scorePF(int newVal = -1);
|
||||
bool priorityPF(int newVal = -1);
|
||||
|
||||
/* Collision registers */
|
||||
bool collM0_P1(int newVal = -1) { return collision(0, newVal); }
|
||||
bool collM0_P0(int newVal = -1) { return collision(1, newVal); }
|
||||
bool collM1_P0(int newVal = -1) { return collision(2, newVal); }
|
||||
bool collM1_P1(int newVal = -1) { return collision(3, newVal); }
|
||||
bool collP0_PF(int newVal = -1) { return collision(4, newVal); }
|
||||
bool collP0_BL(int newVal = -1) { return collision(5, newVal); }
|
||||
bool collP1_PF(int newVal = -1) { return collision(6, newVal); }
|
||||
bool collP1_BL(int newVal = -1) { return collision(7, newVal); }
|
||||
bool collM0_PF(int newVal = -1) { return collision(8, newVal); }
|
||||
bool collM0_BL(int newVal = -1) { return collision(9, newVal); }
|
||||
bool collM1_PF(int newVal = -1) { return collision(10, newVal); }
|
||||
bool collM1_BL(int newVal = -1) { return collision(11, newVal); }
|
||||
bool collBL_PF(int newVal = -1) { return collision(12, newVal); }
|
||||
bool collP0_P1(int newVal = -1) { return collision(13, newVal); }
|
||||
bool collM0_M1(int newVal = -1) { return collision(14, newVal); }
|
||||
|
||||
/* TIA strobe registers */
|
||||
void strobeWsync() { mySystem->poke(WSYNC, 0); }
|
||||
|
@ -187,14 +206,18 @@ class TIADebug : public DebuggerSystem
|
|||
string state();
|
||||
|
||||
private:
|
||||
/** Display a color patch for color at given index in the palette */
|
||||
string colorSwatch(uInt8 c);
|
||||
|
||||
/** Get/set specific bits in the collision register (used by collXX_XX) */
|
||||
bool collision(int collID, int newVal);
|
||||
|
||||
private:
|
||||
TiaState myState;
|
||||
TiaState myOldState;
|
||||
|
||||
System* mySystem;
|
||||
TIA* myTIA;
|
||||
TIA* myTIA;
|
||||
|
||||
string nusizStrings[8];
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: TiaWidget.cxx,v 1.7 2005-08-17 21:38:34 stephena Exp $
|
||||
// $Id: TiaWidget.cxx,v 1.8 2005-08-18 16:19:07 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -34,6 +34,12 @@
|
|||
// ID's for the various widgets
|
||||
// We need ID's, since there are more than one of several types of widgets
|
||||
enum {
|
||||
kP0_PFID, kP0_BLID, kP0_M1ID, kP0_M0ID, kP0_P1ID,
|
||||
kP1_PFID, kP1_BLID, kP1_M1ID, kP1_M0ID,
|
||||
kM0_PFID, kM0_BLID, kM0_M1ID,
|
||||
kM1_PFID, kM1_BLID,
|
||||
kBL_PFID, // Make these first, since we want them to start from 0
|
||||
|
||||
kRamID,
|
||||
kColorRegsID,
|
||||
kGRP0ID, kGRP1ID,
|
||||
|
@ -156,6 +162,50 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
|
|||
myCOLUBKColor = new ColorWidget(boss, xpos, ypos+2, 20, lineHeight - 4);
|
||||
myCOLUBKColor->setTarget(this);
|
||||
|
||||
////////////////////////////
|
||||
// Collision register bits
|
||||
////////////////////////////
|
||||
// Add horizontal labels
|
||||
xpos += myCOLUBKColor->getWidth() + 2*fontWidth + 30; ypos -= 3*lineHeight + 5;
|
||||
t = new StaticTextWidget(boss, xpos, ypos,
|
||||
14*fontWidth, fontHeight,
|
||||
"PF BL M1 M0 P1", kTextAlignLeft);
|
||||
t->setFont(font);
|
||||
|
||||
// Add vertical labels
|
||||
xpos -= 2*fontWidth + 5; ypos += lineHeight;
|
||||
const char* collLabel[] = { "P0", "P1", "M0", "M1", "BL" };
|
||||
for(int row = 0; row < 5; ++row)
|
||||
{
|
||||
t = new StaticTextWidget(boss, xpos, ypos + row*(lineHeight+3),
|
||||
2*fontWidth, fontHeight,
|
||||
collLabel[row], kTextAlignLeft);
|
||||
t->setFont(font);
|
||||
}
|
||||
|
||||
// Finally, add all 15 collision bits
|
||||
xpos += 2 * fontWidth + 5;
|
||||
unsigned int collX = xpos, collY = ypos, idx = 0;
|
||||
for(unsigned int row = 0; row < 5; ++row)
|
||||
{
|
||||
for(unsigned int col = 0; col < 5 - row; ++col)
|
||||
{
|
||||
myCollision[idx] = new CheckboxWidget(boss, font, collX, collY, "", kCheckActionCmd);
|
||||
myCollision[idx]->setFont(font);
|
||||
myCollision[idx]->setTarget(this);
|
||||
myCollision[idx]->setID(idx);
|
||||
addFocusWidget(myCollision[idx]);
|
||||
|
||||
collX += myCollision[idx]->getWidth() + 10;
|
||||
idx++;
|
||||
}
|
||||
collX = xpos;
|
||||
collY += lineHeight+3;
|
||||
}
|
||||
|
||||
// Add STROBE buttons
|
||||
// TODO ...
|
||||
|
||||
// Set the strings to be used in the grPx registers
|
||||
// We only do this once because it's the state that changes, not the strings
|
||||
const char* offstr[] = { "0", "0", "0", "0", "0", "0", "0", "0" };
|
||||
|
@ -171,7 +221,7 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
|
|||
// P0 register info
|
||||
////////////////////////////
|
||||
// grP0
|
||||
xpos = 10; ypos += 2*lineHeight;
|
||||
xpos = 10; ypos += 7*lineHeight;
|
||||
t = new StaticTextWidget(boss, xpos, ypos+2,
|
||||
7*fontWidth, fontHeight,
|
||||
"P0: GR:", kTextAlignLeft);
|
||||
|
@ -635,6 +685,66 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
case kCheckActionCmd:
|
||||
switch(id)
|
||||
{
|
||||
case kP0_PFID:
|
||||
tia.collP0_PF(myCollision[kP0_PFID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kP0_BLID:
|
||||
tia.collP0_BL(myCollision[kP0_BLID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kP0_M1ID:
|
||||
tia.collM1_P0(myCollision[kP0_M1ID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kP0_M0ID:
|
||||
tia.collM0_P0(myCollision[kP0_M0ID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kP0_P1ID:
|
||||
tia.collP0_P1(myCollision[kP0_P1ID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kP1_PFID:
|
||||
tia.collP1_PF(myCollision[kP1_PFID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kP1_BLID:
|
||||
tia.collP1_BL(myCollision[kP1_BLID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kP1_M1ID:
|
||||
tia.collM1_P1(myCollision[kP1_M1ID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kP1_M0ID:
|
||||
tia.collM0_P1(myCollision[kP1_M0ID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kM0_PFID:
|
||||
tia.collM0_PF(myCollision[kM0_PFID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kM0_BLID:
|
||||
tia.collM0_BL(myCollision[kM0_BLID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kM0_M1ID:
|
||||
tia.collM0_M1(myCollision[kM0_M1ID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kM1_PFID:
|
||||
tia.collM1_PF(myCollision[kM1_PFID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kM1_BLID:
|
||||
tia.collM1_BL(myCollision[kM1_BLID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kBL_PFID:
|
||||
tia.collBL_PF(myCollision[kBL_PFID]->getState() ? 1 : 0);
|
||||
break;
|
||||
|
||||
case kRefP0ID:
|
||||
tia.refP0(myRefP0->getState() ? 1 : 0);
|
||||
break;
|
||||
|
@ -711,6 +821,25 @@ void TiaWidget::fillGrid()
|
|||
myCOLUPFColor->setColor(state.coluRegs[2]);
|
||||
myCOLUBKColor->setColor(state.coluRegs[3]);
|
||||
|
||||
////////////////////////////
|
||||
// Collision register bits
|
||||
////////////////////////////
|
||||
myCollision[kP0_PFID]->setState(tia.collP0_PF());
|
||||
myCollision[kP0_BLID]->setState(tia.collP0_BL());
|
||||
myCollision[kP0_M1ID]->setState(tia.collM1_P0());
|
||||
myCollision[kP0_M0ID]->setState(tia.collM0_P0());
|
||||
myCollision[kP0_P1ID]->setState(tia.collP0_P1());
|
||||
myCollision[kP1_PFID]->setState(tia.collP1_PF());
|
||||
myCollision[kP1_BLID]->setState(tia.collP1_BL());
|
||||
myCollision[kP1_M1ID]->setState(tia.collM1_P1());
|
||||
myCollision[kP1_M0ID]->setState(tia.collM0_P1());
|
||||
myCollision[kM0_PFID]->setState(tia.collM0_PF());
|
||||
myCollision[kM0_BLID]->setState(tia.collM0_BL());
|
||||
myCollision[kM0_M1ID]->setState(tia.collM0_M1());
|
||||
myCollision[kM1_PFID]->setState(tia.collM1_PF());
|
||||
myCollision[kM1_BLID]->setState(tia.collM1_BL());
|
||||
myCollision[kBL_PFID]->setState(tia.collBL_PF());
|
||||
|
||||
////////////////////////////
|
||||
// P0 register info
|
||||
////////////////////////////
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: TiaWidget.hxx,v 1.5 2005-08-17 21:38:34 stephena Exp $
|
||||
// $Id: TiaWidget.hxx,v 1.6 2005-08-18 16:19:07 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -97,6 +97,11 @@ class TiaWidget : public Widget, public CommandSender
|
|||
|
||||
CheckboxWidget* myResM0;
|
||||
CheckboxWidget* myResM1;
|
||||
|
||||
/** Collision register bits */
|
||||
CheckboxWidget* myCollision[15];
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Widget.cxx,v 1.29 2005-08-16 18:34:12 stephena Exp $
|
||||
// $Id: Widget.cxx,v 1.30 2005-08-18 16:19:07 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -379,8 +379,8 @@ static unsigned int checked_img[8] =
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font,
|
||||
int x, int y, const string& label,
|
||||
int cmd, uInt8 hotkey)
|
||||
: ButtonWidget(boss, x, y, 16, 16, label, cmd, hotkey),
|
||||
int cmd)
|
||||
: ButtonWidget(boss, x, y, 16, 16, label, cmd, 0),
|
||||
_state(false),
|
||||
_editable(true)
|
||||
{
|
||||
|
@ -388,7 +388,10 @@ CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font,
|
|||
_type = kCheckboxWidget;
|
||||
|
||||
setFont(font);
|
||||
_w = font.getStringWidth(label) + 20;
|
||||
if(label == "")
|
||||
_w = 14;
|
||||
else
|
||||
_w = font.getStringWidth(label) + 20;
|
||||
_h = font.getFontHeight() < 14 ? 14 : font.getFontHeight();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Widget.hxx,v 1.28 2005-08-16 18:34:12 stephena Exp $
|
||||
// $Id: Widget.hxx,v 1.29 2005-08-18 16:19:07 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -71,7 +71,7 @@ enum {
|
|||
This is the base class for all widgets.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Widget.hxx,v 1.28 2005-08-16 18:34:12 stephena Exp $
|
||||
@version $Id: Widget.hxx,v 1.29 2005-08-18 16:19:07 stephena Exp $
|
||||
*/
|
||||
class Widget : public GuiObject
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ class CheckboxWidget : public ButtonWidget
|
|||
{
|
||||
public:
|
||||
CheckboxWidget(GuiObject* boss, const GUI::Font& font, int x, int y,
|
||||
const string& label, int cmd = 0, uInt8 hotkey = 0);
|
||||
const string& label, int cmd = 0);
|
||||
|
||||
void handleMouseUp(int x, int y, int button, int clickCount);
|
||||
virtual void handleMouseEntered(int button) {}
|
||||
|
|
Loading…
Reference in New Issue