diff --git a/stella/src/emucore/TIA.cxx b/stella/src/emucore/TIA.cxx index 866701425..1c9263003 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.49 2005-07-16 16:09:37 urchlay Exp $ +// $Id: TIA.cxx,v 1.50 2005-07-16 18:25:53 urchlay Exp $ //============================================================================ #include @@ -490,7 +490,7 @@ bool TIA::load(Deserializer& in) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TIA::update(int cpuCycles) +void TIA::update() { if(!myPartialFrameFlag) { // This stuff should only happen at the beginning of a new frame. @@ -544,8 +544,7 @@ void TIA::update(int cpuCycles) myPartialFrameFlag = true; // Execute instructions until frame is finished, or a breakpoint/trap hits - mySystem->m6502().execute(cpuCycles); - cerr << "myPartialFrameFlag==" << myPartialFrameFlag << endl; + mySystem->m6502().execute(25000); // TODO: have code here that handles errors.... @@ -562,19 +561,23 @@ void TIA::update(int cpuCycles) } } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TIA::update() -{ - update(25000); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::updateScanline() { // FIXME - extend this method to draw partial scanlines // 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; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/TIA.hxx b/stella/src/emucore/TIA.hxx index 436d76e23..d27985682 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.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 @@ -42,7 +42,7 @@ class Settings; be displayed on screen. @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 { @@ -129,11 +129,6 @@ class TIA : public Device , public MediaSource */ 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 a new scanline.