Skip to content

Commit

Permalink
Improve some messaging. A data record is always pushed, even if it's …
Browse files Browse the repository at this point in the history
…empty (to

help debugging).
  • Loading branch information
davidgiven committed Jan 26, 2020
1 parent 0c48897 commit 6af80d1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 2 additions & 1 deletion arch/ibm/decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ AbstractDecoder::RecordType IbmDecoder::advanceToNextRecord()
if (_currentHeaderLength > 0)
readRawBits(_currentHeaderLength*16);
auto idbits = readRawBits(16);
uint8_t id = decodeFmMfm(idbits).slice(0, 1)[0];
const Bytes idbytes = decodeFmMfm(idbits);
uint8_t id = idbytes.slice(0, 1)[0];
seek(here);

switch (id)
Expand Down
8 changes: 3 additions & 5 deletions lib/decoders/decoders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ void AbstractDecoder::decodeToSectors(Track& track)
sector.headerStartTime = recordStart.ns();
sector.headerEndTime = recordEnd.ns();
r = advanceToNextRecord();
recordStart = fmr.tell();
if (r == DATA_RECORD)
{
recordStart = fmr.tell();
decodeDataRecord();
recordEnd = fmr.tell();
pushRecord(recordStart, recordEnd);
}
recordEnd = fmr.tell();
pushRecord(recordStart, recordEnd);
}
sector.dataStartTime = recordStart.ns();
sector.dataEndTime = recordEnd.ns();
Expand Down
4 changes: 2 additions & 2 deletions lib/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ void readDiskCommand(AbstractDecoder& decoder)
std::cout << "\nRaw (undecoded) records follow:\n\n";
for (auto& record : track->rawrecords)
{
std::cout << fmt::format("I+{:.2f}us", record.position.ns() / 1000.0)
<< std::endl;
std::cout << fmt::format("I+{:.2f}us with {:.2f}us clock\n",
record.position.ns() / 1000.0, record.clock / 1000.0);
hexdump(std::cout, record.data);
std::cout << std::endl;
}
Expand Down

0 comments on commit 6af80d1

Please sign in to comment.