diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Via.Registers.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Via.Registers.cs index 8e354c89e3..1215121257 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Via.Registers.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Via.Registers.cs @@ -58,7 +58,7 @@ case 0x0: return _port.ReadPrb(_prb, _ddrb); case 0x1: - return _port.ReadPra(_pra, _ddra); + return _port.ReadExternalPra(); case 0x2: return _ddrb; case 0x3: @@ -86,7 +86,7 @@ case 0xE: return _ier | 0x80; case 0xF: - return _port.ReadPra(_pra, _ddra); + return _port.ReadExternalPra(); } return 0xFF; @@ -238,7 +238,7 @@ public int EffectivePrB => _prb | ~_ddrb; - public int ActualPrA => _acrPaLatchEnable ? _paLatch : _port.ReadPra(_pra, _ddra); + public int ActualPrA => _acrPaLatchEnable ? _paLatch : _port.ReadExternalPra(); public int ActualPrB => _acrPbLatchEnable ? _pbLatch : _port.ReadPrb(_prb, _ddrb); } diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/Media/D64.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/Media/D64.cs index 082fc32b0a..f086bb3b21 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/Media/D64.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/Media/D64.cs @@ -248,9 +248,9 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media trackDensities.Add(DensityTable[i]); } } - - return new Disk(trackDatas, trackNumbers, trackDensities, 84); - } + + return new Disk(trackDatas, trackNumbers, trackDensities, 84) {WriteProtected = false}; + } } } } diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/Media/G64.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/Media/G64.cs index bceb344add..74f3fd2045 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/Media/G64.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/Media/G64.cs @@ -57,10 +57,10 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media throw new Exception("Byte-level speeds are not yet supported in the G64 loader."); } - return new Disk(trackDatas, trackNumbers, trackDensities, 84); + return new Disk(trackDatas, trackNumbers, trackDensities, 84) {WriteProtected = true}; } - return new Disk(84); + return new Disk(84) {WriteProtected = false}; } } diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/Drive1541.FluxTransitions.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/Drive1541.FluxTransitions.cs index 2cdd555caf..0f9a3782c5 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/Drive1541.FluxTransitions.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/Drive1541.FluxTransitions.cs @@ -72,7 +72,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial } _diskOutputBits >>= 1; - if (_diskWriteEnabled) + if (_diskWriteEnabled && !_diskWriteProtected) _countsBeforeRandomTransition = 0; if ((_diskBits & 1) != 0) diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/Drive1541.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/Drive1541.cs index afe069f236..50fb387ecb 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/Drive1541.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/Drive1541.cs @@ -214,6 +214,11 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial { _trackImageData = _disk.GetDataForTrack(_trackNumber); _diskBits = _trackImageData[_diskByteOffset] >> (Disk.FluxBitsPerEntry - _diskBitsLeft); + _diskWriteProtected = _disk.WriteProtected; + } + else + { + _diskWriteProtected = true; } }