Added ToggleBitWidget, which is very similar to the DataGridWidget, except

instead of editing values, you toggle values.

Implemented the processor status register as a ToggleBitWidget, since most
people are more familiar with the separate bits (vs. the actual value of the
byte).

Currently, the toggle signal is sent to the CpuWidget, but the register
itself isn't changed.  Brian, I only see toggleX() methods for 5 of the
bits, but there are 7 used.  Is that intentional, because if the other two
aren't meant to be used, I need to remove the visual cue that they're
being toggled.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@551 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-06-23 18:11:59 +00:00
parent 92a7352e30
commit 7db440c0b1
7 changed files with 65 additions and 24 deletions

View File

@ -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: makefile,v 1.105 2005-06-23 01:10:25 urchlay Exp $ ## $Id: makefile,v 1.106 2005-06-23 18:11:57 stephena Exp $
##============================================================================ ##============================================================================
##============================================================================ ##============================================================================
@ -158,7 +158,7 @@ M6502_OBJS = D6502.o Device.o M6502.o M6502Hi.o NullDev.o System.o
GUI_OBJS = Font.o Menu.o Launcher.o \ GUI_OBJS = Font.o Menu.o Launcher.o \
Widget.o PopUpWidget.o ScrollBarWidget.o ListWidget.o TabWidget.o \ Widget.o PopUpWidget.o ScrollBarWidget.o ListWidget.o TabWidget.o \
EditableWidget.o EditTextWidget.o EditNumWidget.o AddrValueWidget.o \ EditableWidget.o EditTextWidget.o EditNumWidget.o AddrValueWidget.o \
DataGridWidget.o \ DataGridWidget.o ToggleBitWidget.o \
Dialog.o DialogContainer.o OptionsDialog.o VideoDialog.o AudioDialog.o \ Dialog.o DialogContainer.o OptionsDialog.o VideoDialog.o AudioDialog.o \
EventMappingDialog.o GameInfoDialog.o HelpDialog.o AboutDialog.o \ EventMappingDialog.o GameInfoDialog.o HelpDialog.o AboutDialog.o \
LauncherDialog.o LauncherOptionsDialog.o BrowserDialog.o GameList.o \ LauncherDialog.o LauncherOptionsDialog.o BrowserDialog.o GameList.o \
@ -414,6 +414,9 @@ AddrValueWidget.o: $(GUI)/AddrValueWidget.cxx $(GUI)/AddrValueWidget.hxx
DataGridWidget.o: $(GUI)/DataGridWidget.cxx $(GUI)/DataGridWidget.hxx DataGridWidget.o: $(GUI)/DataGridWidget.cxx $(GUI)/DataGridWidget.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/DataGridWidget.cxx $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/DataGridWidget.cxx
ToggleBitWidget.o: $(GUI)/ToggleBitWidget.cxx $(GUI)/ToggleBitWidget.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/ToggleBitWidget.cxx
Dialog.o: $(GUI)/Dialog.cxx $(GUI)/Dialog.hxx Dialog.o: $(GUI)/Dialog.cxx $(GUI)/Dialog.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/Dialog.cxx $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/Dialog.cxx

View File

