mirror of https://github.com/stella-emu/stella.git
When patching code in the disassembly list, the current base is now used.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2755 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
98886f8850
commit
f5ed7ccf5c
|
@ -26,7 +26,8 @@
|
||||||
accurate. It also automatically differentiates between
|
accurate. It also automatically differentiates between
|
||||||
CODE/PGFX/GFX/DATA/ROW areas, whereas normal Distella
|
CODE/PGFX/GFX/DATA/ROW areas, whereas normal Distella
|
||||||
only differentiates between CODE/GFX/ROW. For now, only
|
only differentiates between CODE/GFX/ROW. For now, only
|
||||||
single-bank (4K and smaller) ROMs are supported.
|
single-bank (4K and smaller) ROMs are supported; support for
|
||||||
|
multi-bank ROMs will come in a future release.
|
||||||
|
|
||||||
- The disassembly now recognizes various TIA/RIOT read/write
|
- The disassembly now recognizes various TIA/RIOT read/write
|
||||||
mirrors, and marks them as such (for example, INPT4|$30 instead
|
mirrors, and marks them as such (for example, INPT4|$30 instead
|
||||||
|
@ -38,6 +39,9 @@
|
||||||
256 byte ROM will show only 256 bytes in the disassembly, instead
|
256 byte ROM will show only 256 bytes in the disassembly, instead
|
||||||
of padding duplicated data to 2K boundary.
|
of padding duplicated data to 2K boundary.
|
||||||
|
|
||||||
|
- Fixed bug when entering patched bytes; the current number base
|
||||||
|
wasn't being used.
|
||||||
|
|
||||||
- Fixed labelling in ROW directives; it wasn't accurately setting
|
- Fixed labelling in ROW directives; it wasn't accurately setting
|
||||||
a label in the case where it occurred in the middle of the data.
|
a label in the case where it occurred in the middle of the data.
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "Debugger.hxx"
|
#include "Debugger.hxx"
|
||||||
|
#include "DiStella.hxx"
|
||||||
#include "PackedBitArray.hxx"
|
#include "PackedBitArray.hxx"
|
||||||
#include "Widget.hxx"
|
#include "Widget.hxx"
|
||||||
#include "ScrollBarWidget.hxx"
|
#include "ScrollBarWidget.hxx"
|
||||||
|
@ -392,8 +393,8 @@ void RomListWidget::handleCommand(CommandSender* sender, int cmd, int data, int
|
||||||
case kCheckActionCmd:
|
case kCheckActionCmd:
|
||||||
// We let the parent class handle this
|
// We let the parent class handle this
|
||||||
// Pass it as a kRLBreakpointChangedCmd command, since that's the intent
|
// Pass it as a kRLBreakpointChangedCmd command, since that's the intent
|
||||||
sendCommand(RomListWidget::kBPointChangedCmd,
|
sendCommand(RomListWidget::kBPointChangedCmd, _currentPos+id,
|
||||||
myCheckList[id]->getState(), _currentPos+id);
|
myCheckList[id]->getState());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kSetPositionCmd:
|
case kSetPositionCmd:
|
||||||
|
@ -552,15 +553,34 @@ GUI::Rect RomListWidget::getEditRect() const
|
||||||
bool RomListWidget::tryInsertChar(char c, int pos)
|
bool RomListWidget::tryInsertChar(char c, int pos)
|
||||||
{
|
{
|
||||||
// Not sure how efficient this is, or should we even care?
|
// Not sure how efficient this is, or should we even care?
|
||||||
|
bool insert = false;
|
||||||
c = tolower(c);
|
c = tolower(c);
|
||||||
if((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
|
switch(_base)
|
||||||
c == '\\' || c == '#' || c == '$' || c == ' ')
|
|
||||||
{
|
{
|
||||||
_editString.insert(pos, 1, c);
|
case kBASE_16:
|
||||||
return true;
|
case kBASE_16_1:
|
||||||
|
case kBASE_16_2:
|
||||||
|
case kBASE_16_4:
|
||||||
|
case kBASE_16_8:
|
||||||
|
insert = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || c == ' ';
|
||||||
|
break;
|
||||||
|
case kBASE_2:
|
||||||
|
case kBASE_2_8:
|
||||||
|
case kBASE_2_16:
|
||||||
|
insert = c == '0' || c == '1' || c == ' ';
|
||||||
|
break;
|
||||||
|
case kBASE_10:
|
||||||
|
if((c >= '0' && c <= '9') || c == ' ')
|
||||||
|
insert = true;
|
||||||
|
break;
|
||||||
|
case kBASE_DEFAULT:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
if(insert)
|
||||||
|
_editString.insert(pos, 1, c);
|
||||||
|
|
||||||
|
return insert;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -573,6 +593,15 @@ void RomListWidget::startEditMode()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_editMode = true;
|
_editMode = true;
|
||||||
|
switch(myDisasm->list[_selectedItem].type)
|
||||||
|
{
|
||||||
|
case CartDebug::GFX:
|
||||||
|
case CartDebug::PGFX:
|
||||||
|
_base = DiStella::settings.gfx_format;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_base = instance().debugger().parser().base();
|
||||||
|
}
|
||||||
|
|
||||||
// Widget gets raw data while editing
|
// Widget gets raw data while editing
|
||||||
EditableWidget::startEditMode();
|
EditableWidget::startEditMode();
|
||||||
|
@ -589,7 +618,7 @@ void RomListWidget::endEditMode()
|
||||||
// Send a message that editing finished with a return/enter key press
|
// Send a message that editing finished with a return/enter key press
|
||||||
// The parent then calls getText() to get the newly entered data
|
// The parent then calls getText() to get the newly entered data
|
||||||
_editMode = false;
|
_editMode = false;
|
||||||
sendCommand(RomListWidget::kRomChangedCmd, _selectedItem, _id);
|
sendCommand(RomListWidget::kRomChangedCmd, _selectedItem, _base);
|
||||||
|
|
||||||
// Reset to normal data entry
|
// Reset to normal data entry
|
||||||
EditableWidget::endEditMode();
|
EditableWidget::endEditMode();
|
||||||
|
|
|
@ -27,6 +27,7 @@ class CheckListWidget;
|
||||||
|
|
||||||
#include "Array.hxx"
|
#include "Array.hxx"
|
||||||
#include "CartDebug.hxx"
|
#include "CartDebug.hxx"
|
||||||
|
#include "DebuggerParser.hxx"
|
||||||
#include "EditableWidget.hxx"
|
#include "EditableWidget.hxx"
|
||||||
|
|
||||||
/** RomListWidget */
|
/** RomListWidget */
|
||||||
|
@ -34,8 +35,10 @@ class RomListWidget : public EditableWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
kBPointChangedCmd = 'RLbp', // click on the checkbox for a breakpoint
|
kBPointChangedCmd = 'RLbp', // 'data' will be disassembly line number,
|
||||||
|
// 'id' will be the checkbox state
|
||||||
kRomChangedCmd = 'RLpr', // 'data' will be disassembly line number
|
kRomChangedCmd = 'RLpr', // 'data' will be disassembly line number
|
||||||
|
// 'id' will be the BaseFormat of the data
|
||||||
kSetPCCmd = 'STpc', // 'data' will be disassembly line number
|
kSetPCCmd = 'STpc', // 'data' will be disassembly line number
|
||||||
kRuntoPCCmd = 'RTpc', // 'data' will be disassembly line number
|
kRuntoPCCmd = 'RTpc', // 'data' will be disassembly line number
|
||||||
kDisassembleCmd = 'REds',
|
kDisassembleCmd = 'REds',
|
||||||
|
@ -99,6 +102,7 @@ class RomListWidget : public EditableWidget
|
||||||
int _selectedItem;
|
int _selectedItem;
|
||||||
int _highlightedItem;
|
int _highlightedItem;
|
||||||
bool _editMode;
|
bool _editMode;
|
||||||
|
BaseFormat _base; // base used during editing
|
||||||
StellaKey _currentKeyDown;
|
StellaKey _currentKeyDown;
|
||||||
|
|
||||||
const CartDebug::Disassembly* myDisasm;
|
const CartDebug::Disassembly* myDisasm;
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "Debugger.hxx"
|
#include "Debugger.hxx"
|
||||||
#include "DebuggerParser.hxx"
|
|
||||||
#include "CartDebug.hxx"
|
#include "CartDebug.hxx"
|
||||||
#include "DiStella.hxx"
|
#include "DiStella.hxx"
|
||||||
#include "CpuDebug.hxx"
|
#include "CpuDebug.hxx"
|
||||||
|
@ -101,9 +100,9 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case RomListWidget::kBPointChangedCmd:
|
case RomListWidget::kBPointChangedCmd:
|
||||||
// 'id' is the line in the disassemblylist to be accessed
|
// 'data' is the line in the disassemblylist to be accessed
|
||||||
// 'data' is the state of the breakpoint at 'id'
|
// 'id' is the state of the breakpoint at 'data'
|
||||||
setBreak(id, data);
|
setBreak(data, id);
|
||||||
// Refresh the romlist, since the breakpoint may not have
|
// Refresh the romlist, since the breakpoint may not have
|
||||||
// actually changed
|
// actually changed
|
||||||
myRomList->setDirty();
|
myRomList->setDirty();
|
||||||
|
@ -112,7 +111,8 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
|
|
||||||
case RomListWidget::kRomChangedCmd:
|
case RomListWidget::kRomChangedCmd:
|
||||||
// 'data' is the line in the disassemblylist to be accessed
|
// 'data' is the line in the disassemblylist to be accessed
|
||||||
patchROM(data, myRomList->getText());
|
// 'id' is the base to use for the data to be changed
|
||||||
|
patchROM(data, myRomList->getText(), (BaseFormat)id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RomListWidget::kSetPCCmd:
|
case RomListWidget::kSetPCCmd:
|
||||||
|
@ -214,7 +214,7 @@ void RomWidget::runtoPC(int disasm_line)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void RomWidget::patchROM(int disasm_line, const string& bytes)
|
void RomWidget::patchROM(int disasm_line, const string& bytes, BaseFormat base)
|
||||||
{
|
{
|
||||||
const CartDebug::DisassemblyList& list =
|
const CartDebug::DisassemblyList& list =
|
||||||
instance().debugger().cartDebug().disassembly().list;
|
instance().debugger().cartDebug().disassembly().list;
|
||||||
|
@ -227,11 +227,8 @@ void RomWidget::patchROM(int disasm_line, const string& bytes)
|
||||||
// Temporarily set to correct base, so we don't have to prefix each byte
|
// Temporarily set to correct base, so we don't have to prefix each byte
|
||||||
// with the type of data
|
// with the type of data
|
||||||
BaseFormat oldbase = instance().debugger().parser().base();
|
BaseFormat oldbase = instance().debugger().parser().base();
|
||||||
if(list[disasm_line].type == CartDebug::GFX)
|
|
||||||
instance().debugger().parser().setBase(DiStella::settings.gfx_format);
|
|
||||||
else
|
|
||||||
instance().debugger().parser().setBase(kBASE_16);
|
|
||||||
|
|
||||||
|
instance().debugger().parser().setBase(base);
|
||||||
command << "rom #" << list[disasm_line].address << " " << bytes;
|
command << "rom #" << list[disasm_line].address << " " << bytes;
|
||||||
instance().debugger().run(command.str());
|
instance().debugger().run(command.str());
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ class GuiObject;
|
||||||
class EditTextWidget;
|
class EditTextWidget;
|
||||||
|
|
||||||
#include "Command.hxx"
|
#include "Command.hxx"
|
||||||
|
#include "DebuggerParser.hxx"
|
||||||
#include "RomListWidget.hxx"
|
#include "RomListWidget.hxx"
|
||||||
|
|
||||||
class RomWidget : public Widget, public CommandSender
|
class RomWidget : public Widget, public CommandSender
|
||||||
|
@ -46,15 +47,10 @@ class RomWidget : public Widget, public CommandSender
|
||||||
void loadConfig();
|
void loadConfig();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
|
||||||
kResolveDataChanged = 'ACrd',
|
|
||||||
kRomNameEntered = 'RWrn'
|
|
||||||
};
|
|
||||||
|
|
||||||
void setBreak(int disasm_line, bool state);
|
void setBreak(int disasm_line, bool state);
|
||||||
void setPC(int disasm_line);
|
void setPC(int disasm_line);
|
||||||
void runtoPC(int disasm_line);
|
void runtoPC(int disasm_line);
|
||||||
void patchROM(int disasm_line, const string& bytes);
|
void patchROM(int disasm_line, const string& bytes, BaseFormat base);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RomListWidget* myRomList;
|
RomListWidget* myRomList;
|
||||||
|
|
Loading…
Reference in New Issue