@@ -603,7 +603,6 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr)
603603 strcat (debug_str, chr);
604604 } else
605605 {
606- char * a;
607606 if ((addr + size) > 0xFFFF )
608607 {
609608 while (addr < 0xFFFF )
@@ -624,28 +623,30 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr)
624623 size++;
625624 }
626625
627- a = Disassemble (addr, opcode);
626+ static char bufferForDisassemblyWithPlentyOfStuff[64 +NL_MAX_NAME_LEN*10 ]; // "plenty"
627+ char * _a = Disassemble (addr, opcode);
628+ strcpy (bufferForDisassemblyWithPlentyOfStuff, _a);
628629
629630 if (symbDebugEnabled)
630631 {
631- replaceNames (ramBankNames, a , &disassembly_operands[i]);
632+ replaceNames (ramBankNames, bufferForDisassemblyWithPlentyOfStuff , &disassembly_operands[i]);
632633 for (int p=0 ;p<ARRAY_SIZE (pageNames);p++)
633634 if (pageNames[p] != NULL )
634- replaceNames (pageNames[p], a , &disassembly_operands[i]);
635+ replaceNames (pageNames[p], bufferForDisassemblyWithPlentyOfStuff , &disassembly_operands[i]);
635636 }
636637
637638 // special case: an RTS opcode
638639 if (GetMem (instruction_addr) == 0x60 )
639640 {
640641 // add "----------" to emphasize the end of subroutine
641- strcat (a , " " );
642- for (int j = strlen (a ); j < (LOG_DISASSEMBLY_MAX_LEN - 1 ); ++j)
643- a [j] = ' -' ;
644- a [LOG_DISASSEMBLY_MAX_LEN - 1 ] = 0 ;
642+ strcat (bufferForDisassemblyWithPlentyOfStuff , " " );
643+ for (int j = strlen (bufferForDisassemblyWithPlentyOfStuff ); j < (LOG_DISASSEMBLY_MAX_LEN - 1 ); ++j)
644+ bufferForDisassemblyWithPlentyOfStuff [j] = ' -' ;
645+ bufferForDisassemblyWithPlentyOfStuff [LOG_DISASSEMBLY_MAX_LEN - 1 ] = 0 ;
645646 }
646647
647648 // append the disassembly to current line
648- strcat (strcat (debug_str, " " ), a );
649+ strcat (strcat (debug_str, " " ), bufferForDisassemblyWithPlentyOfStuff );
649650 }
650651 strcat (debug_str, " \n " );
651652 instructions_count++;
0 commit comments