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
This commit is contained in:
urchlay 2005-07-19 02:24:13 +00:00
parent b1ecc27806
commit 8f81b56384
3 changed files with 21 additions and 15 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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" #include "bspf.hxx"
@ -777,11 +777,10 @@ void Debugger::setQuitState()
// Bus must be unlocked for normal operation when leaving debugger mode // Bus must be unlocked for normal operation when leaving debugger mode
mySystem->unlockDataBus(); mySystem->unlockDataBus();
// execute one instruction on quit, IF we're // execute one instruction on quit. If we're
// sitting at a breakpoint. This will get us past it. // 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 // 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); mySystem->m6502().execute(1);
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -49,6 +49,8 @@ TIA::TIA(const Console& console, Settings& settings)
myCurrentFrameBuffer = new uInt8[160 * 300]; myCurrentFrameBuffer = new uInt8[160 * 300];
myPreviousFrameBuffer = new uInt8[160 * 300]; myPreviousFrameBuffer = new uInt8[160 * 300];
myFrameGreyed = false;
for(uInt32 i = 0; i < 6; ++i) for(uInt32 i = 0; i < 6; ++i)
myBitEnabled[i] = true; myBitEnabled[i] = true;
@ -576,14 +578,16 @@ void TIA::updateScanline()
// Start a new frame if the old one was finished // Start a new frame if the old one was finished
if(!myPartialFrameFlag) { if(!myPartialFrameFlag) {
startFrame(); startFrame();
// don't leave the old frame contents as a giant turd myFrameGreyed = false;
clearToBottom();
} }
// grey out old frame contents
if(!myFrameGreyed) greyOutFrame();
myFrameGreyed = true;
// true either way: // true either way:
myPartialFrameFlag = true; myPartialFrameFlag = true;
int totalClocks = (mySystem->cycles() * 3) - myClockWhenFrameStarted; int totalClocks = (mySystem->cycles() * 3) - myClockWhenFrameStarted;
int endClock = ((totalClocks + 228) / 228) * 228; 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 s = scanlines() + 1; s < 300; s++)
for(int i = 0; i < 160; i++) for(int i = 0; i < 160; i++)
myCurrentFrameBuffer[s * 160 + i] = 0; 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++) { for(int i = 0; i < 160; i++) {
uInt8 tmp = myCurrentFrameBuffer[s * 160 + i] & 0x0f; uInt8 tmp = myCurrentFrameBuffer[s * 160 + i] & 0x0f;
tmp >>= 1; tmp >>= 1;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef TIA_HXX
@ -42,7 +42,7 @@ class Settings;
be displayed on screen. be displayed on screen.
@author Bradford W. Mott @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 class TIA : public Device , public MediaSource
{ {
@ -245,8 +245,8 @@ class TIA : public Device , public MediaSource
// Waste cycles until the current scanline is finished // Waste cycles until the current scanline is finished
void waitHorizontalSync(); void waitHorizontalSync();
// Clear current framebuffer from current scanline+1 to bottom // Grey out current framebuffer from current scanline to bottom
void clearToBottom(); void greyOutFrame();
// Clear both internal TIA buffers to black (palette color 0) // Clear both internal TIA buffers to black (palette color 0)
void clearBuffers(); void clearBuffers();
@ -479,6 +479,9 @@ class TIA : public Device , public MediaSource
// Answers whether specified bits (from TIABit) are enabled or disabled // Answers whether specified bits (from TIABit) are enabled or disabled
bool myBitEnabled[6]; bool myBitEnabled[6];
// Has current frame been "greyed out" (has updateScanline() been run?)
bool myFrameGreyed;
private: private:
// Ball mask table (entries are true or false) // Ball mask table (entries are true or false)
static uInt8 ourBallMaskTable[4][4][320]; static uInt8 ourBallMaskTable[4][4][320];