diff --git a/src/emucore/FBSurface.cxx b/src/emucore/FBSurface.cxx index 7b1f18c95..a837d1c24 100644 --- a/src/emucore/FBSurface.cxx +++ b/src/emucore/FBSurface.cxx @@ -85,8 +85,8 @@ void FBSurface::line(uInt32 x, uInt32 y, uInt32 x2, uInt32 y2, ColorId color) // x is major axis if(dx < 0) { - uInt32 tx = x; x = x2; x2 = tx; - uInt32 ty = y; y = y2; y2 = ty; + std::swap(x, x2); + y = y2; dx = -dx; dy = -dy; } @@ -110,8 +110,8 @@ void FBSurface::line(uInt32 x, uInt32 y, uInt32 x2, uInt32 y2, ColorId color) // y is major axis if(dy < 0) { - uInt32 tx = x; x = x2; x2 = tx; - uInt32 ty = y; y = y2; y2 = ty; + x = x2; + std::swap(y, y2); dx = -dx; dy = -dy; } diff --git a/src/emucore/Thumbulator.cxx b/src/emucore/Thumbulator.cxx index 100d49518..f608c0948 100644 --- a/src/emucore/Thumbulator.cxx +++ b/src/emucore/Thumbulator.cxx @@ -2420,7 +2420,7 @@ int Thumbulator::execute() rb = inst & 0xFF; DO_DISS(statusMsg << "swi 0x" << Base::HEX2 << rb << endl); - if((inst & 0xFF) == 0xCC) + if(rb == 0xCC) { write_register(0, cpsr); return 0; diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 35890ec60..698ae2bc0 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -88,7 +88,7 @@ TIA::TIA(ConsoleIO& console, ConsoleTimingProvider timingProvider, Settings& set myMissile1.setTIA(this); myBall.setTIA(this); - reset(); + initialize(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -128,7 +128,7 @@ void TIA::clearFrameManager() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TIA::reset() +void TIA::initialize() { myHctr = 0; myMovementInProgress = false; @@ -193,6 +193,14 @@ void TIA::reset() #endif // DEBUGGER_SUPPORT } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TIA::reset() +{ + // Simply call initialize(); mostly to get around calling a virtual method + // from the constructor + initialize(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::install(System& system) { diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index e80c2a926..74cde1f36 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -543,6 +543,11 @@ class TIA : public Device string myFixedColorNames[7]; private: + /** + * Called to initialize all instance variables to known state. + */ + void initialize(); + /** * This callback is invoked by FrameManager when a new frame starts. */