From 42122c3465a0d3c6b97e1d1b59e08942ec5c58e2 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 14 Jan 2017 21:39:45 -0330 Subject: [PATCH] First pass to get debugger stuff working for TIA display. --- src/emucore/tia/TIA.cxx | 81 ++++++++++++++--------------------------- src/emucore/tia/TIA.hxx | 2 - 2 files changed, 28 insertions(+), 55 deletions(-) diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index bef23fcc7..3a3641159 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -665,10 +665,9 @@ void TIA::enableColorLoss(bool enabled) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// TODO: stub uInt32 TIA::clocksThisLine() const { - return 0; + return myHctr + myXDelta; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -684,10 +683,30 @@ bool TIA::partialFrame() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// TODO: stub bool TIA::scanlinePos(uInt16& x, uInt16& y) const { - return false; + if(partialFrame()) + { + // We only care about the scanline position when it's in the viewable area + if(1)//myFramePointerClocks >= myFramePointerOffset) + { + x = clocksThisLine();//(myFramePointerClocks - myFramePointerOffset) % 160; + y = scanlines();//(myFramePointerClocks - myFramePointerOffset) / 160; + return true; + } + else + { + x = 0; + y = 0; + return false; + } + } + else + { + x = width(); + y = height(); + return false; + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -822,77 +841,33 @@ void TIA::setJitterRecoveryFactor(Int32 f) { } -#ifdef DEBUGGER_SUPPORT // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::updateScanline() { -#if 0 // FIXME - // Start a new frame if the old one was finished - if(!myPartialFrameFlag) - startFrame(); - - myPartialFrameFlag = true; // true either way - +#if 0 int totalClocks = (mySystem->cycles() * 3) - myClockWhenFrameStarted; int endClock = ((totalClocks + 228) / 228) * 228; - int clock; do { - mySystem->m6502().execute(1); - clock = mySystem->cycles() * 3; - updateFrame(clock); - } while(clock < endClock); - - // if we finished the frame, get ready for the next one - if(!myPartialFrameFlag) - endFrame(); + updateScanlineByStep(); + } while((mySystem->cycles() * 3) < endClock); #endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::updateScanlineByStep() { -#if 0 // FIXME - // Start a new frame if the old one was finished - if(!myPartialFrameFlag) - startFrame(); - - // true either way: - myPartialFrameFlag = true; - // Update frame by one CPU instruction/color clock mySystem->m6502().execute(1); - updateFrame(mySystem->cycles() * 3); - - // if we finished the frame, get ready for the next one - if(!myPartialFrameFlag) - endFrame(); -#endif + updateEmulation(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::updateScanlineByTrace(int target) { -#if 0 // FIXME - // Start a new frame if the old one was finished - if(!myPartialFrameFlag) - startFrame(); - - // true either way: - myPartialFrameFlag = true; - while(mySystem->m6502().getPC() != target) - { - mySystem->m6502().execute(1); - updateFrame(mySystem->cycles() * 3); - } - - // if we finished the frame, get ready for the next one - if(!myPartialFrameFlag) - endFrame(); -#endif + updateScanlineByStep(); } -#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::updateEmulation() diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index 270b008cc..f2783a50d 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -285,7 +285,6 @@ class TIA : public Device // Clear both internal TIA buffers to black (palette color 0) void clearBuffers(); - #ifdef DEBUGGER_SUPPORT /** This method should be called to update the TIA with a new scanline. */ @@ -302,7 +301,6 @@ class TIA : public Device scanline by tracing to target address. */ void updateScanlineByTrace(int target); - #endif /** Save the current state of this device to the given Serializer.