mirror of https://github.com/stella-emu/stella.git
Added console switches to debugger RIOT/IO tab. Barring any huge
problems, we'll soon be ready for a new release (after I update the documentation). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1508 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
ff48c93a02
commit
bba25a39d8
|
@ -13,13 +13,14 @@
|
|||
// 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.5 2008-05-15 15:07:29 stephena Exp $
|
||||
// $Id: RiotDebug.cxx,v 1.6 2008-05-15 18:59:56 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "System.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "Switches.hxx"
|
||||
|
||||
#include "RiotDebug.hxx"
|
||||
|
||||
|
@ -52,13 +53,13 @@ const DebuggerState& RiotDebug::getState()
|
|||
myState.TIMCLKS = timClocks();
|
||||
|
||||
// Controller port pins
|
||||
Controller& port0 = mySystem.m6532().myConsole.controller(Controller::Left);
|
||||
Controller& port0 = myConsole.controller(Controller::Left);
|
||||
myState.P0_PIN1 = port0.myDigitalPinState[Controller::One];
|
||||
myState.P0_PIN2 = port0.myDigitalPinState[Controller::Two];
|
||||
myState.P0_PIN3 = port0.myDigitalPinState[Controller::Three];
|
||||
myState.P0_PIN4 = port0.myDigitalPinState[Controller::Four];
|
||||
myState.P0_PIN6 = port0.myDigitalPinState[Controller::Six];
|
||||
Controller& port1 = mySystem.m6532().myConsole.controller(Controller::Right);
|
||||
Controller& port1 = myConsole.controller(Controller::Right);
|
||||
myState.P1_PIN1 = port1.myDigitalPinState[Controller::One];
|
||||
myState.P1_PIN2 = port1.myDigitalPinState[Controller::Two];
|
||||
myState.P1_PIN3 = port1.myDigitalPinState[Controller::Three];
|
||||
|
@ -91,13 +92,13 @@ void RiotDebug::saveOldState()
|
|||
myOldState.TIMCLKS = timClocks();
|
||||
|
||||
// Controller port pins
|
||||
Controller& port0 = mySystem.m6532().myConsole.controller(Controller::Left);
|
||||
Controller& port0 = myConsole.controller(Controller::Left);
|
||||
myOldState.P0_PIN1 = port0.myDigitalPinState[Controller::One];
|
||||
myOldState.P0_PIN2 = port0.myDigitalPinState[Controller::Two];
|
||||
myOldState.P0_PIN3 = port0.myDigitalPinState[Controller::Three];
|
||||
myOldState.P0_PIN4 = port0.myDigitalPinState[Controller::Four];
|
||||
myOldState.P0_PIN6 = port0.myDigitalPinState[Controller::Six];
|
||||
Controller& port1 = mySystem.m6532().myConsole.controller(Controller::Right);
|
||||
Controller& port1 = myConsole.controller(Controller::Right);
|
||||
myOldState.P1_PIN1 = port1.myDigitalPinState[Controller::One];
|
||||
myOldState.P1_PIN2 = port1.myDigitalPinState[Controller::Two];
|
||||
myOldState.P1_PIN3 = port1.myDigitalPinState[Controller::Three];
|
||||
|
@ -117,10 +118,6 @@ uInt8 RiotDebug::swcha(int newVal)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 RiotDebug::swchb(int newVal)
|
||||
{
|
||||
// TODO: directly access the Switches class to change this
|
||||
// if(newVal > -1)
|
||||
// mySystem.poke(0x282, newVal);
|
||||
|
||||
return mySystem.peek(0x282);
|
||||
}
|
||||
|
||||
|
@ -190,7 +187,7 @@ Int32 RiotDebug::timClocks()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RiotDebug::setP0Pins(bool Pin1, bool Pin2, bool Pin3, bool Pin4, bool Pin6)
|
||||
{
|
||||
Controller& port0 = mySystem.m6532().myConsole.controller(Controller::Left);
|
||||
Controller& port0 = myConsole.controller(Controller::Left);
|
||||
port0.myDigitalPinState[Controller::One] = Pin1;
|
||||
port0.myDigitalPinState[Controller::Two] = Pin2;
|
||||
port0.myDigitalPinState[Controller::Three] = Pin3;
|
||||
|
@ -201,7 +198,7 @@ void RiotDebug::setP0Pins(bool Pin1, bool Pin2, bool Pin3, bool Pin4, bool Pin6)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RiotDebug::setP1Pins(bool Pin1, bool Pin2, bool Pin3, bool Pin4, bool Pin6)
|
||||
{
|
||||
Controller& port1 = mySystem.m6532().myConsole.controller(Controller::Right);
|
||||
Controller& port1 = myConsole.controller(Controller::Right);
|
||||
port1.myDigitalPinState[Controller::One] = Pin1;
|
||||
port1.myDigitalPinState[Controller::Two] = Pin2;
|
||||
port1.myDigitalPinState[Controller::Three] = Pin3;
|
||||
|
@ -209,6 +206,56 @@ void RiotDebug::setP1Pins(bool Pin1, bool Pin2, bool Pin3, bool Pin4, bool Pin6)
|
|||
port1.myDigitalPinState[Controller::Six] = Pin6;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool RiotDebug::diffP0(int newVal)
|
||||
{
|
||||
uInt8& switches = myConsole.switches().mySwitches;
|
||||
if(newVal > -1)
|
||||
switches = Debugger::set_bit(switches, 6, newVal > 0);
|
||||
|
||||
return switches & 0x40;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool RiotDebug::diffP1(int newVal)
|
||||
{
|
||||
uInt8& switches = myConsole.switches().mySwitches;
|
||||
if(newVal > -1)
|
||||
switches = Debugger::set_bit(switches, 7, newVal > 0);
|
||||
|
||||
return switches & 0x80;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool RiotDebug::tvType(int newVal)
|
||||
{
|
||||
uInt8& switches = myConsole.switches().mySwitches;
|
||||
if(newVal > -1)
|
||||
switches = Debugger::set_bit(switches, 3, newVal > 0);
|
||||
|
||||
return switches & 0x08;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool RiotDebug::select(int newVal)
|
||||
{
|
||||
uInt8& switches = myConsole.switches().mySwitches;
|
||||
if(newVal > -1)
|
||||
switches = Debugger::set_bit(switches, 1, newVal > 0);
|
||||
|
||||
return switches & 0x02;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool RiotDebug::reset(int newVal)
|
||||
{
|
||||
uInt8& switches = myConsole.switches().mySwitches;
|
||||
if(newVal > -1)
|
||||
switches = Debugger::set_bit(switches, 0, newVal > 0);
|
||||
|
||||
return switches & 0x01;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string RiotDebug::dirP0String()
|
||||
{
|
||||
|
|
|
@ -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.hxx,v 1.3 2008-05-15 15:07:29 stephena Exp $
|
||||
// $Id: RiotDebug.hxx,v 1.4 2008-05-15 18:59:56 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef RIOT_DEBUG_HXX
|
||||
|
@ -74,6 +74,13 @@ class RiotDebug : public DebuggerSystem
|
|||
void setP0Pins(bool Pin1, bool Pin2, bool Pin3, bool Pin4, bool Pin6);
|
||||
void setP1Pins(bool Pin1, bool Pin2, bool Pin3, bool Pin4, bool Pin6);
|
||||
|
||||
/* Console switches */
|
||||
bool diffP0(int newVal = -1);
|
||||
bool diffP1(int newVal = -1);
|
||||
bool tvType(int newVal = -1);
|
||||
bool select(int newVal = -1);
|
||||
bool reset(int newVal = -1);
|
||||
|
||||
/* Port A description */
|
||||
string dirP0String();
|
||||
string dirP1String();
|
||||
|
|
|
@ -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.12 2008-05-04 17:16:39 stephena Exp $
|
||||
// $Id: CpuWidget.cxx,v 1.13 2008-05-15 18:59:56 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -243,8 +243,8 @@ void CpuWidget::fillGrid()
|
|||
// address in the callback (handleCommand)
|
||||
Debugger& dbg = instance()->debugger();
|
||||
CpuDebug& cpu = dbg.cpuDebug();
|
||||
CpuState state = (CpuState&) cpu.getState();
|
||||
CpuState oldstate = (CpuState&) cpu.getOldState();
|
||||
const CpuState& state = (CpuState&) cpu.getState();
|
||||
const CpuState& oldstate = (CpuState&) cpu.getOldState();
|
||||
|
||||
// Add PC to its own DataGridWidget
|
||||
alist.push_back(kPCRegAddr);
|
||||
|
|
|
@ -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: RiotWidget.cxx,v 1.4 2008-05-15 15:07:29 stephena Exp $
|
||||
// $Id: RiotWidget.cxx,v 1.5 2008-05-15 18:59:56 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -25,6 +25,7 @@
|
|||
#include "GuiObject.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "RiotDebug.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "ToggleBitWidget.hxx"
|
||||
#include "Widget.hxx"
|
||||
|
||||
|
@ -75,8 +76,7 @@
|
|||
kCheckActionCmd); \
|
||||
pins[4]->setID(pinsID); \
|
||||
pins[4]->setTarget(this); \
|
||||
addFocusWidget(pins[4]); \
|
||||
col += t->getWidth() + 20;
|
||||
addFocusWidget(pins[4]);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
|
||||
|
@ -150,8 +150,49 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
|
|||
// Controller port pins (for now, only the latched pins)
|
||||
xpos = col; ypos = 10;
|
||||
CREATE_PORT_PINS("P0 Controller:", myP0Pins, kP0PinsID);
|
||||
xpos = col; ypos = 10;
|
||||
xpos = col + font.getStringWidth("P0 Controller:") + 20; ypos = 10;
|
||||
CREATE_PORT_PINS("P1 Controller:", myP1Pins, kP1PinsID);
|
||||
|
||||
// PO & P1 difficulty switches
|
||||
int pwidth = font.getStringWidth("B/easy");
|
||||
lwidth = font.getStringWidth("P0 Diff: ");
|
||||
xpos = col; ypos += 3 * lineHeight;
|
||||
myP0Diff = new PopUpWidget(boss, font, xpos, ypos, pwidth, lineHeight,
|
||||
"P0 Diff: ", lwidth, kP0DiffChanged);
|
||||
myP0Diff->appendEntry("B/easy", 0);
|
||||
myP0Diff->appendEntry("A/hard", 1);
|
||||
myP0Diff->setTarget(this);
|
||||
addFocusWidget(myP0Diff);
|
||||
ypos += myP0Diff->getHeight() + 5;
|
||||
myP1Diff = new PopUpWidget(boss, font, xpos, ypos, pwidth, lineHeight,
|
||||
"P1 Diff: ", lwidth, kP1DiffChanged);
|
||||
myP1Diff->appendEntry("B/easy", 0);
|
||||
myP1Diff->appendEntry("A/hard", 1);
|
||||
myP1Diff->setTarget(this);
|
||||
addFocusWidget(myP1Diff);
|
||||
|
||||
// TV Type
|
||||
ypos += myP1Diff->getHeight() + 5;
|
||||
myTVType = new PopUpWidget(boss, font, xpos, ypos, pwidth, lineHeight,
|
||||
"TV Type: ", lwidth, kTVTypeChanged);
|
||||
myTVType->appendEntry("B&W", 0);
|
||||
myTVType->appendEntry("Color", 1);
|
||||
myTVType->setTarget(this);
|
||||
addFocusWidget(myTVType);
|
||||
|
||||
// Select and Reset
|
||||
xpos += 20; ypos += myTVType->getHeight() + 5;
|
||||
mySelect = new CheckboxWidget(boss, font, xpos, ypos, "Select",
|
||||
kCheckActionCmd);
|
||||
mySelect->setID(kSelectID);
|
||||
mySelect->setTarget(this);
|
||||
addFocusWidget(mySelect);
|
||||
ypos += myTVType->getHeight() + 5;
|
||||
myReset = new CheckboxWidget(boss, font, xpos, ypos, "Reset",
|
||||
kCheckActionCmd);
|
||||
myReset->setID(kResetID);
|
||||
myReset->setTarget(this);
|
||||
addFocusWidget(myReset);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -226,6 +267,13 @@ void RiotWidget::loadConfig()
|
|||
myP1Pins[2]->setState(!state.P1_PIN3);
|
||||
myP1Pins[3]->setState(!state.P1_PIN4);
|
||||
myP1Pins[4]->setState(!state.P1_PIN6);
|
||||
|
||||
// Console switches (invert reset/select for same reason as the pins)
|
||||
myP0Diff->setSelectedTag((int)riot.diffP0());
|
||||
myP1Diff->setSelectedTag((int)riot.diffP1());
|
||||
myTVType->setSelectedTag((int)riot.tvType());
|
||||
mySelect->setState(!riot.select());
|
||||
myReset->setState(!riot.reset());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -286,7 +334,25 @@ void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
!myP1Pins[2]->getState(), !myP1Pins[3]->getState(),
|
||||
!myP1Pins[4]->getState());
|
||||
break;
|
||||
case kSelectID:
|
||||
riot.select(!mySelect->getState());
|
||||
break;
|
||||
case kResetID:
|
||||
riot.reset(!myReset->getState());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case kP0DiffChanged:
|
||||
riot.diffP0((bool)myP0Diff->getSelectedTag());
|
||||
break;
|
||||
|
||||
case kP1DiffChanged:
|
||||
riot.diffP1((bool)myP1Diff->getSelectedTag());
|
||||
break;
|
||||
|
||||
case kTVTypeChanged:
|
||||
riot.tvType((bool)myTVType->getSelectedTag());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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: RiotWidget.hxx,v 1.4 2008-05-15 15:07:29 stephena Exp $
|
||||
// $Id: RiotWidget.hxx,v 1.5 2008-05-15 18:59:56 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -25,6 +25,7 @@
|
|||
class GuiObject;
|
||||
class ButtonWidget;
|
||||
class DataGridWidget;
|
||||
class PopUpWidget;
|
||||
class ToggleBitWidget;
|
||||
|
||||
#include "Array.hxx"
|
||||
|
@ -54,22 +55,18 @@ class RiotWidget : public Widget, public CommandSender
|
|||
|
||||
CheckboxWidget* myP0Pins[5], *myP1Pins[5];
|
||||
|
||||
CheckboxWidget* myP0Diff, *myP1Diff;
|
||||
CheckboxWidget* myTVType;
|
||||
PopUpWidget *myP0Diff, *myP1Diff;
|
||||
PopUpWidget *myTVType;
|
||||
CheckboxWidget* mySelect;
|
||||
CheckboxWidget* myReset;
|
||||
|
||||
StaticTextWidget* myP0DirText, *myP1DirText;
|
||||
StaticTextWidget* myP0DiffText, *myP1DiffText;
|
||||
StaticTextWidget* myTVTypeText;
|
||||
StaticTextWidget* mySwitchesText;
|
||||
|
||||
// ID's for the various widgets
|
||||
// We need ID's, since there are more than one of several types of widgets
|
||||
enum {
|
||||
kTim1TID, kTim8TID, kTim64TID, kTim1024TID,
|
||||
kSWCHABitsID, kSWACNTBitsID, kSWCHBBitsID, kTimWriteID,
|
||||
kP0PinsID, kP1PinsID
|
||||
kP0PinsID, kP1PinsID,
|
||||
kP0DiffChanged, kP1DiffChanged, kTVTypeChanged, kSelectID, kResetID
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -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: Switches.hxx,v 1.6 2008-02-06 13:45:22 stephena Exp $
|
||||
// $Id: Switches.hxx,v 1.7 2008-05-15 18:59:56 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SWITCHES_HXX
|
||||
|
@ -29,10 +29,15 @@ class Properties;
|
|||
This class represents the console switches of the game console.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Switches.hxx,v 1.6 2008-02-06 13:45:22 stephena Exp $
|
||||
@version $Id: Switches.hxx,v 1.7 2008-05-15 18:59:56 stephena Exp $
|
||||
*/
|
||||
class Switches : public Serializable
|
||||
{
|
||||
/**
|
||||
Riot debug class needs special access to the underlying controller state
|
||||
*/
|
||||
friend class RiotDebug;
|
||||
|
||||
public:
|
||||
/**
|
||||
Create a new set of switches using the specified events and
|
||||
|
|
Loading…
Reference in New Issue