mirror of https://github.com/stella-emu/stella.git
First pass at adding disassembly to the RomWidget. It currently
isn't very useful, only disassembles addresses 0-2048, and doesn't seem to look right :) git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@738 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
7f9ed70401
commit
9d0060a6ac
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Debugger.cxx,v 1.85 2005-08-22 18:17:10 stephena Exp $
|
// $Id: Debugger.cxx,v 1.86 2005-08-24 13:18:02 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
@ -778,6 +778,38 @@ const string& Debugger::disassemble(int start, int lines) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Debugger::disassemble(StringList& list, int start, int lines)
|
||||||
|
{
|
||||||
|
char buf[255], bbuf[255];
|
||||||
|
string result;
|
||||||
|
|
||||||
|
do {
|
||||||
|
result = "";
|
||||||
|
|
||||||
|
const char *label = equateList->getFormatted(start, 4);
|
||||||
|
|
||||||
|
result += label;
|
||||||
|
result += ": ";
|
||||||
|
|
||||||
|
int count = myCpuDebug->disassemble(start, buf, equateList);
|
||||||
|
|
||||||
|
for(int i=0; i<count; i++) {
|
||||||
|
sprintf(bbuf, "%02x ", peek(start++));
|
||||||
|
result += bbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count < 3) result += " ";
|
||||||
|
if(count < 2) result += " ";
|
||||||
|
|
||||||
|
result += " ";
|
||||||
|
result += buf;
|
||||||
|
|
||||||
|
list.push_back(result);
|
||||||
|
|
||||||
|
} while(--lines > 0);
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Debugger::nextScanline(int lines) {
|
void Debugger::nextScanline(int lines) {
|
||||||
saveOldState();
|
saveOldState();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Debugger.hxx,v 1.69 2005-08-22 18:17:10 stephena Exp $
|
// $Id: Debugger.hxx,v 1.70 2005-08-24 13:18:02 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DEBUGGER_HXX
|
#ifndef DEBUGGER_HXX
|
||||||
|
@ -76,7 +76,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
|
||||||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: Debugger.hxx,v 1.69 2005-08-22 18:17:10 stephena Exp $
|
@version $Id: Debugger.hxx,v 1.70 2005-08-24 13:18:02 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class Debugger : public DialogContainer
|
class Debugger : public DialogContainer
|
||||||
{
|
{
|
||||||
|
@ -183,6 +183,12 @@ class Debugger : public DialogContainer
|
||||||
*/
|
*/
|
||||||
const string& disassemble(int start, int lines);
|
const string& disassemble(int start, int lines);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Disassemble from the starting address the specified number of lines
|
||||||
|
and place result in given stringlist.
|
||||||
|
*/
|
||||||
|
void disassemble(StringList& list, int start, int lines);
|
||||||
|
|
||||||
int step();
|
int step();
|
||||||
int trace();
|
int trace();
|
||||||
void nextScanline(int lines);
|
void nextScanline(int lines);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: RomWidget.cxx,v 1.3 2005-08-23 18:32:51 stephena Exp $
|
// $Id: RomWidget.cxx,v 1.4 2005-08-24 13:18:02 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "Debugger.hxx"
|
||||||
#include "GuiObject.hxx"
|
#include "GuiObject.hxx"
|
||||||
#include "CheckListWidget.hxx"
|
#include "CheckListWidget.hxx"
|
||||||
#include "RomWidget.hxx"
|
#include "RomWidget.hxx"
|
||||||
|
@ -28,7 +29,9 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
: Widget(boss, x, y, 16, 16),
|
: Widget(boss, x, y, 16, 16),
|
||||||
CommandSender(boss)
|
CommandSender(boss),
|
||||||
|
myFirstLoad(true),
|
||||||
|
mySourceAvailable(false)
|
||||||
{
|
{
|
||||||
int w = 58 * font.getMaxCharWidth(),
|
int w = 58 * font.getMaxCharWidth(),
|
||||||
h = 31 * font.getLineHeight();
|
h = 31 * font.getLineHeight();
|
||||||
|
@ -54,7 +57,7 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case kListScrolledCmd:
|
case kListScrolledCmd:
|
||||||
cerr << "data invalidated; refill list\n";
|
incrementalUpdate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kListItemChecked:
|
case kListItemChecked:
|
||||||
|
@ -73,24 +76,39 @@ void RomWidget::loadConfig()
|
||||||
should be filled with new data.
|
should be filled with new data.
|
||||||
*/
|
*/
|
||||||
cerr << "RomWidget::loadConfig()\n";
|
cerr << "RomWidget::loadConfig()\n";
|
||||||
fillGrid();
|
if(myFirstLoad) // load the whole bank
|
||||||
myRomList->setDirty(); myRomList->draw();
|
{
|
||||||
|
initialUpdate();
|
||||||
|
myFirstLoad = false;
|
||||||
|
}
|
||||||
|
else // only reload what's in current view
|
||||||
|
{
|
||||||
|
incrementalUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void RomWidget::fillGrid()
|
void RomWidget::initialUpdate()
|
||||||
{
|
{
|
||||||
|
Debugger& dbg = instance()->debugger();
|
||||||
|
|
||||||
|
// Fill romlist with entire ROM (FIXME - only fill with current bank)
|
||||||
|
if(mySourceAvailable)
|
||||||
|
; // FIXME
|
||||||
|
else
|
||||||
|
{
|
||||||
StringList l;
|
StringList l;
|
||||||
BoolArray b;
|
BoolArray b;
|
||||||
|
|
||||||
for(int i = 0; i < 50; ++i)
|
dbg.disassemble(l, 0, 2048); // FIXME - use bank size
|
||||||
{
|
for(int i = 0; i < 2048; ++i)
|
||||||
ostringstream tmp;
|
|
||||||
tmp << "Test line " << i;
|
|
||||||
l.push_back(tmp.str());
|
|
||||||
|
|
||||||
b.push_back(false);
|
b.push_back(false);
|
||||||
}
|
|
||||||
|
|
||||||
myRomList->setList(l, b);
|
myRomList->setList(l, b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void RomWidget::incrementalUpdate()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: RomWidget.hxx,v 1.1 2005-08-22 13:53:23 stephena Exp $
|
// $Id: RomWidget.hxx,v 1.2 2005-08-24 13:18:02 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -41,10 +41,14 @@ class RomWidget : public Widget, public CommandSender
|
||||||
void loadConfig();
|
void loadConfig();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void fillGrid();
|
void initialUpdate();
|
||||||
|
void incrementalUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CheckListWidget* myRomList;
|
CheckListWidget* myRomList;
|
||||||
|
|
||||||
|
bool myFirstLoad;
|
||||||
|
bool mySourceAvailable;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: CheckListWidget.cxx,v 1.4 2005-08-23 18:32:51 stephena Exp $
|
// $Id: CheckListWidget.cxx,v 1.5 2005-08-24 13:18:02 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -61,11 +61,13 @@ void CheckListWidget::setStyle(CheckStyle style)
|
||||||
{
|
{
|
||||||
_checkList[i]->drawBox(true);
|
_checkList[i]->drawBox(true);
|
||||||
_checkList[i]->setFill(false);
|
_checkList[i]->setFill(false);
|
||||||
|
_checkList[i]->setColor(kTextColor);
|
||||||
}
|
}
|
||||||
else if(style == kSolidFill)
|
else if(style == kSolidFill)
|
||||||
{
|
{
|
||||||
_checkList[i]->drawBox(false);
|
_checkList[i]->drawBox(false);
|
||||||
_checkList[i]->setFill(true, kTextColorEm);
|
_checkList[i]->setFill(true);
|
||||||
|
_checkList[i]->setColor(kTextColorEm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Widget.cxx,v 1.32 2005-08-23 18:32:51 stephena Exp $
|
// $Id: Widget.cxx,v 1.33 2005-08-24 13:18:02 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -445,13 +445,6 @@ void CheckboxWidget::setEditable(bool editable)
|
||||||
_holdFocus = _editable = editable;
|
_holdFocus = _editable = editable;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void CheckboxWidget::setFill(bool fill, OverlayColor color)
|
|
||||||
{
|
|
||||||
_fillRect = fill;
|
|
||||||
_fillColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CheckboxWidget::setState(bool state)
|
void CheckboxWidget::setState(bool state)
|
||||||
{
|
{
|
||||||
|
@ -484,7 +477,8 @@ void CheckboxWidget::drawWidget(bool hilite)
|
||||||
if(_state)
|
if(_state)
|
||||||
{
|
{
|
||||||
if(_fillRect)
|
if(_fillRect)
|
||||||
fb.fillRect(_x + 2, _y + box_yoff + 2, 10, 10, _fillColor);
|
fb.fillRect(_x + 2, _y + box_yoff + 2, 10, 10,
|
||||||
|
isEnabled() ? _color : kColor);
|
||||||
else
|
else
|
||||||
fb.drawBitmap(checked_img, _x + 3, _y + box_yoff + 3,
|
fb.drawBitmap(checked_img, _x + 3, _y + box_yoff + 3,
|
||||||
isEnabled() ? _color : kColor);
|
isEnabled() ? _color : kColor);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Widget.hxx,v 1.34 2005-08-23 18:32:51 stephena Exp $
|
// $Id: Widget.hxx,v 1.35 2005-08-24 13:18:02 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -71,7 +71,7 @@ enum {
|
||||||
This is the base class for all widgets.
|
This is the base class for all widgets.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: Widget.hxx,v 1.34 2005-08-23 18:32:51 stephena Exp $
|
@version $Id: Widget.hxx,v 1.35 2005-08-24 13:18:02 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class Widget : public GuiObject
|
class Widget : public GuiObject
|
||||||
{
|
{
|
||||||
|
@ -225,7 +225,7 @@ class CheckboxWidget : public ButtonWidget
|
||||||
void holdFocus(bool status) { _holdFocus = status; }
|
void holdFocus(bool status) { _holdFocus = status; }
|
||||||
|
|
||||||
void setEditable(bool editable);
|
void setEditable(bool editable);
|
||||||
void setFill(bool fill, OverlayColor color = kColor);
|
void setFill(bool fill) { _fillRect = fill; }
|
||||||
void drawBox(bool draw) { _drawBox = draw; }
|
void drawBox(bool draw) { _drawBox = draw; }
|
||||||
|
|
||||||
void setState(bool state);
|
void setState(bool state);
|
||||||
|
|
Loading…
Reference in New Issue