diff --git a/lib/mx/decoder.cc b/lib/mx/decoder.cc index 3fe5d7f2..1ba2a286 100644 --- a/lib/mx/decoder.cc +++ b/lib/mx/decoder.cc @@ -37,7 +37,7 @@ AbstractDecoder::RecordType MxDecoder::advanceToNextRecord() const FluxMatcher* matcher = nullptr; _sector->clock = _clock = _fmr->seekToPattern(ID_PATTERN, matcher); readRawBits(32); /* skip the ID mark */ - readRawBits(32); /* skip the track number */ + _logicalTrack = decodeFmMfm(readRawBits(32)).reader().read_be16(); } else if (_currentSector == 10) { @@ -67,7 +67,7 @@ void MxDecoder::decodeSectorRecord() gotChecksum += br.read_le16(); uint16_t wantChecksum = br.read_le16(); - _sector->logicalTrack = _track->physicalTrack; + _sector->logicalTrack = _logicalTrack; _sector->logicalSide = _track->physicalSide; _sector->logicalSector = _currentSector; _sector->data = bytes.slice(0, SECTOR_SIZE); diff --git a/lib/mx/mx.h b/lib/mx/mx.h index 8c5fc781..6b7a615f 100644 --- a/lib/mx/mx.h +++ b/lib/mx/mx.h @@ -15,6 +15,7 @@ public: private: nanoseconds_t _clock; int _currentSector; + int _logicalTrack; }; #endif