static void debug_int(interrupt_cpu_status_t *cs, const char *name, unsigned int type, CLOCK iclk) { unsigned int i; char *textout, *texttmp; textout = lib_stralloc(name); for (i = 0; i < cs->num_ints; i++) { if (cs->pending_int[i] & type) { texttmp = util_concat(textout, " ", cs->int_name[i], NULL); lib_free(textout); textout = texttmp; } } texttmp = lib_msprintf("%s %ld", textout, iclk); lib_free(textout); textout = texttmp; if (debug.trace_mode == DEBUG_HISTORY || debug.trace_mode == DEBUG_AUTOPLAY) { debug_history_step(textout); } else { log_debug("%s", textout); } lib_free(textout); }
void debug_text(const char *text) { if (debug.trace_mode == DEBUG_HISTORY || debug.trace_mode == DEBUG_AUTOPLAY) debug_history_step(text); else log_debug(text); }
void debug_maincpu(DWORD reg_pc, CLOCK mclk, const char *dis, BYTE reg_a, BYTE reg_x, BYTE reg_y, BYTE reg_sp) { switch (debug.trace_mode) { case DEBUG_SMALL: { char small_dis[7]; small_dis[0] = dis[0]; small_dis[1] = dis[1]; if (dis[3] == ' ') { small_dis[2] = '\0'; } else { small_dis[2] = dis[3]; small_dis[3] = dis[4]; if (dis[6] == ' ') { small_dis[4] = '\0'; } else { small_dis[4] = dis[6]; small_dis[5] = dis[7]; small_dis[6] = '\0'; } } log_debug("%04X %ld %02X%02X%02X %s", (unsigned int)reg_pc, (long)mclk, reg_a, reg_x, reg_y, small_dis); break; } case DEBUG_HISTORY: case DEBUG_AUTOPLAY: { char st[DEBUG_MAXLINELEN]; sprintf(st, ".%04X %02X %02X %8lX %-20s " "%02X%02X%02X%02X", (unsigned int)reg_pc, RLINE(mclk), RCYCLE(mclk), (long)mclk, dis, reg_a, reg_x, reg_y, reg_sp); debug_history_step(st); break; } case DEBUG_NORMAL: log_debug(".%04X %03i %03i %10ld %-22s " "%02x%02x%02x%02x", (unsigned int)reg_pc, RLINE(mclk), RCYCLE(mclk), (long)mclk, dis, reg_a, reg_x, reg_y, reg_sp); break; default: log_debug("Unknown debug format."); } }
void debug_drive(DWORD reg_pc, CLOCK mclk, const char *dis, BYTE reg_a, BYTE reg_x, BYTE reg_y, BYTE reg_sp, unsigned int driveno) { char st[DEBUG_MAXLINELEN]; sprintf(st, "Drive %2u:.%04X %10ld %-22s %02x%02x%02x%02x", driveno, (unsigned int)reg_pc, (long)mclk, dis, reg_a, reg_x, reg_y, reg_sp); if (debug.trace_mode == DEBUG_HISTORY || debug.trace_mode == DEBUG_AUTOPLAY) debug_history_step(st); else log_debug(st); }