Skip to content

Commit

Permalink
Merge pull request #157 from davidgiven/amigacorruption
Browse files Browse the repository at this point in the history
Fix some issues causing corruption when reading Amiga disks
  • Loading branch information
davidgiven authored Apr 8, 2020
2 parents 5be7249 + 1fd6545 commit 3c54a66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions arch/amiga/decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ AbstractDecoder::RecordType AmigaDecoder::advanceToNextRecord()
void AmigaDecoder::decodeSectorRecord()
{
const auto& rawbits = readRawBits(AMIGA_RECORD_SIZE*16);
if (rawbits.size() < (AMIGA_RECORD_SIZE*16))
return;
const auto& rawbytes = toBytes(rawbits).slice(0, AMIGA_RECORD_SIZE*2);
const auto& bytes = decodeFmMfm(rawbits).slice(0, AMIGA_RECORD_SIZE);

Expand Down
12 changes: 6 additions & 6 deletions lib/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ void readDiskCommand(AbstractDecoder& decoder)
if (dumpSectors)
{
std::cout << "\nDecoded sectors follow:\n\n";
for (auto& i : readSectors)
for (auto& sector : track->sectors)
{
auto& sector = i.second;
std::cout << fmt::format("{}.{:02}.{:02}: I+{:.2f}us with {:.2f}us clock\n",
sector->logicalTrack, sector->logicalSide, sector->logicalSector,
sector->position.ns() / 1000.0, sector->clock / 1000.0);
hexdump(std::cout, sector->data);
std::cout << fmt::format("{}.{:02}.{:02}: I+{:.2f}us with {:.2f}us clock: status {}\n",
sector.logicalTrack, sector.logicalSide, sector.logicalSector,
sector.position.ns() / 1000.0, sector.clock / 1000.0,
sector.status);
hexdump(std::cout, sector.data);
std::cout << std::endl;
}
}
Expand Down

0 comments on commit 3c54a66

Please sign in to comment.