diff --git a/source/Disk.cpp b/source/Disk.cpp index 1637d007..ae8411e9 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -1050,7 +1050,10 @@ void __stdcall Disk2InterfaceCard::ReadWrite(WORD pc, WORD addr, BYTE bWrite, BY ReadTrack(m_currDrive, uExecutedCycles); if (!pFloppy->m_trackimagedata) + { + pDrive->SetLastReadTrackSector(0); return UpdateLatchForEmptyDrive(pDrive); + } // Improve precision of "authentic" drive mode - GH#125 UINT uSpinNibbleCount = 0; diff --git a/source/Disk.h b/source/Disk.h index 67c44db6..ae1e6ae2 100644 --- a/source/Disk.h +++ b/source/Disk.h @@ -115,14 +115,25 @@ public: m_headWindow = 0; m_spinning = 0; m_writelight = 0; + m_LastReadTrackSector[0] = -1; + m_LastReadTrackSector[1] = -1; m_disk.clear(); } // NOTE: Managed by Disk2InterfaceCard::ReadWrite() void SetLastReadTrackSector(BYTE* pVolumeTrackSectorChecksum) { - m_LastReadTrackSector[0] = pVolumeTrackSectorChecksum[1]; - m_LastReadTrackSector[1] = pVolumeTrackSectorChecksum[2]; + if (pVolumeTrackSectorChecksum) + { + m_LastReadTrackSector[0] = pVolumeTrackSectorChecksum[1]; + m_LastReadTrackSector[1] = pVolumeTrackSectorChecksum[2]; + } + else + { + m_LastReadTrackSector[0] = -1; + m_LastReadTrackSector[1] = -1; + } + assert(m_LastReadTrackSector[0] <= 80); } public: