D88: Use the data length field to seek past any extra data.

This will effectively ignore the field length if it is shorter
than the sector size (or 0).
This commit is contained in:
Thomas Daede
2022-08-18 15:21:31 -07:00
parent 0ddfd3bead
commit f8257e697a

View File

@@ -115,6 +115,10 @@ public:
int ddam = sectorHeaderReader.seek(7).read_8();
int fddStatusCode = sectorHeaderReader.seek(8).read_8();
int rpm = sectorHeaderReader.seek(13).read_8();
int dataLength = sectorHeaderReader.seek(14).read_le16();
if (dataLength < sectorSize) {
dataLength = sectorSize;
}
// D88 provides much more sector information that is currently
// ignored
if (ddam != 0)
@@ -190,6 +194,7 @@ public:
}
Bytes data(sectorSize);
inputFile.read((char*)data.begin(), data.size());
inputFile.seekg(dataLength-sectorSize, std::ios_base::cur);
physical->add_sector(sectorId);
const auto& sector = image->put(track, head, sectorId);
sector->status = Sector::OK;