Cleaned up equateList stuff. Now there's only one instance, in the

Debugger, which gets used by both DebuggerParser and D6502, but
neither one keeps a pointer to it permanently.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@505 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-06-15 23:45:04 +00:00
parent 1b332ef8f0
commit bbd77f6a51
5 changed files with 20 additions and 16 deletions

View File

@ -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.7 2005-06-15 20:41:08 urchlay Exp $
// $Id: Debugger.cxx,v 1.8 2005-06-15 23:45:04 urchlay Exp $
//============================================================================
#include "bspf.hxx"
@ -340,3 +340,8 @@ void Debugger::toggleN() {
myDebugger->ps( myDebugger->ps() ^ 0x80 );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EquateList *Debugger::equates() {
return equateList;
}

View File

@ -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.4 2005-06-15 20:41:08 urchlay Exp $
// $Id: Debugger.hxx,v 1.5 2005-06-15 23:45:04 urchlay Exp $
//============================================================================
#ifndef DEBUGGER_HXX
@ -47,7 +47,7 @@ enum {
for all debugging operations in Stella (parser, 6502 debugger, etc).
@author Stephen Anthony
@version $Id: Debugger.hxx,v 1.4 2005-06-15 20:41:08 urchlay Exp $
@version $Id: Debugger.hxx,v 1.5 2005-06-15 23:45:04 urchlay Exp $
*/
class Debugger : public DialogContainer
{
@ -136,7 +136,7 @@ class Debugger : public DialogContainer
void reset();
void formatFlags(int f, char *out);
void setEquateList(EquateList *l);
EquateList *equates();
protected:
Console* myConsole;

View File

@ -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: DebuggerParser.cxx,v 1.5 2005-06-15 20:41:08 urchlay Exp $
// $Id: DebuggerParser.cxx,v 1.6 2005-06-15 23:45:04 urchlay Exp $
//============================================================================
#include "bspf.hxx"
@ -33,12 +33,11 @@ enum {
DebuggerParser::DebuggerParser(Debugger* d)
: debugger(d)
{
equateList = new EquateList();
equateList = d->equates();
done = false;
}
DebuggerParser::~DebuggerParser() {
delete equateList;
}
string DebuggerParser::currentAddress() {
@ -179,7 +178,7 @@ string DebuggerParser::run(const string& command) {
if(subStringMatch("loadsym ", command)) {
result = command;
result.erase(0, 8);
result = equateList->loadFile(result);
result = debugger->equateList->loadFile(result);
return result;
}

View File

@ -82,7 +82,7 @@ static struct Equate hardCodedEquates[] = {
};
EquateList::EquateList() {
cerr << sizeof(hardCodedEquates)/sizeof(struct Equate) << endl;
// cerr << sizeof(hardCodedEquates)/sizeof(struct Equate) << endl;
ourVcsEquates = new Equate[ sizeof(hardCodedEquates)/sizeof(struct Equate) ];
for(int i=0; hardCodedEquates[i].label != NULL; i++)
ourVcsEquates[i] = hardCodedEquates[i];
@ -99,11 +99,11 @@ int EquateList::calcSize() {
// FIXME: use something smarter than a linear search in the future.
char *EquateList::getLabel(int addr) {
cerr << "getLabel(" << addr << ")" << endl;
// cerr << "getLabel(" << addr << ")" << endl;
for(int i=0; ourVcsEquates[i].label != NULL; i++) {
cerr << "Checking ourVcsEquates[" << i << "] (" << ourVcsEquates[i].label << endl;
// cerr << "Checking ourVcsEquates[" << i << "] (" << ourVcsEquates[i].label << endl;
if(ourVcsEquates[i].address == addr) {
cerr << "Found label " << ourVcsEquates[i].label << endl;
// cerr << "Found label " << ourVcsEquates[i].label << endl;
return ourVcsEquates[i].label;
}
}
@ -199,11 +199,11 @@ string EquateList::loadFile(string file) {
newEquates[lines].label = NULL;
newEquates[lines].address = 0;
calcSize();
delete ourVcsEquates;
ourVcsEquates = newEquates;
calcSize();
dumpAll();
// dumpAll();
return "loaded " + file + " OK";
}

View File

@ -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: D6502.cxx,v 1.6 2005-06-15 20:41:09 urchlay Exp $
// $Id: D6502.cxx,v 1.7 2005-06-15 23:45:04 urchlay Exp $
//============================================================================
#include <stdio.h>
@ -49,7 +49,7 @@ uInt16 D6502::dPeek(uInt16 address)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt16 D6502::disassemble(uInt16 address, char* buffer, EquateList *equateList)
{
equateList->dumpAll();
// equateList->dumpAll();
uInt8 opcode = mySystem->peek(address);
switch(M6502::ourAddressingModeTable[opcode])