This commit is contained in:
owomomo 2019-06-10 17:27:10 +08:00
commit 3b54181e4d
1 changed files with 10 additions and 9 deletions

View File

@ -603,7 +603,6 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr)
strcat(debug_str, chr); strcat(debug_str, chr);
} else } else
{ {
char* a;
if ((addr + size) > 0xFFFF) if ((addr + size) > 0xFFFF)
{ {
while (addr < 0xFFFF) while (addr < 0xFFFF)
@ -624,28 +623,30 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr)
size++; size++;
} }
a = Disassemble(addr, opcode); static char bufferForDisassemblyWithPlentyOfStuff[64+NL_MAX_NAME_LEN*10]; //"plenty"
char* _a = Disassemble(addr, opcode);
strcpy(bufferForDisassemblyWithPlentyOfStuff, _a);
if (symbDebugEnabled) if (symbDebugEnabled)
{ {
replaceNames(ramBankNames, a, &disassembly_operands[i]); replaceNames(ramBankNames, bufferForDisassemblyWithPlentyOfStuff, &disassembly_operands[i]);
for(int p=0;p<ARRAY_SIZE(pageNames);p++) for(int p=0;p<ARRAY_SIZE(pageNames);p++)
if(pageNames[p] != NULL) if(pageNames[p] != NULL)
replaceNames(pageNames[p], a, &disassembly_operands[i]); replaceNames(pageNames[p], bufferForDisassemblyWithPlentyOfStuff, &disassembly_operands[i]);
} }
// special case: an RTS opcode // special case: an RTS opcode
if (GetMem(instruction_addr) == 0x60) if (GetMem(instruction_addr) == 0x60)
{ {
// add "----------" to emphasize the end of subroutine // add "----------" to emphasize the end of subroutine
strcat(a, " "); strcat(bufferForDisassemblyWithPlentyOfStuff, " ");
for (int j = strlen(a); j < (LOG_DISASSEMBLY_MAX_LEN - 1); ++j) for (int j = strlen(bufferForDisassemblyWithPlentyOfStuff); j < (LOG_DISASSEMBLY_MAX_LEN - 1); ++j)
a[j] = '-'; bufferForDisassemblyWithPlentyOfStuff[j] = '-';
a[LOG_DISASSEMBLY_MAX_LEN - 1] = 0; bufferForDisassemblyWithPlentyOfStuff[LOG_DISASSEMBLY_MAX_LEN - 1] = 0;
} }
// append the disassembly to current line // append the disassembly to current line
strcat(strcat(debug_str, " "), a); strcat(strcat(debug_str, " "), bufferForDisassemblyWithPlentyOfStuff);
} }
strcat(debug_str, "\n"); strcat(debug_str, "\n");
instructions_count++; instructions_count++;