Each bit in the CPU processor status register can now be toggled in

the CpuWidget.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@558 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-06-24 17:46:11 +00:00
parent 6efeb3238b
commit b97d1937de
1 changed files with 45 additions and 83 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: CpuWidget.cxx,v 1.5 2005-06-23 18:11:59 stephena Exp $ // $Id: CpuWidget.cxx,v 1.6 2005-06-24 17:46:11 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
@ -41,6 +41,16 @@ enum {
kNumRegs kNumRegs
}; };
enum {
kPSRegN = 0,
kPSRegV = 1,
kPSRegB = 3,
kPSRegD = 4,
kPSRegI = 5,
kPSRegZ = 6,
kPSRegC = 7
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h) CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h), : Widget(boss, x, y, w, h),
@ -49,7 +59,6 @@ CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h)
int xpos = 10; int xpos = 10;
int ypos = 10; int ypos = 10;
int lwidth = 20; int lwidth = 20;
// const int vWidth = _w - kButtonWidth - 20, space = 6, buttonw = 24;
const GUI::Font& font = instance()->consoleFont(); const GUI::Font& font = instance()->consoleFont();
// Create a 1x5 grid with labels for the CPU registers // Create a 1x5 grid with labels for the CPU registers
@ -118,44 +127,6 @@ CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h)
on.push_back(onstr[i]); on.push_back(onstr[i]);
} }
myPSRegister->setList(off, on); myPSRegister->setList(off, on);
/*
// Add some buttons for common actions
ButtonWidget* b;
xpos = vWidth + 10; ypos = 20;
b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, "0", kRZeroCmd, 0);
b->setTarget(this);
ypos += 16 + space;
b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, "Inv", kRInvertCmd, 0);
b->setTarget(this);
ypos += 16 + space;
b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, "++", kRIncCmd, 0);
b->setTarget(this);
ypos += 16 + space;
b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, "<<", kRShiftLCmd, 0);
b->setTarget(this);
xpos = vWidth + 30 + 10; ypos = 20;
// b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, "", kRCmd, 0);
// b->setTarget(this);
ypos += 16 + space;
b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, "Neg", kRNegateCmd, 0);
b->setTarget(this);
ypos += 16 + space;
b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, "--", kRDecCmd, 0);
b->setTarget(this);
ypos += 16 + space;
b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, ">>", kRShiftRCmd, 0);
b->setTarget(this);
*/
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -167,7 +138,7 @@ CpuWidget::~CpuWidget()
void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data) void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data)
{ {
int addr, value; int addr, value;
// unsigned char byte; Debugger& dbg = instance()->debugger();
switch(cmd) switch(cmd)
{ {
@ -178,71 +149,62 @@ void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data)
switch(addr) switch(addr)
{ {
case kPCRegAddr: case kPCRegAddr:
instance()->debugger().setPC(value); dbg.setPC(value);
break; break;
case kSPRegAddr: case kSPRegAddr:
instance()->debugger().setSP(value); dbg.setSP(value);
break; break;
case kARegAddr: case kARegAddr:
instance()->debugger().setA(value); dbg.setA(value);
break; break;
case kXRegAddr: case kXRegAddr:
instance()->debugger().setX(value); dbg.setX(value);
break; break;
case kYRegAddr: case kYRegAddr:
instance()->debugger().setY(value); dbg.setY(value);
break; break;
} }
break; break;
case kTBItemDataChangedCmd: case kTBItemDataChangedCmd:
cerr << "ps bit changed\n"; {
break; bool state = myPSRegister->getSelectedState();
/*
case kRZeroCmd: switch(data)
myRamGrid->setSelectedValue(0); {
case kPSRegN:
dbg.setN(state);
break; break;
case kRInvertCmd: case kPSRegV:
byte = (unsigned char) myRamGrid->getSelectedValue(); dbg.setV(state);
byte = ~byte;
myRamGrid->setSelectedValue((int)byte);
break; break;
case kRNegateCmd: case kPSRegB:
byte = (unsigned char) myRamGrid->getSelectedValue(); dbg.setB(state);
byte = (~byte) + 1;
myRamGrid->setSelectedValue((int)byte);
break; break;
case kRIncCmd: case kPSRegD:
byte = (unsigned char) myRamGrid->getSelectedValue(); dbg.setD(state);
byte += 1;
myRamGrid->setSelectedValue((int)byte);
break; break;
case kRDecCmd: case kPSRegI:
byte = (unsigned char) myRamGrid->getSelectedValue(); dbg.setI(state);
byte -= 1;
myRamGrid->setSelectedValue((int)byte);
break; break;
case kRShiftLCmd: case kPSRegZ:
byte = (unsigned char) myRamGrid->getSelectedValue(); dbg.setZ(state);
byte <<= 1;
myRamGrid->setSelectedValue((int)byte);
break; break;
case kRShiftRCmd: case kPSRegC:
byte = (unsigned char) myRamGrid->getSelectedValue(); dbg.setC(state);
byte >>= 1;
myRamGrid->setSelectedValue((int)byte);
break; break;
*/ }
}
} }
// TODO - dirty rect, or is it necessary here? // TODO - dirty rect, or is it necessary here?