Check if RAM change succeeded in debugger RAM UI. This previously

wasn't necessary, as ZP RAM can always be changed.  In the new scheme,
however, sometimes the RAM view will actually show ROM, and in those
cases it definitely shouldn't be modified.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1749 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-06-04 09:54:18 +00:00
parent 82325b731c
commit 805300ceb8
3 changed files with 24 additions and 5 deletions

View File

@ -163,11 +163,17 @@ void DataGridWidget::setNumRows(int rows)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::setSelectedValue(int value)
{
setValue(_selectedItem, value);
setValue(_selectedItem, value, _valueList[_selectedItem] != value);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::setValue(int position, int value)
{
setValue(position, value, _valueList[position] != value);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::setValue(int position, int value, bool changed)
{
if(position >= 0 && uInt32(position) < _valueList.size())
{
@ -175,7 +181,7 @@ void DataGridWidget::setValue(int position, int value)
_editString = instance().debugger().valueToString(value, _base);
_valueStringList[position] = _editString;
_changedList[position] = (_valueList[position] != value);
_changedList[position] = changed;
_valueList[position] = value;
sendCommand(kDGItemDataChangedCmd, position, _id);

View File

@ -63,6 +63,8 @@ class DataGridWidget : public EditableWidget
void setSelectedValue(int value);
/** Set value at given position */
void setValue(int position, int value);
/** Set value at given position, manually specifying if the value changed */
void setValue(int position, int value, bool changed);
int getSelectedAddr() const { return _addrList[_selectedItem]; }
int getSelectedValue() const { return _valueList[_selectedItem]; }

View File

@ -164,18 +164,29 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
switch(cmd)
{
case kDGItemDataChangedCmd:
{
addr = myRamGrid->getSelectedAddr();
value = myRamGrid->getSelectedValue();
myUndoAddress = addr;
myUndoValue = dbg.read(state.rport[addr]);
// Attempt the write, and revert if it didn't succeed
uInt8 oldval = dbg.read(state.rport[addr]);
dbg.write(state.wport[addr], value);
uInt8 newval = dbg.read(state.rport[addr]);
if(value != newval)
{
myRamGrid->setValue(addr - myCurrentRamBank*128, newval, false);
break;
}
myUndoAddress = addr;
myUndoValue = oldval;
myDecValue->setEditString(instance().debugger().valueToString(value, kBASE_10));
myBinValue->setEditString(instance().debugger().valueToString(value, kBASE_2));
myRevertButton->setEnabled(true);
myUndoButton->setEnabled(true);
break;
}
case kDGSelectionChangedCmd:
{