Fixed resetting of TIA when changing X/YStart and Width/Height. A full

TIA reset isn't required in this case, and isn't always correct.  Instead,
only the frame parameters should be reset.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1271 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2007-01-06 21:13:29 +00:00
parent 7c5e5af3f4
commit 227c357ece
3 changed files with 78 additions and 78 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: Console.cxx,v 1.120 2007-01-06 16:21:29 stephena Exp $ // $Id: Console.cxx,v 1.121 2007-01-06 21:13:29 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -483,7 +483,7 @@ void Console::changeXStart(int direction)
strval << xstart; strval << xstart;
myProperties.set(Display_XStart, strval.str()); myProperties.set(Display_XStart, strval.str());
((TIA*)myMediaSource)->recalc(); ((TIA*)myMediaSource)->frameReset();
myOSystem->frameBuffer().refresh(); myOSystem->frameBuffer().refresh();
message = "XStart "; message = "XStart ";
@ -521,7 +521,7 @@ void Console::changeYStart(int direction)
strval << ystart; strval << ystart;
myProperties.set(Display_YStart, strval.str()); myProperties.set(Display_YStart, strval.str());
((TIA*)myMediaSource)->recalc(); ((TIA*)myMediaSource)->frameReset();
myOSystem->frameBuffer().refresh(); myOSystem->frameBuffer().refresh();
message = "YStart "; message = "YStart ";
@ -565,7 +565,7 @@ void Console::changeWidth(int direction)
strval << width; strval << width;
myProperties.set(Display_Width, strval.str()); myProperties.set(Display_Width, strval.str());
((TIA*)myMediaSource)->recalc(); ((TIA*)myMediaSource)->frameReset();
initializeVideo(); // takes care of refreshing the screen initializeVideo(); // takes care of refreshing the screen
message = "Width "; message = "Width ";
@ -603,7 +603,7 @@ void Console::changeHeight(int direction)
strval << height; strval << height;
myProperties.set(Display_Height, strval.str()); myProperties.set(Display_Height, strval.str());
((TIA*)myMediaSource)->recalc(); ((TIA*)myMediaSource)->frameReset();
initializeVideo(); // takes care of refreshing the screen initializeVideo(); // takes care of refreshing the screen
message = "Height "; message = "Height ";

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.77 2007-01-06 16:21:31 stephena Exp $ // $Id: TIA.cxx,v 1.78 2007-01-06 21:13:29 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -131,60 +131,6 @@ void TIA::reset()
// Reset the sound device // Reset the sound device
mySound->reset(); mySound->reset();
// Recalculate the size of the display
recalc();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::systemCyclesReset()
{
// Get the current system cycle
uInt32 cycles = mySystem->cycles();
// Adjust the sound cycle indicator
mySound->adjustCycleCounter(-1 * cycles);
// Adjust the dump cycle
myDumpDisabledCycle -= cycles;
// Get the current color clock the system is using
uInt32 clocks = cycles * 3;
// Adjust the clocks by this amount since we're reseting the clock to zero
myClockWhenFrameStarted -= clocks;
myClockStartDisplay -= clocks;
myClockStopDisplay -= clocks;
myClockAtLastUpdate -= clocks;
myVSYNCFinishClock -= clocks;
myLastHMOVEClock -= clocks;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::recalc()
{
// Clear frame buffers
clearBuffers();
// Reset pixel pointer and drawing flag
myFramePointer = myCurrentFrameBuffer;
myYStart = atoi(myConsole.properties().get(Display_YStart).c_str());
myHeight = atoi(myConsole.properties().get(Display_Height).c_str());
// Calculate color clock offsets for starting and stoping frame drawing
myStartDisplayOffset = 228 * myYStart;
myStopDisplayOffset = myStartDisplayOffset + 228 * myHeight;
// Reasonable values to start and stop the current frame drawing
myClockWhenFrameStarted = mySystem->cycles() * 3;
myClockStartDisplay = myClockWhenFrameStarted + myStartDisplayOffset;
myClockStopDisplay = myClockWhenFrameStarted + myStopDisplayOffset;
myClockAtLastUpdate = myClockWhenFrameStarted;
myClocksToEndOfScanLine = 228;
myVSYNCFinishClock = 0x7FFFFFFF;
myScanlineCountForLastFrame = 0;
myCurrentScanline = 0;
// Currently no objects are enabled // Currently no objects are enabled
myEnabledObjects = 0; myEnabledObjects = 0;
@ -250,6 +196,47 @@ void TIA::recalc()
myAllowHMOVEBlanks = myAllowHMOVEBlanks =
(myConsole.properties().get(Emulation_HmoveBlanks) == "YES"); (myConsole.properties().get(Emulation_HmoveBlanks) == "YES");
if(myConsole.getFormat().compare(0, 3, "PAL") == 0)
{
myColorLossEnabled = true;
myMaximumNumberOfScanlines = 342;
}
else // NTSC
{
myColorLossEnabled = false;
myMaximumNumberOfScanlines = 290;
}
// Recalculate the size of the display
frameReset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::frameReset()
{
// Clear frame buffers
clearBuffers();
// Reset pixel pointer and drawing flag
myFramePointer = myCurrentFrameBuffer;
myYStart = atoi(myConsole.properties().get(Display_YStart).c_str());
myHeight = atoi(myConsole.properties().get(Display_Height).c_str());
// Calculate color clock offsets for starting and stoping frame drawing
myStartDisplayOffset = 228 * myYStart;
myStopDisplayOffset = myStartDisplayOffset + 228 * myHeight;
// Reasonable values to start and stop the current frame drawing
myClockWhenFrameStarted = mySystem->cycles() * 3;
myClockStartDisplay = myClockWhenFrameStarted + myStartDisplayOffset;
myClockStopDisplay = myClockWhenFrameStarted + myStopDisplayOffset;
myClockAtLastUpdate = myClockWhenFrameStarted;
myClocksToEndOfScanLine = 228;
myVSYNCFinishClock = 0x7FFFFFFF;
myScanlineCountForLastFrame = 0;
myCurrentScanline = 0;
myFrameXStart = atoi(myConsole.properties().get(Display_XStart).c_str()); myFrameXStart = atoi(myConsole.properties().get(Display_XStart).c_str());
myFrameWidth = atoi(myConsole.properties().get(Display_Width).c_str()); myFrameWidth = atoi(myConsole.properties().get(Display_Width).c_str());
myFrameYStart = atoi(myConsole.properties().get(Display_YStart).c_str()); myFrameYStart = atoi(myConsole.properties().get(Display_YStart).c_str());
@ -270,19 +257,32 @@ void TIA::recalc()
// Values are illegal so reset to default values // Values are illegal so reset to default values
myFrameHeight = 200; myFrameHeight = 200;
} }
if(myConsole.getFormat().compare(0, 3, "PAL") == 0)
{
myColorLossEnabled = true;
myMaximumNumberOfScanlines = 342;
}
else // NTSC
{
myColorLossEnabled = false;
myMaximumNumberOfScanlines = 290;
}
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::systemCyclesReset()
{
// Get the current system cycle
uInt32 cycles = mySystem->cycles();
// Adjust the sound cycle indicator
mySound->adjustCycleCounter(-1 * cycles);
// Adjust the dump cycle
myDumpDisabledCycle -= cycles;
// Get the current color clock the system is using
uInt32 clocks = cycles * 3;
// Adjust the clocks by this amount since we're reseting the clock to zero
myClockWhenFrameStarted -= clocks;
myClockStartDisplay -= clocks;
myClockStopDisplay -= clocks;
myClockAtLastUpdate -= clocks;
myVSYNCFinishClock -= clocks;
myLastHMOVEClock -= clocks;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::install(System& system) void TIA::install(System& system)
{ {

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.40 2007-01-06 16:21:31 stephena Exp $ // $Id: TIA.hxx,v 1.41 2007-01-06 21:13:29 stephena 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.40 2007-01-06 16:21:31 stephena Exp $ @version $Id: TIA.hxx,v 1.41 2007-01-06 21:13:29 stephena Exp $
*/ */
class TIA : public Device , public MediaSource class TIA : public Device , public MediaSource
{ {
@ -75,6 +75,11 @@ class TIA : public Device , public MediaSource
*/ */
virtual void reset(); virtual void reset();
/**
Reset frame to change XStart/YStart/Width/Height properties
*/
virtual void frameReset();
/** /**
Notification method invoked by the system right before the Notification method invoked by the system right before the
system resets its cycle counter to zero. It may be necessary system resets its cycle counter to zero. It may be necessary
@ -82,11 +87,6 @@ class TIA : public Device , public MediaSource
*/ */
virtual void systemCyclesReset(); virtual void systemCyclesReset();
/**
Recalculate set XStart/YStart/Width/Height properties
*/
virtual void recalc();
/** /**
Install TIA in the specified system. Invoked by the system Install TIA in the specified system. Invoked by the system
when the TIA is attached to it. when the TIA is attached to it.