From d0534cb746587f6ef835215e9f0174e1d01baa19 Mon Sep 17 00:00:00 2001 From: stephena Date: Wed, 6 Jul 2005 19:09:26 +0000 Subject: [PATCH] More additions to the TiaWidget, but none of it is functional yet :) Increased debugger window width to 639 pixels. We've already passed the 512x384 mark, so it's no use restricting width to 512 anymore. Besides, the extra width will come in handy for the TiaWidget, and maybe the PromptWidget can now use one less line in the state() display. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@613 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/debugger/Debugger.cxx | 4 +- stella/src/debugger/Debugger.hxx | 8 +- stella/src/gui/CpuWidget.cxx | 4 +- stella/src/gui/GuiUtils.hxx | 5 +- stella/src/gui/RamWidget.cxx | 4 +- stella/src/gui/TiaWidget.cxx | 123 +++++++++++++++++++++++++++---- stella/src/gui/TiaWidget.hxx | 15 +++- 7 files changed, 136 insertions(+), 27 deletions(-) diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index f5090191f..4889b8bd0 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.50 2005-07-03 08:15:31 urchlay Exp $ +// $Id: Debugger.cxx,v 1.51 2005-07-06 19:09:24 stephena Exp $ //============================================================================ #include "bspf.hxx" @@ -404,7 +404,7 @@ void Debugger::writeRAM(uInt16 offset, uInt8 value) /* Element 0 of args is the address. The remaining elements are the data to poke, starting at the given address. */ -const string Debugger::setRAM(IntArray args) { +const string Debugger::setRAM(IntArray& args) { char buf[10]; int count = args.size(); diff --git a/stella/src/debugger/Debugger.hxx b/stella/src/debugger/Debugger.hxx index 14cd88770..42e777001 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.40 2005-07-03 08:15:31 urchlay Exp $ +// $Id: Debugger.hxx,v 1.41 2005-07-06 19:09:25 stephena Exp $ //============================================================================ #ifndef DEBUGGER_HXX @@ -35,7 +35,7 @@ class D6502; #include "bspf.hxx" enum { - kDebuggerWidth = 511, + kDebuggerWidth = 639, kDebuggerLineHeight = 12, // based on the height of the console font kDebuggerLines = 15, }; @@ -51,7 +51,7 @@ enum { for all debugging operations in Stella (parser, 6502 debugger, etc). @author Stephen Anthony - @version $Id: Debugger.hxx,v 1.40 2005-07-03 08:15:31 urchlay Exp $ + @version $Id: Debugger.hxx,v 1.41 2005-07-06 19:09:25 stephena Exp $ */ class Debugger : public DialogContainer { @@ -185,7 +185,7 @@ class Debugger : public DialogContainer void writeRAM(uInt16 addr, uInt8 value); // set a bunch of RAM locations at once - const string setRAM(IntArray args); + const string setRAM(IntArray& args); bool start(); void quit(); diff --git a/stella/src/gui/CpuWidget.cxx b/stella/src/gui/CpuWidget.cxx index 8a74bed14..2c11227c0 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.11 2005-07-05 18:00:05 stephena Exp $ +// $Id: CpuWidget.cxx,v 1.12 2005-07-06 19:09:26 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -127,6 +127,8 @@ CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h) on.push_back(onstr[i]); } myPSRegister->setList(off, on); + + loadConfig(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/GuiUtils.hxx b/stella/src/gui/GuiUtils.hxx index 0114a0e7e..797f2bfbd 100644 --- a/stella/src/gui/GuiUtils.hxx +++ b/stella/src/gui/GuiUtils.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: GuiUtils.hxx,v 1.12 2005-07-02 01:28:43 stephena Exp $ +// $Id: GuiUtils.hxx,v 1.13 2005-07-06 19:09:26 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -29,7 +29,7 @@ Probably not very neat, but at least it works ... @author Stephen Anthony - @version $Id: GuiUtils.hxx,v 1.12 2005-07-02 01:28:43 stephena Exp $ + @version $Id: GuiUtils.hxx,v 1.13 2005-07-06 19:09:26 stephena Exp $ */ #define kLineHeight 12 @@ -55,6 +55,7 @@ enum { kDefaultsCmd = 'DEFA', kSetPositionCmd = 'SETP', kActiveWidgetCmd = 'ACTW', + kCheckActionCmd = 'CBAC', kRendererChanged, kAspectRatioChanged, kFrameRateChanged, diff --git a/stella/src/gui/RamWidget.cxx b/stella/src/gui/RamWidget.cxx index 5fb07e1f6..5463ae282 100644 --- a/stella/src/gui/RamWidget.cxx +++ b/stella/src/gui/RamWidget.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: RamWidget.cxx,v 1.15 2005-07-05 18:00:05 stephena Exp $ +// $Id: RamWidget.cxx,v 1.16 2005-07-06 19:09:26 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -136,6 +136,8 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h) ypos += 16 + space; b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, ">>", kDGShiftRCmd, 0); b->setTarget(myRamGrid); + + loadConfig(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/TiaWidget.cxx b/stella/src/gui/TiaWidget.cxx index aecb2a789..cc5605bde 100644 --- a/stella/src/gui/TiaWidget.cxx +++ b/stella/src/gui/TiaWidget.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: TiaWidget.cxx,v 1.3 2005-07-06 15:09:16 stephena Exp $ +// $Id: TiaWidget.cxx,v 1.4 2005-07-06 19:09:26 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -34,10 +34,17 @@ // We need ID's, since there are more than one of several types of widgets enum { kRamID, - kCOLUP0ID, - kCOLUP1ID, - kCOLUBKID, - kCOLUPFID + kColorRegsID, + kVSyncID, + kVBlankID +}; + +// Color registers +enum { + kCOLUP0Addr, + kCOLUP1Addr, + kCOLUBKAddr, + kCOLUPFAddr }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -97,6 +104,43 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h) myBinValue->setFont(font); myBinValue->setEditable(false); + // Scanline count and VSync/VBlank toggles + xpos = 10; ypos += 2 * kLineHeight; + new StaticTextWidget(boss, xpos, ypos, 40, kLineHeight, "Scanline: ", kTextAlignLeft); + xpos += 40; + myScanlines = new EditTextWidget(boss, xpos, ypos-2, 40, kLineHeight, ""); + myScanlines->clearFlags(WIDGET_TAB_NAVIGATE); + myScanlines->setFont(font); + myScanlines->setEditable(false); + xpos += 55; ypos -= 3; + myVSync = new CheckboxWidget(boss, xpos, ypos, 25, kLineHeight, "VSync", + kCheckActionCmd); + myVSync->setTarget(this); + myVSync->setID(kVSyncID); + myVSync->setFlags(WIDGET_TAB_NAVIGATE); + xpos += 60; + myVBlank = new CheckboxWidget(boss, xpos, ypos, 30, kLineHeight, "VBlank", + kCheckActionCmd); + myVBlank->setTarget(this); + myVBlank->setID(kVBlankID); + myVBlank->setFlags(WIDGET_TAB_NAVIGATE); + + // Color registers + const char* regNames[] = { "COLUP0", "COLUP1", "COLUPF", "COLUBK" }; + xpos = 10; ypos += 2* kLineHeight; + for(int row = 0; row < 4; ++row) + { + StaticTextWidget* t = new StaticTextWidget(boss, xpos, ypos + row*kLineHeight + 2, + 40, kLineHeight, + regNames[row] + string(":"), + kTextAlignLeft); + } + xpos += 40; + myColorRegs = new DataGridWidget(boss, xpos, ypos-1, 1, 4, 2, 8, kBASE_16); + myColorRegs->setTarget(this); + myColorRegs->setID(kColorRegsID); + + /* // Add some buttons for common actions ButtonWidget* b; @@ -109,6 +153,7 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h) // b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, "", kRCmd, 0); // b->setTarget(this); */ + loadConfig(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -136,6 +181,10 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) changeRam(); break; + case kColorRegsID: + changeColorRegs(); + break; + default: cerr << "TiaWidget DG changed\n"; break; @@ -145,17 +194,33 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) break; case kDGSelectionChangedCmd: - // FIXME - for now, only the RAM has multiple cells, so it's the only one - // that can receive this signal - addr = myRamGrid->getSelectedAddr(); - value = myRamGrid->getSelectedValue(); + switch(id) + { + case kRamID: + addr = myRamGrid->getSelectedAddr(); + value = myRamGrid->getSelectedValue(); - buf = instance()->debugger().equates()->getLabel(addr); - if(buf) myLabel->setEditString(buf); - else myLabel->setEditString(""); + buf = instance()->debugger().equates()->getLabel(addr); + if(buf) myLabel->setEditString(buf); + else myLabel->setEditString(""); - myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10)); - myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2)); + myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10)); + myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2)); + break; + } + break; + + case kCheckActionCmd: + switch(id) + { + case kVSyncID: + cerr << "vsync toggled\n"; + break; + + case kVBlankID: + cerr << "vblank toggled\n"; + break; + } break; } @@ -172,12 +237,14 @@ void TiaWidget::loadConfig() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TiaWidget::fillGrid() { +// FIXME - have these widget get correct values from TIADebug + Debugger& dbg = instance()->debugger(); AddrList alist; ValueList vlist; BoolArray changed; -// FIXME - have this actually talk to TIADebug - Debugger& dbg = instance()->debugger(); + // TIA RAM + alist.clear(); vlist.clear(); changed.clear(); for(unsigned int i = 0; i < 16; i++) { alist.push_back(i); @@ -185,11 +252,25 @@ void TiaWidget::fillGrid() changed.push_back(false); } myRamGrid->setList(alist, vlist, changed); + + // Scanline and VSync/VBlank +// FIXME + + // Color registers + alist.clear(); vlist.clear(); changed.clear(); + for(unsigned int i = 0; i < 4; i++) + { + alist.push_back(i); + vlist.push_back(i); + changed.push_back(false); + } + myColorRegs->setList(alist, vlist, changed); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TiaWidget::changeRam() { +cerr << "TiaWidget::changeRam()\n"; int addr = myRamGrid->getSelectedAddr(); int value = myRamGrid->getSelectedValue(); @@ -197,3 +278,13 @@ void TiaWidget::changeRam() myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10)); myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2)); } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TiaWidget::changeColorRegs() +{ +cerr << "TiaWidget::changeColorRegs()\n"; + int addr = myColorRegs->getSelectedAddr(); + int value = myColorRegs->getSelectedValue(); + +//FIXME instance()->debugger().writeRAM(addr - kRamStart, value); +} diff --git a/stella/src/gui/TiaWidget.hxx b/stella/src/gui/TiaWidget.hxx index d0bf88207..59b68a958 100644 --- a/stella/src/gui/TiaWidget.hxx +++ b/stella/src/gui/TiaWidget.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: TiaWidget.hxx,v 1.3 2005-07-06 15:09:16 stephena Exp $ +// $Id: TiaWidget.hxx,v 1.4 2005-07-06 19:09:26 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -47,6 +47,7 @@ class TiaWidget : public Widget, public CommandSender private: void fillGrid(); void changeRam(); + void changeColorRegs(); private: Widget* myActiveWidget; @@ -55,6 +56,18 @@ class TiaWidget : public Widget, public CommandSender EditTextWidget* myBinValue; EditTextWidget* myDecValue; EditTextWidget* myLabel; + + EditTextWidget* myScanlines; + CheckboxWidget* myVSync; + CheckboxWidget* myVBlank; + + DataGridWidget* myColorRegs; +/* FIXME - add widget for this, with ability to show color wheel or something + PaletteWidget* myCOLUP0Color; + PaletteWidget* myCOLUP1Color; + PaletteWidget* myCOLUPFColor; + PaletteWidget* myCOLUBKColor; +*/ }; #endif