From 80a21f2ba872a9587e7dade98d36a2172c18dcce Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 22 Feb 2018 22:23:10 +0100 Subject: [PATCH] Put some debug conditionals around some printfs --- mednafen/psx/cpu.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mednafen/psx/cpu.cpp b/mednafen/psx/cpu.cpp index a6cd349f..3f216f84 100644 --- a/mednafen/psx/cpu.cpp +++ b/mednafen/psx/cpu.cpp @@ -568,6 +568,7 @@ uint32 NO_INLINE PS_CPU::Exception(uint32 code, uint32 PC, const uint32 NP, cons assert(code < 16); +#ifdef DEBUG if(code != EXCEPTION_INT && code != EXCEPTION_BP && code != EXCEPTION_SYSCALL) { static const char* exmne[16] = @@ -578,6 +579,7 @@ uint32 NO_INLINE PS_CPU::Exception(uint32 code, uint32 PC, const uint32 NP, cons PSX_DBG(PSX_DBG_WARNING, "[CPU] Exception %s(0x%02x) @ PC=0x%08x(NP=0x%08x, BDBT=0x%02x), Instr=0x%08x, IPCache=0x%02x, CAUSE=0x%08x, SR=0x%08x, IRQC_Status=0x%04x, IRQC_Mask=0x%04x\n", exmne[code], code, PC, NP, BDBT, instr, IPCache, CP0.CAUSE, CP0.SR, IRQ_GetRegister(IRQ_GSREG_STATUS, NULL, 0), IRQ_GetRegister(IRQ_GSREG_MASK, NULL, 0)); } +#endif if(CP0.SR & (1 << 22)) // BEV handler = 0xBFC00180; @@ -1177,10 +1179,12 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in) break; case CP0REG_DCIC: +#ifdef DEBUG if(val) { PSX_DBG(PSX_DBG_WARNING, "[CPU] Non-zero write to DCIC: 0x%08x\n", val); } +#endif CP0.DCIC = val & 0xFF80003F; break; @@ -1212,7 +1216,9 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in) const uint32 immediate = (int32)(int16)(instr & 0xFFFF); const bool result = (false == (bool)(instr & (1U << 16))); +#ifdef DEBUG PSX_DBG(PSX_DBG_WARNING, "[CPU] BC0x instruction(0x%08x) @ PC=0x%08x\n", instr, PC); +#endif DO_BRANCH(result, (immediate << 2), ~0U, false, 0); } @@ -1336,7 +1342,9 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in) const uint32 immediate = (int32)(int16)(instr & 0xFFFF); const bool result = (false == (bool)(instr & (1U << 16))); +#ifdef DEBUG PSX_DBG(PSX_DBG_WARNING, "[CPU] BC2x instruction(0x%08x) @ PC=0x%08x\n", instr, PC); +#endif DO_BRANCH(result, (immediate << 2), ~0U, false, 0); } @@ -1367,7 +1375,9 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in) { const uint32 sub_op = (instr >> 21) & 0x1F; +#ifdef DEBUG PSX_DBG(PSX_DBG_WARNING, "[CPU] COP%u instruction(0x%08x) @ PC=0x%08x\n", (instr >> 26) & 0x3, instr, PC); +#endif if(sub_op == 0x08 || sub_op == 0x0C) { @@ -1401,7 +1411,9 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in) } else { +#ifdef DEBUG PSX_DBG(PSX_DBG_WARNING, "[CPU] LWC%u instruction(0x%08x) @ PC=0x%08x\n", (instr >> 26) & 0x3, instr, PC); +#endif ReadMemory(timestamp, address, false, true); } @@ -1457,11 +1469,13 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in) CP0.BADA = address; new_PC = Exception(EXCEPTION_ADES, PC, new_PC, instr); } +#ifdef DEBUG else { PSX_DBG(PSX_DBG_WARNING, "[CPU] SWC%u instruction(0x%08x) @ PC=0x%08x\n", (instr >> 26) & 0x3, instr, PC); //WriteMemory(timestamp, address, SOMETHING); } +#endif } END_OPF;