From 4d9cdbc56ae27741c81da3a9ee7f9d65b4ba2a32 Mon Sep 17 00:00:00 2001 From: stephena Date: Sun, 24 Feb 2008 16:51:52 +0000 Subject: [PATCH] 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 --- stella/src/debugger/Debugger.cxx | 115 +++++++----- stella/src/debugger/Equate.hxx | 24 +-- stella/src/debugger/EquateList.cxx | 257 +++++++++++++------------- stella/src/debugger/EquateList.hxx | 74 ++++---- stella/src/debugger/gui/RamWidget.cxx | 12 +- stella/src/emucore/Cart.cxx | 4 +- stella/src/tools/check-sig.cxx | 17 ++ 7 files changed, 271 insertions(+), 232 deletions(-) diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index e7a8ba396..a2cd25367 100644 --- a/stella/src/debugger/Debugger.cxx +++ b/stella/src/debugger/Debugger.cxx @@ -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.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" @@ -871,14 +871,16 @@ void Debugger::nextFrame(int frames) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Debugger::clearAllBreakPoints() { +void Debugger::clearAllBreakPoints() +{ delete breakPoints; breakPoints = new PackedBitArray(0x10000); mySystem->m6502().setBreakPoints(NULL); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Debugger::clearAllTraps() { +void Debugger::clearAllTraps() +{ delete readTraps; delete writeTraps; 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); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int Debugger::dpeek(int addr) { +int Debugger::dpeek(int addr) +{ return mySystem->peek(addr) | (mySystem->peek(addr+1) << 8); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string Debugger::showWatches() { - return myParser->showWatches(); +string Debugger::showWatches() +{ + return myParser->showWatches(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Debugger::addLabel(string label, int address) { - equateList->addEquate(label, address); +void Debugger::addLabel(string label, int address) +{ + equateList->addEquate(label, address); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -913,8 +919,10 @@ void Debugger::reloadROM() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool Debugger::setBank(int bank) { - if(myConsole->cartridge().bankCount() > 1) { +bool Debugger::setBank(int bank) +{ + if(myConsole->cartridge().bankCount() > 1) + { myConsole->cartridge().unlockBank(); myConsole->cartridge().bank(bank); myConsole->cartridge().lockBank(); @@ -924,23 +932,27 @@ bool Debugger::setBank(int bank) { } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int Debugger::getBank() { +int Debugger::getBank() +{ return myConsole->cartridge().bank(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int Debugger::bankCount() { +int Debugger::bankCount() +{ return myConsole->cartridge().bankCount(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const char *Debugger::getCartType() { +const char *Debugger::getCartType() +{ return myConsole->cartridge().name().c_str(); // 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); } @@ -1043,55 +1055,64 @@ GUI::Rect Debugger::getTabBounds() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Debugger::addFunction(string name, string definition, Expression *exp, bool builtin) { - functions.insert(make_pair(name, exp)); - if(!builtin) functionDefs.insert(make_pair(name, definition)); +void Debugger::addFunction(string name, string definition, + Expression *exp, bool builtin) +{ + functions.insert(make_pair(name, exp)); + if(!builtin) + functionDefs.insert(make_pair(name, definition)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Debugger::delFunction(string name) { - FunctionMap::iterator iter = functions.find(name); - if(iter == functions.end()) - return; +void Debugger::delFunction(string name) +{ + FunctionMap::iterator iter = functions.find(name); + if(iter == functions.end()) + return; - functions.erase(name); - delete iter->second; + functions.erase(name); + delete iter->second; - FunctionDefMap::iterator def_iter = functionDefs.find(name); - if(def_iter == functionDefs.end()) - return; + FunctionDefMap::iterator def_iter = functionDefs.find(name); + if(def_iter == functionDefs.end()) + return; - functionDefs.erase(name); + functionDefs.erase(name); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Expression *Debugger::getFunction(string name) { - FunctionMap::iterator iter = functions.find(name); - if(iter == functions.end()) - return 0; - else - return iter->second; +Expression *Debugger::getFunction(string name) +{ + FunctionMap::iterator iter = functions.find(name); + if(iter == functions.end()) + return 0; + else + return iter->second; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string Debugger::getFunctionDef(string name) { - FunctionDefMap::iterator iter = functionDefs.find(name); - if(iter == functionDefs.end()) - return ""; - else - return iter->second; +string Debugger::getFunctionDef(string name) +{ + FunctionDefMap::iterator iter = functionDefs.find(name); + if(iter == functionDefs.end()) + return ""; + else + return iter->second; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const FunctionDefMap Debugger::getFunctionDefMap() { - return functionDefs; +const FunctionDefMap Debugger::getFunctionDefMap() +{ + return functionDefs; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const string Debugger::builtinHelp() { +const string Debugger::builtinHelp() +{ 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 += " {"; result += builtin_functions[i][1]; @@ -1114,13 +1135,15 @@ bool Debugger::saveROM(string filename) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Debugger::lockState() { +void Debugger::lockState() +{ mySystem->lockDataBus(); myConsole->cartridge().lockBank(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Debugger::unlockState() { +void Debugger::unlockState() +{ mySystem->unlockDataBus(); myConsole->cartridge().unlockBank(); } diff --git a/stella/src/debugger/Equate.hxx b/stella/src/debugger/Equate.hxx index 35aafd7d6..173520373 100644 --- a/stella/src/debugger/Equate.hxx +++ b/stella/src/debugger/Equate.hxx @@ -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: 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 @@ -21,24 +21,24 @@ #include "bspf.hxx" -const int EQF_READ = 1; // Address can be read from -const int EQF_WRITE = 2; // Address can be written to -const int EQF_USER = 4; // Equate is user-defined, not built-in - -// When used in a search, EQF_ANY matches any type of label -const int EQF_ANY = 0; +enum { + EQF_ANY = 1 << 0, // matches any type of label + EQF_READ = 1 << 1, // address can be read from + EQF_WRITE = 1 << 2, // address can be written to + EQF_USER = 1 << 3, // equate is user-defined, not built-in // When used in a search, EQF_ROM matches only 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 // for the TIA and RIOT only. -const int EQF_ROM = EQF_READ | EQF_USER; -const int EQF_RAM = EQF_WRITE | EQF_READ | EQF_USER; + EQF_ROM = EQF_READ | EQF_USER, + EQF_RAM = EQF_WRITE | EQF_READ | EQF_USER +}; struct Equate { - string label; - int address; - int flags; + string label; + int address; + int flags; }; #endif diff --git a/stella/src/debugger/EquateList.cxx b/stella/src/debugger/EquateList.cxx index 5777a7a51..8b3d0b47f 100644 --- a/stella/src/debugger/EquateList.cxx +++ b/stella/src/debugger/EquateList.cxx @@ -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: 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 @@ -27,10 +27,10 @@ static Equate hardCodedEquates[] = { // Standard $00-based TIA write locations: - { "VSYNC", 0x00, EQF_WRITE }, + { "VSYNC", 0x00, EQF_WRITE }, { "VBLANK", 0x01, EQF_WRITE }, - { "WSYNC", 0x02, EQF_WRITE }, - { "RSYNC", 0x03 , EQF_WRITE }, + { "WSYNC", 0x02, EQF_WRITE }, + { "RSYNC", 0x03, EQF_WRITE }, { "NUSIZ0", 0x04, EQF_WRITE }, { "NUSIZ1", 0x05, EQF_WRITE }, { "COLUP0", 0x06, EQF_WRITE }, @@ -38,47 +38,47 @@ static Equate hardCodedEquates[] = { { "COLUPF", 0x08, EQF_WRITE }, { "COLUBK", 0x09, EQF_WRITE }, { "CTRLPF", 0x0A, EQF_WRITE }, - { "REFP0", 0x0B, EQF_WRITE }, - { "REFP1", 0x0C, EQF_WRITE }, - { "PF0", 0x0D, EQF_WRITE }, - { "PF1", 0x0E, EQF_WRITE }, - { "PF2", 0x0F, EQF_WRITE }, - { "RESP0", 0x10, EQF_WRITE }, - { "RESP1", 0x11, EQF_WRITE }, - { "RESM0", 0x12, EQF_WRITE }, - { "RESM1", 0x13, EQF_WRITE }, - { "RESBL", 0x14, EQF_WRITE }, - { "AUDC0", 0x15, EQF_WRITE }, - { "AUDC1", 0x16, EQF_WRITE }, - { "AUDF0", 0x17, EQF_WRITE }, - { "AUDF1", 0x18, EQF_WRITE }, - { "AUDV0", 0x19, EQF_WRITE }, - { "AUDV1", 0x1A , EQF_WRITE }, - { "GRP0", 0x1B, EQF_WRITE }, - { "GRP1", 0x1C, EQF_WRITE }, - { "ENAM0", 0x1D, EQF_WRITE }, - { "ENAM1", 0x1E, EQF_WRITE }, - { "ENABL", 0x1F, EQF_WRITE }, - { "HMP0", 0x20, EQF_WRITE }, - { "HMP1", 0x21, EQF_WRITE }, - { "HMM0", 0x22, EQF_WRITE }, - { "HMM1", 0x23, EQF_WRITE }, - { "HMBL", 0x24, EQF_WRITE }, + { "REFP0", 0x0B, EQF_WRITE }, + { "REFP1", 0x0C, EQF_WRITE }, + { "PF0", 0x0D, EQF_WRITE }, + { "PF1", 0x0E, EQF_WRITE }, + { "PF2", 0x0F, EQF_WRITE }, + { "RESP0", 0x10, EQF_WRITE }, + { "RESP1", 0x11, EQF_WRITE }, + { "RESM0", 0x12, EQF_WRITE }, + { "RESM1", 0x13, EQF_WRITE }, + { "RESBL", 0x14, EQF_WRITE }, + { "AUDC0", 0x15, EQF_WRITE }, + { "AUDC1", 0x16, EQF_WRITE }, + { "AUDF0", 0x17, EQF_WRITE }, + { "AUDF1", 0x18, EQF_WRITE }, + { "AUDV0", 0x19, EQF_WRITE }, + { "AUDV1", 0x1A, EQF_WRITE }, + { "GRP0", 0x1B, EQF_WRITE }, + { "GRP1", 0x1C, EQF_WRITE }, + { "ENAM0", 0x1D, EQF_WRITE }, + { "ENAM1", 0x1E, EQF_WRITE }, + { "ENABL", 0x1F, EQF_WRITE }, + { "HMP0", 0x20, EQF_WRITE }, + { "HMP1", 0x21, EQF_WRITE }, + { "HMM0", 0x22, EQF_WRITE }, + { "HMM1", 0x23, EQF_WRITE }, + { "HMBL", 0x24, EQF_WRITE }, { "VDELP0", 0x25, EQF_WRITE }, { "VDEL01", 0x26, EQF_WRITE }, { "VDELP1", 0x26, EQF_WRITE }, { "VDELBL", 0x27, EQF_WRITE }, { "RESMP0", 0x28, EQF_WRITE }, { "RESMP1", 0x29, EQF_WRITE }, - { "HMOVE", 0x2A, EQF_WRITE }, - { "HMCLR", 0x2B, EQF_WRITE }, - { "CXCLR", 0x2C, EQF_WRITE }, + { "HMOVE", 0x2A, EQF_WRITE }, + { "HMCLR", 0x2B, EQF_WRITE }, + { "CXCLR", 0x2C, EQF_WRITE }, // Mirrored $30-based TIA write locations: - { "VSYNC.30", 0x30, EQF_WRITE }, + { "VSYNC.30", 0x30, EQF_WRITE }, { "VBLANK.30", 0x31, EQF_WRITE }, - { "WSYNC.30", 0x32, EQF_WRITE }, - { "RSYNC.30", 0x33 , EQF_WRITE }, + { "WSYNC.30", 0x32, EQF_WRITE }, + { "RSYNC.30", 0x33, EQF_WRITE }, { "NUSIZ0.30", 0x34, EQF_WRITE }, { "NUSIZ1.30", 0x35, EQF_WRITE }, { "COLUP0.30", 0x36, EQF_WRITE }, @@ -86,116 +86,116 @@ static Equate hardCodedEquates[] = { { "COLUPF.30", 0x38, EQF_WRITE }, { "COLUBK.30", 0x39, EQF_WRITE }, { "CTRLPF.30", 0x3A, EQF_WRITE }, - { "REFP0.30", 0x3B, EQF_WRITE }, - { "REFP1.30", 0x3C, EQF_WRITE }, - { "PF0.30", 0x3D, EQF_WRITE }, - { "PF1.30", 0x3E, EQF_WRITE }, - { "PF2.30", 0x3F, EQF_WRITE }, - { "RESP0.30", 0x40, EQF_WRITE }, - { "RESP1.30", 0x41, EQF_WRITE }, - { "RESM0.30", 0x42, EQF_WRITE }, - { "RESM1.30", 0x43, EQF_WRITE }, - { "RESBL.30", 0x44, EQF_WRITE }, - { "AUDC0.30", 0x45, EQF_WRITE }, - { "AUDC1.30", 0x46, EQF_WRITE }, - { "AUDF0.30", 0x47, EQF_WRITE }, - { "AUDF1.30", 0x48, EQF_WRITE }, - { "AUDV0.30", 0x49, EQF_WRITE }, - { "AUDV1.30", 0x4A , EQF_WRITE }, - { "GRP0.30", 0x4B, EQF_WRITE }, - { "GRP1.30", 0x4C, EQF_WRITE }, - { "ENAM0.30", 0x4D, EQF_WRITE }, - { "ENAM1.30", 0x4E, EQF_WRITE }, - { "ENABL.30", 0x4F, EQF_WRITE }, - { "HMP0.30", 0x50, EQF_WRITE }, - { "HMP1.30", 0x51, EQF_WRITE }, - { "HMM0.30", 0x52, EQF_WRITE }, - { "HMM1.30", 0x53, EQF_WRITE }, - { "HMBL.30", 0x54, EQF_WRITE }, + { "REFP0.30", 0x3B, EQF_WRITE }, + { "REFP1.30", 0x3C, EQF_WRITE }, + { "PF0.30", 0x3D, EQF_WRITE }, + { "PF1.30", 0x3E, EQF_WRITE }, + { "PF2.30", 0x3F, EQF_WRITE }, + { "RESP0.30", 0x40, EQF_WRITE }, + { "RESP1.30", 0x41, EQF_WRITE }, + { "RESM0.30", 0x42, EQF_WRITE }, + { "RESM1.30", 0x43, EQF_WRITE }, + { "RESBL.30", 0x44, EQF_WRITE }, + { "AUDC0.30", 0x45, EQF_WRITE }, + { "AUDC1.30", 0x46, EQF_WRITE }, + { "AUDF0.30", 0x47, EQF_WRITE }, + { "AUDF1.30", 0x48, EQF_WRITE }, + { "AUDV0.30", 0x49, EQF_WRITE }, + { "AUDV1.30", 0x4A, EQF_WRITE }, + { "GRP0.30", 0x4B, EQF_WRITE }, + { "GRP1.30", 0x4C, EQF_WRITE }, + { "ENAM0.30", 0x4D, EQF_WRITE }, + { "ENAM1.30", 0x4E, EQF_WRITE }, + { "ENABL.30", 0x4F, EQF_WRITE }, + { "HMP0.30", 0x50, EQF_WRITE }, + { "HMP1.30", 0x51, EQF_WRITE }, + { "HMM0.30", 0x52, EQF_WRITE }, + { "HMM1.30", 0x53, EQF_WRITE }, + { "HMBL.30", 0x54, EQF_WRITE }, { "VDELP0.30", 0x55, EQF_WRITE }, { "VDEL01.30", 0x56, EQF_WRITE }, { "VDELP1.30", 0x56, EQF_WRITE }, { "VDELBL.30", 0x57, EQF_WRITE }, { "RESMP0.30", 0x58, EQF_WRITE }, { "RESMP1.30", 0x59, EQF_WRITE }, - { "HMOVE.30", 0x5A, EQF_WRITE }, - { "HMCLR.30", 0x5B, EQF_WRITE }, - { "CXCLR.30", 0x5C, EQF_WRITE }, + { "HMOVE.30", 0x5A, EQF_WRITE }, + { "HMCLR.30", 0x5B, EQF_WRITE }, + { "CXCLR.30", 0x5C, EQF_WRITE }, // Standard $00-based TIA read locations: - { "CXM0P", 0x00, EQF_READ }, - { "CXM1P", 0x01, EQF_READ }, + { "CXM0P", 0x00, EQF_READ }, + { "CXM1P", 0x01, EQF_READ }, { "CXP0FB", 0x02, EQF_READ }, { "CXP1FB", 0x03, EQF_READ }, { "CXM0FB", 0x04, EQF_READ }, { "CXM1FB", 0x05, EQF_READ }, { "CXBLPF", 0x06, EQF_READ }, { "CXPPMM", 0x07, EQF_READ }, - { "INPT0", 0x08, EQF_READ }, - { "INPT1", 0x09, EQF_READ }, - { "INPT2", 0x0A, EQF_READ }, - { "INPT3", 0x0B, EQF_READ }, - { "INPT4", 0x0C, EQF_READ }, - { "INPT5", 0x0D, EQF_READ }, + { "INPT0", 0x08, EQF_READ }, + { "INPT1", 0x09, EQF_READ }, + { "INPT2", 0x0A, EQF_READ }, + { "INPT3", 0x0B, EQF_READ }, + { "INPT4", 0x0C, EQF_READ }, + { "INPT5", 0x0D, EQF_READ }, // Mirrored $10-based TIA read locations: - { "CXM0P.10", 0x10, EQF_READ }, - { "CXM1P.10", 0x11, EQF_READ }, + { "CXM0P.10", 0x10, EQF_READ }, + { "CXM1P.10", 0x11, EQF_READ }, { "CXP0FB.10", 0x12, EQF_READ }, { "CXP1FB.10", 0x13, EQF_READ }, { "CXM0FB.10", 0x14, EQF_READ }, { "CXM1FB.10", 0x15, EQF_READ }, { "CXBLPF.10", 0x16, EQF_READ }, { "CXPPMM.10", 0x17, EQF_READ }, - { "INPT0.10", 0x18, EQF_READ }, - { "INPT1.10", 0x19, EQF_READ }, - { "INPT2.10", 0x1A, EQF_READ }, - { "INPT3.10", 0x1B, EQF_READ }, - { "INPT4.10", 0x1C, EQF_READ }, - { "INPT5.10", 0x1D, EQF_READ }, + { "INPT0.10", 0x18, EQF_READ }, + { "INPT1.10", 0x19, EQF_READ }, + { "INPT2.10", 0x1A, EQF_READ }, + { "INPT3.10", 0x1B, EQF_READ }, + { "INPT4.10", 0x1C, EQF_READ }, + { "INPT5.10", 0x1D, EQF_READ }, // Mirrored $20-based TIA read locations: - { "CXM0P.20", 0x20, EQF_READ }, - { "CXM1P.20", 0x21, EQF_READ }, + { "CXM0P.20", 0x20, EQF_READ }, + { "CXM1P.20", 0x21, EQF_READ }, { "CXP0FB.20", 0x22, EQF_READ }, { "CXP1FB.20", 0x23, EQF_READ }, { "CXM0FB.20", 0x24, EQF_READ }, { "CXM1FB.20", 0x25, EQF_READ }, { "CXBLPF.20", 0x26, EQF_READ }, { "CXPPMM.20", 0x27, EQF_READ }, - { "INPT0.20", 0x28, EQF_READ }, - { "INPT1.20", 0x29, EQF_READ }, - { "INPT2.20", 0x2A, EQF_READ }, - { "INPT3.20", 0x2B, EQF_READ }, - { "INPT4.20", 0x2C, EQF_READ }, - { "INPT5.20", 0x2D, EQF_READ }, + { "INPT0.20", 0x28, EQF_READ }, + { "INPT1.20", 0x29, EQF_READ }, + { "INPT2.20", 0x2A, EQF_READ }, + { "INPT3.20", 0x2B, EQF_READ }, + { "INPT4.20", 0x2C, EQF_READ }, + { "INPT5.20", 0x2D, EQF_READ }, // Mirrored $30-based TIA read locations: - { "CXM0P.30", 0x30, EQF_READ }, - { "CXM1P.30", 0x31, EQF_READ }, + { "CXM0P.30", 0x30, EQF_READ }, + { "CXM1P.30", 0x31, EQF_READ }, { "CXP0FB.30", 0x32, EQF_READ }, { "CXP1FB.30", 0x33, EQF_READ }, { "CXM0FB.30", 0x34, EQF_READ }, { "CXM1FB.30", 0x35, EQF_READ }, { "CXBLPF.30", 0x36, EQF_READ }, { "CXPPMM.30", 0x37, EQF_READ }, - { "INPT0.30", 0x38, EQF_READ }, - { "INPT1.30", 0x39, EQF_READ }, - { "INPT2.30", 0x3A, EQF_READ }, - { "INPT3.30", 0x3B, EQF_READ }, - { "INPT4.30", 0x3C, EQF_READ }, - { "INPT5.30", 0x3D, EQF_READ }, + { "INPT0.30", 0x38, EQF_READ }, + { "INPT1.30", 0x39, EQF_READ }, + { "INPT2.30", 0x3A, EQF_READ }, + { "INPT3.30", 0x3B, EQF_READ }, + { "INPT4.30", 0x3C, EQF_READ }, + { "INPT5.30", 0x3D, EQF_READ }, // Standard RIOT locations (read, write, or both): - { "SWCHA", 0x0280, EQF_READ | EQF_WRITE }, - { "SWCHB", 0x0282, EQF_READ | EQF_WRITE }, - { "SWACNT", 0x281, EQF_WRITE }, - { "SWBCNT", 0x283, EQF_WRITE }, - { "INTIM", 0x0284, EQF_READ }, - { "TIM1T", 0x0294, EQF_WRITE }, - { "TIM8T", 0x0295, EQF_WRITE }, - { "TIM64T", 0x0296, EQF_WRITE }, - { "TIM1024T", 0x0297, EQF_WRITE } + { "SWCHA", 0x280, EQF_READ | EQF_WRITE }, + { "SWCHB", 0x282, EQF_READ | EQF_WRITE }, + { "SWACNT", 0x281, EQF_WRITE }, + { "SWBCNT", 0x283, EQF_WRITE }, + { "INTIM", 0x284, EQF_READ }, + { "TIM1T", 0x294, EQF_WRITE }, + { "TIM8T", 0x295, EQF_WRITE }, + { "TIM64T", 0x296, EQF_WRITE }, + { "TIM1024T", 0x297, EQF_WRITE } }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -221,32 +221,33 @@ EquateList::~EquateList() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int EquateList::calcSize() { - currentSize = myFwdMap.size(); - return currentSize; +int EquateList::calcSize() +{ + currentSize = myFwdMap.size(); + return currentSize; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // DEPRECATED const string& EquateList::getLabel(int addr) { - return getLabel(addr, EQF_ANY); + return getLabel(addr, EQF_ANY); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const string& EquateList::getLabel(int addr, int flags) { - static string nothing = ""; addrToLabel::const_iterator iter = myRevMap.find(addr); - if(iter == myRevMap.end()) - return nothing; - else { - if(flags == EQF_ANY || flags == iter->second.flags) - return iter->second.label; - else - return nothing; + if(iter != myRevMap.end()) + { + // FIXME - until we fix the issue of correctly setting the equate + // flags to something other than 'EQF_ANY' by default, + // this comparison will almost always fail + if(1)//flags == EQF_ANY || iter->second.flags & flags) + 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); 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]; @@ -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; 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; - e->label = label; - e->address = address; - e->flags = EQF_ANY; + Equate e; + e.label = label; + e.address = address; + e.flags = EQF_ANY; // FIXME - this should be specified as a parameter undefine(label); - myFwdMap.insert(make_pair(label, *e)); - myRevMap.insert(make_pair(address, *e)); + myFwdMap.insert(make_pair(label, e)); + myRevMap.insert(make_pair(address, e)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/debugger/EquateList.hxx b/stella/src/debugger/EquateList.hxx index da9bc609b..48eb69352 100644 --- a/stella/src/debugger/EquateList.hxx +++ b/stella/src/debugger/EquateList.hxx @@ -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: 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 @@ -25,47 +25,47 @@ #include "Equate.hxx" #include "Array.hxx" -using namespace std; +class EquateList +{ + public: + EquateList(); + ~EquateList(); -typedef map addrToLabel; -typedef map labelToAddr; + 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, 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 Equates; + private: + int calcSize(); + int parse4hex(char *c); + string extractLabel(char *c); + int extractValue(char *c); -class EquateList { - public: - EquateList(); - ~EquateList(); - 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: + typedef map addrToLabel; + typedef map labelToAddr; + typedef Common::Array Equates; - private: - int calcSize(); - int parse4hex(char *c); - string extractLabel(char *c); - int extractValue(char *c); - string completions; - string compPrefix; + string completions; + string compPrefix; - private: - //Equates ourVcsEquates; - int currentSize; - labelToAddr myFwdMap; - addrToLabel myRevMap; + //Equates ourVcsEquates; + int currentSize; + labelToAddr myFwdMap; + addrToLabel myRevMap; }; #endif diff --git a/stella/src/debugger/gui/RamWidget.cxx b/stella/src/debugger/gui/RamWidget.cxx index e96a962c6..505ca6703 100644 --- a/stella/src/debugger/gui/RamWidget.cxx +++ b/stella/src/debugger/gui/RamWidget.cxx @@ -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: 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 // 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 // memory location int addr, value; - const char* buf; RamDebug& dbg = instance()->debugger().ramDebug(); switch(cmd) @@ -173,17 +172,16 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) break; case kDGSelectionChangedCmd: + { addr = myRamGrid->getSelectedAddr(); value = myRamGrid->getSelectedValue(); - buf = instance()->debugger().equates()->getLabel( - addr+kRamStart, EQF_RAM).c_str(); - if(*buf) myLabel->setEditString(buf); - else myLabel->setEditString(""); - + myLabel->setEditString( + instance()->debugger().equates()->getLabel(addr+kRamStart, EQF_RAM)); myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10)); myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2)); break; + } case kRevertCmd: for(unsigned int i = 0; i < kRamSize; i++) diff --git a/stella/src/emucore/Cart.cxx b/stella/src/emucore/Cart.cxx index 378836b5c..ad8b4b98f 100644 --- a/stella/src/emucore/Cart.cxx +++ b/stella/src/emucore/Cart.cxx @@ -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: 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 @@ -430,7 +430,7 @@ bool Cartridge::isProbably4A50(const uInt8* image, uInt32 size) { // 4A50 carts store address $4A50 at the NMI vector, which // 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 return (image[idx] == 0x50 && image[idx+1] == 0x4A); } diff --git a/stella/src/tools/check-sig.cxx b/stella/src/tools/check-sig.cxx index 56688e97d..ef3605322 100644 --- a/stella/src/tools/check-sig.cxx +++ b/stella/src/tools/check-sig.cxx @@ -13,6 +13,7 @@ typedef unsigned int uInt32; int searchForBytes(const uInt8* image, uInt32 imagesize, const uInt8* signature, uInt32 sigsize) { +#if 1 uInt32 count = 0; for(uInt32 i = 0; i < imagesize - sigsize; ++i) { @@ -29,6 +30,22 @@ int searchForBytes(const uInt8* image, uInt32 imagesize, } 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 } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -