From 8f81b563840e040da3890f306722c1c141065546 Mon Sep 17 00:00:00 2001 From: urchlay Date: Tue, 19 Jul 2005 02:24:13 +0000 Subject: [PATCH] Fixed "sticky breakif/trap syndrome" that caused the CPU to get stuck when we hit a trap or a breakif. This fix is kind of hackish, I've got to come up with a better way to do it. Improved behaviour of greying-out frame in updateScanline(). It's still not quite right. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@677 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/debugger/Debugger.cxx | 9 ++++----- stella/src/emucore/TIA.cxx | 16 ++++++++++------ stella/src/emucore/TIA.hxx | 11 +++++++---- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index 1938f8dd5..20812c4fb 100644 --- a/stella/src/debugger/Debugger.cxx +++ b/stella/src/debugger/Debugger.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Debugger.cxx,v 1.68 2005-07-18 02:03:40 urchlay Exp $ +// $Id: Debugger.cxx,v 1.69 2005-07-19 02:24:12 urchlay Exp $ //============================================================================ #include "bspf.hxx" @@ -777,11 +777,10 @@ void Debugger::setQuitState() // Bus must be unlocked for normal operation when leaving debugger mode mySystem->unlockDataBus(); - // execute one instruction on quit, IF we're - // sitting at a breakpoint. This will get us past it. + // execute one instruction on quit. If we're + // sitting at a breakpoint/trap, this will get us past it. // Somehow this feels like a hack to me, but I don't know why - // FIXME: do this for traps, too - if(breakPoints->isSet(myCpuDebug->pc())) + // if(breakPoints->isSet(myCpuDebug->pc())) mySystem->m6502().execute(1); } diff --git a/stella/src/emucore/TIA.cxx b/stella/src/emucore/TIA.cxx index 9eaea4636..c98876fd3 100644 --- a/stella/src/emucore/TIA.cxx +++ b/stella/src/emucore/TIA.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: TIA.cxx,v 1.54 2005-07-18 23:00:17 urchlay Exp $ +// $Id: TIA.cxx,v 1.55 2005-07-19 02:24:13 urchlay Exp $ //============================================================================ #include @@ -49,6 +49,8 @@ TIA::TIA(const Console& console, Settings& settings) myCurrentFrameBuffer = new uInt8[160 * 300]; myPreviousFrameBuffer = new uInt8[160 * 300]; + myFrameGreyed = false; + for(uInt32 i = 0; i < 6; ++i) myBitEnabled[i] = true; @@ -576,14 +578,16 @@ void TIA::updateScanline() // Start a new frame if the old one was finished if(!myPartialFrameFlag) { startFrame(); - // don't leave the old frame contents as a giant turd - clearToBottom(); + myFrameGreyed = false; } + // grey out old frame contents + if(!myFrameGreyed) greyOutFrame(); + myFrameGreyed = true; + // true either way: myPartialFrameFlag = true; - int totalClocks = (mySystem->cycles() * 3) - myClockWhenFrameStarted; int endClock = ((totalClocks + 228) / 228) * 228; @@ -1865,14 +1869,14 @@ inline void TIA::waitHorizontalSync() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TIA::clearToBottom() +void TIA::greyOutFrame() { /* for(int s = scanlines() + 1; s < 300; s++) for(int i = 0; i < 160; i++) myCurrentFrameBuffer[s * 160 + i] = 0; */ - for(int s = scanlines() + 1; s < 300; s++) + for(int s = scanlines(); s < 300; s++) for(int i = 0; i < 160; i++) { uInt8 tmp = myCurrentFrameBuffer[s * 160 + i] & 0x0f; tmp >>= 1; diff --git a/stella/src/emucore/TIA.hxx b/stella/src/emucore/TIA.hxx index cbefca0a2..c371127f9 100644 --- a/stella/src/emucore/TIA.hxx +++ b/stella/src/emucore/TIA.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: TIA.hxx,v 1.29 2005-07-16 22:35:23 urchlay Exp $ +// $Id: TIA.hxx,v 1.30 2005-07-19 02:24:13 urchlay Exp $ //============================================================================ #ifndef TIA_HXX @@ -42,7 +42,7 @@ class Settings; be displayed on screen. @author Bradford W. Mott - @version $Id: TIA.hxx,v 1.29 2005-07-16 22:35:23 urchlay Exp $ + @version $Id: TIA.hxx,v 1.30 2005-07-19 02:24:13 urchlay Exp $ */ class TIA : public Device , public MediaSource { @@ -245,8 +245,8 @@ class TIA : public Device , public MediaSource // Waste cycles until the current scanline is finished void waitHorizontalSync(); - // Clear current framebuffer from current scanline+1 to bottom - void clearToBottom(); + // Grey out current framebuffer from current scanline to bottom + void greyOutFrame(); // Clear both internal TIA buffers to black (palette color 0) void clearBuffers(); @@ -479,6 +479,9 @@ class TIA : public Device , public MediaSource // Answers whether specified bits (from TIABit) are enabled or disabled bool myBitEnabled[6]; + // Has current frame been "greyed out" (has updateScanline() been run?) + bool myFrameGreyed; + private: // Ball mask table (entries are true or false) static uInt8 ourBallMaskTable[4][4][320];