Per-scanline update *almost* works correctly! Actually it's working,

except it lets you keep advancing past the end of the frame.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@659 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-07-16 18:25:54 +00:00
parent 55d57ed1ea
commit 3a49da3b6c
2 changed files with 16 additions and 18 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: TIA.cxx,v 1.49 2005-07-16 16:09:37 urchlay Exp $ // $Id: TIA.cxx,v 1.50 2005-07-16 18:25:53 urchlay Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -490,7 +490,7 @@ bool TIA::load(Deserializer& in)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::update(int cpuCycles) void TIA::update()
{ {
if(!myPartialFrameFlag) { if(!myPartialFrameFlag) {
// This stuff should only happen at the beginning of a new frame. // This stuff should only happen at the beginning of a new frame.
@ -544,8 +544,7 @@ void TIA::update(int cpuCycles)
myPartialFrameFlag = true; myPartialFrameFlag = true;
// Execute instructions until frame is finished, or a breakpoint/trap hits // Execute instructions until frame is finished, or a breakpoint/trap hits
mySystem->m6502().execute(cpuCycles); mySystem->m6502().execute(25000);
cerr << "myPartialFrameFlag==" << myPartialFrameFlag << endl;
// TODO: have code here that handles errors.... // TODO: have code here that handles errors....
@ -562,19 +561,23 @@ void TIA::update(int cpuCycles)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::update()
{
update(25000);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::updateScanline() void TIA::updateScanline()
{ {
// FIXME - extend this method to draw partial scanlines // FIXME - extend this method to draw partial scanlines
// ie, when step/trace is called from the debugger // ie, when step/trace is called from the debugger
update(76); int totalClocks = (mySystem->cycles() * 3) - myClockWhenFrameStarted;
int endClock = ((totalClocks + 228) / 228) * 228;
int clock;
do {
mySystem->m6502().execute(1);
clock = mySystem->cycles() * 3;
} while(clock < endClock);
totalClocks = (mySystem->cycles() * 3) - myClockWhenFrameStarted;
myCurrentScanline = totalClocks / 228;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.27 2005-07-16 16:09:37 urchlay Exp $ // $Id: TIA.hxx,v 1.28 2005-07-16 18:25:54 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.27 2005-07-16 16:09:37 urchlay Exp $ @version $Id: TIA.hxx,v 1.28 2005-07-16 18:25:54 urchlay Exp $
*/ */
class TIA : public Device , public MediaSource class TIA : public Device , public MediaSource
{ {
@ -129,11 +129,6 @@ class TIA : public Device , public MediaSource
*/ */
virtual void update(); virtual void update();
/* The backend update method. Currently pointless to make this public, as
we don't support partial scanline updates, but give it time :)
*/
void update(int cpuCycles);
/** /**
This method should be called to update the media source with This method should be called to update the media source with
a new scanline. a new scanline.