diff --git a/src/emucore/Control.cxx b/src/emucore/Control.cxx index f9400fa3f..93f622933 100644 --- a/src/emucore/Control.cxx +++ b/src/emucore/Control.cxx @@ -99,8 +99,7 @@ uInt8 Controller::read() if(read(Two)) ioport |= 0x02; if(read(Three)) ioport |= 0x04; if(read(Four)) ioport |= 0x08; - - return myJack == Left ? (ioport << 4) : ioport; + return ioport; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Control.hxx b/src/emucore/Control.hxx index 3acd99cbe..2ae9feaa9 100644 --- a/src/emucore/Control.hxx +++ b/src/emucore/Control.hxx @@ -123,12 +123,7 @@ class Controller : public Serializable /** Read the entire state of all digital pins for this controller. - - Note that this method must take into account the location of the - pin data in the bitfield, and zero the remaining data: - - Left port : upper 4 bits valid, lower 4 bits zero'ed - Right port: lower 4 bits valid, upper 4 bits zero'ed + Note that this method must use the lower 4 bits, and zero the upper bits. @return The state of all digital pins */ diff --git a/src/emucore/M6532.cxx b/src/emucore/M6532.cxx index 6756aa287..7f16c1908 100644 --- a/src/emucore/M6532.cxx +++ b/src/emucore/M6532.cxx @@ -119,8 +119,8 @@ uInt8 M6532::peek(uInt16 addr) { case 0x00: // SWCHA - Port A I/O Register (Joystick) { - uInt8 value = myConsole.controller(Controller::Left).read() | - myConsole.controller(Controller::Right).read(); + uInt8 value = (myConsole.controller(Controller::Left).read() << 4)| + myConsole.controller(Controller::Right).read(); // Each pin is high (1) by default and will only go low (0) if either // (a) External device drives the pin low diff --git a/src/emucore/TrackBall.cxx b/src/emucore/TrackBall.cxx index 8d7a5021b..b5deda560 100644 --- a/src/emucore/TrackBall.cxx +++ b/src/emucore/TrackBall.cxx @@ -109,7 +109,7 @@ uInt8 TrackBall::read() myDigitalPinState[Three] = IOPortA & 0x40; myDigitalPinState[Four] = IOPortA & 0x80; - return myJack == Left ? IOPortA : (IOPortA >> 4); + return (IOPortA >> 4); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -131,9 +131,8 @@ void TrackBall::update() if(myTrakBallLinesV == 0) myTrakBallLinesV = 1; // Get mouse button state - myDigitalPinState[Six] = - (myEvent.get(Event::MouseButtonLeftValue) == 0) || - (myEvent.get(Event::MouseButtonRightValue) == 0); + myDigitalPinState[Six] = (myEvent.get(Event::MouseButtonLeftValue) == 0) && + (myEvent.get(Event::MouseButtonRightValue) == 0); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/TrackBall.hxx b/src/emucore/TrackBall.hxx index cc005360f..a74fc00d7 100644 --- a/src/emucore/TrackBall.hxx +++ b/src/emucore/TrackBall.hxx @@ -59,15 +59,7 @@ class TrackBall : public Controller public: /** Read the entire state of all digital pins for this controller. - - Note that this method must take into account the location of the - pin data in the bitfield, and zero the remaining data: - - Left port : upper 4 bits valid, lower 4 bits zero'ed - Right port: lower 4 bits valid, upper 4 bits zero'ed - - This method completely takes over reading of the port; - it doesn't call Controller::read() at all. + Note that this method must use the lower 4 bits, and zero the upper bits. @return The state of all digital pins */