mirror of https://github.com/stella-emu/stella.git
De-uglified the symbol loading somewhat. It still isn't working 100%.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@503 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
d6d73fff6f
commit
c00de2813c
|
@ -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.6 2005-06-15 04:30:33 urchlay Exp $
|
// $Id: Debugger.cxx,v 1.7 2005-06-15 20:41:08 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
@ -31,6 +31,7 @@
|
||||||
#include "D6502.hxx"
|
#include "D6502.hxx"
|
||||||
|
|
||||||
#include "Debugger.hxx"
|
#include "Debugger.hxx"
|
||||||
|
#include "EquateList.hxx"
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Debugger::Debugger(OSystem* osystem)
|
Debugger::Debugger(OSystem* osystem)
|
||||||
|
@ -42,6 +43,7 @@ Debugger::Debugger(OSystem* osystem)
|
||||||
{
|
{
|
||||||
// Init parser
|
// Init parser
|
||||||
myParser = new DebuggerParser(this);
|
myParser = new DebuggerParser(this);
|
||||||
|
equateList = new EquateList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -49,6 +51,7 @@ Debugger::~Debugger()
|
||||||
{
|
{
|
||||||
delete myParser;
|
delete myParser;
|
||||||
delete myDebugger;
|
delete myDebugger;
|
||||||
|
// delete equateList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -115,7 +118,7 @@ const string Debugger::state()
|
||||||
sprintf(buf, "%d", mySystem->cycles());
|
sprintf(buf, "%d", mySystem->cycles());
|
||||||
result += buf;
|
result += buf;
|
||||||
result += "\n ";
|
result += "\n ";
|
||||||
int count = myDebugger->disassemble(myDebugger->pc(), buf);
|
int count = myDebugger->disassemble(myDebugger->pc(), buf, equateList);
|
||||||
for(int i=0; i<count; i++) {
|
for(int i=0; i<count; i++) {
|
||||||
sprintf(bbuf, "%02x ", readRAM(myDebugger->pc() + i));
|
sprintf(bbuf, "%02x ", readRAM(myDebugger->pc() + i));
|
||||||
result += bbuf;
|
result += bbuf;
|
||||||
|
@ -337,7 +340,3 @@ void Debugger::toggleN() {
|
||||||
myDebugger->ps( myDebugger->ps() ^ 0x80 );
|
myDebugger->ps( myDebugger->ps() ^ 0x80 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void Debugger::setEquateList(EquateList *l) {
|
|
||||||
myDebugger->setEquateList(l);
|
|
||||||
}
|
|
||||||
|
|
|
@ -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.hxx,v 1.3 2005-06-15 04:30:35 urchlay Exp $
|
// $Id: Debugger.hxx,v 1.4 2005-06-15 20:41:08 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DEBUGGER_HXX
|
#ifndef DEBUGGER_HXX
|
||||||
|
@ -47,7 +47,7 @@ enum {
|
||||||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: Debugger.hxx,v 1.3 2005-06-15 04:30:35 urchlay Exp $
|
@version $Id: Debugger.hxx,v 1.4 2005-06-15 20:41:08 urchlay Exp $
|
||||||
*/
|
*/
|
||||||
class Debugger : public DialogContainer
|
class Debugger : public DialogContainer
|
||||||
{
|
{
|
||||||
|
@ -144,6 +144,7 @@ class Debugger : public DialogContainer
|
||||||
|
|
||||||
DebuggerParser* myParser;
|
DebuggerParser* myParser;
|
||||||
D6502* myDebugger;
|
D6502* myDebugger;
|
||||||
|
EquateList *equateList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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: DebuggerParser.cxx,v 1.4 2005-06-15 04:30:35 urchlay Exp $
|
// $Id: DebuggerParser.cxx,v 1.5 2005-06-15 20:41:08 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
@ -180,7 +180,6 @@ string DebuggerParser::run(const string& command) {
|
||||||
result = command;
|
result = command;
|
||||||
result.erase(0, 8);
|
result.erase(0, 8);
|
||||||
result = equateList->loadFile(result);
|
result = equateList->loadFile(result);
|
||||||
debugger->setEquateList(equateList);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,9 +99,14 @@ int EquateList::calcSize() {
|
||||||
|
|
||||||
// FIXME: use something smarter than a linear search in the future.
|
// FIXME: use something smarter than a linear search in the future.
|
||||||
char *EquateList::getLabel(int addr) {
|
char *EquateList::getLabel(int addr) {
|
||||||
for(int i=0; ourVcsEquates[i].label != NULL; i++)
|
cerr << "getLabel(" << addr << ")" << endl;
|
||||||
if(ourVcsEquates[i].address == addr)
|
for(int i=0; ourVcsEquates[i].label != NULL; i++) {
|
||||||
|
cerr << "Checking ourVcsEquates[" << i << "] (" << ourVcsEquates[i].label << endl;
|
||||||
|
if(ourVcsEquates[i].address == addr) {
|
||||||
|
cerr << "Found label " << ourVcsEquates[i].label << endl;
|
||||||
return ourVcsEquates[i].label;
|
return ourVcsEquates[i].label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +203,7 @@ string EquateList::loadFile(string file) {
|
||||||
delete ourVcsEquates;
|
delete ourVcsEquates;
|
||||||
ourVcsEquates = newEquates;
|
ourVcsEquates = newEquates;
|
||||||
|
|
||||||
// dumpAll();
|
dumpAll();
|
||||||
return "loaded " + file + " OK";
|
return "loaded " + file + " OK";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,12 @@ class EquateList {
|
||||||
char *EquateList::getFormatted(int addr, int places);
|
char *EquateList::getFormatted(int addr, int places);
|
||||||
int getAddress(const char *label);
|
int getAddress(const char *label);
|
||||||
string loadFile(string file);
|
string loadFile(string file);
|
||||||
|
void dumpAll();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int calcSize();
|
int calcSize();
|
||||||
int parse4hex(char *c);
|
int parse4hex(char *c);
|
||||||
string EquateList::getLabel(char *c);
|
string EquateList::getLabel(char *c);
|
||||||
void dumpAll();
|
|
||||||
|
|
||||||
struct Equate *ourVcsEquates;
|
struct Equate *ourVcsEquates;
|
||||||
int currentSize;
|
int currentSize;
|
||||||
|
|
|
@ -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: D6502.cxx,v 1.5 2005-06-15 04:30:35 urchlay Exp $
|
// $Id: D6502.cxx,v 1.6 2005-06-15 20:41:09 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -26,13 +26,11 @@
|
||||||
D6502::D6502(System* system)
|
D6502::D6502(System* system)
|
||||||
: mySystem(system)
|
: mySystem(system)
|
||||||
{
|
{
|
||||||
equateList = new EquateList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
D6502::~D6502()
|
D6502::~D6502()
|
||||||
{
|
{
|
||||||
// delete equateList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -49,8 +47,9 @@ uInt16 D6502::dPeek(uInt16 address)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt16 D6502::disassemble(uInt16 address, char* buffer)
|
uInt16 D6502::disassemble(uInt16 address, char* buffer, EquateList *equateList)
|
||||||
{
|
{
|
||||||
|
equateList->dumpAll();
|
||||||
uInt8 opcode = mySystem->peek(address);
|
uInt8 opcode = mySystem->peek(address);
|
||||||
|
|
||||||
switch(M6502::ourAddressingModeTable[opcode])
|
switch(M6502::ourAddressingModeTable[opcode])
|
||||||
|
@ -105,14 +104,14 @@ uInt16 D6502::disassemble(uInt16 address, char* buffer)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
case M6502::Relative:
|
case M6502::Relative:
|
||||||
sprintf(buffer, "%s $%04X ; %d", M6502::ourInstructionMnemonicTable[opcode],
|
sprintf(buffer, "%s %s ; %d", M6502::ourInstructionMnemonicTable[opcode],
|
||||||
address + 2 + ((Int16)(Int8)mySystem->peek(address + 1)),
|
equateList->getFormatted(address + 2 + ((Int16)(Int8)mySystem->peek(address + 1)), 4),
|
||||||
M6502::ourInstructionProcessorCycleTable[opcode]);
|
M6502::ourInstructionProcessorCycleTable[opcode]);
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
case M6502::Zero:
|
case M6502::Zero:
|
||||||
sprintf(buffer, "%s $%02X ; %d", M6502::ourInstructionMnemonicTable[opcode],
|
sprintf(buffer, "%s %s ; %d", M6502::ourInstructionMnemonicTable[opcode],
|
||||||
mySystem->peek(address + 1),
|
equateList->getFormatted(mySystem->peek(address + 1), 2),
|
||||||
M6502::ourInstructionProcessorCycleTable[opcode]);
|
M6502::ourInstructionProcessorCycleTable[opcode]);
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
|
@ -207,8 +206,3 @@ void D6502::y(uInt8 value)
|
||||||
mySystem->m6502().Y = value;
|
mySystem->m6502().Y = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void D6502::setEquateList(EquateList *el)
|
|
||||||
{
|
|
||||||
equateList = el;
|
|
||||||
}
|
|
||||||
|
|
|
@ -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: D6502.hxx,v 1.4 2005-06-15 04:30:35 urchlay Exp $
|
// $Id: D6502.hxx,v 1.5 2005-06-15 20:41:09 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef D6502_HXX
|
#ifndef D6502_HXX
|
||||||
|
@ -31,7 +31,7 @@ class System;
|
||||||
basic functionality needed for interactive debuggers.
|
basic functionality needed for interactive debuggers.
|
||||||
|
|
||||||
@author Bradford W. Mott
|
@author Bradford W. Mott
|
||||||
@version $Id: D6502.hxx,v 1.4 2005-06-15 04:30:35 urchlay Exp $
|
@version $Id: D6502.hxx,v 1.5 2005-06-15 20:41:09 urchlay Exp $
|
||||||
*/
|
*/
|
||||||
class D6502
|
class D6502
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ class D6502
|
||||||
@param buffer The buffer where the ASCII disassemble should be stored
|
@param buffer The buffer where the ASCII disassemble should be stored
|
||||||
@return The number of bytes disassembled
|
@return The number of bytes disassembled
|
||||||
*/
|
*/
|
||||||
uInt16 disassemble(uInt16 address, char* buffer);
|
uInt16 disassemble(uInt16 address, char* buffer, EquateList *equateList);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -147,12 +147,9 @@ class D6502
|
||||||
|
|
||||||
uInt16 dPeek(uInt16 address);
|
uInt16 dPeek(uInt16 address);
|
||||||
|
|
||||||
void setEquateList(EquateList *el);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Pointer to the system I'm debugging
|
// Pointer to the system I'm debugging
|
||||||
System* mySystem;
|
System* mySystem;
|
||||||
EquateList *equateList;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue