Symbolic debug: tweaked register names, allowed to disable them from config file (entry "symbRegNames").

This commit is contained in:
feos-tas 2015-03-11 18:16:14 +00:00
parent 7d323c450a
commit aae0c7dd45
4 changed files with 15 additions and 14 deletions

View File

@ -74,6 +74,7 @@ extern bool fullSaveStateLoads;
extern int frameSkipAmt;
extern int32 fps_scale_frameadvance;
extern bool symbDebugEnabled;
extern bool symbRegNames;
extern TASEDITOR_CONFIG taseditorConfig;
extern char* recentProjectsArray[];
@ -276,6 +277,7 @@ static CFGSTRUCT fceuconfig[] =
AC(debuggerAutoload),
AC(allowUDLR),
AC(symbDebugEnabled),
AC(symbRegNames),
AC(debuggerSaveLoadDEBFiles),
AC(debuggerDisplayROMoffsets),
AC(debuggerFontSize),

View File

@ -31,7 +31,6 @@
#include <assert.h>
int GetNesFileAddress(int A);
int RegNameCount = 0;
inline int RomPageIndexForAddress(int addr) { return (addr-0x8000)>>(debuggerPageSize); }
@ -58,6 +57,7 @@ bool ramBankNamesLoaded = false;
extern char LoadedRomFName[2048];
char NLfilename[2048];
bool symbDebugEnabled = true;
bool symbRegNames = true;
int debuggerWasActive = 0;
char temp_chr[40] = {0};
char delimiterChar[2] = "#";
@ -65,16 +65,13 @@ char delimiterChar[2] = "#";
extern BOOL CALLBACK nameBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern char bookmarkDescription[];
// nonzero to use these predefined register names
#define PREDEFINED_REGISTER_NAMES 0
MemoryMappedRegister RegNames[] = {
{"$2000", "PPU_CTRL_REG1"},
{"$2001", "PPU_CTRL_REG2"},
{"$2000", "PPU_CTRL"},
{"$2001", "PPU_MASK"},
{"$2002", "PPU_STATUS"},
{"$2003", "PPU_SPR_ADDR"},
{"$2004", "PPU_SPR_DATA"},
{"$2005", "PPU_SCROLL_REG"},
{"$2003", "PPU_OAM_ADDR"},
{"$2004", "PPU_OAM_DATA"},
{"$2005", "PPU_SCROLL"},
{"$2006", "PPU_ADDRESS"},
{"$2007", "PPU_DATA"},
{"$4000", "SQ1_VOL"},
@ -98,11 +95,13 @@ MemoryMappedRegister RegNames[] = {
{"$4012", "DMC_START"},
{"$4013", "DMC_LEN"},
{"$4014", "OAM_DMA"},
{"$4015", "SND_CHN"},
{"$4015", "APU_STATUS"},
{"$4016", "JOY1"},
{"$4017", "JOY2"}
{"$4017", "JOY2_FRAME"}
};
int RegNameCount = sizeof(RegNames)/sizeof(MemoryMappedRegister);
/**
* Tests whether a char is a valid hexadecimal character.
*
@ -555,6 +554,7 @@ void replaceNames(Name* list, char* str, std::vector<uint16>* addressesLog)
}
for (int i = 0; i < RegNameCount; i++) {
if (!symbRegNames) break;
// copypaste, because Name* is too complex to abstract
*buff = 0;
src = str;
@ -652,9 +652,6 @@ void setNamesPointerForAddress(uint16 address, Name* newNode)
void loadNameFiles()
{
int cb;
#if PREDEFINED_REGISTER_NAMES
RegNameCount = sizeof(RegNames)/sizeof(MemoryMappedRegister);
#endif
if (!ramBankNamesLoaded)
{

View File

@ -40,6 +40,7 @@ struct MemoryMappedRegister
};
extern bool symbDebugEnabled;
extern bool symbRegNames;
extern std::vector<unsigned int> bookmarks_addr;
extern std::vector<std::string> bookmarks_name;
extern int debuggerWasActive;

View File

@ -642,6 +642,7 @@ void UpdateCaption()
strcat(str, node->name);
}
for (int i = 0; i < RegNameCount; i++) {
if (!symbRegNames) break;
int test = 0;
sscanf(RegNames[i].offset, "$%4x", &test);
if (test == CursorStartAddy) {