mirror of https://github.com/stella-emu/stella.git
Added non-edit mode to DataGridWidget.
Some work on TIADebug. Change tracking now works for the color registers. Getting/setting the color registers works (sort of, since the change doesn't seem to be registering in TIA). Some work on TiaWidget. Color registers and scanline count are shown. VSync and VBlank are shown, but can't be changed. Made CheckboxWidget only emit a signal when interactively clicking on the checkbox (changing state programmatically no longer emits the signal). TODO: maybe two signals should be used?? git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@647 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
10298d8ba2
commit
0f4b93acf3
|
@ -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.10 2005-07-09 23:44:07 urchlay Exp $
|
||||
// $Id: TIADebug.cxx,v 1.11 2005-07-14 18:28:35 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "System.hxx"
|
||||
|
@ -44,6 +44,12 @@ DebuggerState& TIADebug::getState()
|
|||
for(int i = 0; i < 0x010; ++i)
|
||||
myState.ram.push_back(myTIA->peek(i));
|
||||
|
||||
myState.coluRegs.clear();
|
||||
myState.coluRegs.push_back(coluP0());
|
||||
myState.coluRegs.push_back(coluP1());
|
||||
myState.coluRegs.push_back(coluPF());
|
||||
myState.coluRegs.push_back(coluBK());
|
||||
|
||||
return myState;
|
||||
}
|
||||
|
||||
|
@ -53,6 +59,56 @@ void TIADebug::saveOldState()
|
|||
myOldState.ram.clear();
|
||||
for(int i = 0; i < 0x010; ++i)
|
||||
myOldState.ram.push_back(myTIA->peek(i));
|
||||
|
||||
myOldState.coluRegs.clear();
|
||||
myOldState.coluRegs.push_back(coluP0());
|
||||
myOldState.coluRegs.push_back(coluP1());
|
||||
myOldState.coluRegs.push_back(coluPF());
|
||||
myOldState.coluRegs.push_back(coluBK());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIADebug::coluP0(int newVal)
|
||||
{
|
||||
// TIA::myCOLUxx are stored 4 copies to each int,
|
||||
// we need only 1 when fetching, but store all 4
|
||||
if(newVal > -1)
|
||||
myTIA->myCOLUP0 = (((((newVal << 8) | newVal) << 8) | newVal) << 8) | newVal;
|
||||
|
||||
return myTIA->myCOLUP0 & 0xff;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIADebug::coluP1(int newVal)
|
||||
{
|
||||
// TIA::myCOLUxx are stored 4 copies to each int,
|
||||
// we need only 1 when fetching, but store all 4
|
||||
if(newVal > -1)
|
||||
myTIA->myCOLUP1 = (((((newVal << 8) | newVal) << 8) | newVal) << 8) | newVal;
|
||||
|
||||
return myTIA->myCOLUP1 & 0xff;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIADebug::coluPF(int newVal)
|
||||
{
|
||||
// TIA::myCOLUxx are stored 4 copies to each int,
|
||||
// we need only 1 when fetching, but store all 4
|
||||
if(newVal > -1)
|
||||
myTIA->myCOLUPF = (((((newVal << 8) | newVal) << 8) | newVal) << 8) | newVal;
|
||||
|
||||
return myTIA->myCOLUPF & 0xff;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIADebug::coluBK(int newVal)
|
||||
{
|
||||
// TIA::myCOLUxx are stored 4 copies to each int,
|
||||
// we need only 1 when fetching, but store all 4
|
||||
if(newVal > -1)
|
||||
myTIA->myCOLUBK = (((((newVal << 8) | newVal) << 8) | newVal) << 8) | newVal;
|
||||
|
||||
return myTIA->myCOLUBK & 0xff;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -141,11 +197,10 @@ string TIADebug::state()
|
|||
// TODO: inverse video for changed regs. Core needs to track this.
|
||||
// TODO: strobes? WSYNC RSYNC RESP0/1 RESM0/1 RESBL HMOVE HMCLR CXCLR
|
||||
|
||||
// TIA::myCOLUxx are stored 4 copies to each int, we need only 1
|
||||
uInt8 COLUP0 = myTIA->myCOLUP0 & 0xff;
|
||||
uInt8 COLUP1 = myTIA->myCOLUP1 & 0xff;
|
||||
uInt8 COLUPF = myTIA->myCOLUPF & 0xff;
|
||||
uInt8 COLUBK = myTIA->myCOLUBK & 0xff;
|
||||
uInt8 COLUP0 = coluP0();
|
||||
uInt8 COLUP1 = coluP1();
|
||||
uInt8 COLUPF = coluPF();
|
||||
uInt8 COLUBK = coluBK();
|
||||
|
||||
// TIA::myPF holds all 3 PFx regs, we shall extract
|
||||
int PF = myTIA->myPF;
|
||||
|
|
|
@ -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.6 2005-07-08 17:22:40 stephena Exp $
|
||||
// $Id: TIADebug.hxx,v 1.7 2005-07-14 18:28:35 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef TIA_DEBUG_HXX
|
||||
|
@ -29,6 +29,7 @@ class TiaState : public DebuggerState
|
|||
{
|
||||
public:
|
||||
IntArray ram;
|
||||
IntArray coluRegs;
|
||||
};
|
||||
|
||||
class TIADebug : public DebuggerSystem
|
||||
|
@ -42,6 +43,10 @@ class TIADebug : public DebuggerSystem
|
|||
void saveOldState();
|
||||
|
||||
// FIXME - add whole slew of setXXX() methods
|
||||
uInt8 coluP0(int newVal = -1);
|
||||
uInt8 coluP1(int newVal = -1);
|
||||
uInt8 coluPF(int newVal = -1);
|
||||
uInt8 coluBK(int newVal = -1);
|
||||
|
||||
int scanlines();
|
||||
int frameCount();
|
||||
|
|
|
@ -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: Array.hxx,v 1.6 2005-07-02 18:34:54 stephena Exp $
|
||||
// $Id: Array.hxx,v 1.7 2005-07-14 18:28:36 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -192,7 +192,8 @@ class Array
|
|||
|
||||
} // Namespace GUI
|
||||
|
||||
typedef GUI::Array<int> IntArray;
|
||||
typedef GUI::Array<bool> BoolArray;
|
||||
typedef GUI::Array<int> IntArray;
|
||||
typedef GUI::Array<bool> BoolArray;
|
||||
typedef GUI::Array<uInt8> ByteArray;
|
||||
|
||||
#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: DataGridWidget.cxx,v 1.13 2005-07-07 15:19:04 stephena Exp $
|
||||
// $Id: DataGridWidget.cxx,v 1.14 2005-07-14 18:28:36 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -297,42 +297,63 @@ bool DataGridWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
|||
break;
|
||||
|
||||
case 'n': // negate
|
||||
negateCell();
|
||||
dirty = true;
|
||||
if(_editable)
|
||||
{
|
||||
negateCell();
|
||||
dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'i': // invert
|
||||
case '!':
|
||||
invertCell();
|
||||
dirty = true;
|
||||
if(_editable)
|
||||
{
|
||||
invertCell();
|
||||
dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case '-': // decrement
|
||||
decrementCell();
|
||||
dirty = true;
|
||||
if(_editable)
|
||||
{
|
||||
decrementCell();
|
||||
dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case '+': // increment
|
||||
case '=':
|
||||
incrementCell();
|
||||
dirty = true;
|
||||
if(_editable)
|
||||
{
|
||||
incrementCell();
|
||||
dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case '<': // shift left
|
||||
case ',':
|
||||
lshiftCell();
|
||||
dirty = true;
|
||||
if(_editable)
|
||||
{
|
||||
lshiftCell();
|
||||
dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case '>': // shift right
|
||||
case '.':
|
||||
rshiftCell();
|
||||
dirty = true;
|
||||
if(_editable)
|
||||
{
|
||||
rshiftCell();
|
||||
dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'z': // zero
|
||||
zeroCell();
|
||||
dirty = true;
|
||||
if(_editable)
|
||||
{
|
||||
zeroCell();
|
||||
dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -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.9 2005-07-12 02:27:07 urchlay Exp $
|
||||
// $Id: TiaWidget.cxx,v 1.10 2005-07-14 18:28:36 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -33,18 +33,18 @@
|
|||
// ID's for the various widgets
|
||||
// We need ID's, since there are more than one of several types of widgets
|
||||
enum {
|
||||
kRamID,
|
||||
kColorRegsID,
|
||||
kVSyncID,
|
||||
kVBlankID
|
||||
kRamID = 'TWra',
|
||||
kColorRegsID = 'TWcr',
|
||||
kVSyncID = 'TWvs',
|
||||
kVBlankID = 'TWvb'
|
||||
};
|
||||
|
||||
// Color registers
|
||||
enum {
|
||||
kCOLUP0Addr,
|
||||
kCOLUP1Addr,
|
||||
kCOLUBKAddr,
|
||||
kCOLUPFAddr
|
||||
kCOLUPFAddr,
|
||||
kCOLUBKAddr
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -60,6 +60,7 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
|
|||
|
||||
// Create a 16x1 grid holding byte values with labels
|
||||
myRamGrid = new DataGridWidget(boss, xpos+lwidth, ypos, 16, 1, 2, 8, kBASE_16);
|
||||
myRamGrid->setEditable(false);
|
||||
myRamGrid->setTarget(this);
|
||||
myRamGrid->setID(kRamID);
|
||||
myActiveWidget = myRamGrid;
|
||||
|
@ -130,10 +131,10 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
|
|||
xpos = 10; ypos += 2* kLineHeight;
|
||||
for(int row = 0; row < 4; ++row)
|
||||
{
|
||||
StaticTextWidget* t = new StaticTextWidget(boss, xpos, ypos + row*kLineHeight + 2,
|
||||
40, kLineHeight,
|
||||
regNames[row] + string(":"),
|
||||
kTextAlignLeft);
|
||||
new StaticTextWidget(boss, xpos, ypos + row*kLineHeight + 2,
|
||||
40, kLineHeight,
|
||||
regNames[row] + string(":"),
|
||||
kTextAlignLeft);
|
||||
}
|
||||
xpos += 40;
|
||||
myColorRegs = new DataGridWidget(boss, xpos, ypos-1, 1, 4, 2, 8, kBASE_16);
|
||||
|
@ -168,7 +169,7 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
// It will then send the 'kDGItemDataChangedCmd' signal to change the actual
|
||||
// memory location
|
||||
int addr, value;
|
||||
const char* buf;
|
||||
string buf;
|
||||
|
||||
Debugger& dbg = instance()->debugger();
|
||||
|
||||
|
@ -177,10 +178,6 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
case kDGItemDataChangedCmd:
|
||||
switch(id)
|
||||
{
|
||||
case kRamID:
|
||||
changeRam();
|
||||
break;
|
||||
|
||||
case kColorRegsID:
|
||||
changeColorRegs();
|
||||
break;
|
||||
|
@ -201,12 +198,10 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
addr = myRamGrid->getSelectedAddr();
|
||||
value = myRamGrid->getSelectedValue();
|
||||
|
||||
buf = instance()->debugger().equates()->getLabel(addr).c_str();
|
||||
if(*buf) myLabel->setEditString(buf);
|
||||
else myLabel->setEditString("");
|
||||
myLabel->setEditString(dbg.equates()->getLabel(addr));
|
||||
|
||||
myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10));
|
||||
myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2));
|
||||
myDecValue->setEditString(dbg.valueToString(value, kBASE_10));
|
||||
myBinValue->setEditString(dbg.valueToString(value, kBASE_2));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -243,7 +238,8 @@ void TiaWidget::fillGrid()
|
|||
IntArray vlist;
|
||||
BoolArray changed;
|
||||
|
||||
TIADebug& tia = instance()->debugger().tiaDebug();
|
||||
Debugger& dbg = instance()->debugger();
|
||||
TIADebug& tia = dbg.tiaDebug();
|
||||
TiaState state = (TiaState&) tia.getState();
|
||||
TiaState oldstate = (TiaState&) tia.getOldState();
|
||||
|
||||
|
@ -258,40 +254,43 @@ void TiaWidget::fillGrid()
|
|||
myRamGrid->setList(alist, vlist, changed);
|
||||
|
||||
// Scanline and VSync/VBlank
|
||||
// FIXME
|
||||
myScanlines->setEditString(dbg.valueToString(tia.scanlines(), kBASE_10));
|
||||
myVSync->setState(tia.vsync());
|
||||
myVBlank->setState(tia.vblank());
|
||||
|
||||
// Color registers
|
||||
alist.clear(); vlist.clear(); changed.clear();
|
||||
for(unsigned int i = 0; i < 4; i++)
|
||||
{
|
||||
alist.push_back(i);
|
||||
vlist.push_back(i);
|
||||
changed.push_back(false);
|
||||
vlist.push_back(state.coluRegs[i]);
|
||||
changed.push_back(state.coluRegs[i] != oldstate.coluRegs[i]);
|
||||
}
|
||||
myColorRegs->setList(alist, vlist, changed);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TiaWidget::changeRam()
|
||||
{
|
||||
int addr = myRamGrid->getSelectedAddr();
|
||||
int value = myRamGrid->getSelectedValue();
|
||||
|
||||
IntArray ram;
|
||||
ram.push_back(addr);
|
||||
ram.push_back(value);
|
||||
|
||||
// instance()->debugger().setRAM(ram);
|
||||
myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10));
|
||||
myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TiaWidget::changeColorRegs()
|
||||
{
|
||||
cerr << "TiaWidget::changeColorRegs()\n";
|
||||
int addr = myColorRegs->getSelectedAddr();
|
||||
int value = myColorRegs->getSelectedValue();
|
||||
|
||||
//FIXME instance()->debugger().writeRAM(addr - kRamStart, value);
|
||||
switch(addr)
|
||||
{
|
||||
case kCOLUP0Addr:
|
||||
instance()->debugger().tiaDebug().coluP0(value);
|
||||
break;
|
||||
|
||||
case kCOLUP1Addr:
|
||||
instance()->debugger().tiaDebug().coluP1(value);
|
||||
break;
|
||||
|
||||
case kCOLUPFAddr:
|
||||
instance()->debugger().tiaDebug().coluPF(value);
|
||||
break;
|
||||
|
||||
case kCOLUBKAddr:
|
||||
instance()->debugger().tiaDebug().coluBK(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.4 2005-07-06 19:09:26 stephena Exp $
|
||||
// $Id: TiaWidget.hxx,v 1.5 2005-07-14 18:28:36 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -46,7 +46,6 @@ class TiaWidget : public Widget, public CommandSender
|
|||
|
||||
private:
|
||||
void fillGrid();
|
||||
void changeRam();
|
||||
void changeColorRegs();
|
||||
|
||||
private:
|
||||
|
|
|
@ -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.23 2005-07-06 15:09:16 stephena Exp $
|
||||
// $Id: Widget.cxx,v 1.24 2005-07-14 18:28:36 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -246,17 +246,17 @@ void Widget::setNextInChain(Widget* start, Widget* hasFocus)
|
|||
if(!start)
|
||||
return;
|
||||
// FIXME - get this working
|
||||
cerr << "--------------------------------\nWidget list:\n";
|
||||
//cerr << "--------------------------------\nWidget list:\n";
|
||||
Widget* w1 = start;
|
||||
while(w1)
|
||||
{
|
||||
if(w1->getFlags() & WIDGET_TAB_NAVIGATE)
|
||||
{
|
||||
cerr << w1 << endl;
|
||||
// cerr << w1 << endl;
|
||||
}
|
||||
w1 = w1->_next;
|
||||
}
|
||||
cerr << "\n--------------------------------\n";
|
||||
//cerr << "\n--------------------------------\n";
|
||||
|
||||
|
||||
// We search the array in circular fashion until the 'end' is reached
|
||||
|
@ -397,7 +397,12 @@ CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h,
|
|||
void CheckboxWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
||||
{
|
||||
if(isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h)
|
||||
{
|
||||
toggleState();
|
||||
|
||||
// We only send a command when the widget has been changed interactively
|
||||
sendCommand(_cmd, _state, _id);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -409,7 +414,6 @@ void CheckboxWidget::setState(bool state)
|
|||
_flags ^= WIDGET_INV_BORDER;
|
||||
draw();
|
||||
}
|
||||
sendCommand(_cmd, _state, _id);
|
||||
|
||||
// Refresh the screen after the checkbox is drawn
|
||||
// TODO - create dirty rectangle
|
||||
|
|
Loading…
Reference in New Issue