mirror of https://github.com/stella-emu/stella.git
Fixed SWCHA read handler in the case where the ports are swapped.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2370 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
a56778d497
commit
7247029e70
|
@ -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;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue