From 74a664840f7ad54e64fb262100d6f524a33682a0 Mon Sep 17 00:00:00 2001 From: tomcw Date: Sat, 20 Aug 2022 12:54:14 +0100 Subject: [PATCH] WOZ: Fix for 'Balance of Power' (#1022) --- source/Disk.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/Disk.cpp b/source/Disk.cpp index 6adc246f..1c8e53b1 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -326,8 +326,9 @@ void Disk2InterfaceCard::ReadTrack(const int drive, ULONG uExecutedCycles) } pFloppy->m_byte = (currentPosition * pFloppy->m_nibbles) / currentTrackLength; // Ref: WOZ-1.01 + pFloppy->m_byte += 1; // Round-up for sensitive cross-track sync check (GH#1022) - if (pFloppy->m_byte == (pFloppy->m_nibbles-1)) // Last nibble may not be complete, so advance by 1 nibble + if (pFloppy->m_byte >= (pFloppy->m_nibbles-1)) // Last nibble may not be complete, so advance by 1 nibble pFloppy->m_byte = 0; pFloppy->m_bitOffset = pFloppy->m_byte*8; @@ -1239,7 +1240,11 @@ void __stdcall Disk2InterfaceCard::DataLatchReadWriteWOZ(WORD pc, WORD addr, BYT FloppyDisk& floppy = drive.m_disk; if (!floppy.m_trackimagedata && floppy.m_imagehandle) + { ReadTrack(m_currDrive, uExecutedCycles); + // NB. ReadTrack() has called GetBitCellDelta(), so the subsequent call to GetBitCellDelta() below just returns bitCellDelta==0 + // So could just return at this point. + } if (!floppy.m_trackimagedata) {