mirror of https://github.com/stella-emu/stella.git
First partial commit of the new TIA code. This ones fixes collision
detection being done outside the displayable area. Originally, areas above 'YStart' scanline were not processed as all, as an optimization. However, several ROMs can do collision detection above ystart, so we now process the entire frame (but only display the stuff below ystart). Bumped version number. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1839 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
c7ab0992db
commit
6b4cc11b03
|
@ -19,7 +19,7 @@
|
||||||
#ifndef VERSION_HXX
|
#ifndef VERSION_HXX
|
||||||
#define VERSION_HXX
|
#define VERSION_HXX
|
||||||
|
|
||||||
#define STELLA_BASE_VERSION "2.8.5_svn"
|
#define STELLA_BASE_VERSION "3.0_svn"
|
||||||
|
|
||||||
#ifdef NIGHTLY_BUILD
|
#ifdef NIGHTLY_BUILD
|
||||||
#define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD
|
#define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD
|
||||||
|
|
|
@ -56,8 +56,8 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
|
||||||
myFrameCounter(0)
|
myFrameCounter(0)
|
||||||
{
|
{
|
||||||
// Allocate buffers for two frame buffers
|
// Allocate buffers for two frame buffers
|
||||||
myCurrentFrameBuffer = new uInt8[160 * 300];
|
myCurrentFrameBuffer = new uInt8[160 * 320];
|
||||||
myPreviousFrameBuffer = new uInt8[160 * 300];
|
myPreviousFrameBuffer = new uInt8[160 * 320];
|
||||||
|
|
||||||
// Make sure all TIA bits are enabled
|
// Make sure all TIA bits are enabled
|
||||||
enableBits(true);
|
enableBits(true);
|
||||||
|
@ -206,9 +206,13 @@ void TIA::frameReset()
|
||||||
if(myFrameHeight < 210) myFrameHeight = 210;
|
if(myFrameHeight < 210) myFrameHeight = 210;
|
||||||
if(myFrameHeight > 256) myFrameHeight = 256;
|
if(myFrameHeight > 256) myFrameHeight = 256;
|
||||||
|
|
||||||
// Calculate color clock offsets for starting and stoping frame drawing
|
myFramePointerOffset = 160 * myFrameYStart;
|
||||||
myStartDisplayOffset = 228 * myFrameYStart;
|
|
||||||
myStopDisplayOffset = myStartDisplayOffset + 228 * myFrameHeight;
|
// Calculate color clock offsets for starting and stopping frame drawing
|
||||||
|
// Note that although we always start drawing at scanline zero, the
|
||||||
|
// framebuffer that is exposed outside the class actually starts at 'ystart'
|
||||||
|
myStartDisplayOffset = 0;
|
||||||
|
myStopDisplayOffset = 228 * (myFrameYStart + myFrameHeight);
|
||||||
|
|
||||||
// Reasonable values to start and stop the current frame drawing
|
// Reasonable values to start and stop the current frame drawing
|
||||||
myClockWhenFrameStarted = mySystem->cycles() * 3;
|
myClockWhenFrameStarted = mySystem->cycles() * 3;
|
||||||
|
@ -217,8 +221,6 @@ void TIA::frameReset()
|
||||||
myClockAtLastUpdate = myClockWhenFrameStarted;
|
myClockAtLastUpdate = myClockWhenFrameStarted;
|
||||||
myClocksToEndOfScanLine = 228;
|
myClocksToEndOfScanLine = 228;
|
||||||
myVSYNCFinishClock = 0x7FFFFFFF;
|
myVSYNCFinishClock = 0x7FFFFFFF;
|
||||||
myScanlineCountForLastFrame = 0;
|
|
||||||
myCurrentScanline = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1424,8 +1426,8 @@ void TIA::greyOutFrame()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void TIA::clearBuffers()
|
void TIA::clearBuffers()
|
||||||
{
|
{
|
||||||
memset(myCurrentFrameBuffer, 0, 160 * 300);
|
memset(myCurrentFrameBuffer, 0, 160 * 320);
|
||||||
memset(myPreviousFrameBuffer, 0, 160 * 300);
|
memset(myPreviousFrameBuffer, 0, 160 * 320);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -147,14 +147,16 @@ class TIA : public Device
|
||||||
|
|
||||||
@return Pointer to the current frame buffer
|
@return Pointer to the current frame buffer
|
||||||
*/
|
*/
|
||||||
uInt8* currentFrameBuffer() const { return myCurrentFrameBuffer; }
|
uInt8* currentFrameBuffer() const
|
||||||
|
{ return myCurrentFrameBuffer + myFramePointerOffset; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Answers the previous frame buffer
|
Answers the previous frame buffer
|
||||||
|
|
||||||
@return Pointer to the previous frame buffer
|
@return Pointer to the previous frame buffer
|
||||||
*/
|
*/
|
||||||
uInt8* previousFrameBuffer() const { return myPreviousFrameBuffer; }
|
uInt8* previousFrameBuffer() const
|
||||||
|
{ return myPreviousFrameBuffer + myFramePointerOffset; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Answers the width and height of the frame buffer
|
Answers the width and height of the frame buffer
|
||||||
|
@ -283,6 +285,10 @@ class TIA : public Device
|
||||||
// Pointer to the next pixel that will be drawn in the current frame buffer
|
// Pointer to the next pixel that will be drawn in the current frame buffer
|
||||||
uInt8* myFramePointer;
|
uInt8* myFramePointer;
|
||||||
|
|
||||||
|
// Indicates offset used by the exported frame buffer
|
||||||
|
// (the exported frame buffer is a vertical 'sliding window' of the actual buffer)
|
||||||
|
uInt32 myFramePointerOffset;
|
||||||
|
|
||||||
// Indicates the width of the visible scanline
|
// Indicates the width of the visible scanline
|
||||||
uInt32 myFrameWidth;
|
uInt32 myFrameWidth;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue