mirror of https://github.com/stella-emu/stella.git
Added expression support for all the CPU registers.
Semi-fixed a bug: formatFlags was capitalizing the wrong flags. I'm pretty sure it's because they were being pushed into the BoolArray in reverse order. I "fixed" formatFlags by having it ignore the BoolArray, and call my new CpuDebug methods to get the flag states directly. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@653 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
31e17b4627
commit
8260b7b495
|
@ -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: CpuDebug.cxx,v 1.3 2005-07-08 17:22:40 stephena Exp $
|
// $Id: CpuDebug.cxx,v 1.4 2005-07-15 02:59:00 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "Array.hxx"
|
#include "Array.hxx"
|
||||||
|
@ -42,6 +42,8 @@ DebuggerState& CpuDebug::getState()
|
||||||
myState.PSbits.clear();
|
myState.PSbits.clear();
|
||||||
for(int i = 0; i < 8; ++i)
|
for(int i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
|
// FIXME: Hey, Steve, I think these are *backwards*!
|
||||||
|
// At least, formatFlags was backwards
|
||||||
if(myState.PS & (1<<(7-i)))
|
if(myState.PS & (1<<(7-i)))
|
||||||
myState.PSbits.push_back(true);
|
myState.PSbits.push_back(true);
|
||||||
else
|
else
|
||||||
|
|
|
@ -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: CpuDebug.hxx,v 1.4 2005-07-15 02:30:47 urchlay Exp $
|
// $Id: CpuDebug.hxx,v 1.5 2005-07-15 02:59:00 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef CPU_DEBUG_HXX
|
#ifndef CPU_DEBUG_HXX
|
||||||
|
@ -52,10 +52,20 @@ class CpuDebug : public DebuggerSystem
|
||||||
int dPeek(int address);
|
int dPeek(int address);
|
||||||
|
|
||||||
int pc() { return mySystem->m6502().PC; }
|
int pc() { return mySystem->m6502().PC; }
|
||||||
|
int sp() { return mySystem->m6502().SP; }
|
||||||
int a() { return mySystem->m6502().A; }
|
int a() { return mySystem->m6502().A; }
|
||||||
int x() { return mySystem->m6502().X; }
|
int x() { return mySystem->m6502().X; }
|
||||||
int y() { return mySystem->m6502().Y; }
|
int y() { return mySystem->m6502().Y; }
|
||||||
|
|
||||||
|
// these return int, not boolean!
|
||||||
|
int n() { return mySystem->m6502().N; }
|
||||||
|
int v() { return mySystem->m6502().V; }
|
||||||
|
int b() { return mySystem->m6502().B; }
|
||||||
|
int d() { return mySystem->m6502().D; }
|
||||||
|
int i() { return mySystem->m6502().I; }
|
||||||
|
int z() { return !mySystem->m6502().notZ; }
|
||||||
|
int c() { return mySystem->m6502().C; }
|
||||||
|
|
||||||
void setPC(int pc);
|
void setPC(int pc);
|
||||||
void setSP(int sp);
|
void setSP(int sp);
|
||||||
void setPS(int ps);
|
void setPS(int ps);
|
||||||
|
|
|
@ -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: Debugger.cxx,v 1.63 2005-07-14 15:13:14 stephena Exp $
|
// $Id: Debugger.cxx,v 1.64 2005-07-15 02:59:00 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
@ -352,39 +352,39 @@ void Debugger::reset() {
|
||||||
void Debugger::formatFlags(BoolArray& b, char *out) {
|
void Debugger::formatFlags(BoolArray& b, char *out) {
|
||||||
// NV-BDIZC
|
// NV-BDIZC
|
||||||
|
|
||||||
if(b[7])
|
if(myCpuDebug->n())
|
||||||
out[0] = 'N';
|
out[0] = 'N';
|
||||||
else
|
else
|
||||||
out[0] = 'n';
|
out[0] = 'n';
|
||||||
|
|
||||||
if(b[6])
|
if(myCpuDebug->v())
|
||||||
out[1] = 'V';
|
out[1] = 'V';
|
||||||
else
|
else
|
||||||
out[1] = 'v';
|
out[1] = 'v';
|
||||||
|
|
||||||
out[2] = '-';
|
out[2] = '-';
|
||||||
|
|
||||||
if(b[4])
|
if(myCpuDebug->b())
|
||||||
out[3] = 'B';
|
out[3] = 'B';
|
||||||
else
|
else
|
||||||
out[3] = 'b';
|
out[3] = 'b';
|
||||||
|
|
||||||
if(b[3])
|
if(myCpuDebug->d())
|
||||||
out[4] = 'D';
|
out[4] = 'D';
|
||||||
else
|
else
|
||||||
out[4] = 'd';
|
out[4] = 'd';
|
||||||
|
|
||||||
if(b[2])
|
if(myCpuDebug->i())
|
||||||
out[5] = 'I';
|
out[5] = 'I';
|
||||||
else
|
else
|
||||||
out[5] = 'i';
|
out[5] = 'i';
|
||||||
|
|
||||||
if(b[1])
|
if(myCpuDebug->z())
|
||||||
out[6] = 'Z';
|
out[6] = 'Z';
|
||||||
else
|
else
|
||||||
out[6] = 'z';
|
out[6] = 'z';
|
||||||
|
|
||||||
if(b[0])
|
if(myCpuDebug->c())
|
||||||
out[7] = 'C';
|
out[7] = 'C';
|
||||||
else
|
else
|
||||||
out[7] = 'c';
|
out[7] = 'c';
|
||||||
|
|
|
@ -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: YaccParser.cxx,v 1.9 2005-07-15 02:30:47 urchlay Exp $
|
// $Id: YaccParser.cxx,v 1.10 2005-07-15 02:59:00 urchlay 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
|
||||||
|
@ -174,10 +174,45 @@ int const_to_int(char *c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// special methods that get e.g. CPU registers
|
||||||
|
// TODO: store in a map or something
|
||||||
CPUDEBUG_INT_METHOD getSpecial(char *c) {
|
CPUDEBUG_INT_METHOD getSpecial(char *c) {
|
||||||
if(strcmp(c, "a") == 0)
|
if(strcmp(c, "a") == 0)
|
||||||
return &CpuDebug::a;
|
return &CpuDebug::a;
|
||||||
|
|
||||||
|
if(strcmp(c, "x") == 0)
|
||||||
|
return &CpuDebug::x;
|
||||||
|
|
||||||
|
if(strcmp(c, "y") == 0)
|
||||||
|
return &CpuDebug::y;
|
||||||
|
|
||||||
|
if(strcmp(c, "pc") == 0)
|
||||||
|
return &CpuDebug::pc;
|
||||||
|
|
||||||
|
if(strcmp(c, "sp") == 0)
|
||||||
|
return &CpuDebug::sp;
|
||||||
|
|
||||||
|
if(strcmp(c, "c") == 0)
|
||||||
|
return &CpuDebug::c;
|
||||||
|
|
||||||
|
if(strcmp(c, "z") == 0)
|
||||||
|
return &CpuDebug::z;
|
||||||
|
|
||||||
|
if(strcmp(c, "n") == 0)
|
||||||
|
return &CpuDebug::n;
|
||||||
|
|
||||||
|
if(strcmp(c, "v") == 0)
|
||||||
|
return &CpuDebug::v;
|
||||||
|
|
||||||
|
if(strcmp(c, "d") == 0)
|
||||||
|
return &CpuDebug::d;
|
||||||
|
|
||||||
|
if(strcmp(c, "i") == 0)
|
||||||
|
return &CpuDebug::i;
|
||||||
|
|
||||||
|
if(strcmp(c, "b") == 0)
|
||||||
|
return &CpuDebug::b;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue