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
|
||||
// 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"
|
||||
|
@ -31,6 +31,7 @@
|
|||
#include "D6502.hxx"
|
||||
|
||||
#include "Debugger.hxx"
|
||||
#include "EquateList.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Debugger::Debugger(OSystem* osystem)
|
||||
|
@ -42,6 +43,7 @@ Debugger::Debugger(OSystem* osystem)
|
|||
{
|
||||
// Init parser
|
||||
myParser = new DebuggerParser(this);
|
||||
equateList = new EquateList();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -49,6 +51,7 @@ Debugger::~Debugger()
|
|||
{
|
||||
delete myParser;
|
||||
delete myDebugger;
|
||||
// delete equateList;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -115,7 +118,7 @@ const string Debugger::state()
|
|||
sprintf(buf, "%d", mySystem->cycles());
|
||||
result += buf;
|
||||
result += "\n ";
|
||||
int count = myDebugger->disassemble(myDebugger->pc(), buf);
|
||||
int count = myDebugger->disassemble(myDebugger->pc(), buf, equateList);
|
||||
for(int i=0; i<count; i++) {
|
||||
sprintf(bbuf, "%02x ", readRAM(myDebugger->pc() + i));
|
||||
result += bbuf;
|
||||
|
@ -337,7 +340,3 @@ void Debugger::toggleN() {
|
|||
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
|
||||
// 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
|
||||
|
@ -47,7 +47,7 @@ enum {
|
|||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||
|
||||
@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
|
||||
{
|
||||
|
@ -144,6 +144,7 @@ class Debugger : public DialogContainer
|
|||
|
||||
DebuggerParser* myParser;
|
||||
D6502* myDebugger;
|
||||
EquateList *equateList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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.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"
|
||||
|
@ -180,7 +180,6 @@ string DebuggerParser::run(const string& command) {
|
|||
result = command;
|
||||
result.erase(0, 8);
|
||||
result = equateList->loadFile(result);
|
||||
debugger->setEquateList(equateList);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,9 +99,14 @@ int EquateList::calcSize() {
|
|||
|
||||
// FIXME: use something smarter than a linear search in the future.
|
||||
char *EquateList::getLabel(int addr) {
|
||||
for(int i=0; ourVcsEquates[i].label != NULL; i++)
|
||||
if(ourVcsEquates[i].address == addr)
|
||||
cerr << "getLabel(" << addr << ")" << endl;
|
||||
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 NULL;
|
||||
}
|
||||
|
@ -198,7 +203,7 @@ string EquateList::loadFile(string file) {
|
|||
delete ourVcsEquates;
|
||||
ourVcsEquates = newEquates;
|
||||
|
||||
// dumpAll();
|
||||
dumpAll();
|
||||
return "loaded " + file + " OK";
|
||||
}
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@ class EquateList {
|
|||
char *EquateList::getFormatted(int addr, int places);
|
||||
int getAddress(const char *label);
|
||||
string loadFile(string file);
|
||||
void dumpAll();
|
||||
|
||||
private:
|
||||
int calcSize();
|
||||
int parse4hex(char *c);
|
||||
string EquateList::getLabel(char *c);
|
||||
void dumpAll();
|
||||
|
||||
struct Equate *ourVcsEquates;
|
||||
int currentSize;
|
||||
|
|
|
@ -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.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>
|
||||
|
@ -26,13 +26,11 @@
|
|||
D6502::D6502(System* system)
|
||||
: mySystem(system)
|
||||
{
|
||||
equateList = new EquateList();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
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);
|
||||
|
||||
switch(M6502::ourAddressingModeTable[opcode])
|
||||
|
@ -105,14 +104,14 @@ uInt16 D6502::disassemble(uInt16 address, char* buffer)
|
|||
return 2;
|
||||
|
||||
case M6502::Relative:
|
||||
sprintf(buffer, "%s $%04X ; %d", M6502::ourInstructionMnemonicTable[opcode],
|
||||
address + 2 + ((Int16)(Int8)mySystem->peek(address + 1)),
|
||||
sprintf(buffer, "%s %s ; %d", M6502::ourInstructionMnemonicTable[opcode],
|
||||
equateList->getFormatted(address + 2 + ((Int16)(Int8)mySystem->peek(address + 1)), 4),
|
||||
M6502::ourInstructionProcessorCycleTable[opcode]);
|
||||
return 2;
|
||||
|
||||
case M6502::Zero:
|
||||
sprintf(buffer, "%s $%02X ; %d", M6502::ourInstructionMnemonicTable[opcode],
|
||||
mySystem->peek(address + 1),
|
||||
sprintf(buffer, "%s %s ; %d", M6502::ourInstructionMnemonicTable[opcode],
|
||||
equateList->getFormatted(mySystem->peek(address + 1), 2),
|
||||
M6502::ourInstructionProcessorCycleTable[opcode]);
|
||||
return 2;
|
||||
|
||||
|
@ -207,8 +206,3 @@ void D6502::y(uInt8 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
|
||||
// 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
|
||||
|
@ -31,7 +31,7 @@ class System;
|
|||
basic functionality needed for interactive debuggers.
|
||||
|
||||
@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
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ class D6502
|
|||
@param buffer The buffer where the ASCII disassemble should be stored
|
||||
@return The number of bytes disassembled
|
||||
*/
|
||||
uInt16 disassemble(uInt16 address, char* buffer);
|
||||
uInt16 disassemble(uInt16 address, char* buffer, EquateList *equateList);
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -147,12 +147,9 @@ class D6502
|
|||
|
||||
uInt16 dPeek(uInt16 address);
|
||||
|
||||
void setEquateList(EquateList *el);
|
||||
|
||||
protected:
|
||||
// Pointer to the system I'm debugging
|
||||
System* mySystem;
|
||||
EquateList *equateList;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue