Disk logging: Improved info & formatting for DumpTrackWOZ()

This commit is contained in:
tomcw 2020-02-23 13:19:38 +00:00
parent 7268bc1421
commit b84bb97aa1
3 changed files with 38 additions and 13 deletions

View File

@ -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 // Dump nibbles from current position bitstream wraps to same position
void Disk2InterfaceCard::DumpTrackWOZ(FloppyDisk floppy) // pass a copy of m_floppy void Disk2InterfaceCard::DumpTrackWOZ(FloppyDisk floppy) // pass a copy of m_floppy
{ {
#ifdef LOG_DISK_NIBBLES_READ FormatTrack formatTrack(true);
FormatTrack formatTrack;
#endif
BYTE shiftReg = 0; BYTE shiftReg = 0;
UINT zeroCount = 0; UINT zeroCount = 0;
UINT nibbleCount = 0; UINT nibbleCount = 0;
floppy.m_bitMask = 1 << 7; const UINT startBitOffset = 0;
floppy.m_bitOffset = 0; floppy.m_bitOffset = startBitOffset;
floppy.m_byte = 0;
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; 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); if (zeroCount == 0) StringCbPrintf(str, sizeof(str), " %02X", shiftReg);
else StringCbPrintf(str, sizeof(str), "(%c)%02X", syncBits, shiftReg); else StringCbPrintf(str, sizeof(str), "(%c)%02X", syncBits, shiftReg);
OutputDebugString(str); OutputDebugString(str);
formatTrack.DecodeLatchNibbleRead(shiftReg);
if ((nibbleCount % 32) == 0) if ((nibbleCount % 32) == 0)
{ {
std::string strReadDetected = formatTrack.GetReadD5AAxxDetectedString();
if (!strReadDetected.empty())
{
OutputDebugString("\t; ");
OutputDebugString(strReadDetected.c_str());
}
OutputDebugString("\n"); OutputDebugString("\n");
newLine = true; newLine = true;
} }
#ifdef LOG_DISK_NIBBLES_READ
formatTrack.DecodeLatchNibbleRead(shiftReg);
#endif
shiftReg = 0; shiftReg = 0;
zeroCount = 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 #endif

View File

@ -268,7 +268,11 @@ void FormatTrack::DecodeLatchNibble(BYTE floppylatch, bool bIsWrite, bool bIsSyn
if (!bIsWrite) if (!bIsWrite)
{ {
BYTE addrPrologue = m_bAddressPrologueIsDOS3_2 ? (BYTE)kADDR_PROLOGUE_DOS3_2 : (BYTE)kADDR_PROLOGUE_DOS3_3; 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 #endif
#if LOG_DISK_NIBBLES_WRITE #if LOG_DISK_NIBBLES_WRITE

View File

@ -26,8 +26,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
class FormatTrack // Monitor for formatting of track class FormatTrack // Monitor for formatting of track
{ {
public: public:
FormatTrack(void) FormatTrack(bool bSuppressOutput=false)
{ {
m_bSuppressReadD5AAxxDetected = bSuppressOutput;
Reset(); Reset();
}; };
@ -39,6 +40,7 @@ public:
void DriveSwitchedToWriteMode(UINT uTrackIndex); void DriveSwitchedToWriteMode(UINT uTrackIndex);
void DecodeLatchNibbleRead(BYTE floppylatch); void DecodeLatchNibbleRead(BYTE floppylatch);
void DecodeLatchNibbleWrite(BYTE floppylatch, UINT uSpinNibbleCount, const class FloppyDisk* const pFloppy, bool bIsSyncFF); 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 SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
void LoadSnapshot(class YamlLoadHelper& yamlLoadHelper); void LoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
@ -60,6 +62,9 @@ private:
BYTE m_VolTrkSecChk4and4[8]; BYTE m_VolTrkSecChk4and4[8];
UINT m_4and4idx; UINT m_4and4idx;
std::string m_strReadD5AAxxDetected;
bool m_bSuppressReadD5AAxxDetected;
#if LOG_DISK_NIBBLES_WRITE_TRACK_GAPS #if LOG_DISK_NIBBLES_WRITE_TRACK_GAPS
UINT m_DbgGap1Size; UINT m_DbgGap1Size;
UINT m_DbgGap2Size; UINT m_DbgGap2Size;