Dump nibbles from current position bitstream wraps to same position NB. Need to define LOG_DISK_NIBBLES_READ so that GetReadD5AAxxDetectedString() works.
| 1682 | // Dump nibbles from current position bitstream wraps to same position |
| 1683 | // NB. Need to define LOG_DISK_NIBBLES_READ so that GetReadD5AAxxDetectedString() works. |
| 1684 | void Disk2InterfaceCard::DumpTrackWOZ(FloppyDisk floppy) // pass a copy of m_floppy |
| 1685 | { |
| 1686 | FormatTrack formatTrack(true); |
| 1687 | |
| 1688 | BYTE shiftReg = 0; |
| 1689 | UINT zeroCount = 0; |
| 1690 | UINT nibbleCount = 0; |
| 1691 | |
| 1692 | const UINT startBitOffset = 0; // NB. may need to tweak this offset, since the bitstream is a circular buffer |
| 1693 | floppy.m_bitOffset = startBitOffset; |
| 1694 | UpdateBitStreamOffsets(floppy); |
| 1695 | |
| 1696 | int nibbleStartBitOffset = -1; |
| 1697 | |
| 1698 | bool newLine = true; |
| 1699 | bool doneLastBit = false; |
| 1700 | |
| 1701 | while (1) |
| 1702 | { |
| 1703 | if (newLine && nibbleStartBitOffset >= 0) |
| 1704 | { |
| 1705 | newLine = false; |
| 1706 | LogOutput("%04X:", nibbleStartBitOffset); |
| 1707 | nibbleStartBitOffset = -1; |
| 1708 | } |
| 1709 | |
| 1710 | BYTE n = floppy.m_trackimage[floppy.m_byte]; |
| 1711 | BYTE outputBit = (n & floppy.m_bitMask) ? 1 : 0; |
| 1712 | |
| 1713 | IncBitStream(floppy); |
| 1714 | |
| 1715 | if (startBitOffset == floppy.m_bitOffset) // done complete track? |
| 1716 | doneLastBit = true; |
| 1717 | else if (doneLastBit) |
| 1718 | break; |
| 1719 | |
| 1720 | if (shiftReg & 0x80) |
| 1721 | { |
| 1722 | if (outputBit == 0) // zero, so LSS holds nibble in latch |
| 1723 | { |
| 1724 | zeroCount++; |
| 1725 | continue; |
| 1726 | } |
| 1727 | |
| 1728 | // else: start of next nibble |
| 1729 | |
| 1730 | nibbleCount++; |
| 1731 | |
| 1732 | char syncBits = zeroCount <= 9 ? '0' + zeroCount : '+'; |
| 1733 | if (zeroCount == 0) LogOutput("%02X ", shiftReg); |
| 1734 | else LogOutput("%02X(%c)", shiftReg, syncBits); |
| 1735 | |
| 1736 | formatTrack.DecodeLatchNibbleRead(shiftReg); |
| 1737 | |
| 1738 | if ((nibbleCount % 32) == 0) |
| 1739 | { |
| 1740 | std::string strReadDetected = formatTrack.GetReadD5AAxxDetectedString(); |
| 1741 | if (!strReadDetected.empty()) |
nothing calls this directly
no test coverage detected