C64: Perform sync check before shifting.

This commit is contained in:
Anthony Konzel 2016-03-03 00:13:55 -06:00
parent 64ded912df
commit cff1708be6
1 changed files with 9 additions and 9 deletions

View File

@ -101,16 +101,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial
_diskSupplementaryCounter++;
if ((_diskSupplementaryCounter & 0x3) == 0x2)
{
_byteReady = false;
_bitsRemainingInLatchedByte--;
if (_bitsRemainingInLatchedByte <= 0)
{
_bitsRemainingInLatchedByte = 8;
// SOE (sync output enabled)
_byteReady = Via1.Ca2;
}
_byteReady = false;
_bitHistory = (_bitHistory << 1) | ((_diskSupplementaryCounter & 0xC) == 0x0 ? 1 : 0);
_sync = false;
if (Via1.Cb2 && (_bitHistory & 0x3FF) == 0x3FF)
@ -120,6 +112,14 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial
_byteReady = false;
}
if (_bitsRemainingInLatchedByte <= 0)
{
_bitsRemainingInLatchedByte = 8;
// SOE (sync output enabled)
_byteReady = Via1.Ca2;
}
// negative transition activates SO pin on CPU
_previousCa1 = Via1.Ca1;
Via1.Ca1 = !_byteReady;