Partially fixed issue with RAM labels (and also PC labels) not being

displayed in the debugger GUI.  I say 'partially', since it's not really
distinguishing between different types of labels with the same address, so
in some cases what you see in the debugger GUI won't be correct (but at
least you'll see *something*).  I need to determine how the DASM sym file
is generated to fix this final issue.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1405 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-02-24 16:51:52 +00:00
parent 360a5711ed
commit 4d9cdbc56a
7 changed files with 271 additions and 232 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: Debugger.cxx,v 1.118 2008-02-06 13:45:19 stephena Exp $ // $Id: Debugger.cxx,v 1.119 2008-02-24 16:51:52 stephena Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -871,14 +871,16 @@ void Debugger::nextFrame(int frames)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::clearAllBreakPoints() { void Debugger::clearAllBreakPoints()
{
delete breakPoints; delete breakPoints;
breakPoints = new PackedBitArray(0x10000); breakPoints = new PackedBitArray(0x10000);
mySystem->m6502().setBreakPoints(NULL); mySystem->m6502().setBreakPoints(NULL);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::clearAllTraps() { void Debugger::clearAllTraps()
{
delete readTraps; delete readTraps;
delete writeTraps; delete writeTraps;
readTraps = new PackedBitArray(0x10000); readTraps = new PackedBitArray(0x10000);
@ -887,23 +889,27 @@ void Debugger::clearAllTraps() {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::peek(int addr) { int Debugger::peek(int addr)
{
return mySystem->peek(addr); return mySystem->peek(addr);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::dpeek(int addr) { int Debugger::dpeek(int addr)
{
return mySystem->peek(addr) | (mySystem->peek(addr+1) << 8); return mySystem->peek(addr) | (mySystem->peek(addr+1) << 8);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Debugger::showWatches() { string Debugger::showWatches()
return myParser->showWatches(); {
return myParser->showWatches();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::addLabel(string label, int address) { void Debugger::addLabel(string label, int address)
equateList->addEquate(label, address); {
equateList->addEquate(label, address);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -913,8 +919,10 @@ void Debugger::reloadROM()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::setBank(int bank) { bool Debugger::setBank(int bank)
if(myConsole->cartridge().bankCount() > 1) { {
if(myConsole->cartridge().bankCount() > 1)
{
myConsole->cartridge().unlockBank(); myConsole->cartridge().unlockBank();
myConsole->cartridge().bank(bank); myConsole->cartridge().bank(bank);
myConsole->cartridge().lockBank(); myConsole->cartridge().lockBank();
@ -924,23 +932,27 @@ bool Debugger::setBank(int bank) {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::getBank() { int Debugger::getBank()
{
return myConsole->cartridge().bank(); return myConsole->cartridge().bank();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::bankCount() { int Debugger::bankCount()
{
return myConsole->cartridge().bankCount(); return myConsole->cartridge().bankCount();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char *Debugger::getCartType() { const char *Debugger::getCartType()
{
return myConsole->cartridge().name().c_str(); return myConsole->cartridge().name().c_str();
// FIXME - maybe whatever is calling this should use a string instead // FIXME - maybe whatever is calling this should use a string instead
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::patchROM(int addr, int value) { bool Debugger::patchROM(int addr, int value)
{
return myConsole->cartridge().patch(addr, value); return myConsole->cartridge().patch(addr, value);
} }
@ -1043,55 +1055,64 @@ GUI::Rect Debugger::getTabBounds() const
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::addFunction(string name, string definition, Expression *exp, bool builtin) { void Debugger::addFunction(string name, string definition,
functions.insert(make_pair(name, exp)); Expression *exp, bool builtin)
if(!builtin) functionDefs.insert(make_pair(name, definition)); {
functions.insert(make_pair(name, exp));
if(!builtin)
functionDefs.insert(make_pair(name, definition));
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::delFunction(string name) { void Debugger::delFunction(string name)
FunctionMap::iterator iter = functions.find(name); {
if(iter == functions.end()) FunctionMap::iterator iter = functions.find(name);
return; if(iter == functions.end())
return;
functions.erase(name); functions.erase(name);
delete iter->second; delete iter->second;
FunctionDefMap::iterator def_iter = functionDefs.find(name); FunctionDefMap::iterator def_iter = functionDefs.find(name);
if(def_iter == functionDefs.end()) if(def_iter == functionDefs.end())
return; return;
functionDefs.erase(name); functionDefs.erase(name);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expression *Debugger::getFunction(string name) { Expression *Debugger::getFunction(string name)
FunctionMap::iterator iter = functions.find(name); {
if(iter == functions.end()) FunctionMap::iterator iter = functions.find(name);
return 0; if(iter == functions.end())
else return 0;
return iter->second; else
return iter->second;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Debugger::getFunctionDef(string name) { string Debugger::getFunctionDef(string name)
FunctionDefMap::iterator iter = functionDefs.find(name); {
if(iter == functionDefs.end()) FunctionDefMap::iterator iter = functionDefs.find(name);
return ""; if(iter == functionDefs.end())
else return "";
return iter->second; else
return iter->second;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FunctionDefMap Debugger::getFunctionDefMap() { const FunctionDefMap Debugger::getFunctionDefMap()
return functionDefs; {
return functionDefs;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string Debugger::builtinHelp() { const string Debugger::builtinHelp()
{
string result; string result;
for(int i=0; builtin_functions[i][0] != ""; i++) { for(int i=0; builtin_functions[i][0] != ""; i++)
{
result += builtin_functions[i][0]; result += builtin_functions[i][0];
result += " {"; result += " {";
result += builtin_functions[i][1]; result += builtin_functions[i][1];
@ -1114,13 +1135,15 @@ bool Debugger::saveROM(string filename)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::lockState() { void Debugger::lockState()
{
mySystem->lockDataBus(); mySystem->lockDataBus();
myConsole->cartridge().lockBank(); myConsole->cartridge().lockBank();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::unlockState() { void Debugger::unlockState()
{
mySystem->unlockDataBus(); mySystem->unlockDataBus();
myConsole->cartridge().unlockBank(); myConsole->cartridge().unlockBank();
} }

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: Equate.hxx,v 1.7 2008-02-06 13:45:20 stephena Exp $ // $Id: Equate.hxx,v 1.8 2008-02-24 16:51:52 stephena Exp $
//============================================================================ //============================================================================
#ifndef EQUATE_HXX #ifndef EQUATE_HXX
@ -21,24 +21,24 @@
#include "bspf.hxx" #include "bspf.hxx"
const int EQF_READ = 1; // Address can be read from enum {
const int EQF_WRITE = 2; // Address can be written to EQF_ANY = 1 << 0, // matches any type of label
const int EQF_USER = 4; // Equate is user-defined, not built-in EQF_READ = 1 << 1, // address can be read from
EQF_WRITE = 1 << 2, // address can be written to
// When used in a search, EQF_ANY matches any type of label EQF_USER = 1 << 3, // equate is user-defined, not built-in
const int EQF_ANY = 0;
// When used in a search, EQF_ROM matches only ROM addresses, // When used in a search, EQF_ROM matches only ROM addresses,
// and EQF_RAM only matches RAM addresses. Both RAM and ROM addresses // and EQF_RAM only matches RAM addresses. Both RAM and ROM addresses
// are by definition user-defined, since the built-in equates are // are by definition user-defined, since the built-in equates are
// for the TIA and RIOT only. // for the TIA and RIOT only.
const int EQF_ROM = EQF_READ | EQF_USER; EQF_ROM = EQF_READ | EQF_USER,
const int EQF_RAM = EQF_WRITE | EQF_READ | EQF_USER; EQF_RAM = EQF_WRITE | EQF_READ | EQF_USER
};
struct Equate { struct Equate {
string label; string label;
int address; int address;
int flags; int flags;
}; };
#endif #endif

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: EquateList.cxx,v 1.26 2008-02-06 13:45:20 stephena Exp $ // $Id: EquateList.cxx,v 1.27 2008-02-24 16:51:52 stephena Exp $
//============================================================================ //============================================================================
#include <fstream> #include <fstream>
@ -27,10 +27,10 @@
static Equate hardCodedEquates[] = { static Equate hardCodedEquates[] = {
// Standard $00-based TIA write locations: // Standard $00-based TIA write locations:
{ "VSYNC", 0x00, EQF_WRITE }, { "VSYNC", 0x00, EQF_WRITE },
{ "VBLANK", 0x01, EQF_WRITE }, { "VBLANK", 0x01, EQF_WRITE },
{ "WSYNC", 0x02, EQF_WRITE }, { "WSYNC", 0x02, EQF_WRITE },
{ "RSYNC", 0x03 , EQF_WRITE }, { "RSYNC", 0x03, EQF_WRITE },
{ "NUSIZ0", 0x04, EQF_WRITE }, { "NUSIZ0", 0x04, EQF_WRITE },
{ "NUSIZ1", 0x05, EQF_WRITE }, { "NUSIZ1", 0x05, EQF_WRITE },
{ "COLUP0", 0x06, EQF_WRITE }, { "COLUP0", 0x06, EQF_WRITE },
@ -38,47 +38,47 @@ static Equate hardCodedEquates[] = {
{ "COLUPF", 0x08, EQF_WRITE }, { "COLUPF", 0x08, EQF_WRITE },
{ "COLUBK", 0x09, EQF_WRITE }, { "COLUBK", 0x09, EQF_WRITE },
{ "CTRLPF", 0x0A, EQF_WRITE }, { "CTRLPF", 0x0A, EQF_WRITE },
{ "REFP0", 0x0B, EQF_WRITE }, { "REFP0", 0x0B, EQF_WRITE },
{ "REFP1", 0x0C, EQF_WRITE }, { "REFP1", 0x0C, EQF_WRITE },
{ "PF0", 0x0D, EQF_WRITE }, { "PF0", 0x0D, EQF_WRITE },
{ "PF1", 0x0E, EQF_WRITE }, { "PF1", 0x0E, EQF_WRITE },
{ "PF2", 0x0F, EQF_WRITE }, { "PF2", 0x0F, EQF_WRITE },
{ "RESP0", 0x10, EQF_WRITE }, { "RESP0", 0x10, EQF_WRITE },
{ "RESP1", 0x11, EQF_WRITE }, { "RESP1", 0x11, EQF_WRITE },
{ "RESM0", 0x12, EQF_WRITE }, { "RESM0", 0x12, EQF_WRITE },
{ "RESM1", 0x13, EQF_WRITE }, { "RESM1", 0x13, EQF_WRITE },
{ "RESBL", 0x14, EQF_WRITE }, { "RESBL", 0x14, EQF_WRITE },
{ "AUDC0", 0x15, EQF_WRITE }, { "AUDC0", 0x15, EQF_WRITE },
{ "AUDC1", 0x16, EQF_WRITE }, { "AUDC1", 0x16, EQF_WRITE },
{ "AUDF0", 0x17, EQF_WRITE }, { "AUDF0", 0x17, EQF_WRITE },
{ "AUDF1", 0x18, EQF_WRITE }, { "AUDF1", 0x18, EQF_WRITE },
{ "AUDV0", 0x19, EQF_WRITE }, { "AUDV0", 0x19, EQF_WRITE },
{ "AUDV1", 0x1A , EQF_WRITE }, { "AUDV1", 0x1A, EQF_WRITE },
{ "GRP0", 0x1B, EQF_WRITE }, { "GRP0", 0x1B, EQF_WRITE },
{ "GRP1", 0x1C, EQF_WRITE }, { "GRP1", 0x1C, EQF_WRITE },
{ "ENAM0", 0x1D, EQF_WRITE }, { "ENAM0", 0x1D, EQF_WRITE },
{ "ENAM1", 0x1E, EQF_WRITE }, { "ENAM1", 0x1E, EQF_WRITE },
{ "ENABL", 0x1F, EQF_WRITE }, { "ENABL", 0x1F, EQF_WRITE },
{ "HMP0", 0x20, EQF_WRITE }, { "HMP0", 0x20, EQF_WRITE },
{ "HMP1", 0x21, EQF_WRITE }, { "HMP1", 0x21, EQF_WRITE },
{ "HMM0", 0x22, EQF_WRITE }, { "HMM0", 0x22, EQF_WRITE },
{ "HMM1", 0x23, EQF_WRITE }, { "HMM1", 0x23, EQF_WRITE },
{ "HMBL", 0x24, EQF_WRITE }, { "HMBL", 0x24, EQF_WRITE },
{ "VDELP0", 0x25, EQF_WRITE }, { "VDELP0", 0x25, EQF_WRITE },
{ "VDEL01", 0x26, EQF_WRITE }, { "VDEL01", 0x26, EQF_WRITE },
{ "VDELP1", 0x26, EQF_WRITE }, { "VDELP1", 0x26, EQF_WRITE },
{ "VDELBL", 0x27, EQF_WRITE }, { "VDELBL", 0x27, EQF_WRITE },
{ "RESMP0", 0x28, EQF_WRITE }, { "RESMP0", 0x28, EQF_WRITE },
{ "RESMP1", 0x29, EQF_WRITE }, { "RESMP1", 0x29, EQF_WRITE },
{ "HMOVE", 0x2A, EQF_WRITE }, { "HMOVE", 0x2A, EQF_WRITE },
{ "HMCLR", 0x2B, EQF_WRITE }, { "HMCLR", 0x2B, EQF_WRITE },
{ "CXCLR", 0x2C, EQF_WRITE }, { "CXCLR", 0x2C, EQF_WRITE },
// Mirrored $30-based TIA write locations: // Mirrored $30-based TIA write locations:
{ "VSYNC.30", 0x30, EQF_WRITE }, { "VSYNC.30", 0x30, EQF_WRITE },
{ "VBLANK.30", 0x31, EQF_WRITE }, { "VBLANK.30", 0x31, EQF_WRITE },
{ "WSYNC.30", 0x32, EQF_WRITE }, { "WSYNC.30", 0x32, EQF_WRITE },
{ "RSYNC.30", 0x33 , EQF_WRITE }, { "RSYNC.30", 0x33, EQF_WRITE },
{ "NUSIZ0.30", 0x34, EQF_WRITE }, { "NUSIZ0.30", 0x34, EQF_WRITE },
{ "NUSIZ1.30", 0x35, EQF_WRITE }, { "NUSIZ1.30", 0x35, EQF_WRITE },
{ "COLUP0.30", 0x36, EQF_WRITE }, { "COLUP0.30", 0x36, EQF_WRITE },
@ -86,116 +86,116 @@ static Equate hardCodedEquates[] = {
{ "COLUPF.30", 0x38, EQF_WRITE }, { "COLUPF.30", 0x38, EQF_WRITE },
{ "COLUBK.30", 0x39, EQF_WRITE }, { "COLUBK.30", 0x39, EQF_WRITE },
{ "CTRLPF.30", 0x3A, EQF_WRITE }, { "CTRLPF.30", 0x3A, EQF_WRITE },
{ "REFP0.30", 0x3B, EQF_WRITE }, { "REFP0.30", 0x3B, EQF_WRITE },
{ "REFP1.30", 0x3C, EQF_WRITE }, { "REFP1.30", 0x3C, EQF_WRITE },
{ "PF0.30", 0x3D, EQF_WRITE }, { "PF0.30", 0x3D, EQF_WRITE },
{ "PF1.30", 0x3E, EQF_WRITE }, { "PF1.30", 0x3E, EQF_WRITE },
{ "PF2.30", 0x3F, EQF_WRITE }, { "PF2.30", 0x3F, EQF_WRITE },
{ "RESP0.30", 0x40, EQF_WRITE }, { "RESP0.30", 0x40, EQF_WRITE },
{ "RESP1.30", 0x41, EQF_WRITE }, { "RESP1.30", 0x41, EQF_WRITE },
{ "RESM0.30", 0x42, EQF_WRITE }, { "RESM0.30", 0x42, EQF_WRITE },
{ "RESM1.30", 0x43, EQF_WRITE }, { "RESM1.30", 0x43, EQF_WRITE },
{ "RESBL.30", 0x44, EQF_WRITE }, { "RESBL.30", 0x44, EQF_WRITE },
{ "AUDC0.30", 0x45, EQF_WRITE }, { "AUDC0.30", 0x45, EQF_WRITE },
{ "AUDC1.30", 0x46, EQF_WRITE }, { "AUDC1.30", 0x46, EQF_WRITE },
{ "AUDF0.30", 0x47, EQF_WRITE }, { "AUDF0.30", 0x47, EQF_WRITE },
{ "AUDF1.30", 0x48, EQF_WRITE }, { "AUDF1.30", 0x48, EQF_WRITE },
{ "AUDV0.30", 0x49, EQF_WRITE }, { "AUDV0.30", 0x49, EQF_WRITE },
{ "AUDV1.30", 0x4A , EQF_WRITE }, { "AUDV1.30", 0x4A, EQF_WRITE },
{ "GRP0.30", 0x4B, EQF_WRITE }, { "GRP0.30", 0x4B, EQF_WRITE },
{ "GRP1.30", 0x4C, EQF_WRITE }, { "GRP1.30", 0x4C, EQF_WRITE },
{ "ENAM0.30", 0x4D, EQF_WRITE }, { "ENAM0.30", 0x4D, EQF_WRITE },
{ "ENAM1.30", 0x4E, EQF_WRITE }, { "ENAM1.30", 0x4E, EQF_WRITE },
{ "ENABL.30", 0x4F, EQF_WRITE }, { "ENABL.30", 0x4F, EQF_WRITE },
{ "HMP0.30", 0x50, EQF_WRITE }, { "HMP0.30", 0x50, EQF_WRITE },
{ "HMP1.30", 0x51, EQF_WRITE }, { "HMP1.30", 0x51, EQF_WRITE },
{ "HMM0.30", 0x52, EQF_WRITE }, { "HMM0.30", 0x52, EQF_WRITE },
{ "HMM1.30", 0x53, EQF_WRITE }, { "HMM1.30", 0x53, EQF_WRITE },
{ "HMBL.30", 0x54, EQF_WRITE }, { "HMBL.30", 0x54, EQF_WRITE },
{ "VDELP0.30", 0x55, EQF_WRITE }, { "VDELP0.30", 0x55, EQF_WRITE },
{ "VDEL01.30", 0x56, EQF_WRITE }, { "VDEL01.30", 0x56, EQF_WRITE },
{ "VDELP1.30", 0x56, EQF_WRITE }, { "VDELP1.30", 0x56, EQF_WRITE },
{ "VDELBL.30", 0x57, EQF_WRITE }, { "VDELBL.30", 0x57, EQF_WRITE },
{ "RESMP0.30", 0x58, EQF_WRITE }, { "RESMP0.30", 0x58, EQF_WRITE },
{ "RESMP1.30", 0x59, EQF_WRITE }, { "RESMP1.30", 0x59, EQF_WRITE },
{ "HMOVE.30", 0x5A, EQF_WRITE }, { "HMOVE.30", 0x5A, EQF_WRITE },
{ "HMCLR.30", 0x5B, EQF_WRITE }, { "HMCLR.30", 0x5B, EQF_WRITE },
{ "CXCLR.30", 0x5C, EQF_WRITE }, { "CXCLR.30", 0x5C, EQF_WRITE },
// Standard $00-based TIA read locations: // Standard $00-based TIA read locations:
{ "CXM0P", 0x00, EQF_READ }, { "CXM0P", 0x00, EQF_READ },
{ "CXM1P", 0x01, EQF_READ }, { "CXM1P", 0x01, EQF_READ },
{ "CXP0FB", 0x02, EQF_READ }, { "CXP0FB", 0x02, EQF_READ },
{ "CXP1FB", 0x03, EQF_READ }, { "CXP1FB", 0x03, EQF_READ },
{ "CXM0FB", 0x04, EQF_READ }, { "CXM0FB", 0x04, EQF_READ },
{ "CXM1FB", 0x05, EQF_READ }, { "CXM1FB", 0x05, EQF_READ },
{ "CXBLPF", 0x06, EQF_READ }, { "CXBLPF", 0x06, EQF_READ },
{ "CXPPMM", 0x07, EQF_READ }, { "CXPPMM", 0x07, EQF_READ },
{ "INPT0", 0x08, EQF_READ }, { "INPT0", 0x08, EQF_READ },
{ "INPT1", 0x09, EQF_READ }, { "INPT1", 0x09, EQF_READ },
{ "INPT2", 0x0A, EQF_READ }, { "INPT2", 0x0A, EQF_READ },
{ "INPT3", 0x0B, EQF_READ }, { "INPT3", 0x0B, EQF_READ },
{ "INPT4", 0x0C, EQF_READ }, { "INPT4", 0x0C, EQF_READ },
{ "INPT5", 0x0D, EQF_READ }, { "INPT5", 0x0D, EQF_READ },
// Mirrored $10-based TIA read locations: // Mirrored $10-based TIA read locations:
{ "CXM0P.10", 0x10, EQF_READ }, { "CXM0P.10", 0x10, EQF_READ },
{ "CXM1P.10", 0x11, EQF_READ }, { "CXM1P.10", 0x11, EQF_READ },
{ "CXP0FB.10", 0x12, EQF_READ }, { "CXP0FB.10", 0x12, EQF_READ },
{ "CXP1FB.10", 0x13, EQF_READ }, { "CXP1FB.10", 0x13, EQF_READ },
{ "CXM0FB.10", 0x14, EQF_READ }, { "CXM0FB.10", 0x14, EQF_READ },
{ "CXM1FB.10", 0x15, EQF_READ }, { "CXM1FB.10", 0x15, EQF_READ },
{ "CXBLPF.10", 0x16, EQF_READ }, { "CXBLPF.10", 0x16, EQF_READ },
{ "CXPPMM.10", 0x17, EQF_READ }, { "CXPPMM.10", 0x17, EQF_READ },
{ "INPT0.10", 0x18, EQF_READ }, { "INPT0.10", 0x18, EQF_READ },
{ "INPT1.10", 0x19, EQF_READ }, { "INPT1.10", 0x19, EQF_READ },
{ "INPT2.10", 0x1A, EQF_READ }, { "INPT2.10", 0x1A, EQF_READ },
{ "INPT3.10", 0x1B, EQF_READ }, { "INPT3.10", 0x1B, EQF_READ },
{ "INPT4.10", 0x1C, EQF_READ }, { "INPT4.10", 0x1C, EQF_READ },
{ "INPT5.10", 0x1D, EQF_READ }, { "INPT5.10", 0x1D, EQF_READ },
// Mirrored $20-based TIA read locations: // Mirrored $20-based TIA read locations:
{ "CXM0P.20", 0x20, EQF_READ }, { "CXM0P.20", 0x20, EQF_READ },
{ "CXM1P.20", 0x21, EQF_READ }, { "CXM1P.20", 0x21, EQF_READ },
{ "CXP0FB.20", 0x22, EQF_READ }, { "CXP0FB.20", 0x22, EQF_READ },
{ "CXP1FB.20", 0x23, EQF_READ }, { "CXP1FB.20", 0x23, EQF_READ },
{ "CXM0FB.20", 0x24, EQF_READ }, { "CXM0FB.20", 0x24, EQF_READ },
{ "CXM1FB.20", 0x25, EQF_READ }, { "CXM1FB.20", 0x25, EQF_READ },
{ "CXBLPF.20", 0x26, EQF_READ }, { "CXBLPF.20", 0x26, EQF_READ },
{ "CXPPMM.20", 0x27, EQF_READ }, { "CXPPMM.20", 0x27, EQF_READ },
{ "INPT0.20", 0x28, EQF_READ }, { "INPT0.20", 0x28, EQF_READ },
{ "INPT1.20", 0x29, EQF_READ }, { "INPT1.20", 0x29, EQF_READ },
{ "INPT2.20", 0x2A, EQF_READ }, { "INPT2.20", 0x2A, EQF_READ },
{ "INPT3.20", 0x2B, EQF_READ }, { "INPT3.20", 0x2B, EQF_READ },
{ "INPT4.20", 0x2C, EQF_READ }, { "INPT4.20", 0x2C, EQF_READ },
{ "INPT5.20", 0x2D, EQF_READ }, { "INPT5.20", 0x2D, EQF_READ },
// Mirrored $30-based TIA read locations: // Mirrored $30-based TIA read locations:
{ "CXM0P.30", 0x30, EQF_READ }, { "CXM0P.30", 0x30, EQF_READ },
{ "CXM1P.30", 0x31, EQF_READ }, { "CXM1P.30", 0x31, EQF_READ },
{ "CXP0FB.30", 0x32, EQF_READ }, { "CXP0FB.30", 0x32, EQF_READ },
{ "CXP1FB.30", 0x33, EQF_READ }, { "CXP1FB.30", 0x33, EQF_READ },
{ "CXM0FB.30", 0x34, EQF_READ }, { "CXM0FB.30", 0x34, EQF_READ },
{ "CXM1FB.30", 0x35, EQF_READ }, { "CXM1FB.30", 0x35, EQF_READ },
{ "CXBLPF.30", 0x36, EQF_READ }, { "CXBLPF.30", 0x36, EQF_READ },
{ "CXPPMM.30", 0x37, EQF_READ }, { "CXPPMM.30", 0x37, EQF_READ },
{ "INPT0.30", 0x38, EQF_READ }, { "INPT0.30", 0x38, EQF_READ },
{ "INPT1.30", 0x39, EQF_READ }, { "INPT1.30", 0x39, EQF_READ },
{ "INPT2.30", 0x3A, EQF_READ }, { "INPT2.30", 0x3A, EQF_READ },
{ "INPT3.30", 0x3B, EQF_READ }, { "INPT3.30", 0x3B, EQF_READ },
{ "INPT4.30", 0x3C, EQF_READ }, { "INPT4.30", 0x3C, EQF_READ },
{ "INPT5.30", 0x3D, EQF_READ }, { "INPT5.30", 0x3D, EQF_READ },
// Standard RIOT locations (read, write, or both): // Standard RIOT locations (read, write, or both):
{ "SWCHA", 0x0280, EQF_READ | EQF_WRITE }, { "SWCHA", 0x280, EQF_READ | EQF_WRITE },
{ "SWCHB", 0x0282, EQF_READ | EQF_WRITE }, { "SWCHB", 0x282, EQF_READ | EQF_WRITE },
{ "SWACNT", 0x281, EQF_WRITE }, { "SWACNT", 0x281, EQF_WRITE },
{ "SWBCNT", 0x283, EQF_WRITE }, { "SWBCNT", 0x283, EQF_WRITE },
{ "INTIM", 0x0284, EQF_READ }, { "INTIM", 0x284, EQF_READ },
{ "TIM1T", 0x0294, EQF_WRITE }, { "TIM1T", 0x294, EQF_WRITE },
{ "TIM8T", 0x0295, EQF_WRITE }, { "TIM8T", 0x295, EQF_WRITE },
{ "TIM64T", 0x0296, EQF_WRITE }, { "TIM64T", 0x296, EQF_WRITE },
{ "TIM1024T", 0x0297, EQF_WRITE } { "TIM1024T", 0x297, EQF_WRITE }
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -221,32 +221,33 @@ EquateList::~EquateList()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int EquateList::calcSize() { int EquateList::calcSize()
currentSize = myFwdMap.size(); {
return currentSize; currentSize = myFwdMap.size();
return currentSize;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// DEPRECATED // DEPRECATED
const string& EquateList::getLabel(int addr) const string& EquateList::getLabel(int addr)
{ {
return getLabel(addr, EQF_ANY); return getLabel(addr, EQF_ANY);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& EquateList::getLabel(int addr, int flags) const string& EquateList::getLabel(int addr, int flags)
{ {
static string nothing = "";
addrToLabel::const_iterator iter = myRevMap.find(addr); addrToLabel::const_iterator iter = myRevMap.find(addr);
if(iter == myRevMap.end()) if(iter != myRevMap.end())
return nothing; {
else { // FIXME - until we fix the issue of correctly setting the equate
if(flags == EQF_ANY || flags == iter->second.flags) // flags to something other than 'EQF_ANY' by default,
return iter->second.label; // this comparison will almost always fail
else if(1)//flags == EQF_ANY || iter->second.flags & flags)
return nothing; return iter->second.label;
} }
return EmptyString;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -284,7 +285,7 @@ int EquateList::getAddress(const string& label)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool EquateList::undefine(string& label) bool EquateList::undefine(const string& label)
{ {
labelToAddr::iterator iter = myFwdMap.find(label); labelToAddr::iterator iter = myFwdMap.find(label);
if(iter == myFwdMap.end()) if(iter == myFwdMap.end())
@ -302,7 +303,7 @@ bool EquateList::undefine(string& label)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool EquateList::saveFile(string file) bool EquateList::saveFile(const string& file)
{ {
char buf[256]; char buf[256];
@ -325,7 +326,7 @@ bool EquateList::saveFile(string file)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string EquateList::loadFile(string file) string EquateList::loadFile(const string& file)
{ {
int pos = 0, lines = 0, curVal; int pos = 0, lines = 0, curVal;
string curLabel; string curLabel;
@ -373,16 +374,16 @@ string EquateList::loadFile(string file)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EquateList::addEquate(string label, int address) void EquateList::addEquate(const string& label, int address)
{ {
Equate *e = new Equate; Equate e;
e->label = label; e.label = label;
e->address = address; e.address = address;
e->flags = EQF_ANY; e.flags = EQF_ANY; // FIXME - this should be specified as a parameter
undefine(label); undefine(label);
myFwdMap.insert(make_pair(label, *e)); myFwdMap.insert(make_pair(label, e));
myRevMap.insert(make_pair(address, *e)); myRevMap.insert(make_pair(address, e));
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: EquateList.hxx,v 1.16 2008-02-06 13:45:20 stephena Exp $ // $Id: EquateList.hxx,v 1.17 2008-02-24 16:51:52 stephena Exp $
//============================================================================ //============================================================================
#ifndef EQUATELIST_HXX #ifndef EQUATELIST_HXX
@ -25,47 +25,47 @@
#include "Equate.hxx" #include "Equate.hxx"
#include "Array.hxx" #include "Array.hxx"
using namespace std; class EquateList
{
public:
EquateList();
~EquateList();
typedef map<int, Equate> addrToLabel; const string& getLabel(int addr);
typedef map<string, Equate> labelToAddr; const string& getLabel(int addr, int flags);
const char *getFormatted(int addr, int places);
const char *getFormatted(int addr, int places, int flags);
int getAddress(const string& label);
int getAddress(const string& label, const int flags);
void addEquate(const string& label, int address);
// void addEquate(string label, int address, const int flags);
bool saveFile(const string& file);
string loadFile(const string& file);
bool undefine(const string& label);
bool undefine(const char *lbl);
//string dumpAll();
int countCompletions(const char *in);
const char *getCompletions();
const char *getCompletionPrefix();
typedef Common::Array<Equate> Equates; private:
int calcSize();
int parse4hex(char *c);
string extractLabel(char *c);
int extractValue(char *c);
class EquateList { private:
public: typedef map<int, Equate> addrToLabel;
EquateList(); typedef map<string, Equate> labelToAddr;
~EquateList(); typedef Common::Array<Equate> Equates;
const string& getLabel(int addr);
const string& getLabel(int addr, int flags);
const char *getFormatted(int addr, int places);
const char *getFormatted(int addr, int places, const int flags);
int getAddress(const string& label);
int getAddress(const string& label, const int flags);
void addEquate(string label, int address);
// void addEquate(string label, int address, const int flags);
bool saveFile(string file);
string loadFile(string file);
bool undefine(string& label);
bool undefine(const char *lbl);
//string dumpAll();
int countCompletions(const char *in);
const char *getCompletions();
const char *getCompletionPrefix();
private: string completions;
int calcSize(); string compPrefix;
int parse4hex(char *c);
string extractLabel(char *c);
int extractValue(char *c);
string completions;
string compPrefix;
private: //Equates ourVcsEquates;
//Equates ourVcsEquates; int currentSize;
int currentSize; labelToAddr myFwdMap;
labelToAddr myFwdMap; addrToLabel myRevMap;
addrToLabel myRevMap;
}; };
#endif #endif

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: RamWidget.cxx,v 1.14 2008-02-06 13:45:20 stephena Exp $ // $Id: RamWidget.cxx,v 1.15 2008-02-24 16:51:52 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
@ -153,7 +153,6 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
// It will then send the 'kDGItemDataChangedCmd' signal to change the actual // It will then send the 'kDGItemDataChangedCmd' signal to change the actual
// memory location // memory location
int addr, value; int addr, value;
const char* buf;
RamDebug& dbg = instance()->debugger().ramDebug(); RamDebug& dbg = instance()->debugger().ramDebug();
switch(cmd) switch(cmd)
@ -173,17 +172,16 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
break; break;
case kDGSelectionChangedCmd: case kDGSelectionChangedCmd:
{
addr = myRamGrid->getSelectedAddr(); addr = myRamGrid->getSelectedAddr();
value = myRamGrid->getSelectedValue(); value = myRamGrid->getSelectedValue();
buf = instance()->debugger().equates()->getLabel( myLabel->setEditString(
addr+kRamStart, EQF_RAM).c_str(); instance()->debugger().equates()->getLabel(addr+kRamStart, EQF_RAM));
if(*buf) myLabel->setEditString(buf);
else myLabel->setEditString("");
myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10)); myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10));
myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2)); myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2));
break; break;
}
case kRevertCmd: case kRevertCmd:
for(unsigned int i = 0; i < kRamSize; i++) for(unsigned int i = 0; i < kRamSize; i++)

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: Cart.cxx,v 1.38 2008-02-22 15:29:52 stephena Exp $ // $Id: Cart.cxx,v 1.39 2008-02-24 16:51:52 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -430,7 +430,7 @@ bool Cartridge::isProbably4A50(const uInt8* image, uInt32 size)
{ {
// 4A50 carts store address $4A50 at the NMI vector, which // 4A50 carts store address $4A50 at the NMI vector, which
// in this scheme is always in the last page of ROM at // in this scheme is always in the last page of ROM at
// $1FFA - $1FFB // $1FFA - $1FFB (at least this is true in rev 1 of the format)
int idx = size - 6; // $1FFA int idx = size - 6; // $1FFA
return (image[idx] == 0x50 && image[idx+1] == 0x4A); return (image[idx] == 0x50 && image[idx+1] == 0x4A);
} }

View File

@ -13,6 +13,7 @@ typedef unsigned int uInt32;
int searchForBytes(const uInt8* image, uInt32 imagesize, int searchForBytes(const uInt8* image, uInt32 imagesize,
const uInt8* signature, uInt32 sigsize) const uInt8* signature, uInt32 sigsize)
{ {
#if 1
uInt32 count = 0; uInt32 count = 0;
for(uInt32 i = 0; i < imagesize - sigsize; ++i) for(uInt32 i = 0; i < imagesize - sigsize; ++i)
{ {
@ -29,6 +30,22 @@ int searchForBytes(const uInt8* image, uInt32 imagesize,
} }
return count; return count;
#else
uInt32 minhits = 2;
uInt32 count = 0;
for(uInt32 i = 0; i < imagesize - 3; ++i)
{
if(image[i] == 0xEA && image[i+2] >= 0x60 && image[i+2] <= 0x6F)
{
++count;
i += 3;
}
if(count >= minhits)
break;
}
return count;
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -