From 4ecb247c170569b7046e2b0c686d0b63d5317203 Mon Sep 17 00:00:00 2001 From: Asnivor Date: Fri, 16 Mar 2018 08:08:35 +0000 Subject: [PATCH] Fixed AY-3-8912 overflow bug --- .../Hardware/SoundOuput/AYChip.cs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/SoundOuput/AYChip.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/SoundOuput/AYChip.cs index 06817afe19..34515cd5eb 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/SoundOuput/AYChip.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/SoundOuput/AYChip.cs @@ -650,32 +650,32 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum _countE = 0; _eState += +_eDirection; - var mask = (1 << _registers[AY_E_SHAPE]); - if ((_eState & ~31) != 0) { + var mask = (1 << _registers[AY_E_SHAPE]); + if ((mask & ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) | (1 << 9) | (1 << 15))) != 0) { _eState = _eDirection = 0; } - } - else if ((mask & ((1 << 8) | (1 << 12))) != 0) - { - _eState &= 31; - } - else if ((mask & ((1 << 10) | (1 << 14))) != 0) - { - _eDirection = -_eDirection; - _eState += _eDirection; - } - else - { - // 11,13 - _eState = 31; - _eDirection = 0; - } + else if ((mask & ((1 << 8) | (1 << 12))) != 0) + { + _eState &= 31; + } + else if ((mask & ((1 << 10) | (1 << 14))) != 0) + { + _eDirection = -_eDirection; + _eState += _eDirection; + } + else + { + // 11,13 + _eState = 31; + _eDirection = 0; + } + } } }