Rename cylinder to track throughout (mostly).

This commit is contained in:
David Given
2022-03-25 20:16:12 +01:00
parent ea8af83d61
commit 86c5cccb08
115 changed files with 344 additions and 344 deletions

View File

@@ -115,14 +115,14 @@ public:
{ {
std::vector<std::shared_ptr<const Sector>> sectors; std::vector<std::shared_ptr<const Sector>> sectors;
if ((location.logicalCylinder >= 0) && if ((location.logicalTrack >= 0) &&
(location.logicalCylinder < AMIGA_TRACKS_PER_DISK)) (location.logicalTrack < AMIGA_TRACKS_PER_DISK))
{ {
for (int sectorId = 0; sectorId < AMIGA_SECTORS_PER_TRACK; for (int sectorId = 0; sectorId < AMIGA_SECTORS_PER_TRACK;
sectorId++) sectorId++)
{ {
const auto& sector = image.get( const auto& sector = image.get(
location.logicalCylinder, location.head, sectorId); location.logicalTrack, location.head, sectorId);
if (sector) if (sector)
sectors.push_back(sector); sectors.push_back(sector);
} }

View File

@@ -39,7 +39,7 @@ public:
unsigned numSectors = 16; unsigned numSectors = 16;
for (int sectorId = 0; sectorId < numSectors; sectorId++) for (int sectorId = 0; sectorId < numSectors; sectorId++)
{ {
const auto& sector = image.get(location.logicalCylinder, 0, sectorId); const auto& sector = image.get(location.logicalTrack, 0, sectorId);
if (sector) if (sector)
sectors.push_back(sector); sectors.push_back(sector);
} }

View File

@@ -126,12 +126,12 @@ public:
switch (_config.format()) switch (_config.format())
{ {
case BROTHER120: case BROTHER120:
if (location.logicalCylinder >= BROTHER_TRACKS_PER_120KB_DISK) if (location.logicalTrack >= BROTHER_TRACKS_PER_120KB_DISK)
return sectors; return sectors;
break; break;
case BROTHER240: case BROTHER240:
if (location.logicalCylinder >= BROTHER_TRACKS_PER_240KB_DISK) if (location.logicalTrack >= BROTHER_TRACKS_PER_240KB_DISK)
return sectors; return sectors;
break; break;
} }
@@ -141,7 +141,7 @@ public:
sectorCount++) sectorCount++)
{ {
int sectorId = charToInt(skew.at(sectorCount)); int sectorId = charToInt(skew.at(sectorCount));
const auto& sector = image.get(location.logicalCylinder, 0, sectorId); const auto& sector = image.get(location.logicalTrack, 0, sectorId);
if (sector) if (sector)
sectors.push_back(sector); sectors.push_back(sector);
} }

View File

@@ -217,10 +217,10 @@ public:
if (location.head == 0) if (location.head == 0)
{ {
unsigned numSectors = sectorsForTrack(location.logicalCylinder); unsigned numSectors = sectorsForTrack(location.logicalTrack);
for (int sectorId=0; sectorId<numSectors; sectorId++) for (int sectorId=0; sectorId<numSectors; sectorId++)
{ {
const auto& sector = image.get(location.logicalCylinder, 0, sectorId); const auto& sector = image.get(location.logicalTrack, 0, sectorId);
if (sector) if (sector)
sectors.push_back(sector); sectors.push_back(sector);
} }
@@ -250,7 +250,7 @@ public:
else else
_formatByte1 = _formatByte2 = 0; _formatByte1 = _formatByte2 = 0;
double clockRateUs = clockRateUsForTrack(location.logicalCylinder) * _config.clock_compensation_factor(); double clockRateUs = clockRateUsForTrack(location.logicalTrack) * _config.clock_compensation_factor();
int bitsPerRevolution = 200000.0 / clockRateUs; int bitsPerRevolution = 200000.0 / clockRateUs;

View File

@@ -139,7 +139,7 @@ public:
bw += decodeFmMfm(bits).slice(0, IBM_IDAM_LEN); bw += decodeFmMfm(bits).slice(0, IBM_IDAM_LEN);
IbmDecoderProto::TrackdataProto trackdata; IbmDecoderProto::TrackdataProto trackdata;
getTrackFormat(trackdata, _sector->physicalCylinder, _sector->physicalHead); getTrackFormat(trackdata, _sector->physicalTrack, _sector->physicalHead);
_sector->logicalTrack = br.read_8(); _sector->logicalTrack = br.read_8();
_sector->logicalSide = br.read_8(); _sector->logicalSide = br.read_8();
@@ -155,7 +155,7 @@ public:
if (trackdata.ignore_side_byte()) if (trackdata.ignore_side_byte())
_sector->logicalSide = _sector->physicalHead; _sector->logicalSide = _sector->physicalHead;
if (trackdata.ignore_track_byte()) if (trackdata.ignore_track_byte())
_sector->logicalTrack = _sector->physicalCylinder; _sector->logicalTrack = _sector->physicalTrack;
for (int sector : trackdata.ignore_sector()) for (int sector : trackdata.ignore_sector())
if (_sector->logicalSector == sector) if (_sector->logicalSector == sector)
@@ -206,7 +206,7 @@ public:
std::set<unsigned> requiredSectors(const Location& location) const override std::set<unsigned> requiredSectors(const Location& location) const override
{ {
IbmDecoderProto::TrackdataProto trackdata; IbmDecoderProto::TrackdataProto trackdata;
getTrackFormat(trackdata, location.logicalCylinder, location.head); getTrackFormat(trackdata, location.logicalTrack, location.head);
std::set<unsigned> s; std::set<unsigned> s;
if (trackdata.has_sectors()) if (trackdata.has_sectors())
@@ -227,12 +227,12 @@ public:
} }
private: private:
void getTrackFormat(IbmDecoderProto::TrackdataProto& trackdata, unsigned cylinder, unsigned head) const void getTrackFormat(IbmDecoderProto::TrackdataProto& trackdata, unsigned track, unsigned head) const
{ {
trackdata.Clear(); trackdata.Clear();
for (const auto& f : _config.trackdata()) for (const auto& f : _config.trackdata())
{ {
if (f.has_cylinder() && (f.cylinder() != cylinder)) if (f.has_track() && (f.track() != track))
continue; continue;
if (f.has_head() && (f.head() != head)) if (f.has_head() && (f.head() != head))
continue; continue;

View File

@@ -89,13 +89,13 @@ private:
} }
void getTrackFormat(IbmEncoderProto::TrackdataProto& trackdata, void getTrackFormat(IbmEncoderProto::TrackdataProto& trackdata,
unsigned cylinder, unsigned track,
unsigned head) unsigned head)
{ {
trackdata.Clear(); trackdata.Clear();
for (const auto& f : _config.trackdata()) for (const auto& f : _config.trackdata())
{ {
if (f.has_cylinder() && (f.cylinder() != cylinder)) if (f.has_track() && (f.track() != track))
continue; continue;
if (f.has_head() && (f.head() != head)) if (f.has_head() && (f.head() != head))
continue; continue;
@@ -132,12 +132,12 @@ public:
{ {
std::vector<std::shared_ptr<const Sector>> sectors; std::vector<std::shared_ptr<const Sector>> sectors;
IbmEncoderProto::TrackdataProto trackdata; IbmEncoderProto::TrackdataProto trackdata;
getTrackFormat(trackdata, location.logicalCylinder, location.head); getTrackFormat(trackdata, location.logicalTrack, location.head);
int logicalSide = location.head ^ trackdata.swap_sides(); int logicalSide = location.head ^ trackdata.swap_sides();
for (int sectorId : getSectorIds(trackdata)) for (int sectorId : getSectorIds(trackdata))
{ {
const auto& sector = image.get(location.logicalCylinder, logicalSide, sectorId); const auto& sector = image.get(location.logicalTrack, logicalSide, sectorId);
if (sector) if (sector)
sectors.push_back(sector); sectors.push_back(sector);
} }
@@ -151,7 +151,7 @@ public:
const Image& image) override const Image& image) override
{ {
IbmEncoderProto::TrackdataProto trackdata; IbmEncoderProto::TrackdataProto trackdata;
getTrackFormat(trackdata, location.logicalCylinder, location.head); getTrackFormat(trackdata, location.logicalTrack, location.head);
auto writeBytes = [&](const Bytes& bytes) auto writeBytes = [&](const Bytes& bytes)
{ {

View File

@@ -19,7 +19,7 @@
struct IbmIdam struct IbmIdam
{ {
uint8_t id; uint8_t id;
uint8_t cylinder; uint8_t track;
uint8_t side; uint8_t side;
uint8_t sector; uint8_t sector;
uint8_t sectorSize; uint8_t sectorSize;

View File

@@ -13,7 +13,7 @@ message IbmDecoderProto {
optional int32 max_sector = 2 [(help) = "require these sectors to exist for a good read"]; optional int32 max_sector = 2 [(help) = "require these sectors to exist for a good read"];
} }
optional int32 cylinder = 7 [(help) = "if set, the format applies only to this track"]; optional int32 track = 7 [(help) = "if set, the format applies only to this track"];
optional int32 head = 8 [(help) = "if set, the format applies only to this head"]; optional int32 head = 8 [(help) = "if set, the format applies only to this head"];
optional bool ignore_side_byte = 2 [default = false, (help) = "ignore side byte in sector header"]; optional bool ignore_side_byte = 2 [default = false, (help) = "ignore side byte in sector header"];
@@ -42,7 +42,7 @@ message IbmEncoderProto {
optional int32 max_sector = 2 [(help) = "write these sectors (in order) on each track"]; optional int32 max_sector = 2 [(help) = "write these sectors (in order) on each track"];
} }
optional int32 cylinder = 15 [(help) = "if set, the format applies only to this track"]; optional int32 track = 15 [(help) = "if set, the format applies only to this track"];
optional int32 head = 16 [(help) = "if set, the format applies only to this head"]; optional int32 head = 16 [(help) = "if set, the format applies only to this head"];
optional double track_length_ms = 1 [(help) = "length of track"]; optional double track_length_ms = 1 [(help) = "length of track"];

View File

@@ -144,7 +144,7 @@ public:
auto header = toBytes(readRawBits(7*8)).slice(0, 7); auto header = toBytes(readRawBits(7*8)).slice(0, 7);
uint8_t encodedTrack = decode_data_gcr(header[0]); uint8_t encodedTrack = decode_data_gcr(header[0]);
if (encodedTrack != (_sector->physicalCylinder & 0x3f)) if (encodedTrack != (_sector->physicalTrack & 0x3f))
return; return;
uint8_t encodedSector = decode_data_gcr(header[1]); uint8_t encodedSector = decode_data_gcr(header[1]);
@@ -155,7 +155,7 @@ public:
if (encodedSector > 11) if (encodedSector > 11)
return; return;
_sector->logicalTrack = _sector->physicalCylinder; _sector->logicalTrack = _sector->physicalTrack;
_sector->logicalSide = decode_side(encodedSide); _sector->logicalSide = decode_side(encodedSide);
_sector->logicalSector = encodedSector; _sector->logicalSector = encodedSector;
uint8_t gotsum = (encodedTrack ^ encodedSector ^ encodedSide ^ formatByte) & 0x3f; uint8_t gotsum = (encodedTrack ^ encodedSector ^ encodedSide ^ formatByte) & 0x3f;
@@ -185,16 +185,16 @@ public:
std::set<unsigned> requiredSectors(const Location& location) const override std::set<unsigned> requiredSectors(const Location& location) const override
{ {
unsigned cylinder = location.logicalCylinder; unsigned track = location.logicalTrack;
int count; int count;
if (cylinder < 16) if (track < 16)
count = 12; count = 12;
else if (cylinder < 32) else if (track < 32)
count = 11; count = 11;
else if (cylinder < 48) else if (track < 48)
count = 10; count = 10;
else if (cylinder < 64) else if (track < 64)
count = 9; count = 9;
else else
count = 8; count = 8;

View File

@@ -224,14 +224,14 @@ public:
{ {
std::vector<std::shared_ptr<const Sector>> sectors; std::vector<std::shared_ptr<const Sector>> sectors;
if ((location.logicalCylinder >= 0) && if ((location.logicalTrack >= 0) &&
(location.logicalCylinder < MAC_TRACKS_PER_DISK)) (location.logicalTrack < MAC_TRACKS_PER_DISK))
{ {
unsigned numSectors = sectorsForTrack(location.logicalCylinder); unsigned numSectors = sectorsForTrack(location.logicalTrack);
for (int sectorId = 0; sectorId < numSectors; sectorId++) for (int sectorId = 0; sectorId < numSectors; sectorId++)
{ {
const auto& sector = image.get( const auto& sector = image.get(
location.logicalCylinder, location.head, sectorId); location.logicalTrack, location.head, sectorId);
if (sector) if (sector)
sectors.push_back(sector); sectors.push_back(sector);
} }
@@ -244,7 +244,7 @@ public:
const std::vector<std::shared_ptr<const Sector>>& sectors, const std::vector<std::shared_ptr<const Sector>>& sectors,
const Image& image) override const Image& image) override
{ {
double clockRateUs = clockRateUsForTrack(location.logicalCylinder) * double clockRateUs = clockRateUsForTrack(location.logicalTrack) *
_config.clock_compensation_factor(); _config.clock_compensation_factor();
int bitsPerRevolution = 200000.0 / clockRateUs; int bitsPerRevolution = 200000.0 / clockRateUs;
std::vector<bool> bits(bitsPerRevolution); std::vector<bool> bits(bitsPerRevolution);

View File

@@ -133,7 +133,7 @@ public:
return; return;
if (_sector->logicalTrack > 76) if (_sector->logicalTrack > 76)
return; return;
if (_sector->logicalTrack != _sector->physicalCylinder) if (_sector->logicalTrack != _sector->physicalTrack)
return; return;
br.read(10); /* OS data or padding */ br.read(10); /* OS data or padding */

View File

@@ -82,12 +82,12 @@ public:
{ {
std::vector<std::shared_ptr<const Sector>> sectors; std::vector<std::shared_ptr<const Sector>> sectors;
if ((location.logicalCylinder >= 0) && (location.logicalCylinder < 77)) if ((location.logicalTrack >= 0) && (location.logicalTrack < 77))
{ {
for (int sectorId = 0; sectorId < 16; sectorId++) for (int sectorId = 0; sectorId < 16; sectorId++)
{ {
const auto& sector = image.get( const auto& sector = image.get(
location.logicalCylinder, location.head, sectorId); location.logicalTrack, location.head, sectorId);
if (sector) if (sector)
sectors.push_back(sector); sectors.push_back(sector);
} }

View File

@@ -65,7 +65,7 @@ public:
gotChecksum += br.read_be16(); gotChecksum += br.read_be16();
uint16_t wantChecksum = br.read_be16(); uint16_t wantChecksum = br.read_be16();
_sector->logicalTrack = _sector->physicalCylinder; _sector->logicalTrack = _sector->physicalTrack;
_sector->logicalSide = _sector->physicalHead; _sector->logicalSide = _sector->physicalHead;
_sector->logicalSector = _currentSector; _sector->logicalSector = _currentSector;
_sector->data = bytes.slice(0, SECTOR_SIZE).swab(); _sector->data = bytes.slice(0, SECTOR_SIZE).swab();

View File

@@ -152,7 +152,7 @@ public:
_sector->logicalSide = _sector->physicalHead; _sector->logicalSide = _sector->physicalHead;
_sector->logicalSector = _hardSectorId; _sector->logicalSector = _hardSectorId;
_sector->logicalTrack = _sector->physicalCylinder; _sector->logicalTrack = _sector->physicalTrack;
if (headerSize == NORTHSTAR_HEADER_SIZE_DD) { if (headerSize == NORTHSTAR_HEADER_SIZE_DD) {
br.read_8(); /* MFM second Sync char, usually 0xFB */ br.read_8(); /* MFM second Sync char, usually 0xFB */

View File

@@ -133,12 +133,12 @@ public:
{ {
std::vector<std::shared_ptr<const Sector>> sectors; std::vector<std::shared_ptr<const Sector>> sectors;
if ((location.logicalCylinder >= 0) && (location.logicalCylinder < 35)) if ((location.logicalTrack >= 0) && (location.logicalTrack < 35))
{ {
for (int sectorId = 0; sectorId < 10; sectorId++) for (int sectorId = 0; sectorId < 10; sectorId++)
{ {
const auto& sector = image.get( const auto& sector = image.get(
location.logicalCylinder, location.head, sectorId); location.logicalTrack, location.head, sectorId);
if (sector) if (sector)
sectors.push_back(sector); sectors.push_back(sector);
} }

View File

@@ -69,7 +69,7 @@ public:
{ {
int sectorId = charToInt(sectorChar); int sectorId = charToInt(sectorChar);
const auto& sector = const auto& sector =
image.get(location.logicalCylinder, location.head, sectorId); image.get(location.logicalTrack, location.head, sectorId);
if (sector) if (sector)
sectors.push_back(sector); sectors.push_back(sector);
} }

View File

@@ -145,15 +145,15 @@ public:
private: private:
void getTrackFormat(Victor9kEncoderProto::TrackdataProto& trackdata, void getTrackFormat(Victor9kEncoderProto::TrackdataProto& trackdata,
unsigned cylinder, unsigned track,
unsigned head) unsigned head)
{ {
trackdata.Clear(); trackdata.Clear();
for (const auto& f : _config.trackdata()) for (const auto& f : _config.trackdata())
{ {
if (f.has_min_cylinder() && (cylinder < f.min_cylinder())) if (f.has_min_track() && (track < f.min_track()))
continue; continue;
if (f.has_max_cylinder() && (cylinder > f.max_cylinder())) if (f.has_max_track() && (track > f.max_track()))
continue; continue;
if (f.has_head() && (head != f.head())) if (f.has_head() && (head != f.head()))
continue; continue;
@@ -169,13 +169,13 @@ public:
std::vector<std::shared_ptr<const Sector>> sectors; std::vector<std::shared_ptr<const Sector>> sectors;
Victor9kEncoderProto::TrackdataProto trackdata; Victor9kEncoderProto::TrackdataProto trackdata;
getTrackFormat(trackdata, location.logicalCylinder, location.head); getTrackFormat(trackdata, location.logicalTrack, location.head);
for (int i = 0; i < trackdata.sector_range().sector_count(); i++) for (int i = 0; i < trackdata.sector_range().sector_count(); i++)
{ {
int sectorId = trackdata.sector_range().start_sector() + i; int sectorId = trackdata.sector_range().start_sector() + i;
const auto& sector = const auto& sector =
image.get(location.logicalCylinder, location.head, sectorId); image.get(location.logicalTrack, location.head, sectorId);
if (sector) if (sector)
sectors.push_back(sector); sectors.push_back(sector);
} }
@@ -188,7 +188,7 @@ public:
const Image& image) override const Image& image) override
{ {
Victor9kEncoderProto::TrackdataProto trackdata; Victor9kEncoderProto::TrackdataProto trackdata;
getTrackFormat(trackdata, location.logicalCylinder, location.head); getTrackFormat(trackdata, location.logicalTrack, location.head);
unsigned bitsPerRevolution = unsigned bitsPerRevolution =
trackdata.original_data_rate_khz() * trackdata.original_period_ms(); trackdata.original_data_rate_khz() * trackdata.original_period_ms();

View File

@@ -12,12 +12,12 @@ message Victor9kEncoderProto {
optional int32 sector_count = 2 [(help) = "number of sectors on track"]; optional int32 sector_count = 2 [(help) = "number of sectors on track"];
} }
optional int32 min_cylinder = 1 [(help) = "minimum cylinder this format applies to"]; optional int32 min_track = 1 [(help) = "minimum track this format applies to"];
optional int32 max_cylinder = 2 [(help) = "maximum cylinder this format applies to"]; optional int32 max_track = 2 [(help) = "maximum track this format applies to"];
optional int32 head = 3 [(help) = "which head this format applies to"]; optional int32 head = 3 [(help) = "which head this format applies to"];
optional double original_period_ms = 4 [(help) = "original rotational period of this cylinder"]; optional double original_period_ms = 4 [(help) = "original rotational period of this track"];
optional double original_data_rate_khz = 5 [(help) = "original data rate of this cylinder"]; optional double original_data_rate_khz = 5 [(help) = "original data rate of this track"];
optional double post_index_gap_us = 6 [(help) = "size of post-index gap"]; optional double post_index_gap_us = 6 [(help) = "size of post-index gap"];
optional int32 pre_header_sync_bits = 10 [(help) = "number of sync bits before the sector header"]; optional int32 pre_header_sync_bits = 10 [(help) = "number of sync bits before the sector header"];
optional int32 pre_data_sync_bits = 8 [(help) = "number of sync bits before the sector data"]; optional int32 pre_data_sync_bits = 8 [(help) = "number of sync bits before the sector data"];

View File

@@ -27,7 +27,7 @@ message ConfigProto {
optional DecoderProto decoder = 4; optional DecoderProto decoder = 4;
optional UsbProto usb = 5; optional UsbProto usb = 5;
optional RangeProto cylinders = 6; optional RangeProto tracks = 6;
optional RangeProto heads = 7; optional RangeProto heads = 7;
optional int32 tpi = 16 [ (help) = "TPI of image; if 0, use TPI of drive" ]; optional int32 tpi = 16 [ (help) = "TPI of image; if 0, use TPI of drive" ];

View File

@@ -72,7 +72,7 @@ std::shared_ptr<const TrackDataFlux> AbstractDecoder::decodeToSectors(
auto newSector = [&] { auto newSector = [&] {
_sector = std::make_shared<Sector>(); _sector = std::make_shared<Sector>();
_sector->status = Sector::MISSING; _sector->status = Sector::MISSING;
_sector->physicalCylinder = location.physicalCylinder; _sector->physicalTrack = location.physicalTrack;
_sector->physicalHead = location.head; _sector->physicalHead = location.head;
}; };

View File

@@ -18,16 +18,16 @@ message DriveProto
optional double revolutions = 6 optional double revolutions = 6
[ default = 1.2, (help) = "number of revolutions to read" ]; [ default = 1.2, (help) = "number of revolutions to read" ];
optional int32 cylinders = 7 optional int32 tracks = 7
[ default = 81, (help) = "Number of cylinders supported by drive" ]; [ default = 81, (help) = "Number of tracks supported by drive" ];
optional int32 heads = 8 optional int32 heads = 8
[ default = 2, (help) = "Number of heads supported by drive" ]; [ default = 2, (help) = "Number of heads supported by drive" ];
optional int32 head_bias = 10 [ optional int32 head_bias = 10 [
default = 0, default = 0,
(help) = "Bias to apply to the head position (in cylinders)" (help) = "Bias to apply to the head position (in tracks)"
]; ];
optional int32 head_width = 11 optional int32 head_width = 11
[ default = 1, (help) = "Width of the head (in cylinders)" ]; [ default = 1, (help) = "Width of the head (in tracks)" ];
optional int32 tpi = 9 [ default = 96, (help) = "TPI of drive" ]; optional int32 tpi = 9 [ default = 96, (help) = "TPI of drive" ];
} }

View File

@@ -10,7 +10,7 @@ enum FluxFileVersion {
} }
message TrackFluxProto { message TrackFluxProto {
optional int32 cylinder = 1; optional int32 track = 1;
optional int32 head = 2; optional int32 head = 2;
repeated bytes flux = 3; repeated bytes flux = 3;
} }

View File

@@ -14,14 +14,14 @@ struct Record
struct Location struct Location
{ {
unsigned physicalCylinder; unsigned physicalTrack;
unsigned logicalCylinder; unsigned logicalTrack;
unsigned head; unsigned head;
unsigned groupSize; unsigned groupSize;
std::strong_ordering operator<=>(const Location& other) const std::strong_ordering operator<=>(const Location& other) const
{ {
auto i = physicalCylinder <=> other.physicalCylinder; auto i = physicalTrack <=> other.physicalTrack;
if (i == std::strong_ordering::equal) if (i == std::strong_ordering::equal)
i = head <=> other.head; i = head <=> other.head;
return i; return i;

View File

@@ -26,14 +26,14 @@ public:
} }
public: public:
void writeFlux(int cylinder, int head, const Fluxmap& fluxmap) override void writeFlux(int track, int head, const Fluxmap& fluxmap) override
{ {
unsigned totalTicks = fluxmap.ticks() + 2; unsigned totalTicks = fluxmap.ticks() + 2;
unsigned channels = _config.index_markers() ? 2 : 1; unsigned channels = _config.index_markers() ? 2 : 1;
mkdir(_config.directory().c_str(), 0744); mkdir(_config.directory().c_str(), 0744);
std::ofstream of( std::ofstream of(
fmt::format("{}/c{:02d}.h{:01d}.au", _config.directory(), cylinder, head), fmt::format("{}/c{:02d}.h{:01d}.au", _config.directory(), track, head),
std::ios::out | std::ios::binary); std::ios::out | std::ios::binary);
if (!of.is_open()) if (!of.is_open())
Error() << "cannot open output file"; Error() << "cannot open output file";

View File

@@ -37,7 +37,7 @@ public:
for (const auto& e : _data) for (const auto& e : _data)
{ {
auto track = proto.add_track(); auto track = proto.add_track();
track->set_cylinder(e.first.first); track->set_track(e.first.first);
track->set_head(e.first.second); track->set_head(e.first.second);
for (const auto& fluxBytes : e.second) for (const auto& fluxBytes : e.second)
track->add_flux(fluxBytes); track->add_flux(fluxBytes);
@@ -51,9 +51,9 @@ public:
} }
public: public:
void writeFlux(int cylinder, int head, const Fluxmap& fluxmap) override void writeFlux(int track, int head, const Fluxmap& fluxmap) override
{ {
auto& vector = _data[std::make_pair(cylinder, head)]; auto& vector = _data[std::make_pair(track, head)];
vector.push_back(fluxmap.rawBytes()); vector.push_back(fluxmap.rawBytes());
} }

View File

@@ -47,8 +47,8 @@ public:
_fileheader.file_id[2] = 'P'; _fileheader.file_id[2] = 'P';
_fileheader.version = 0x18; /* Version 1.8 of the spec */ _fileheader.version = 0x18; /* Version 1.8 of the spec */
_fileheader.type = _config.type_byte(); _fileheader.type = _config.type_byte();
_fileheader.start_track = strackno(config.cylinders().start(), config.heads().start()); _fileheader.start_track = strackno(config.tracks().start(), config.heads().start());
_fileheader.end_track = strackno(config.cylinders().end(), config.heads().end()); _fileheader.end_track = strackno(config.tracks().end(), config.heads().end());
_fileheader.flags = SCP_FLAG_INDEXED _fileheader.flags = SCP_FLAG_INDEXED
| SCP_FLAG_96TPI; | SCP_FLAG_96TPI;
_fileheader.cell_width = 0; _fileheader.cell_width = 0;
@@ -80,16 +80,16 @@ public:
} }
public: public:
void writeFlux(int cylinder, int head, const Fluxmap& fluxmap) override void writeFlux(int track, int head, const Fluxmap& fluxmap) override
{ {
ByteWriter trackdataWriter(_trackdata); ByteWriter trackdataWriter(_trackdata);
trackdataWriter.seekToEnd(); trackdataWriter.seekToEnd();
int strack = strackno(cylinder, head); int strack = strackno(track, head);
if (strack >= std::size(_fileheader.track)) { if (strack >= std::size(_fileheader.track)) {
std::cout << fmt::format("SCP: cannot write track {} head {}, " std::cout << fmt::format("SCP: cannot write track {} head {}, "
"there are not not enough Track Data Headers.\n", "there are not not enough Track Data Headers.\n",
cylinder, head); track, head);
return; return;
} }
ScpTrack trackheader = {0}; ScpTrack trackheader = {0};

View File

@@ -20,11 +20,11 @@ public:
{} {}
public: public:
void writeFlux(int cylinder, int head, const Fluxmap& fluxmap) override void writeFlux(int track, int head, const Fluxmap& fluxmap) override
{ {
mkdir(_config.directory().c_str(), 0744); mkdir(_config.directory().c_str(), 0744);
std::ofstream of( std::ofstream of(
fmt::format("{}/c{:02d}.h{:01d}.vcd", _config.directory(), cylinder, head), fmt::format("{}/c{:02d}.h{:01d}.vcd", _config.directory(), track, head),
std::ios::out | std::ios::binary); std::ios::out | std::ios::binary);
if (!of.is_open()) if (!of.is_open())
Error() << "cannot open output file"; Error() << "cannot open output file";

View File

@@ -14,10 +14,10 @@ struct CwfHeader
uint8_t version; // version of this file uint8_t version; // version of this file
uint8_t clock_rate; // clock rate used: 0, 1, 2 (2 = 28MHz) uint8_t clock_rate; // clock rate used: 0, 1, 2 (2 = 28MHz)
uint8_t drive_type; // type of drive uint8_t drive_type; // type of drive
uint8_t cylinders; // number of cylinders uint8_t tracks; // number of tracks
uint8_t sides; // number of sides uint8_t sides; // number of sides
uint8_t index_mark; // nonzero if index marks are included uint8_t index_mark; // nonzero if index marks are included
uint8_t step; // cylinder stepping interval uint8_t step; // track stepping interval
uint8_t filler[15]; // reserved for expansion uint8_t filler[15]; // reserved for expansion
uint8_t comment[100]; // brief comment uint8_t comment[100]; // brief comment
}; };
@@ -58,11 +58,11 @@ public:
Error() << "unsupported clock rate"; Error() << "unsupported clock rate";
} }
std::cout << fmt::format("CWF {}x{} = {} cylinders, {} sides\n", std::cout << fmt::format("CWF {}x{} = {} tracks, {} sides\n",
_header.cylinders, _header.step, _header.cylinders*_header.step, _header.sides); _header.tracks, _header.step, _header.tracks*_header.step, _header.sides);
std::cout << fmt::format("CWF sample clock rate: {} MHz\n", _clockRate / 1e6); std::cout << fmt::format("CWF sample clock rate: {} MHz\n", _clockRate / 1e6);
int tracks = _header.cylinders*_header.sides; int tracks = _header.tracks*_header.sides;
for (int i=0; i<tracks; i++) for (int i=0; i<tracks; i++)
{ {
CwfTrack trackheader; CwfTrack trackheader;

View File

@@ -62,12 +62,12 @@ public:
} }
public: public:
std::unique_ptr<FluxSourceIterator> readFlux(int cylinder, int head) override std::unique_ptr<FluxSourceIterator> readFlux(int track, int head) override
{ {
for (const auto& track : _proto.track()) for (const auto& trackFlux : _proto.track())
{ {
if ((track.cylinder() == cylinder) && (track.head() == head)) if ((trackFlux.track() == track) && (trackFlux.head() == head))
return std::make_unique<Fl2FluxSourceIterator>(track); return std::make_unique<Fl2FluxSourceIterator>(trackFlux);
} }
return std::make_unique<EmptyFluxSourceIterator>(); return std::make_unique<EmptyFluxSourceIterator>();

View File

@@ -76,9 +76,9 @@ void FluxSource::updateConfigForFilename(FluxSourceProto* proto, const std::stri
class TrivialFluxSourceIterator : public FluxSourceIterator class TrivialFluxSourceIterator : public FluxSourceIterator
{ {
public: public:
TrivialFluxSourceIterator(TrivialFluxSource* fluxSource, int cylinder, int head): TrivialFluxSourceIterator(TrivialFluxSource* fluxSource, int track, int head):
_fluxSource(fluxSource), _fluxSource(fluxSource),
_cylinder(cylinder), _track(track),
_head(head) _head(head)
{} {}
@@ -89,20 +89,20 @@ public:
std::unique_ptr<const Fluxmap> next() override std::unique_ptr<const Fluxmap> next() override
{ {
auto fluxmap = _fluxSource->readSingleFlux(_cylinder, _head); auto fluxmap = _fluxSource->readSingleFlux(_track, _head);
_fluxSource = nullptr; _fluxSource = nullptr;
return fluxmap; return fluxmap;
} }
private: private:
TrivialFluxSource* _fluxSource; TrivialFluxSource* _fluxSource;
int _cylinder; int _track;
int _head; int _head;
}; };
std::unique_ptr<FluxSourceIterator> TrivialFluxSource::readFlux(int cylinder, int head) std::unique_ptr<FluxSourceIterator> TrivialFluxSource::readFlux(int track, int head)
{ {
return std::make_unique<TrivialFluxSourceIterator>(this, cylinder, head); return std::make_unique<TrivialFluxSourceIterator>(this, track, head);
} }

View File

@@ -15,9 +15,9 @@ private:
{ {
public: public:
HardwareFluxSourceIterator( HardwareFluxSourceIterator(
const HardwareFluxSource& fluxsource, int cylinder, int head): const HardwareFluxSource& fluxsource, int track, int head):
_fluxsource(fluxsource), _fluxsource(fluxsource),
_cylinder(cylinder), _track(track),
_head(head) _head(head)
{ {
} }
@@ -30,7 +30,7 @@ private:
std::unique_ptr<const Fluxmap> next() std::unique_ptr<const Fluxmap> next()
{ {
usbSetDrive(config.drive().drive(), config.drive().high_density(), config.drive().index_mode()); usbSetDrive(config.drive().drive(), config.drive().high_density(), config.drive().index_mode());
usbSeek(_cylinder); usbSeek(_track);
Bytes data = usbRead(_head, Bytes data = usbRead(_head,
config.drive().sync_with_index(), config.drive().sync_with_index(),
@@ -43,7 +43,7 @@ private:
private: private:
const HardwareFluxSource& _fluxsource; const HardwareFluxSource& _fluxsource;
int _cylinder; int _track;
int _head; int _head;
}; };
@@ -76,10 +76,10 @@ public:
~HardwareFluxSource() {} ~HardwareFluxSource() {}
public: public:
std::unique_ptr<FluxSourceIterator> readFlux(int cylinder, int head) override std::unique_ptr<FluxSourceIterator> readFlux(int track, int head) override
{ {
return std::make_unique<HardwareFluxSourceIterator>( return std::make_unique<HardwareFluxSourceIterator>(
*this, cylinder, head); *this, track, head);
} }
void recalibrate() override void recalibrate() override

View File

@@ -32,11 +32,11 @@ public:
data.writer() += inputFile; data.writer() += inputFile;
ByteReader br(data); ByteReader br(data);
unsigned numCylinders = 39; unsigned numTracks = 39;
unsigned numHeads = 1; unsigned numHeads = 1;
unsigned numSectors = 0; unsigned numSectors = 0;
Logger() << fmt::format("D64: reading image with {} cylinders, {} heads", numCylinders, numHeads); Logger() << fmt::format("D64: reading image with {} tracks, {} heads", numTracks, numHeads);
uint32_t offset = 0; uint32_t offset = 0;
@@ -55,7 +55,7 @@ public:
for (int track = 0; track < 40; track++) for (int track = 0; track < 40; track++)
{ {
int numSectors = sectorsPerTrack(track); int numSectors = sectorsPerTrack(track);
int physicalCylinder = track * 2; int physicalTrack = track * 2;
for (int head = 0; head < numHeads; head++) for (int head = 0; head < numHeads; head++)
{ {
for (int sectorId = 0; sectorId < numSectors; sectorId++) for (int sectorId = 0; sectorId < numSectors; sectorId++)
@@ -69,7 +69,7 @@ public:
sector->status = Sector::OK; sector->status = Sector::OK;
sector->logicalTrack = track; sector->logicalTrack = track;
sector->physicalCylinder = physicalCylinder; sector->physicalTrack = physicalTrack;
sector->logicalSide = sector->physicalHead = head; sector->logicalSide = sector->physicalHead = head;
sector->logicalSector = sectorId; sector->logicalSector = sectorId;
sector->data.writer().append(payload); sector->data.writer().append(payload);
@@ -79,7 +79,7 @@ public:
// DATA_MISSING // DATA_MISSING
sector->status = Sector::DATA_MISSING; sector->status = Sector::DATA_MISSING;
sector->logicalTrack = track; sector->logicalTrack = track;
sector->physicalCylinder = physicalCylinder; sector->physicalTrack = physicalTrack;
sector->logicalSide = sector->physicalHead = head; sector->logicalSide = sector->physicalHead = head;
sector->logicalSector = sectorId; sector->logicalSector = sectorId;
} }

View File

@@ -87,7 +87,7 @@ public:
continue; continue;
int currentTrackOffset = trackOffset; int currentTrackOffset = trackOffset;
int currentTrackCylinder = -1; int currentTrackTrack = -1;
int currentSectorsInTrack = int currentSectorsInTrack =
0xffff; // don't know # of sectors until we read the first one 0xffff; // don't know # of sectors until we read the first one
int trackSectorSize = -1; int trackSectorSize = -1;
@@ -105,7 +105,7 @@ public:
inputFile.read( inputFile.read(
(char*)sectorHeader.begin(), sectorHeader.size()); (char*)sectorHeader.begin(), sectorHeader.size());
ByteReader sectorHeaderReader(sectorHeader); ByteReader sectorHeaderReader(sectorHeader);
int cylinder = sectorHeaderReader.seek(0).read_8(); int track = sectorHeaderReader.seek(0).read_8();
int head = sectorHeaderReader.seek(1).read_8(); int head = sectorHeaderReader.seek(1).read_8();
int sectorId = sectorHeaderReader.seek(2).read_8(); int sectorId = sectorHeaderReader.seek(2).read_8();
int sectorSize = 128 << sectorHeaderReader.seek(3).read_8(); int sectorSize = 128 << sectorHeaderReader.seek(3).read_8();
@@ -132,21 +132,21 @@ public:
{ {
Error() << "D88: mismatched number of sectors in track"; Error() << "D88: mismatched number of sectors in track";
} }
if (currentTrackCylinder < 0) if (currentTrackTrack < 0)
{ {
currentTrackCylinder = cylinder; currentTrackTrack = track;
} }
else if (currentTrackCylinder != cylinder) else if (currentTrackTrack != track)
{ {
Error() << "D88: all sectors in a track must belong to the " Error() << "D88: all sectors in a track must belong to the "
"same cylinder"; "same track";
} }
if (trackSectorSize < 0) if (trackSectorSize < 0)
{ {
trackSectorSize = sectorSize; trackSectorSize = sectorSize;
// this is the first sector we've read, use it settings for // this is the first sector we've read, use it settings for
// per-track data // per-track data
trackdata->set_cylinder(cylinder * physicalStep); trackdata->set_track(track * physicalStep);
trackdata->set_head(head); trackdata->set_head(head);
trackdata->set_sector_size(sectorSize); trackdata->set_sector_size(sectorSize);
trackdata->set_use_fm(fm); trackdata->set_use_fm(fm);
@@ -177,10 +177,10 @@ public:
Bytes data(sectorSize); Bytes data(sectorSize);
inputFile.read((char*)data.begin(), data.size()); inputFile.read((char*)data.begin(), data.size());
const auto& sector = const auto& sector =
image->put(cylinder * physicalStep, head, sectorId); image->put(track * physicalStep, head, sectorId);
sector->status = Sector::OK; sector->status = Sector::OK;
sector->logicalTrack = cylinder; sector->logicalTrack = track;
sector->physicalCylinder = cylinder * physicalStep; sector->physicalTrack = track * physicalStep;
sector->logicalSide = sector->physicalHead = head; sector->logicalSide = sector->physicalHead = head;
sector->logicalSector = sectorId; sector->logicalSector = sectorId;
sector->data = data; sector->data = data;
@@ -209,11 +209,11 @@ public:
heads->set_end(geometry.numSides - 1); heads->set_end(geometry.numSides - 1);
} }
if (!config.has_cylinders()) if (!config.has_tracks())
{ {
auto* cylinders = config.mutable_cylinders(); auto* tracks = config.mutable_tracks();
cylinders->set_start(0); tracks->set_start(0);
cylinders->set_end(geometry.numTracks - 1); tracks->set_end(geometry.numTracks - 1);
} }
return image; return image;

View File

@@ -71,7 +71,7 @@ public:
{ {
if (inputFile.eof()) if (inputFile.eof())
break; break;
int physicalCylinder = track; int physicalTrack = track;
for (int side = 0; side < 2; side++) for (int side = 0; side < 2; side++)
{ {
@@ -85,10 +85,10 @@ public:
inputFile.read((char*)data.begin(), data.size()); inputFile.read((char*)data.begin(), data.size());
const auto& sector = const auto& sector =
image->put(physicalCylinder, side, sectorId); image->put(physicalTrack, side, sectorId);
sector->status = Sector::OK; sector->status = Sector::OK;
sector->logicalTrack = track; sector->logicalTrack = track;
sector->physicalCylinder = physicalCylinder; sector->physicalTrack = physicalTrack;
sector->logicalSide = sector->physicalHead = side; sector->logicalSide = sector->physicalHead = side;
sector->logicalSector = sectorId; sector->logicalSector = sectorId;
sector->data = data; sector->data = data;
@@ -110,7 +110,7 @@ public:
case 0x00: case 0x00:
Logger() << "DIM: automatically setting format to 1.2MB " Logger() << "DIM: automatically setting format to 1.2MB "
"(1024 byte sectors)"; "(1024 byte sectors)";
config.mutable_cylinders()->set_end(76); config.mutable_tracks()->set_end(76);
trackdata->set_track_length_ms(167); trackdata->set_track_length_ms(167);
trackdata->set_sector_size(1024); trackdata->set_sector_size(1024);
for (int i = 0; i < 9; i++) for (int i = 0; i < 9; i++)
@@ -156,11 +156,11 @@ public:
heads->set_end(geometry.numSides - 1); heads->set_end(geometry.numSides - 1);
} }
if (!config.has_cylinders()) if (!config.has_tracks())
{ {
auto* cylinders = config.mutable_cylinders(); auto* tracks = config.mutable_tracks();
cylinders->set_start(0); tracks->set_start(0);
cylinders->set_end(geometry.numTracks - 1); tracks->set_end(geometry.numTracks - 1);
} }
return image; return image;

View File

@@ -36,7 +36,7 @@ public:
uint8_t encoding = br.read_8(); uint8_t encoding = br.read_8();
uint8_t formatByte = br.read_8(); uint8_t formatByte = br.read_8();
unsigned numCylinders = 80; unsigned numTracks = 80;
unsigned numHeads = 2; unsigned numHeads = 2;
unsigned numSectors = 0; unsigned numSectors = 0;
bool mfm = false; bool mfm = false;
@@ -66,8 +66,8 @@ public:
} }
Logger() << fmt::format( Logger() << fmt::format(
"DC42: reading image with {} cylinders, {} heads; {}; {}", "DC42: reading image with {} tracks, {} heads; {}; {}",
numCylinders, numTracks,
numHeads, numHeads,
mfm ? "MFM" : "GCR", mfm ? "MFM" : "GCR",
label); label);
@@ -92,7 +92,7 @@ public:
uint32_t tagPtr = dataPtr + dataSize; uint32_t tagPtr = dataPtr + dataSize;
std::unique_ptr<Image> image(new Image); std::unique_ptr<Image> image(new Image);
for (int track = 0; track < numCylinders; track++) for (int track = 0; track < numTracks; track++)
{ {
int numSectors = sectorsPerTrack(track); int numSectors = sectorsPerTrack(track);
for (int head = 0; head < numHeads; head++) for (int head = 0; head < numHeads; head++)
@@ -109,7 +109,7 @@ public:
const auto& sector = image->put(track, head, sectorId); const auto& sector = image->put(track, head, sectorId);
sector->status = Sector::OK; sector->status = Sector::OK;
sector->logicalTrack = sector->physicalCylinder = track; sector->logicalTrack = sector->physicalTrack = track;
sector->logicalSide = sector->physicalHead = head; sector->logicalSide = sector->physicalHead = head;
sector->logicalSector = sectorId; sector->logicalSector = sectorId;
sector->data.writer().append(payload).append(tag); sector->data.writer().append(payload).append(tag);
@@ -117,7 +117,7 @@ public:
} }
} }
image->setGeometry({.numTracks = numCylinders, image->setGeometry({.numTracks = numTracks,
.numSides = numHeads, .numSides = numHeads,
.numSectors = 12, .numSectors = 12,
.sectorSize = 512 + 12, .sectorSize = 512 + 12,

View File

@@ -50,7 +50,7 @@ public:
{ {
if (inputFile.eof()) if (inputFile.eof())
break; break;
int physicalCylinder = track; int physicalTrack = track;
for (int side = 0; side < sides; side++) for (int side = 0; side < sides; side++)
{ {
@@ -64,10 +64,10 @@ public:
inputFile.read((char*)data.begin(), data.size()); inputFile.read((char*)data.begin(), data.size());
const auto& sector = const auto& sector =
image->put(physicalCylinder, side, sectorId); image->put(physicalTrack, side, sectorId);
sector->status = Sector::OK; sector->status = Sector::OK;
sector->logicalTrack = track; sector->logicalTrack = track;
sector->physicalCylinder = physicalCylinder; sector->physicalTrack = physicalTrack;
sector->logicalSide = sector->physicalHead = side; sector->logicalSide = sector->physicalHead = side;
sector->logicalSector = sectorId; sector->logicalSector = sectorId;
sector->data = data; sector->data = data;
@@ -89,7 +89,7 @@ public:
case 0x90: case 0x90:
Logger() << "FDI: automatically setting format to 1.2MB " Logger() << "FDI: automatically setting format to 1.2MB "
"(1024 byte sectors)"; "(1024 byte sectors)";
config.mutable_cylinders()->set_end(76); config.mutable_tracks()->set_end(76);
trackdata->set_track_length_ms(167); trackdata->set_track_length_ms(167);
trackdata->set_sector_size(1024); trackdata->set_sector_size(1024);
for (int i = 0; i < 9; i++) for (int i = 0; i < 9; i++)
@@ -125,11 +125,11 @@ public:
heads->set_end(geometry.numSides - 1); heads->set_end(geometry.numSides - 1);
} }
if (!config.has_cylinders()) if (!config.has_tracks())
{ {
auto* cylinders = config.mutable_cylinders(); auto* tracks = config.mutable_tracks();
cylinders->set_start(0); tracks->set_start(0);
cylinders->set_end(geometry.numTracks - 1); tracks->set_end(geometry.numTracks - 1);
} }
return image; return image;

View File

@@ -100,12 +100,12 @@ public:
1A byte - ASCII EOF character 1A byte - ASCII EOF character
- For each track on the disk: - For each track on the disk:
1 byte Mode value see getModulationspeed for definition 1 byte Mode value see getModulationspeed for definition
1 byte Cylinder 1 byte Track
1 byte Head 1 byte Head
1 byte number of sectors in track 1 byte number of sectors in track
1 byte sector size see getsectorsize for definition 1 byte sector size see getsectorsize for definition
sector numbering map sector numbering map
sector cylinder map (optional) definied in high byte of head (since head is 0 or 1) sector track map (optional) definied in high byte of head (since head is 0 or 1)
sector head map (optional) definied in high byte of head (since head is 0 or 1) sector head map (optional) definied in high byte of head (since head is 0 or 1)
sector data records sector data records
<End of file> <End of file>
@@ -163,7 +163,7 @@ public:
headerPtr++; headerPtr++;
sectorSize = getSectorSize(header.SectorSize); sectorSize = getSectorSize(header.SectorSize);
//Read optional cylinder map To Do //Read optional track map To Do
//Read optional sector head map To Do //Read optional sector head map To Do
@@ -218,7 +218,7 @@ public:
Error() << fmt::format("don't understand IMD disks with sector status {}", Status_Sector); Error() << fmt::format("don't understand IMD disks with sector status {}", Status_Sector);
} }
sector->status = Sector::OK; sector->status = Sector::OK;
sector->logicalTrack = sector->physicalCylinder = header.track; sector->logicalTrack = sector->physicalTrack = header.track;
sector->logicalSide = sector->physicalHead = header.Head; sector->logicalSide = sector->physicalHead = header.Head;
sector->logicalSector = (sector_map[s]); sector->logicalSector = (sector_map[s]);
} }

View File

@@ -47,7 +47,7 @@ public:
const auto& sector = image->put(track, side, sectorId); const auto& sector = image->put(track, side, sectorId);
sector->status = Sector::OK; sector->status = Sector::OK;
sector->logicalTrack = track; sector->logicalTrack = track;
sector->physicalCylinder = track; sector->physicalTrack = track;
sector->logicalSide = sector->physicalHead = side; sector->logicalSide = sector->physicalHead = side;
sector->logicalSector = sectorId; sector->logicalSector = sectorId;
sector->data = data; sector->data = data;

View File

@@ -123,7 +123,7 @@ public:
const auto& sector = const auto& sector =
image->put(header.track, head, header.sector); image->put(header.track, head, header.sector);
sector->status = Sector::OK; sector->status = Sector::OK;
sector->logicalTrack = sector->physicalCylinder = sector->logicalTrack = sector->physicalTrack =
header.track; header.track;
sector->logicalSide = sector->physicalHead = head; sector->logicalSide = sector->physicalHead = head;
sector->logicalSector = header.sector; sector->logicalSector = header.sector;

View File

@@ -55,7 +55,7 @@ public:
Logger() << "NFD: overriding configured format"; Logger() << "NFD: overriding configured format";
auto ibm = config.mutable_encoder()->mutable_ibm(); auto ibm = config.mutable_encoder()->mutable_ibm();
config.mutable_cylinders()->set_end(0); config.mutable_tracks()->set_end(0);
Logger() << "NFD: HD 1.2MB mode"; Logger() << "NFD: HD 1.2MB mode";
if (!config.drive().has_drive()) if (!config.drive().has_drive())
config.mutable_drive()->set_high_density(true); config.mutable_drive()->set_high_density(true);
@@ -67,14 +67,14 @@ public:
trackdata->set_clock_rate_khz(500); trackdata->set_clock_rate_khz(500);
trackdata->set_track_length_ms(167); trackdata->set_track_length_ms(167);
auto sectors = trackdata->mutable_sectors(); auto sectors = trackdata->mutable_sectors();
int currentTrackCylinder = -1; int currentTrackTrack = -1;
int currentTrackHead = -1; int currentTrackHead = -1;
int trackSectorSize = -1; int trackSectorSize = -1;
for (int sectorInTrack = 0; sectorInTrack < 26; sectorInTrack++) for (int sectorInTrack = 0; sectorInTrack < 26; sectorInTrack++)
{ {
headerReader.seek(0x120 + track * 26 * 16 + sectorInTrack * 16); headerReader.seek(0x120 + track * 26 * 16 + sectorInTrack * 16);
int cylinder = headerReader.read_8(); int track = headerReader.read_8();
int head = headerReader.read_8(); int head = headerReader.read_8();
int sectorId = headerReader.read_8(); int sectorId = headerReader.read_8();
int sectorSize = 128 << headerReader.read_8(); int sectorSize = 128 << headerReader.read_8();
@@ -82,22 +82,22 @@ public:
int ddam = headerReader.read_8(); int ddam = headerReader.read_8();
int status = headerReader.read_8(); int status = headerReader.read_8();
headerReader.skip(9); // skip ST0, ST1, ST2, PDA, reserved(5) headerReader.skip(9); // skip ST0, ST1, ST2, PDA, reserved(5)
if (cylinder == 0xFF) if (track == 0xFF)
continue; continue;
if (ddam != 0) if (ddam != 0)
Error() << "NFD: nonzero ddam currently unsupported"; Error() << "NFD: nonzero ddam currently unsupported";
if (status != 0) if (status != 0)
Error() << "NFD: nonzero fdd status codes are currently " Error() << "NFD: nonzero fdd status codes are currently "
"unsupported"; "unsupported";
if (currentTrackCylinder < 0) if (currentTrackTrack < 0)
{ {
currentTrackCylinder = cylinder; currentTrackTrack = track;
currentTrackHead = head; currentTrackHead = head;
} }
else if (currentTrackCylinder != cylinder) else if (currentTrackTrack != track)
{ {
Error() << "NFD: all sectors in a track must belong to the " Error() << "NFD: all sectors in a track must belong to the "
"same cylinder"; "same track";
} }
else if (currentTrackHead != head) else if (currentTrackHead != head)
{ {
@@ -109,7 +109,7 @@ public:
trackSectorSize = sectorSize; trackSectorSize = sectorSize;
// this is the first sector we've read, use it settings for // this is the first sector we've read, use it settings for
// per-track data // per-track data
trackdata->set_cylinder(cylinder); trackdata->set_track(track);
trackdata->set_head(head); trackdata->set_head(head);
trackdata->set_sector_size(sectorSize); trackdata->set_sector_size(sectorSize);
trackdata->set_use_fm(!mfm); trackdata->set_use_fm(!mfm);
@@ -139,17 +139,17 @@ public:
} }
Bytes data(sectorSize); Bytes data(sectorSize);
inputFile.read((char*)data.begin(), data.size()); inputFile.read((char*)data.begin(), data.size());
const auto& sector = image->put(cylinder, head, sectorId); const auto& sector = image->put(track, head, sectorId);
sector->status = Sector::OK; sector->status = Sector::OK;
sector->logicalTrack = cylinder; sector->logicalTrack = track;
sector->physicalCylinder = cylinder; sector->physicalTrack = track;
sector->logicalSide = sector->physicalHead = head; sector->logicalSide = sector->physicalHead = head;
sector->logicalSector = sectorId; sector->logicalSector = sectorId;
sector->data = data; sector->data = data;
sectors->add_sector(sectorId); sectors->add_sector(sectorId);
if (config.cylinders().end() < cylinder) if (config.tracks().end() < track)
config.mutable_cylinders()->set_end(cylinder); config.mutable_tracks()->set_end(track);
} }
} }

View File

@@ -32,7 +32,7 @@ public:
Logger() << fmt::format( Logger() << fmt::format(
"NSI: Autodetecting geometry based on file size: {}", fsize); "NSI: Autodetecting geometry based on file size: {}", fsize);
unsigned numCylinders = 35; unsigned numTracks = 35;
unsigned numSectors = 10; unsigned numSectors = 10;
unsigned numHeads = 2; unsigned numHeads = 2;
unsigned sectorSize = 512; unsigned sectorSize = 512;
@@ -63,18 +63,18 @@ public:
Logger() << fmt::format( Logger() << fmt::format(
"reading {} tracks, {} heads, {} sectors, {} bytes per sector, {} " "reading {} tracks, {} heads, {} sectors, {} bytes per sector, {} "
"kB total", "kB total",
numCylinders, numTracks,
numHeads, numHeads,
numSectors, numSectors,
sectorSize, sectorSize,
numCylinders * numHeads * trackSize / 1024); numTracks * numHeads * trackSize / 1024);
std::unique_ptr<Image> image(new Image); std::unique_ptr<Image> image(new Image);
unsigned sectorFileOffset; unsigned sectorFileOffset;
for (unsigned head = 0; head < numHeads; head++) for (unsigned head = 0; head < numHeads; head++)
{ {
for (unsigned track = 0; track < numCylinders; track++) for (unsigned track = 0; track < numTracks; track++)
{ {
for (unsigned sectorId = 0; sectorId < numSectors; sectorId++) for (unsigned sectorId = 0; sectorId < numSectors; sectorId++)
{ {
@@ -86,8 +86,8 @@ public:
else else
{ /* Head 1 is from track 70-35 */ { /* Head 1 is from track 70-35 */
sectorFileOffset = sectorFileOffset =
(trackSize * numCylinders) + /* Skip over side 0 */ (trackSize * numTracks) + /* Skip over side 0 */
((numCylinders - track - 1) * trackSize) + ((numTracks - track - 1) * trackSize) +
(sectorId * sectorSize); /* Sector offset from (sectorId * sectorSize); /* Sector offset from
beginning of track. */ beginning of track. */
} }
@@ -99,7 +99,7 @@ public:
const auto& sector = image->put(track, head, sectorId); const auto& sector = image->put(track, head, sectorId);
sector->status = Sector::OK; sector->status = Sector::OK;
sector->logicalTrack = sector->physicalCylinder = track; sector->logicalTrack = sector->physicalTrack = track;
sector->logicalSide = sector->physicalHead = head; sector->logicalSide = sector->physicalHead = head;
sector->logicalSector = sectorId; sector->logicalSector = sectorId;
sector->data = data; sector->data = data;
@@ -107,7 +107,7 @@ public:
} }
} }
image->setGeometry({.numTracks = numCylinders, image->setGeometry({.numTracks = numTracks,
.numSides = numHeads, .numSides = numHeads,
.numSectors = numSectors, .numSectors = numSectors,
.sectorSize = sectorSize}); .sectorSize = sectorSize});

View File

@@ -111,7 +111,7 @@ public:
if (sectorCount == 0xff) if (sectorCount == 0xff)
break; break;
uint8_t physicalCylinder = br.read_8(); uint8_t physicalTrack = br.read_8();
uint8_t physicalHead = br.read_8() & 1; uint8_t physicalHead = br.read_8() & 1;
br.skip(1); /* crc */ br.skip(1); /* crc */
@@ -185,7 +185,7 @@ public:
const auto& sector = const auto& sector =
image->put(logicalTrack, logicalSide, sectorId); image->put(logicalTrack, logicalSide, sectorId);
sector->status = Sector::OK; sector->status = Sector::OK;
sector->physicalCylinder = physicalCylinder; sector->physicalTrack = physicalTrack;
sector->physicalHead = physicalHead; sector->physicalHead = physicalHead;
sector->data = data.slice(0, sectorSize); sector->data = data.slice(0, sectorSize);
totalSize += sectorSize; totalSize += sectorSize;

View File

@@ -97,7 +97,7 @@ void ImageWriter::writeCsv(const Image& image, const std::string& filename)
for (const auto& sector : image) for (const auto& sector : image)
{ {
f << fmt::format("{},{},{},{},{},{},{},{},{},{},{},{},{}\n", f << fmt::format("{},{},{},{},{},{},{},{},{},{},{},{},{}\n",
sector->physicalCylinder, sector->physicalTrack,
sector->physicalHead, sector->physicalHead,
sector->logicalTrack, sector->logicalTrack,
sector->logicalSide, sector->logicalSide,

View File

@@ -31,7 +31,7 @@ public:
return; return;
} }
Logger() << fmt::format("Writing {} cylinders, {} sides, {} sectors, {} ({} bytes/sector), {} kB total", Logger() << fmt::format("Writing {} tracks, {} sides, {} sectors, {} ({} bytes/sector), {} kB total",
geometry.numTracks, geometry.numSides, geometry.numTracks, geometry.numSides,
geometry.numSectors, geometry.sectorSize == 256 ? "SD" : "DD", geometry.sectorSize, geometry.numSectors, geometry.sectorSize == 256 ? "SD" : "DD", geometry.sectorSize,
geometry.numTracks * geometry.numSides * geometry.numSectors * geometry.sectorSize / 1024); geometry.numTracks * geometry.numSides * geometry.numSectors * geometry.sectorSize / 1024);

View File

@@ -30,7 +30,7 @@ public:
return; return;
} }
Logger() << fmt::format("RAW: writing {} cylinders, {} sides", Logger() << fmt::format("RAW: writing {} tracks, {} sides",
geometry.numTracks, geometry.numSides); geometry.numTracks, geometry.numSides);
std::ofstream outputFile(_config.filename(), std::ios::out | std::ios::binary); std::ofstream outputFile(_config.filename(), std::ios::out | std::ios::binary);

View File

@@ -62,14 +62,14 @@ std::string Logger::toString(const AnyLogMessage& message)
/* Indicates that we're starting a write operation. */ /* Indicates that we're starting a write operation. */
[&](const BeginWriteOperationLogMessage& m) [&](const BeginWriteOperationLogMessage& m)
{ {
stream << fmt::format("{:2}.{}: ", m.cylinder, m.head); stream << fmt::format("{:2}.{}: ", m.track, m.head);
indented = true; indented = true;
}, },
/* Indicates that we're starting a read operation. */ /* Indicates that we're starting a read operation. */
[&](const BeginReadOperationLogMessage& m) [&](const BeginReadOperationLogMessage& m)
{ {
stream << fmt::format("{:2}.{}: ", m.cylinder, m.head); stream << fmt::format("{:2}.{}: ", m.track, m.head);
indented = true; indented = true;
}, },

View File

@@ -34,7 +34,7 @@ struct DiskReadLogMessage
struct BeginReadOperationLogMessage struct BeginReadOperationLogMessage
{ {
unsigned cylinder; unsigned track;
unsigned head; unsigned head;
}; };
@@ -46,7 +46,7 @@ struct EndReadOperationLogMessage
struct BeginWriteOperationLogMessage struct BeginWriteOperationLogMessage
{ {
unsigned cylinder; unsigned track;
unsigned head; unsigned head;
}; };

View File

@@ -105,16 +105,16 @@ std::unique_ptr<const Image> Mapper::remapSectorsLogicalToPhysical(
}); });
} }
unsigned Mapper::remapCylinderPhysicalToLogical(unsigned pcylinder) unsigned Mapper::remapTrackPhysicalToLogical(unsigned ptrack)
{ {
return (pcylinder - config.drive().head_bias()) / return (ptrack - config.drive().head_bias()) /
config.drive().head_width(); config.drive().head_width();
} }
unsigned Mapper::remapCylinderLogicalToPhysical(unsigned lcylinder) unsigned Mapper::remapTrackLogicalToPhysical(unsigned ltrack)
{ {
Error() << "not working yet"; Error() << "not working yet";
return config.drive().head_bias() + lcylinder * config.drive().head_width(); return config.drive().head_bias() + ltrack * config.drive().head_width();
} }
std::set<Location> Mapper::computeLocations() std::set<Location> Mapper::computeLocations()
@@ -128,14 +128,14 @@ std::set<Location> Mapper::computeLocations()
Error() Error()
<< "this drive can't write this image, because the head is too big"; << "this drive can't write this image, because the head is too big";
for (unsigned logicalCylinder : iterate(config.cylinders())) for (unsigned logicalTrack : iterate(config.tracks()))
{ {
for (unsigned head : iterate(config.heads())) for (unsigned head : iterate(config.heads()))
{ {
unsigned physicalCylinder = config.drive().head_bias() + logicalCylinder * track_step; unsigned physicalTrack = config.drive().head_bias() + logicalTrack * track_step;
locations.insert({.physicalCylinder = physicalCylinder, locations.insert({.physicalTrack = physicalTrack,
.logicalCylinder = logicalCylinder, .logicalTrack = logicalTrack,
.head = head, .head = head,
.groupSize = track_step}); .groupSize = track_step});
} }

View File

@@ -13,8 +13,8 @@ public:
static std::unique_ptr<const Image> remapSectorsLogicalToPhysical( static std::unique_ptr<const Image> remapSectorsLogicalToPhysical(
const Image& source, const SectorMappingProto& mapping); const Image& source, const SectorMappingProto& mapping);
static unsigned remapCylinderPhysicalToLogical(unsigned cylinder); static unsigned remapTrackPhysicalToLogical(unsigned track);
static unsigned remapCylinderLogicalToPhysical(unsigned cylinder); static unsigned remapTrackLogicalToPhysical(unsigned track);
static std::set<Location> computeLocations(); static std::set<Location> computeLocations();
}; };

View File

@@ -24,9 +24,9 @@
static std::unique_ptr<FluxSink> outputFluxSink; static std::unique_ptr<FluxSink> outputFluxSink;
static std::shared_ptr<const Fluxmap> readFluxmap( static std::shared_ptr<const Fluxmap> readFluxmap(
FluxSourceIterator& fluxsourceIterator, unsigned cylinder, unsigned head) FluxSourceIterator& fluxsourceIterator, unsigned track, unsigned head)
{ {
Logger() << BeginReadOperationLogMessage{cylinder, head}; Logger() << BeginReadOperationLogMessage{track, head};
auto fluxmap = fluxsourceIterator.next()->rescale( auto fluxmap = fluxsourceIterator.next()->rescale(
1.0 / config.flux_source().rescale()); 1.0 / config.flux_source().rescale());
Logger() << EndReadOperationLogMessage() Logger() << EndReadOperationLogMessage()
@@ -118,12 +118,12 @@ std::shared_ptr<const DiskFlux> readDiskCommand(
Fluxmap totalFlux; Fluxmap totalFlux;
auto fluxsourceIterator = auto fluxsourceIterator =
fluxsource.readFlux(location.physicalCylinder, location.head); fluxsource.readFlux(location.physicalTrack, location.head);
int retriesRemaining = config.decoder().retries(); int retriesRemaining = config.decoder().retries();
while (fluxsourceIterator->hasNext()) while (fluxsourceIterator->hasNext())
{ {
auto fluxmap = readFluxmap( auto fluxmap = readFluxmap(
*fluxsourceIterator, location.physicalCylinder, location.head); *fluxsourceIterator, location.physicalTrack, location.head);
totalFlux.appendDesync().appendBytes(fluxmap->rawBytes()); totalFlux.appendDesync().appendBytes(fluxmap->rawBytes());
auto trackdataflux = decoder.decodeToSectors(fluxmap, location); auto trackdataflux = decoder.decodeToSectors(fluxmap, location);
@@ -185,7 +185,7 @@ std::shared_ptr<const DiskFlux> readDiskCommand(
if (outputFluxSink) if (outputFluxSink)
outputFluxSink->writeFlux( outputFluxSink->writeFlux(
location.physicalCylinder, location.head, totalFlux); location.physicalTrack, location.head, totalFlux);
if (config.decoder().dump_records()) if (config.decoder().dump_records())
{ {
@@ -271,14 +271,14 @@ void readDiskCommand(
void rawReadDiskCommand(FluxSource& fluxsource, FluxSink& fluxsink) void rawReadDiskCommand(FluxSource& fluxsource, FluxSink& fluxsink)
{ {
for (int cylinder : iterate(config.cylinders())) for (int track : iterate(config.tracks()))
{ {
for (int head : iterate(config.heads())) for (int head : iterate(config.heads()))
{ {
testForEmergencyStop(); testForEmergencyStop();
auto fluxsourceIterator = fluxsource.readFlux(cylinder, head); auto fluxsourceIterator = fluxsource.readFlux(track, head);
auto fluxmap = readFluxmap(*fluxsourceIterator, cylinder, head); auto fluxmap = readFluxmap(*fluxsourceIterator, track, head);
fluxsink.writeFlux(cylinder, head, *fluxmap); fluxsink.writeFlux(track, head, *fluxmap);
} }
} }
} }

View File

@@ -10,7 +10,7 @@ class ImageWriter;
class TrackDataFlux; class TrackDataFlux;
extern std::unique_ptr<TrackDataFlux> readAndDecodeTrack( extern std::unique_ptr<TrackDataFlux> readAndDecodeTrack(
FluxSource& source, AbstractDecoder& decoder, unsigned cylinder, unsigned head); FluxSource& source, AbstractDecoder& decoder, unsigned track, unsigned head);
extern std::shared_ptr<const DiskFlux> readDiskCommand(FluxSource& fluxsource, AbstractDecoder& decoder); extern std::shared_ptr<const DiskFlux> readDiskCommand(FluxSource& fluxsource, AbstractDecoder& decoder);
extern void readDiskCommand(FluxSource& source, AbstractDecoder& decoder, ImageWriter& writer); extern void readDiskCommand(FluxSource& source, AbstractDecoder& decoder, ImageWriter& writer);

View File

@@ -35,7 +35,7 @@ public:
nanoseconds_t headerEndTime = 0; nanoseconds_t headerEndTime = 0;
nanoseconds_t dataStartTime = 0; nanoseconds_t dataStartTime = 0;
nanoseconds_t dataEndTime = 0; nanoseconds_t dataEndTime = 0;
unsigned physicalCylinder = 0; unsigned physicalTrack = 0;
unsigned physicalHead = 0; unsigned physicalHead = 0;
unsigned logicalTrack = 0; unsigned logicalTrack = 0;
unsigned logicalSide = 0; unsigned logicalSide = 0;

View File

@@ -23,7 +23,7 @@ static const char* gw_error(int e)
case ACK_NO_BUS: return "No bus"; case ACK_NO_BUS: return "No bus";
case ACK_BAD_UNIT: return "Invalid unit"; case ACK_BAD_UNIT: return "Invalid unit";
case ACK_BAD_PIN: return "Invalid pin"; case ACK_BAD_PIN: return "Invalid pin";
case ACK_BAD_CYLINDER: return "Invalid cylinder"; case ACK_BAD_CYLINDER: return "Invalid track";
default: return "Unknown error"; default: return "Unknown error";
} }
} }

View File

@@ -112,10 +112,10 @@ bool readGroup(FluxSource& fluxSource,
offset += config.drive().head_width()) offset += config.drive().head_width())
{ {
auto fluxSourceIterator = fluxSource.readFlux( auto fluxSourceIterator = fluxSource.readFlux(
location.physicalCylinder + offset, location.head); location.physicalTrack + offset, location.head);
Logger() << BeginReadOperationLogMessage{ Logger() << BeginReadOperationLogMessage{
location.physicalCylinder + offset, location.head}; location.physicalTrack + offset, location.head};
std::shared_ptr<const Fluxmap> fluxmap = std::shared_ptr<const Fluxmap> fluxmap =
fluxSourceIterator->next()->rescale( fluxSourceIterator->next()->rescale(
1.0 / config.flux_source().rescale()); 1.0 / config.flux_source().rescale());
@@ -150,9 +150,9 @@ void writeTracks(FluxSink& fluxSink,
for (unsigned offset = 0; offset < location.groupSize; for (unsigned offset = 0; offset < location.groupSize;
offset += config.drive().head_width()) offset += config.drive().head_width())
{ {
unsigned physicalCylinder = location.physicalCylinder + offset; unsigned physicalTrack = location.physicalTrack + offset;
Logger() << BeginWriteOperationLogMessage{physicalCylinder, location.head}; Logger() << BeginWriteOperationLogMessage{physicalTrack, location.head};
if (offset == 0) if (offset == 0)
{ {
@@ -166,7 +166,7 @@ void writeTracks(FluxSink& fluxSink,
* let's leave it disabled for now. */ * let's leave it disabled for now. */
// fluxmap->precompensate(PRECOMPENSATION_THRESHOLD_TICKS, // fluxmap->precompensate(PRECOMPENSATION_THRESHOLD_TICKS,
// 2); // 2);
fluxSink.writeFlux(physicalCylinder, location.head, *scaled); fluxSink.writeFlux(physicalTrack, location.head, *scaled);
Logger() << fmt::format("writing {0} ms in {1} bytes", Logger() << fmt::format("writing {0} ms in {1} bytes",
int(fluxmap->duration() / 1e6), int(fluxmap->duration() / 1e6),
fluxmap->bytes()); fluxmap->bytes());
@@ -177,7 +177,7 @@ void writeTracks(FluxSink& fluxSink,
/* Erase this track rather than writing. */ /* Erase this track rather than writing. */
Fluxmap blank; Fluxmap blank;
fluxSink.writeFlux(physicalCylinder, location.head, blank); fluxSink.writeFlux(physicalTrack, location.head, blank);
Logger() << "erased"; Logger() << "erased";
} }
@@ -274,7 +274,7 @@ void writeRawDiskCommand(FluxSource& fluxSource, FluxSink& fluxSink)
[&](const Location& location) [&](const Location& location)
{ {
return fluxSource return fluxSource
.readFlux(location.physicalCylinder, location.head) .readFlux(location.physicalTrack, location.head)
->next(); ->next();
}, },
dontVerify); dontVerify);
@@ -319,7 +319,7 @@ std::shared_ptr<const DiskFlux> readDiskCommand(
{ {
for (const auto& data : track->trackDatas) for (const auto& data : track->trackDatas)
outputFluxSink->writeFlux( outputFluxSink->writeFlux(
location.physicalCylinder, location.head, *data->fluxmap); location.physicalTrack, location.head, *data->fluxmap);
} }
if (config.decoder().dump_records()) if (config.decoder().dump_records())
@@ -414,14 +414,14 @@ void readDiskCommand(
void rawReadDiskCommand(FluxSource& fluxsource, FluxSink& fluxsink) void rawReadDiskCommand(FluxSource& fluxsource, FluxSink& fluxsink)
{ {
for (unsigned cylinder : iterate(config.cylinders())) for (unsigned track : iterate(config.tracks()))
{ {
for (unsigned head : iterate(config.heads())) for (unsigned head : iterate(config.heads()))
{ {
testForEmergencyStop(); testForEmergencyStop();
auto fluxSourceIterator = fluxsource.readFlux(cylinder, head); auto fluxSourceIterator = fluxsource.readFlux(track, head);
Logger() << BeginReadOperationLogMessage{cylinder, head}; Logger() << BeginReadOperationLogMessage{track, head};
auto fluxmap = fluxSourceIterator->next()->rescale( auto fluxmap = fluxSourceIterator->next()->rescale(
1.0 / config.flux_source().rescale()); 1.0 / config.flux_source().rescale());
Logger() << EndReadOperationLogMessage() Logger() << EndReadOperationLogMessage()
@@ -429,7 +429,7 @@ void rawReadDiskCommand(FluxSource& fluxsource, FluxSink& fluxsink)
fluxmap->duration() / 1e6, fluxmap->duration() / 1e6,
fluxmap->bytes()); fluxmap->bytes());
fluxsink.writeFlux(cylinder, head, *fluxmap); fluxsink.writeFlux(track, head, *fluxmap);
} }
} }
} }

View File

@@ -24,9 +24,9 @@ static StringFlag destFlux(
FluxSink::updateConfigForFilename(config.mutable_flux_sink(), value); FluxSink::updateConfigForFilename(config.mutable_flux_sink(), value);
}); });
static IntFlag destCylinder( static IntFlag destTrack(
{ "--cylinder", "-c" }, { "--cylinder", "-c" },
"cylinder to write to", "track to write to",
0); 0);
static IntFlag destHead( static IntFlag destHead(
@@ -213,7 +213,7 @@ int mainAnalyseDriveResponse(int argc, const char* argv[])
usbSetDrive(config.drive().drive(), usbSetDrive(config.drive().drive(),
config.drive().high_density(), config.drive().high_density(),
config.drive().index_mode()); config.drive().index_mode());
usbSeek(destCylinder); usbSeek(destTrack);
std::cout << "Measuring rotational speed...\n"; std::cout << "Measuring rotational speed...\n";
nanoseconds_t period = usbGetRotationalPeriod(0); nanoseconds_t period = usbGetRotationalPeriod(0);

View File

@@ -82,9 +82,9 @@ void visualiseSectorsToFile(const Image& image, const std::string& filename)
? (panel_centre + side*panel_size) ? (panel_centre + side*panel_size)
: panel_centre); : panel_centre);
for (int physicalCylinder = 0; physicalCylinder < TRACKS; physicalCylinder++) for (int physicalTrack = 0; physicalTrack < TRACKS; physicalTrack++)
{ {
double visibleDistance = (TRACKS * 0.5) + (TRACKS - physicalCylinder); double visibleDistance = (TRACKS * 0.5) + (TRACKS - physicalTrack);
double radius = (disk_radius*visibleDistance)/(TRACKS * 1.5); double radius = (disk_radius*visibleDistance)/(TRACKS * 1.5);
painter.noFill(); painter.noFill();
painter.lineColor(0x88, 0x88, 0x88); painter.lineColor(0x88, 0x88, 0x88);
@@ -96,7 +96,7 @@ void visualiseSectorsToFile(const Image& image, const std::string& filename)
{ {
for (const auto& sector : image) for (const auto& sector : image)
{ {
if ((sector->physicalHead == side) && (sector->physicalCylinder == physicalCylinder) if ((sector->physicalHead == side) && (sector->physicalTrack == physicalTrack)
&& (sector->logicalSector == alignWithSector)) && (sector->logicalSector == alignWithSector))
{ {
offset = sector->headerStartTime; offset = sector->headerStartTime;
@@ -124,7 +124,7 @@ void visualiseSectorsToFile(const Image& image, const std::string& filename)
/* Sadly, Images aren't indexable by physical track. */ /* Sadly, Images aren't indexable by physical track. */
for (const auto& sector : image) for (const auto& sector : image)
{ {
if ((sector->physicalHead == side) && (sector->physicalCylinder == physicalCylinder)) if ((sector->physicalHead == side) && (sector->physicalTrack == physicalTrack))
{ {
painter.lineColor(0xff, 0x00, 0x00); painter.lineColor(0xff, 0x00, 0x00);
if (sector->status == Sector::OK) if (sector->status == Sector::OK)
@@ -192,7 +192,7 @@ static void readRow(const std::vector<std::string>& row, Image& image)
int logicalSector = std::stoi(row[4]); int logicalSector = std::stoi(row[4]);
const auto& sector = image.put(logicalTrack, logicalSide, logicalSector); const auto& sector = image.put(logicalTrack, logicalSide, logicalSector);
sector->physicalCylinder = std::stoi(row[0]); sector->physicalTrack = std::stoi(row[0]);
sector->physicalHead = std::stoi(row[1]); sector->physicalHead = std::stoi(row[1]);
sector->logicalTrack = logicalTrack; sector->logicalTrack = logicalTrack;
sector->logicalSide = logicalSide; sector->logicalSide = logicalSide;

View File

@@ -23,9 +23,9 @@ static StringFlag sourceFlux(
FluxSource::updateConfigForFilename(config.mutable_flux_source(), value); FluxSource::updateConfigForFilename(config.mutable_flux_source(), value);
}); });
static IntFlag cylinderFlag( static IntFlag trackFlag(
{ "--cylinder", "-c" }, { "--cylinder", "-c" },
"Cylinder to read.", "Track to read.",
0); 0);
static IntFlag headFlag( static IntFlag headFlag(
@@ -205,7 +205,7 @@ int mainInspect(int argc, const char* argv[])
flags.parseFlagsWithConfigFiles(argc, argv, {}); flags.parseFlagsWithConfigFiles(argc, argv, {});
std::unique_ptr<FluxSource> fluxSource(FluxSource::create(config.flux_source())); std::unique_ptr<FluxSource> fluxSource(FluxSource::create(config.flux_source()));
const auto fluxmap = fluxSource->readFlux(cylinderFlag, headFlag)->next(); const auto fluxmap = fluxSource->readFlux(trackFlag, headFlag)->next();
std::cout << fmt::format("0x{:x} bytes of data in {:.3f}ms\n", std::cout << fmt::format("0x{:x} bytes of data in {:.3f}ms\n",
fluxmap->bytes(), fluxmap->bytes(),

View File

@@ -36,13 +36,13 @@ static StringFlag destFlux(
FluxSink::updateConfigForFilename(config.mutable_flux_sink(), value); FluxSink::updateConfigForFilename(config.mutable_flux_sink(), value);
}); });
static StringFlag srcCylinders( static StringFlag srcTracks(
{ "--cylinders", "-c" }, { "--cylinders", "-c" },
"cylinders to read from", "tracks to read from",
"", "",
[](const auto& value) [](const auto& value)
{ {
setRange(config.mutable_cylinders(), value); setRange(config.mutable_tracks(), value);
}); });
static StringFlag srcHeads( static StringFlag srcHeads(
@@ -56,7 +56,7 @@ static StringFlag srcHeads(
int mainRawRead(int argc, const char* argv[]) int mainRawRead(int argc, const char* argv[])
{ {
setRange(config.mutable_cylinders(), "0-79"); setRange(config.mutable_tracks(), "0-79");
setRange(config.mutable_heads(), "0-1"); setRange(config.mutable_heads(), "0-1");
if (argc == 1) if (argc == 1)

View File

@@ -32,13 +32,13 @@ static StringFlag destFlux(
FluxSink::updateConfigForFilename(config.mutable_flux_sink(), value); FluxSink::updateConfigForFilename(config.mutable_flux_sink(), value);
}); });
static StringFlag destCylinders( static StringFlag destTracks(
{ "--cylinders", "-c" }, { "--cylinders", "-c" },
"cylinders to write to", "tracks to write to",
"", "",
[](const auto& value) [](const auto& value)
{ {
setRange(config.mutable_cylinders(), value); setRange(config.mutable_tracks(), value);
}); });
static StringFlag destHeads( static StringFlag destHeads(
@@ -60,7 +60,7 @@ static ActionFlag eraseFlag(
int mainRawWrite(int argc, const char* argv[]) int mainRawWrite(int argc, const char* argv[])
{ {
setRange(config.mutable_cylinders(), "0-79"); setRange(config.mutable_tracks(), "0-79");
setRange(config.mutable_heads(), "0-1"); setRange(config.mutable_heads(), "0-1");
if (argc == 1) if (argc == 1)

View File

@@ -45,13 +45,13 @@ static StringFlag copyFluxTo(
FluxSink::updateConfigForFilename(config.mutable_decoder()->mutable_copy_flux_to(), value); FluxSink::updateConfigForFilename(config.mutable_decoder()->mutable_copy_flux_to(), value);
}); });
static StringFlag srcCylinders( static StringFlag srcTracks(
{ "--cylinders", "-c" }, { "--cylinders", "-c" },
"cylinders to read from", "tracks to read from",
"", "",
[](const auto& value) [](const auto& value)
{ {
setRange(config.mutable_cylinders(), value); setRange(config.mutable_tracks(), value);
}); });
static StringFlag srcHeads( static StringFlag srcHeads(

View File

@@ -16,9 +16,9 @@ static StringFlag sourceFlux(
FluxSource::updateConfigForFilename(config.mutable_flux_source(), value); FluxSource::updateConfigForFilename(config.mutable_flux_source(), value);
}); });
static IntFlag cylinder( static IntFlag track(
{ "--cylinder", "-c" }, { "--cylinder", "-c" },
"cylinder to seek to", "track to seek to",
0); 0);
extern const std::map<std::string, std::string> readables; extern const std::map<std::string, std::string> readables;
@@ -31,6 +31,6 @@ int mainSeek(int argc, const char* argv[])
Error() << "this only makes sense with a real disk drive"; Error() << "this only makes sense with a real disk drive";
usbSetDrive(config.drive().drive(), false, config.drive().index_mode()); usbSetDrive(config.drive().drive(), false, config.drive().index_mode());
usbSeek(cylinder); usbSeek(track);
return 0; return 0;
} }

View File

@@ -38,13 +38,13 @@ static StringFlag destFlux(
FluxSource::updateConfigForFilename(config.mutable_flux_source(), value); FluxSource::updateConfigForFilename(config.mutable_flux_source(), value);
}); });
static StringFlag destCylinders( static StringFlag destTracks(
{ "--cylinders", "-c" }, { "--cylinders", "-c" },
"cylinders to write to", "tracks to write to",
"", "",
[](const auto& value) [](const auto& value)
{ {
setRange(config.mutable_cylinders(), value); setRange(config.mutable_tracks(), value);
}); });
static StringFlag destHeads( static StringFlag destHeads(

View File

@@ -2,7 +2,7 @@ comment: 'Adjust configuration for a 40-track drive'
is_extension: true is_extension: true
drive { drive {
cylinders: 40 tracks: 40
head_width: 1 head_width: 1
tpi: 48 tpi: 48
} }

View File

@@ -19,7 +19,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -19,7 +19,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -9,7 +9,7 @@ decoder {
aeslanier {} aeslanier {}
} }
cylinders { tracks {
start: 0 start: 0
end: 76 end: 76
} }

View File

@@ -15,7 +15,7 @@ decoder {
agat {} agat {}
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -38,7 +38,7 @@ decoder {
amiga {} amiga {}
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -15,7 +15,7 @@ decoder {
ibm {} ibm {}
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -28,7 +28,7 @@ encoder {
apple2 {} apple2 {}
} }
cylinders { tracks {
start: 0 start: 0
end: 39 end: 39
} }

View File

@@ -8,7 +8,7 @@ usb {
} }
drive { drive {
cylinders: 160 tracks: 160
heads: 1 heads: 1
head_width: 4 head_width: 4
tpi: 48 tpi: 48

View File

@@ -67,7 +67,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -66,7 +66,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 81 end: 81
} }

View File

@@ -67,7 +67,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -67,7 +67,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 81 end: 81
} }

View File

@@ -66,7 +66,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -66,7 +66,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 81 end: 81
} }

View File

@@ -67,7 +67,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -67,7 +67,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 81 end: 81
} }

View File

@@ -44,7 +44,7 @@ drive {
head_bias: 1 head_bias: 1
} }
cylinders { tracks {
start: 0 start: 0
end: 38 end: 38
} }

View File

@@ -42,7 +42,7 @@ drive {
head_bias: 1 head_bias: 1
} }
cylinders { tracks {
start: 0 start: 0
end: 77 end: 77
} }

View File

@@ -18,7 +18,7 @@ decoder {
c64 {} c64 {}
} }
cylinders { tracks {
start: 0 start: 0
end: 39 end: 39
} }

View File

@@ -68,7 +68,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -37,7 +37,7 @@ decoder {
ibm {} ibm {}
} }
cylinders { tracks {
start: 0 start: 0
end: 76 end: 76
} }

View File

@@ -9,7 +9,7 @@ decoder {
f85 {} f85 {}
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -9,7 +9,7 @@ decoder {
fb100 {} fb100 {}
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
step: 2 step: 2

View File

@@ -58,7 +58,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 69 end: 69
} }

View File

@@ -35,7 +35,7 @@ encoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 76 end: 76
} }

View File

@@ -9,7 +9,7 @@ decoder {
ibm {} ibm {}
} }
cylinders { tracks {
start: 0 start: 0
end: 81 end: 81
} }

View File

@@ -61,7 +61,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -55,7 +55,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 76 end: 76
} }

View File

@@ -60,7 +60,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -51,7 +51,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 39 end: 39
} }

View File

@@ -51,7 +51,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 39 end: 39
} }

View File

@@ -51,7 +51,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -51,7 +51,7 @@ decoder {
} }
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -106,7 +106,7 @@ decoder {
macintosh {} macintosh {}
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -107,7 +107,7 @@ decoder {
macintosh {} macintosh {}
} }
cylinders { tracks {
start: 0 start: 0
end: 79 end: 79
} }

View File

@@ -41,7 +41,7 @@ decoder {
micropolis {} micropolis {}
} }
cylinders { tracks {
start: 0 start: 0
end: 34 end: 34
} }

View File

@@ -41,7 +41,7 @@ decoder {
micropolis {} micropolis {}
} }
cylinders { tracks {
start: 0 start: 0
end: 34 end: 34
} }

Some files were not shown because too many files have changed in this diff Show More