@ -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.31 2005-06-23 14:33:10 stephena Exp $ // $Id: Debugger.cxx,v 1.32 2005-06-23 18:11:58 stephena Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -422,7 +422,7 @@ void Debugger::setY(int y) {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::setS(int sp) { void Debugger::setSP(int sp) {
myDebugger->sp(sp); myDebugger->sp(sp);
} }
@ -524,12 +524,12 @@ int Debugger::getY() {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::getS() { int Debugger::getSP() {
return myDebugger->sp(); return myDebugger->sp();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::getP() { int Debugger::getPS() {
return myDebugger->ps(); return myDebugger->ps();
} }

View File

@ -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.28 2005-06-23 14:33:10 stephena Exp $ // $Id: Debugger.hxx,v 1.29 2005-06-23 18:11:58 stephena Exp $
//============================================================================ //============================================================================
#ifndef DEBUGGER_HXX #ifndef DEBUGGER_HXX
@ -51,7 +51,7 @@ enum {
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.28 2005-06-23 14:33:10 stephena Exp $ @version $Id: Debugger.hxx,v 1.29 2005-06-23 18:11:58 stephena Exp $
*/ */
class Debugger : public DialogContainer class Debugger : public DialogContainer
{ {
@ -178,14 +178,14 @@ class Debugger : public DialogContainer
void setA(int a); void setA(int a);
void setX(int x); void setX(int x);
void setY(int y); void setY(int y);
void setS(int sp); void setSP(int sp);
void setPC(int pc); void setPC(int pc);
int getPC(); int getPC();
int getA(); int getA();
int getX(); int getX();
int getY(); int getY();
int getP(); int getPS();
int getS(); int getSP();
int cycles(); int cycles();
int peek(int addr); int peek(int addr);
int dpeek(int addr); int dpeek(int addr);

View File

@ -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: DebuggerParser.cxx,v 1.31 2005-06-23 14:33:10 stephena Exp $ // $Id: DebuggerParser.cxx,v 1.32 2005-06-23 18:11:58 stephena Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -104,8 +104,8 @@ int DebuggerParser::decipher_arg(const string &str) {
if(arg == "a") result = debugger->getA(); if(arg == "a") result = debugger->getA();
else if(arg == "x") result = debugger->getX(); else if(arg == "x") result = debugger->getX();
else if(arg == "y") result = debugger->getY(); else if(arg == "y") result = debugger->getY();
else if(arg == "p") result = debugger->getP(); else if(arg == "p") result = debugger->getPS();
else if(arg == "s") result = debugger->getS(); else if(arg == "s") result = debugger->getSP();
else if(arg == "pc" || arg == ".") result = debugger->getPC(); else if(arg == "pc" || arg == ".") result = debugger->getPC();
else { // Not a special, must be a regular arg: check for label first else { // Not a special, must be a regular arg: check for label first
const char *a = arg.c_str(); const char *a = arg.c_str();
@ -479,7 +479,7 @@ string DebuggerParser::run(const string& command) {
} else if(subStringMatch(verb, "s")) { } else if(subStringMatch(verb, "s")) {
if(argCount == 1) if(argCount == 1)
if(args[0] <= 0xff) if(args[0] <= 0xff)
debugger->setS(args[0]); debugger->setSP(args[0]);
else else
return "value out of range (must be 00 - ff)"; return "value out of range (must be 00 - ff)";
else else

View File

@ -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: CpuWidget.cxx,v 1.4 2005-06-23 14:33:11 stephena Exp $ // $Id: CpuWidget.cxx,v 1.5 2005-06-23 18:11:59 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
@ -28,6 +28,7 @@
#include "Widget.hxx" #include "Widget.hxx"
#include "DataGridWidget.hxx" #include "DataGridWidget.hxx"
#include "EditTextWidget.hxx" #include "EditTextWidget.hxx"
#include "ToggleBitWidget.hxx"
#include "CpuWidget.hxx" #include "CpuWidget.hxx"
@ -73,6 +74,14 @@ CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h)
myPCLabel->setFont(font); myPCLabel->setFont(font);
myPCLabel->setEditable(false); myPCLabel->setEditable(false);
// Create a bitfield widget for changing the processor status
xpos = 10; ypos = 2 + 6*kLineHeight;
StaticTextWidget* t = new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight,
"PS:", kTextAlignLeft);
t->setFont(font);
myPSRegister = new ToggleBitWidget(boss, xpos+lwidth + 5, ypos-2, 8, 1);
myPSRegister->setTarget(this);
// And some status fields // And some status fields
xpos = 10; ypos = 10 + 8*kLineHeight; xpos = 10; ypos = 10 + 8*kLineHeight;
new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "Current Ins:", kTextAlignLeft); new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "Current Ins:", kTextAlignLeft);
@ -98,6 +107,18 @@ CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h)
myStatus->setFont(font); myStatus->setFont(font);
myStatus->setEditable(false); myStatus->setEditable(false);
// Set the strings to be used in the PSRegister
// We only do this once because it's the state that changes, not the strings
const char* offstr[] = { "n", "v", "-", "b", "d", "i", "z", "c" };
const char* onstr[] = { "N", "V", "-", "B", "D", "I", "Z", "C" };
StringList off, on;
for(int i = 0; i < 8; ++i)
{
off.push_back(offstr[i]);
on.push_back(onstr[i]);
}
myPSRegister->setList(off, on);
/* /*
@ -161,7 +182,7 @@ void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data)
break; break;
case kSPRegAddr: case kSPRegAddr:
instance()->debugger().setS(value); instance()->debugger().setSP(value);
break; break;
case kARegAddr: case kARegAddr:
@ -178,6 +199,9 @@ void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data)
} }
break; break;
case kTBItemDataChangedCmd:
cerr << "ps bit changed\n";
break;
/* /*
case kRZeroCmd: case kRZeroCmd:
myRamGrid->setSelectedValue(0); myRamGrid->setSelectedValue(0);
@ -248,13 +272,25 @@ void CpuWidget::fillGrid()
// And now fill the values // And now fill the values
Debugger& dbg = instance()->debugger(); Debugger& dbg = instance()->debugger();
vlist.push_back(dbg.getPC()); vlist.push_back(dbg.getPC());
vlist.push_back(dbg.getS()); vlist.push_back(dbg.getSP());
vlist.push_back(dbg.getA()); vlist.push_back(dbg.getA());
vlist.push_back(dbg.getX()); vlist.push_back(dbg.getX());
vlist.push_back(dbg.getY()); vlist.push_back(dbg.getY());
myCpuGrid->setList(alist, vlist); myCpuGrid->setList(alist, vlist);
// Update the PS register booleans
BoolList b;
int ps = dbg.getPS();
for(int i = 0; i < 8; ++i)
{
if(ps & (1<<(7-i)))
b.push_back(true);
else
b.push_back(false);
}
myPSRegister->setState(b);
// Update the other status fields // Update the other status fields
int pc = dbg.getPC(); int pc = dbg.getPC();
const char* buf; const char* buf;

View File

@ -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: CpuWidget.hxx,v 1.3 2005-06-22 18:30:43 stephena Exp $ // $Id: CpuWidget.hxx,v 1.4 2005-06-23 18:11:59 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
@ -26,6 +26,7 @@ class GuiObject;
class ButtonWidget; class ButtonWidget;
class EditTextWidget; class EditTextWidget;
class DataGridWidget; class DataGridWidget;
class ToggleBitWidget;
#include "Array.hxx" #include "Array.hxx"
#include "Widget.hxx" #include "Widget.hxx"
@ -50,7 +51,7 @@ class CpuWidget : public Widget, public CommandSender
Widget* myActiveWidget; Widget* myActiveWidget;
DataGridWidget* myCpuGrid; DataGridWidget* myCpuGrid;
// FIXME - add a ToggleBitWidget for processor status (ps) register ToggleBitWidget* myPSRegister;
EditTextWidget* myPCLabel; EditTextWidget* myPCLabel;
EditTextWidget* myCurrentIns; EditTextWidget* myCurrentIns;

View File

@ -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.21 2005-06-23 14:33:12 stephena Exp $ // $Id: Widget.hxx,v 1.22 2005-06-23 18:11:59 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
@ -55,7 +55,8 @@ enum {
kPopUpWidget = 'POPU', kPopUpWidget = 'POPU',
kTabWidget = 'TABW', kTabWidget = 'TABW',
kPromptWidget = 'PROM', kPromptWidget = 'PROM',
kDataGridWidget = 'BGRI' kDataGridWidget = 'BGRI',
kToggleBitWidget = 'TGBT'
}; };
enum { enum {
@ -67,7 +68,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.21 2005-06-23 14:33:12 stephena Exp $ @version $Id: Widget.hxx,v 1.22 2005-06-23 18:11:59 stephena Exp $
*/ */
class Widget : public GuiObject class Widget : public GuiObject
{ {