fix #790 RIGHT NOW for some lazy guy. this means addresses such as "$1234" are no longer replaced with "mysymbol" but will now appear as "$1234 mysymbol". If anyone doesn't like this, you'll have to write about it in the bug ticket and I'll add it as an option. also fix replacement of zero page addresses (for instance, $F0 couldn't be replaced because the search token was $00F0)

This commit is contained in:
zeromus 2017-12-01 05:53:51 +00:00
parent 3077b3c904
commit 08b81a9089
2 changed files with 33 additions and 5 deletions

View File

@ -470,7 +470,9 @@ void HighlightSyntax(int lines)
numpos = SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_FINDTEXT, (WPARAM)FR_DOWN, (LPARAM)&num); numpos = SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_FINDTEXT, (WPARAM)FR_DOWN, (LPARAM)&num);
if (numpos != 0) if (numpos != 0)
{ {
if (debug_str[numpos + 3] == ',' || debug_str[numpos + 3] == ')' || debug_str[numpos + 3] == '\n') if (debug_str[numpos + 3] == ',' || debug_str[numpos + 3] == ')' || debug_str[numpos + 3] == '\n'
|| debug_str[numpos + 3] == ' ' //zero 30-nov-2017 - in support of combined label/offset disassembly. not sure this is a good idea
)
wordbreak = numpos + 2; wordbreak = numpos + 2;
else else
wordbreak = numpos + 4; wordbreak = numpos + 4;

View File

@ -533,12 +533,38 @@ void replaceNames(Name* list, char* str, std::vector<uint16>* addressesLog)
*buff = 0; *buff = 0;
src = str; src = str;
while (pos = strstr(src, list->offset)) int addrlen = 5;
//zero 30-nov-2017 - handle zero page differently
char test[64];
strcpy(test, list->offset);
if(!strncmp(test,"$00",3))
{ {
*pos = 0; strcpy(test,"$");
strcat(buff, src); strcat(test,list->offset+3);
addrlen = 3;
}
while (pos = strstr(src, test))
{
//zero 30-nov-2017 - change how this works so we can display the address still
//*pos = 0;
//strcat(buff, src);
//strcat(buff, list->name);
//src = pos + 5; // 5 = strlen(beg->offset), because all offsets are in "$XXXX" format
//zero 30-nov-2017 - change how this works so we can display the address still
//append beginning part, plus addrlen for the offset
strncat(buff,src,pos-src+addrlen);
//append a space
strcat(buff," ");
//append the label
strcat(buff, list->name); strcat(buff, list->name);
src = pos + 5; // 5 = strlen(beg->offset), because all offsets are in "$XXXX" format //begin processing after that offset
src = pos + addrlen;
//append a space.. unless what's next is an RParen, I guess
if(*src != ')') strcat(buff," ");
if (addressesLog) if (addressesLog)
addressesLog->push_back(list->offsetNumeric); addressesLog->push_back(list->offsetNumeric);
} }