diff --git a/stella/src/build/makefile b/stella/src/build/makefile index 337b2ed5a..41cf251a5 100644 --- a/stella/src/build/makefile +++ b/stella/src/build/makefile @@ -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: 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 \ Widget.o PopUpWidget.o ScrollBarWidget.o ListWidget.o TabWidget.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 \ EventMappingDialog.o GameInfoDialog.o HelpDialog.o AboutDialog.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 $(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 $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/Dialog.cxx diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index a5555ed02..6fca22e6f 100644 --- a/stella/src/debugger/Debugger.cxx +++ b/stella/src/debugger/Debugger.cxx @@ -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: 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" @@ -422,7 +422,7 @@ void Debugger::setY(int y) { } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Debugger::setS(int sp) { +void Debugger::setSP(int sp) { myDebugger->sp(sp); } @@ -524,12 +524,12 @@ int Debugger::getY() { } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int Debugger::getS() { +int Debugger::getSP() { return myDebugger->sp(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int Debugger::getP() { +int Debugger::getPS() { return myDebugger->ps(); } diff --git a/stella/src/debugger/Debugger.hxx b/stella/src/debugger/Debugger.hxx index 372408557..13276ccf9 100644 --- a/stella/src/debugger/Debugger.hxx +++ b/stella/src/debugger/Debugger.hxx @@ -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: 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 @@ -51,7 +51,7 @@ enum { for all debugging operations in Stella (parser, 6502 debugger, etc). @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 { @@ -178,14 +178,14 @@ class Debugger : public DialogContainer void setA(int a); void setX(int x); void setY(int y); - void setS(int sp); + void setSP(int sp); void setPC(int pc); int getPC(); int getA(); int getX(); int getY(); - int getP(); - int getS(); + int getPS(); + int getSP(); int cycles(); int peek(int addr); int dpeek(int addr); diff --git a/stella/src/debugger/DebuggerParser.cxx b/stella/src/debugger/DebuggerParser.cxx index 7e511693b..10ffd805e 100644 --- a/stella/src/debugger/DebuggerParser.cxx +++ b/stella/src/debugger/DebuggerParser.cxx @@ -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: 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" @@ -104,8 +104,8 @@ int DebuggerParser::decipher_arg(const string &str) { if(arg == "a") result = debugger->getA(); else if(arg == "x") result = debugger->getX(); else if(arg == "y") result = debugger->getY(); - else if(arg == "p") result = debugger->getP(); - else if(arg == "s") result = debugger->getS(); + else if(arg == "p") result = debugger->getPS(); + else if(arg == "s") result = debugger->getSP(); else if(arg == "pc" || arg == ".") result = debugger->getPC(); else { // Not a special, must be a regular arg: check for label first const char *a = arg.c_str(); @@ -479,7 +479,7 @@ string DebuggerParser::run(const string& command) { } else if(subStringMatch(verb, "s")) { if(argCount == 1) if(args[0] <= 0xff) - debugger->setS(args[0]); + debugger->setSP(args[0]); else return "value out of range (must be 00 - ff)"; else diff --git a/stella/src/gui/CpuWidget.cxx b/stella/src/gui/CpuWidget.cxx index f8c108298..894065ab0 100644 --- a/stella/src/gui/CpuWidget.cxx +++ b/stella/src/gui/CpuWidget.cxx @@ -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: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -28,6 +28,7 @@ #include "Widget.hxx" #include "DataGridWidget.hxx" #include "EditTextWidget.hxx" +#include "ToggleBitWidget.hxx" #include "CpuWidget.hxx" @@ -73,6 +74,14 @@ CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h) myPCLabel->setFont(font); 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 xpos = 10; ypos = 10 + 8*kLineHeight; 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->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; case kSPRegAddr: - instance()->debugger().setS(value); + instance()->debugger().setSP(value); break; case kARegAddr: @@ -178,6 +199,9 @@ void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data) } break; + case kTBItemDataChangedCmd: + cerr << "ps bit changed\n"; + break; /* case kRZeroCmd: myRamGrid->setSelectedValue(0); @@ -248,13 +272,25 @@ void CpuWidget::fillGrid() // And now fill the values Debugger& dbg = instance()->debugger(); vlist.push_back(dbg.getPC()); - vlist.push_back(dbg.getS()); + vlist.push_back(dbg.getSP()); vlist.push_back(dbg.getA()); vlist.push_back(dbg.getX()); vlist.push_back(dbg.getY()); 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 int pc = dbg.getPC(); const char* buf; diff --git a/stella/src/gui/CpuWidget.hxx b/stella/src/gui/CpuWidget.hxx index e9599068c..57ce39512 100644 --- a/stella/src/gui/CpuWidget.hxx +++ b/stella/src/gui/CpuWidget.hxx @@ -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: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -26,6 +26,7 @@ class GuiObject; class ButtonWidget; class EditTextWidget; class DataGridWidget; +class ToggleBitWidget; #include "Array.hxx" #include "Widget.hxx" @@ -49,8 +50,8 @@ class CpuWidget : public Widget, public CommandSender private: Widget* myActiveWidget; - DataGridWidget* myCpuGrid; - // FIXME - add a ToggleBitWidget for processor status (ps) register + DataGridWidget* myCpuGrid; + ToggleBitWidget* myPSRegister; EditTextWidget* myPCLabel; EditTextWidget* myCurrentIns; diff --git a/stella/src/gui/Widget.hxx b/stella/src/gui/Widget.hxx index c12760017..074171859 100644 --- a/stella/src/gui/Widget.hxx +++ b/stella/src/gui/Widget.hxx @@ -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.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 // Copyright (C) 2002-2004 The ScummVM project @@ -55,7 +55,8 @@ enum { kPopUpWidget = 'POPU', kTabWidget = 'TABW', kPromptWidget = 'PROM', - kDataGridWidget = 'BGRI' + kDataGridWidget = 'BGRI', + kToggleBitWidget = 'TGBT' }; enum { @@ -67,7 +68,7 @@ enum { This is the base class for all widgets. @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 {