diff --git a/source/Disk.cpp b/source/Disk.cpp index c676b5ad..454d37e6 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -1365,19 +1365,18 @@ void Disk2InterfaceCard::DumpSectorWOZ(FloppyDisk floppy) // pass a copy of m_fl // Dump nibbles from current position bitstream wraps to same position void Disk2InterfaceCard::DumpTrackWOZ(FloppyDisk floppy) // pass a copy of m_floppy { -#ifdef LOG_DISK_NIBBLES_READ - FormatTrack formatTrack; -#endif + FormatTrack formatTrack(true); BYTE shiftReg = 0; UINT zeroCount = 0; UINT nibbleCount = 0; - floppy.m_bitMask = 1 << 7; - floppy.m_bitOffset = 0; - floppy.m_byte = 0; + const UINT startBitOffset = 0; + floppy.m_bitOffset = startBitOffset; - const UINT startBitOffset = floppy.m_bitOffset; + floppy.m_byte = floppy.m_bitOffset / 8; + const UINT remainder = 7 - (floppy.m_bitOffset & 7); + floppy.m_bitMask = 1 << remainder; bool newLine = true; @@ -1430,19 +1429,36 @@ void Disk2InterfaceCard::DumpTrackWOZ(FloppyDisk floppy) // pass a copy of m_flo if (zeroCount == 0) StringCbPrintf(str, sizeof(str), " %02X", shiftReg); else StringCbPrintf(str, sizeof(str), "(%c)%02X", syncBits, shiftReg); OutputDebugString(str); + + formatTrack.DecodeLatchNibbleRead(shiftReg); + if ((nibbleCount % 32) == 0) { + std::string strReadDetected = formatTrack.GetReadD5AAxxDetectedString(); + if (!strReadDetected.empty()) + { + OutputDebugString("\t; "); + OutputDebugString(strReadDetected.c_str()); + } OutputDebugString("\n"); newLine = true; } -#ifdef LOG_DISK_NIBBLES_READ - formatTrack.DecodeLatchNibbleRead(shiftReg); -#endif - shiftReg = 0; zeroCount = 0; } + + // Output any remaining "read D5AAxx detected" + if (nibbleCount % 32) + { + std::string strReadDetected = formatTrack.GetReadD5AAxxDetectedString(); + if (!strReadDetected.empty()) + { + OutputDebugString("\t; "); + OutputDebugString(strReadDetected.c_str()); + } + OutputDebugString("\n"); + } } #endif diff --git a/source/DiskFormatTrack.cpp b/source/DiskFormatTrack.cpp index 229fedee..14f8c6d3 100644 --- a/source/DiskFormatTrack.cpp +++ b/source/DiskFormatTrack.cpp @@ -268,7 +268,11 @@ void FormatTrack::DecodeLatchNibble(BYTE floppylatch, bool bIsWrite, bool bIsSyn if (!bIsWrite) { BYTE addrPrologue = m_bAddressPrologueIsDOS3_2 ? (BYTE)kADDR_PROLOGUE_DOS3_2 : (BYTE)kADDR_PROLOGUE_DOS3_3; - LOG_DISK("read D5AA%02X detected - Vol:%02X Trk:%02X Sec:%02X Chk:%02X %s\r\n", addrPrologue, m_VolTrkSecChk[0], m_VolTrkSecChk[1], m_VolTrkSecChk[2], m_VolTrkSecChk[3], chk?"":"(bad)"); + char str[100]; + sprintf_s(str, sizeof(str), "read D5AA%02X detected - Vol:%02X Trk:%02X Sec:%02X Chk:%02X %s", addrPrologue, m_VolTrkSecChk[0], m_VolTrkSecChk[1], m_VolTrkSecChk[2], m_VolTrkSecChk[3], chk?"":"(bad)"); + m_strReadD5AAxxDetected = str; + if (!m_bSuppressReadD5AAxxDetected) + LOG_DISK("%s\r\n", str); } #endif #if LOG_DISK_NIBBLES_WRITE diff --git a/source/DiskFormatTrack.h b/source/DiskFormatTrack.h index b0a9100e..00692a15 100644 --- a/source/DiskFormatTrack.h +++ b/source/DiskFormatTrack.h @@ -26,8 +26,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA class FormatTrack // Monitor for formatting of track { public: - FormatTrack(void) + FormatTrack(bool bSuppressOutput=false) { + m_bSuppressReadD5AAxxDetected = bSuppressOutput; Reset(); }; @@ -39,6 +40,7 @@ public: void DriveSwitchedToWriteMode(UINT uTrackIndex); void DecodeLatchNibbleRead(BYTE floppylatch); void DecodeLatchNibbleWrite(BYTE floppylatch, UINT uSpinNibbleCount, const class FloppyDisk* const pFloppy, bool bIsSyncFF); + std::string GetReadD5AAxxDetectedString(void) { std::string tmp = m_strReadD5AAxxDetected; m_strReadD5AAxxDetected = ""; return tmp; } void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper); void LoadSnapshot(class YamlLoadHelper& yamlLoadHelper); @@ -60,6 +62,9 @@ private: BYTE m_VolTrkSecChk4and4[8]; UINT m_4and4idx; + std::string m_strReadD5AAxxDetected; + bool m_bSuppressReadD5AAxxDetected; + #if LOG_DISK_NIBBLES_WRITE_TRACK_GAPS UINT m_DbgGap1Size; UINT m_DbgGap2Size;