--- hatari/src/falcon/dsp_disasm.c 2019/04/09 08:49:37 1.1.1.5 +++ hatari/src/falcon/dsp_disasm.c 2019/04/09 08:53:21 1.1.1.7 @@ -24,11 +24,13 @@ #endif #include +#include #include #include "dsp_core.h" #include "dsp_cpu.h" #include "dsp_disasm.h" +#include "profile.h" /* More disasm infos, if wanted */ @@ -44,9 +46,9 @@ /* Current instruction */ static Uint32 cur_inst; -static Uint32 disasm_cur_inst_len; +static Uint16 disasm_cur_inst_len; static char str_instr[50]; -static char str_instr2[100]; +static char str_instr2[120]; static char parallelmove_name[64]; /* Previous instruction */ @@ -538,16 +540,25 @@ Uint16 dsp56k_disasm(dsp_trace_disasm_t */ const char* dsp56k_getInstructionText(void) { + const int len = sizeof(str_instr); + Uint64 count, cycles; + Uint16 cycle_diff; + float percentage; + int offset; + if (isLooping) { *str_instr2 = 0; } - else if (disasm_cur_inst_len == 1) { - sprintf(str_instr2, "p:%04x %06x (%02d cyc) %s\n", prev_inst_pc, cur_inst, dsp_core.instr_cycle, str_instr); - } - else { - sprintf(str_instr2, "p:%04x %06x %06x (%02d cyc) %s\n", prev_inst_pc, cur_inst, read_memory(prev_inst_pc + 1), dsp_core.instr_cycle, str_instr); + if (disasm_cur_inst_len == 1) { + offset = sprintf(str_instr2, "p:%04x %06x (%02d cyc) %-*s\n", prev_inst_pc, cur_inst, dsp_core.instr_cycle, len, str_instr); + } else { + offset = sprintf(str_instr2, "p:%04x %06x %06x (%02d cyc) %-*s\n", prev_inst_pc, cur_inst, read_memory(prev_inst_pc + 1), dsp_core.instr_cycle, len, str_instr); + } + if (offset > 2 && Profile_DspAddressData(prev_inst_pc, &percentage, &count, &cycles, &cycle_diff)) { + offset -= 2; + sprintf(str_instr2+offset, "%5.2f%% (%"PRId64", %"PRId64", %d)\n", + percentage, count, cycles, cycle_diff); } - return str_instr2; }