From 6ca01903b40d207ee8fc639d0d3c2723242c271b Mon Sep 17 00:00:00 2001 From: tomcw Date: Sun, 3 Sep 2023 21:40:09 +0100 Subject: [PATCH] Debug: Output cycle delta to log file --- source/Speaker.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/Speaker.cpp b/source/Speaker.cpp index a8d28087..90489aa3 100644 --- a/source/Speaker.cpp +++ b/source/Speaker.cpp @@ -418,6 +418,9 @@ static void UpdateSpkr() //============================================================================= +static FILE* g_fhSpkr = NULL; +static unsigned __int64 g_nSpkrLastCycle2 = 0; + // Called by emulation code when Speaker I/O reg is accessed // @@ -441,6 +444,14 @@ BYTE __stdcall SpkrToggle (WORD, WORD, BYTE, BYTE, ULONG nExecutedCycles) { CpuCalcCycles(nExecutedCycles); +#if 0 + if (!g_fhSpkr) + g_fhSpkr = fopen("spkrDelta.log", "w+"); + ULONG nCycleDiff = (ULONG)(g_nCumulativeCycles - g_nSpkrLastCycle2); + g_nSpkrLastCycle2 = g_nCumulativeCycles; + fprintf(g_fhSpkr, "%d\n", nCycleDiff); +#endif + UpdateSpkr(); short speakerDriveLevel = SPKR_DATA_INIT;