From 0b272431ca314db019bc860d85ab24bcbf90630b Mon Sep 17 00:00:00 2001 From: stephena Date: Tue, 29 Apr 2008 15:13:16 +0000 Subject: [PATCH] Added preliminary support for a RIOT (I/O) tab in the debugger. It currently only shows the SWCHx and SWxCNT registers, but it will be expanded to include all items currently shown by the prompt 'riot' command. Added SaveKey controller, which is basically an AtariVox without the SpeakJet chip. The I2C code still isn't working (same as AtariVox). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1489 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/debugger/RiotDebug.cxx | 26 +++++++++++----------- stella/src/debugger/gui/DebuggerDialog.cxx | 13 +++++++---- stella/src/debugger/gui/module.mk | 1 + stella/src/emucore/AtariVox.cxx | 16 +++++++++++-- stella/src/emucore/Console.cxx | 11 +++++++-- stella/src/emucore/Control.cxx | 5 ++++- stella/src/emucore/Control.hxx | 6 ++--- stella/src/emucore/MT24LC256.cxx | 4 ++-- stella/src/emucore/module.mk | 1 + stella/src/gui/Widget.hxx | 5 +++-- 10 files changed, 59 insertions(+), 29 deletions(-) diff --git a/stella/src/debugger/RiotDebug.cxx b/stella/src/debugger/RiotDebug.cxx index 13edf3b36..866669d4c 100644 --- a/stella/src/debugger/RiotDebug.cxx +++ b/stella/src/debugger/RiotDebug.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: RiotDebug.cxx,v 1.1 2008-04-19 21:11:52 stephena Exp $ +// $Id: RiotDebug.cxx,v 1.2 2008-04-29 15:13:15 stephena Exp $ //============================================================================ #include @@ -37,10 +37,10 @@ const DebuggerState& RiotDebug::getState() myState.SWCHB = swchb(); myState.SWACNT = swacnt(); myState.SWBCNT = swbcnt(); - Debugger::set_bits(swcha(), myState.swchaBits); - Debugger::set_bits(swchb(), myState.swchbBits); - Debugger::set_bits(swacnt(), myState.swacntBits); - Debugger::set_bits(swbcnt(), myState.swbcntBits); + Debugger::set_bits(myState.SWCHA, myState.swchaBits); + Debugger::set_bits(myState.SWCHB, myState.swchbBits); + Debugger::set_bits(myState.SWACNT, myState.swacntBits); + Debugger::set_bits(myState.SWBCNT, myState.swbcntBits); // Timer registers myState.TIM1T = tim1T(); @@ -62,10 +62,10 @@ void RiotDebug::saveOldState() myOldState.SWCHB = swchb(); myOldState.SWACNT = swacnt(); myOldState.SWBCNT = swbcnt(); - Debugger::set_bits(swcha(), myOldState.swchaBits); - Debugger::set_bits(swchb(), myOldState.swchbBits); - Debugger::set_bits(swacnt(), myOldState.swacntBits); - Debugger::set_bits(swbcnt(), myOldState.swbcntBits); + Debugger::set_bits(myOldState.SWCHA, myOldState.swchaBits); + Debugger::set_bits(myOldState.SWCHB, myOldState.swchbBits); + Debugger::set_bits(myOldState.SWACNT, myOldState.swacntBits); + Debugger::set_bits(myOldState.SWBCNT, myOldState.swbcntBits); // Timer registers myOldState.TIM1T = tim1T(); @@ -214,8 +214,8 @@ string RiotDebug::tvTypeString() string RiotDebug::switchesString() { ostringstream buf; - buf << (swchb() & 0x2 ? "-" : "+") << "select " << - (swchb() & 0x1 ? "-" : "+") << "reset"; + buf << (swchb() & 0x2 ? "-" : "+") << "select " + << (swchb() & 0x1 ? "-" : "+") << "reset"; return buf.str(); } @@ -233,10 +233,10 @@ string RiotDebug::toString() myDebugger.invIfChanged(state.SWCHA, oldstate.SWCHA) + " "; ret += myDebugger.valueToString(0x281) + "/" + myDebugger.equates().getFormatted(0x281, 2) + "=" + - myDebugger.invIfChanged(state.SWCHB, oldstate.SWCHB) + " "; + myDebugger.invIfChanged(state.SWACNT, oldstate.SWACNT) + " "; ret += myDebugger.valueToString(0x282) + "/" + myDebugger.equates().getFormatted(0x282, 2) + "=" + - myDebugger.invIfChanged(state.SWACNT, oldstate.SWACNT) + " "; + myDebugger.invIfChanged(state.SWCHB, oldstate.SWCHB) + " "; ret += myDebugger.valueToString(0x283) + "/" + myDebugger.equates().getFormatted(0x283, 2) + "=" + myDebugger.invIfChanged(state.SWBCNT, oldstate.SWBCNT) + " "; diff --git a/stella/src/debugger/gui/DebuggerDialog.cxx b/stella/src/debugger/gui/DebuggerDialog.cxx index b484a1670..5efcf040d 100644 --- a/stella/src/debugger/gui/DebuggerDialog.cxx +++ b/stella/src/debugger/gui/DebuggerDialog.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: DebuggerDialog.cxx,v 1.23 2008-03-23 17:43:22 stephena Exp $ +// $Id: DebuggerDialog.cxx,v 1.24 2008-04-29 15:13:15 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -29,6 +29,7 @@ #include "PromptWidget.hxx" #include "CpuWidget.hxx" #include "RamWidget.hxx" +#include "RiotWidget.hxx" #include "RomWidget.hxx" #include "TiaWidget.hxx" #include "DataGridOpsWidget.hxx" @@ -182,6 +183,13 @@ void DebuggerDialog::addTabArea() myTab->setParentWidget(tabID, tia); addToFocusList(tia->getFocusList(), tabID); + // The input/output tab (includes RIOT and INPTx from TIA) + tabID = myTab->addTab("I/O"); + RiotWidget* riot = new RiotWidget(myTab, instance()->consoleFont(), + 2, 2, widWidth, widHeight); + myTab->setParentWidget(tabID, riot); + addToFocusList(riot->getFocusList(), tabID); + // The Audio tab tabID = myTab->addTab("Audio"); AudioWidget* aud = new AudioWidget(myTab, instance()->consoleFont(), @@ -189,9 +197,6 @@ void DebuggerDialog::addTabArea() myTab->setParentWidget(tabID, aud); addToFocusList(aud->getFocusList(), tabID); - // The input/output tab (part of RIOT) -// tabID = myTab->addTab("I/O"); - myTab->setActiveTab(0); } diff --git a/stella/src/debugger/gui/module.mk b/stella/src/debugger/gui/module.mk index 60bb8c430..fb6728c13 100644 --- a/stella/src/debugger/gui/module.mk +++ b/stella/src/debugger/gui/module.mk @@ -5,6 +5,7 @@ MODULE_OBJS := \ src/debugger/gui/CpuWidget.o \ src/debugger/gui/PromptWidget.o \ src/debugger/gui/RamWidget.o \ + src/debugger/gui/RiotWidget.o \ src/debugger/gui/RomWidget.o \ src/debugger/gui/RomListWidget.o \ src/debugger/gui/TiaWidget.o \ diff --git a/stella/src/emucore/AtariVox.cxx b/stella/src/emucore/AtariVox.cxx index e1945d44c..cfd7ed73b 100644 --- a/stella/src/emucore/AtariVox.cxx +++ b/stella/src/emucore/AtariVox.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: AtariVox.cxx,v 1.16 2008-04-20 19:52:33 stephena Exp $ +// $Id: AtariVox.cxx,v 1.17 2008-04-29 15:13:15 stephena Exp $ //============================================================================ #ifdef SPEAKJET_EMULATION @@ -158,16 +158,26 @@ void AtariVox::clockDataIn(bool value) { if(DEBUG_ATARIVOX) cerr << "value && (myShiftCount == 0), returning" << endl; +cerr << "!!!!! INVALID START BIT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; return; } // If this is the first write this frame, or if it's been a long time // since the last write, start a new data byte. - if(cycle < myLastDataWriteCycle || cycle > myLastDataWriteCycle + 1000) + if(cycle < myLastDataWriteCycle) { myShiftRegister = 0; myShiftCount = 0; +cerr << "!!!!! START NEW BYTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; } + else if(cycle > myLastDataWriteCycle + 1000) + { + myShiftRegister = 0; + myShiftCount = 0; +cerr << "!!!!! DELAY TOO LONG !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; + } + +cerr << "value = " << value << " (" << (int)myShiftCount << ")" << endl; // If this is the first write this frame, or if it's been 62 cycles // since the last write, shift this bit into the current byte. @@ -195,6 +205,8 @@ void AtariVox::clockDataIn(bool value) #else mySpeakJet->write(data); #endif +cerr << " ==> " << (int)data << endl; +cerr << "----------------------------------------------------------\n"; } myShiftRegister = 0; } diff --git a/stella/src/emucore/Console.cxx b/stella/src/emucore/Console.cxx index bbf573dc6..2468401cb 100644 --- a/stella/src/emucore/Console.cxx +++ b/stella/src/emucore/Console.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: Console.cxx,v 1.137 2008-04-13 23:43:14 stephena Exp $ +// $Id: Console.cxx,v 1.138 2008-04-29 15:13:16 stephena Exp $ //============================================================================ #include @@ -38,6 +38,7 @@ #include "Paddles.hxx" #include "Props.hxx" #include "PropsSet.hxx" +#include "SaveKey.hxx" #include "Settings.hxx" #include "Sound.hxx" #include "Switches.hxx" @@ -178,13 +179,19 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props) } else if(right == "ATARIVOX") { - string eepromfile = // fixme myOSystem->baseDir() + BSPF_PATH_SEPARATOR + "atarivox_eeprom.dat"; myControllers[rightPort] = myAVox = new AtariVox(Controller::Right, *myEvent, *mySystem, myOSystem->serialPort(), myOSystem->settings().getString("avoxport"), eepromfile); } + else if(right == "SAVEKEY") + { + string eepromfile = // fixme myOSystem->baseDir() + BSPF_PATH_SEPARATOR + + "savekey_eeprom.dat"; + myControllers[rightPort] = new SaveKey(Controller::Right, *myEvent, *mySystem, + eepromfile); + } else { myControllers[rightPort] = new Joystick(Controller::Right, *myEvent, *mySystem); diff --git a/stella/src/emucore/Control.cxx b/stella/src/emucore/Control.cxx index 00c9af273..a9c0a9391 100644 --- a/stella/src/emucore/Control.cxx +++ b/stella/src/emucore/Control.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: Control.cxx,v 1.10 2008-04-13 23:43:14 stephena Exp $ +// $Id: Control.cxx,v 1.11 2008-04-29 15:13:16 stephena Exp $ //============================================================================ #include @@ -61,6 +61,9 @@ Controller::Controller(Jack jack, const Event& event, const System& system, case AtariVox: myName = "AtariVox"; break; + case SaveKey: + myName = "SaveKey"; + break; } } diff --git a/stella/src/emucore/Control.hxx b/stella/src/emucore/Control.hxx index f79ec4609..68147b354 100644 --- a/stella/src/emucore/Control.hxx +++ b/stella/src/emucore/Control.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: Control.hxx,v 1.13 2008-04-13 23:43:14 stephena Exp $ +// $Id: Control.hxx,v 1.14 2008-04-29 15:13:16 stephena Exp $ //============================================================================ #ifndef CONTROLLER_HXX @@ -57,7 +57,7 @@ class System; of the controller from the perspective of the controller's jack. @author Bradford W. Mott - @version $Id: Control.hxx,v 1.13 2008-04-13 23:43:14 stephena Exp $ + @version $Id: Control.hxx,v 1.14 2008-04-29 15:13:16 stephena Exp $ */ class Controller : public Serializable { @@ -76,7 +76,7 @@ class Controller : public Serializable enum Type { BoosterGrip, Driving, Keyboard, Paddles, Joystick, - TrackBall22, AtariVox + TrackBall22, AtariVox, SaveKey }; public: diff --git a/stella/src/emucore/MT24LC256.cxx b/stella/src/emucore/MT24LC256.cxx index 43a5993fd..6de9b4804 100644 --- a/stella/src/emucore/MT24LC256.cxx +++ b/stella/src/emucore/MT24LC256.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: MT24LC256.cxx,v 1.5 2008-04-20 19:52:33 stephena Exp $ +// $Id: MT24LC256.cxx,v 1.6 2008-04-29 15:13:16 stephena Exp $ //============================================================================ #include @@ -86,7 +86,7 @@ MT24LC256::~MT24LC256() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool MT24LC256::readSDA() { -//cerr << "readSDA: <== " << (jpee_mdat && jpee_sdat) << endl; +cerr << "readSDA: <== " << (jpee_mdat && jpee_sdat) << endl; return jpee_mdat && jpee_sdat; } diff --git a/stella/src/emucore/module.mk b/stella/src/emucore/module.mk index 30c44637d..c80cc791e 100644 --- a/stella/src/emucore/module.mk +++ b/stella/src/emucore/module.mk @@ -47,6 +47,7 @@ MODULE_OBJS := \ src/emucore/Props.o \ src/emucore/PropsSet.o \ src/emucore/Random.o \ + src/emucore/SaveKey.o \ src/emucore/Serializer.o \ src/emucore/Settings.o \ src/emucore/SpeakJet.o \ diff --git a/stella/src/gui/Widget.hxx b/stella/src/gui/Widget.hxx index 3e6e8192c..efea9532e 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.59 2008-02-06 13:45:24 stephena Exp $ +// $Id: Widget.hxx,v 1.60 2008-04-29 15:13:16 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -67,6 +67,7 @@ enum { kDataGridWidget = 'BGRI', kPromptWidget = 'PROM', kRamWidget = 'RAMW', + kRiotWidget = 'RIOW', kRomListWidget = 'ROML', kRomWidget = 'ROMW', kTiaInfoWidget = 'TIAI', @@ -87,7 +88,7 @@ enum { This is the base class for all widgets. @author Stephen Anthony - @version $Id: Widget.hxx,v 1.59 2008-02-06 13:45:24 stephena Exp $ + @version $Id: Widget.hxx,v 1.60 2008-04-29 15:13:16 stephena Exp $ */ class Widget : public GuiObject {