Actually fix the c64 1581 side issue. Turns out the data's not flipped between

the two sides, only the bit in the sector header...
This commit is contained in:
David Given
2022-09-12 15:34:21 +02:00
parent 32dcd1551b
commit c63a761ca4
7 changed files with 36 additions and 29 deletions

View File

@@ -151,8 +151,7 @@ public:
if (wantCrc == gotCrc)
_sector->status = Sector::DATA_MISSING; /* correct but unintuitive */
if (trackdata.swap_sides())
_sector->logicalSide ^= 1;
_sector->logicalSide ^= trackdata.invert_side_byte();
if (trackdata.ignore_side_byte())
_sector->logicalSide = _sector->physicalHead;
if (trackdata.ignore_track_byte())

View File

@@ -107,28 +107,6 @@ private:
}
public:
std::vector<std::shared_ptr<const Sector>> collectSectors(
const Location& location, const Image& image) override
{
std::vector<std::shared_ptr<const Sector>> sectors;
IbmEncoderProto::TrackdataProto trackdata;
getEncoderTrackData(trackdata, location.logicalTrack, location.head);
auto& trackLayout =
Layout::getLayoutOfTrack(location.logicalTrack, location.head);
int logicalSide = location.head ^ trackdata.swap_sides();
for (unsigned sectorId : trackLayout.diskSectorOrder)
{
const auto& sector =
image.get(location.logicalTrack, logicalSide, sectorId);
if (sector)
sectors.push_back(sector);
}
return sectors;
}
std::unique_ptr<Fluxmap> encode(const Location& location,
const std::vector<std::shared_ptr<const Sector>>& sectors,
const Image& image) override
@@ -224,7 +202,7 @@ public:
}
bw.write_8(idamUnencoded);
bw.write_8(sectorData->logicalTrack);
bw.write_8(sectorData->logicalSide);
bw.write_8(sectorData->logicalSide ^ trackdata.invert_side_byte());
bw.write_8(sectorData->logicalSector);
bw.write_8(sectorSize);
uint16_t crc = crc16(CCITT_POLY, header);

View File

@@ -10,7 +10,7 @@ message IbmDecoderProto {
optional bool ignore_side_byte = 2 [default = false, (help) = "ignore side byte in sector header"];
optional bool ignore_track_byte = 6 [default = false, (help) = "ignore track byte in sector header"];
optional bool swap_sides = 4 [default = false, (help) = "put logical side 1 on physical side 0"];
optional bool invert_side_byte = 4 [default = false, (help) = "invert the side byte in the sector header"];
repeated int32 ignore_sector = 10 [(help) = "sectors with these IDs will not be read"];
}
@@ -33,7 +33,7 @@ message IbmEncoderProto {
optional int32 gap1 = 10 [default=50, (help) = "size of gap 2 (the post-ID gap)"];
optional int32 gap2 = 11 [default=22, (help) = "size of gap 3 (the pre-data gap)"];
optional int32 gap3 = 12 [default=80, (help) = "size of gap 4 (the post-data or format gap)"];
optional bool swap_sides = 14 [default=false, (help) = "swap side bytes when writing"];
optional bool invert_side_byte = 14 [default=false, (help) = "invert the side byte in the header"];
optional int32 gap_fill_byte = 18 [default=0x9254, (help) = "16-bit raw bit pattern of gap fill byte"];
optional double target_rotational_period_ms = 1 [default=200, (help) = "rotational period of target disk"];
}