From 03c5fa58f41a27a2f1c75a430b7bc30e2babf839 Mon Sep 17 00:00:00 2001 From: ekeeke Date: Sat, 4 Apr 2020 15:30:46 +0200 Subject: [PATCH] [Core/CPU] improved debug logging --- core/m68k/m68kcpu.c | 17 +++++++++-------- core/m68k/s68kcpu.c | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/core/m68k/m68kcpu.c b/core/m68k/m68kcpu.c index 1251845..1ee38a7 100644 --- a/core/m68k/m68kcpu.c +++ b/core/m68k/m68kcpu.c @@ -188,7 +188,8 @@ void m68k_set_fc_callback(void (*callback)(unsigned int new_fc)) } #endif -#ifdef LOGVDP +#ifdef LOGERROR + extern void error(char *format, ...); extern uint16 v_counter; #endif @@ -202,8 +203,8 @@ void m68k_update_irq(unsigned int mask) /* Update IRQ level */ CPU_INT_LEVEL |= (mask << 8); -#ifdef LOGVDP - error("[%d(%d)][%d(%d)] IRQ Level = %d(0x%02x) (%x)\n", v_counter, m68k.cycles/3420, m68k.cycles, m68k.cycles%3420,CPU_INT_LEVEL>>8,FLAG_INT_MASK,m68k_get_reg(M68K_REG_PC)); +#ifdef LOGERROR + error("[%d(%d)][%d(%d)] m68k IRQ Level = %d(0x%02x) (%x)\n", v_counter, m68k.cycles/3420, m68k.cycles, m68k.cycles%3420,CPU_INT_LEVEL>>8,FLAG_INT_MASK,m68k_get_reg(M68K_REG_PC)); #endif } @@ -212,8 +213,8 @@ void m68k_set_irq(unsigned int int_level) /* Set IRQ level */ CPU_INT_LEVEL = int_level << 8; -#ifdef LOGVDP - error("[%d(%d)][%d(%d)] IRQ Level = %d(0x%02x) (%x)\n", v_counter, m68k.cycles/3420, m68k.cycles, m68k.cycles%3420,CPU_INT_LEVEL>>8,FLAG_INT_MASK,m68k_get_reg(M68K_REG_PC)); +#ifdef LOGERROR + error("[%d(%d)][%d(%d)] m68k IRQ Level = %d(0x%02x) (%x)\n", v_counter, m68k.cycles/3420, m68k.cycles, m68k.cycles%3420,CPU_INT_LEVEL>>8,FLAG_INT_MASK,m68k_get_reg(M68K_REG_PC)); #endif } @@ -245,8 +246,8 @@ void m68k_set_irq_delay(unsigned int int_level) CPU_INT_LEVEL = int_level << 8; } -#ifdef LOGVDP - error("[%d(%d)][%d(%d)] IRQ Level = %d(0x%02x) (%x)\n", v_counter, m68k.cycles/3420, m68k.cycles, m68k.cycles%3420,CPU_INT_LEVEL>>8,FLAG_INT_MASK,m68k_get_reg(M68K_REG_PC)); +#ifdef LOGERROR + error("[%d(%d)][%d(%d)] m68k IRQ Level = %d(0x%02x) (%x)\n", v_counter, m68k.cycles/3420, m68k.cycles, m68k.cycles%3420,CPU_INT_LEVEL>>8,FLAG_INT_MASK,m68k_get_reg(M68K_REG_PC)); #endif /* Check interrupt mask to process IRQ */ @@ -277,7 +278,7 @@ void m68k_run(unsigned int cycles) /* Return point for when we have an address error (TODO: use goto) */ m68ki_set_address_error_trap() /* auto-disable (see m68kcpu.h) */ -#ifdef LOGVDP +#ifdef LOGERROR error("[%d][%d] m68k run to %d cycles (%x), irq mask = %x (%x)\n", v_counter, m68k.cycles, cycles, m68k.pc,FLAG_INT_MASK, CPU_INT_LEVEL); #endif diff --git a/core/m68k/s68kcpu.c b/core/m68k/s68kcpu.c index 74bd04c..4d8236e 100644 --- a/core/m68k/s68kcpu.c +++ b/core/m68k/s68kcpu.c @@ -213,7 +213,7 @@ void s68k_update_irq(unsigned int mask) CPU_INT_LEVEL = mask << 8; #ifdef LOG_SCD - error("[%d][%d] IRQ Level = %d(0x%02x) (%x)\n", v_counter, s68k.cycles, CPU_INT_LEVEL>>8,FLAG_INT_MASK,s68k.pc); + error("[%d][%d] s68k IRQ Level = %d(0x%02x) (%x)\n", v_counter, s68k.cycles, CPU_INT_LEVEL>>8,FLAG_INT_MASK,s68k.pc); #endif }