From aaa4b8521043ae8c4f68c3e2b79d25c3064cc610 Mon Sep 17 00:00:00 2001 From: ogamespec Date: Thu, 10 Aug 2023 09:41:20 +0300 Subject: [PATCH 1/2] tabs --- src/gekkoc.cpp | 56 +++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/gekkoc.cpp b/src/gekkoc.cpp index e685927f..cf1766b0 100644 --- a/src/gekkoc.cpp +++ b/src/gekkoc.cpp @@ -3278,16 +3278,16 @@ namespace Gekko switch (type) { - case GEKKO_QUANT_TYPE::U8: flt = (float)(uint8_t)data; break; - case GEKKO_QUANT_TYPE::U16: flt = (float)(uint16_t)data; break; - case GEKKO_QUANT_TYPE::S8: - if (data & 0x80) data |= 0xffffff00; - flt = (float)(int8_t)data; break; - case GEKKO_QUANT_TYPE::S16: - if (data & 0x8000) data |= 0xffff0000; - flt = (float)(int16_t)data; break; - case GEKKO_QUANT_TYPE::SINGLE_FLOAT: - default: flt = *((float*)&data); break; + case GEKKO_QUANT_TYPE::U8: flt = (float)(uint8_t)data; break; + case GEKKO_QUANT_TYPE::U16: flt = (float)(uint16_t)data; break; + case GEKKO_QUANT_TYPE::S8: + if (data & 0x80) data |= 0xffffff00; + flt = (float)(int8_t)data; break; + case GEKKO_QUANT_TYPE::S16: + if (data & 0x8000) data |= 0xffff0000; + flt = (float)(int16_t)data; break; + case GEKKO_QUANT_TYPE::SINGLE_FLOAT: + default: flt = *((float*)&data); break; } return flt * core->interp->ldScale[scale]; @@ -3302,24 +3302,24 @@ namespace Gekko switch (type) { - case GEKKO_QUANT_TYPE::U8: - if (data < 0) data = 0; - if (data > 255) data = 255; - uval = (uint8_t)(uint32_t)data; break; - case GEKKO_QUANT_TYPE::U16: - if (data < 0) data = 0; - if (data > 65535) data = 65535; - uval = (uint16_t)(uint32_t)data; break; - case GEKKO_QUANT_TYPE::S8: - if (data < -128) data = -128; - if (data > 127) data = 127; - uval = (int8_t)(uint8_t)(int32_t)(uint32_t)data; break; - case GEKKO_QUANT_TYPE::S16: - if (data < -32768) data = -32768; - if (data > 32767) data = 32767; - uval = (int16_t)(uint16_t)(int32_t)(uint32_t)data; break; - case GEKKO_QUANT_TYPE::SINGLE_FLOAT: - default: *((float*)&uval) = data; break; + case GEKKO_QUANT_TYPE::U8: + if (data < 0) data = 0; + if (data > 255) data = 255; + uval = (uint8_t)(uint32_t)data; break; + case GEKKO_QUANT_TYPE::U16: + if (data < 0) data = 0; + if (data > 65535) data = 65535; + uval = (uint16_t)(uint32_t)data; break; + case GEKKO_QUANT_TYPE::S8: + if (data < -128) data = -128; + if (data > 127) data = 127; + uval = (int8_t)(uint8_t)(int32_t)(uint32_t)data; break; + case GEKKO_QUANT_TYPE::S16: + if (data < -32768) data = -32768; + if (data > 32767) data = 32767; + uval = (int16_t)(uint16_t)(int32_t)(uint32_t)data; break; + case GEKKO_QUANT_TYPE::SINGLE_FLOAT: + default: *((float*)&uval) = data; break; } return uval; From 6abe01273e2aaa960e6809691ac342b2c4a0e729 Mon Sep 17 00:00:00 2001 From: ogamespec Date: Thu, 10 Aug 2023 10:11:11 +0300 Subject: [PATCH 2/2] Fixed step-over in Gekko debug (F10) --- src/gekko.cpp | 22 ++++++++++++++++++---- src/gekko.h | 5 ++++- src/gekkoc.cpp | 4 ++-- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/gekko.cpp b/src/gekko.cpp index 048ca8a7..3f5cde00 100644 --- a/src/gekko.cpp +++ b/src/gekko.cpp @@ -18,7 +18,9 @@ namespace Gekko if (core->EnableTestBreakpoints) { - core->TestBreakpoints(); + if (core->TestBreakpoints()) { + return; + } } core->interp->ExecuteOpcode(); @@ -173,7 +175,15 @@ namespace Gekko void GekkoCore::Exception(Gekko::Exception code) { - //Halt("Gekko Exception: #%04X\n", (uint16_t)code); + if (break_on_exception) + { + Halt("Gekko Exception: #%04X\n", (uint16_t)code); + } + + if (trace_exceptions) + { + Report(Channel::CPU, "Gekko Exception: #%04X\n", (uint16_t)code); + } if (exception) { @@ -769,12 +779,13 @@ namespace Gekko EnableTestWriteBreakpoints = false; } - void GekkoCore::TestBreakpoints() + bool GekkoCore::TestBreakpoints() { if (oneShotBreakpoint != BadAddress && regs.pc == oneShotBreakpoint) { + Halt("One shot breakpoint at addr: 0x%08X\n", oneShotBreakpoint); oneShotBreakpoint = BadAddress; - Halt("One shot breakpoint\n"); + return true; } uint32_t addr = BadAddress; @@ -793,7 +804,10 @@ namespace Gekko if (addr != BadAddress) { Halt("Gekko suspended at addr: 0x%08X\n", addr); + return true; } + + return false; } void GekkoCore::TestReadBreakpoints(uint32_t accessAddress) diff --git a/src/gekko.h b/src/gekko.h index 737e5386..4633475b 100644 --- a/src/gekko.h +++ b/src/gekko.h @@ -602,7 +602,10 @@ namespace Gekko SpinLock breakPointsLock; uint32_t oneShotBreakpoint = BadAddress; - void TestBreakpoints(); + bool break_on_exception = false; + bool trace_exceptions = false; + + bool TestBreakpoints(); void TestReadBreakpoints(uint32_t accessAddress); void TestWriteBreakpoints(uint32_t accessAddress); diff --git a/src/gekkoc.cpp b/src/gekkoc.cpp index cf1766b0..e5d51610 100644 --- a/src/gekkoc.cpp +++ b/src/gekkoc.cpp @@ -4282,12 +4282,12 @@ namespace Gekko // Locked cache DMA case SPR::DMAU: - //DBReport2(DbgChannel::CPU, "DMAU: 0x%08X\n", RRS); + Report(Channel::CPU, "DMAU: 0x%08X\n", core->regs.gpr[info.paramBits[1]]); break; case SPR::DMAL: { core->regs.spr[spr] = core->regs.gpr[info.paramBits[1]]; - //DBReport2(DbgChannel::CPU, "DMAL: 0x%08X\n", RRS); + Report(Channel::CPU, "DMAL: 0x%08X\n", core->regs.spr[spr]); if (core->regs.spr[SPR::DMAL] & GEKKO_DMAL_DMA_T) { uint32_t maddr = core->regs.spr[SPR::DMAU] & GEKKO_DMAU_MEM_ADDR;